Log in | Register | Lost password

Bottom
pgArchive filter patch (code included)
  • Posted: 18.09.2005, 12:06
     
    Converted
    rank:
    12
    registered:
     March 2009
    Status:
    offline
    last visit:
    Posts:
    0
    Just wanted to share this -

    I patched pgarchive so that it can handle filtering (pagestter-style filters specifified in URL). This patch will allow you to filter the publications shown in pgarchive based on any field.

    Change the following:

    in pnuser.php, function pgarchiveShowArchive

    Code

    function pgarchiveShowArchive($template, $calendar)

    {

    $tid = pnVarCleanFromInput('tid');

    $year = pnVarCleanFromInput('year');

    $month = pnVarCleanFromInput('month');

    $filter = pnVarCleanFromInput('filter'); //ADD THIS LINE


    in pnuser.php, function pgarchiveShowArchive

    Code

    $publications = pnModAPIFunc('pgarchive', 'user', 'getPublications',

    array( 'tid' => $tid,

    'year' => $year,

    'month' => $month,

    'filter' => $filter, //ADD THIS LINE

    'calendar' => $calendar) );


    in pnuserapi.php, function pgarchive_userapi_getPublications

    Code

    $tid = (int)$args['tid'];

    $month = (int)$args['month'];

    $year = (int)$args['year'];

    $calendar = (isset($args['calendar']) ? $args['calendar'] : false);

    $userfilter = (isset($args['filter']) ? $args['filter'] : false); //ADD THIS LINE


    in pnuserapi.php, function pgarchive_userapi_getPublications

    Code

    $filter = array("$baseField:ge:$yearStart-$monthStart-1,$baseField:lt:$yearEnd-$monthEnd-1".",".$userfilter); //APPEND ",".userfilter at end
  • Posted: 26.11.2006, 06:50
     
    Converted
    rank:
    12
    registered:
     March 2009
    Status:
    offline
    last visit:
    Posts:
    0
    This hack work well except when you cross years.
    First I had a url like this:
    ...index.php?module=pgarchive&tid=2&filter1=cat:eq:1676&filter2=cat:eq:1680
    but it didn'work.
    so I had to change:

    filter1 and filter2
    to
    filter and filter1

    All goes well, I can walk across months whitout errors but when I go from december 2006 to january 2007 I get only pages with no records.

Template courtesy of Designs By Darren.