/[drupal]/contributions/modules/casetracker_services/casetracker_services.module
ViewVC logotype

Diff of /contributions/modules/casetracker_services/casetracker_services.module

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.2.2.9, Mon Apr 7 12:46:01 2008 UTC revision 1.2.2.10, Tue Apr 8 00:29:17 2008 UTC
# Line 1  Line 1 
1  <?php  <?php
2  // $Id: casetracker_services.module,v 1.2.2.8 2008/04/04 05:28:49 sime Exp $  // $Id: casetracker_services.module,v 1.2.2.9 2008/04/07 12:46:01 sime Exp $
3    
4  /**  /**
5   * Implementation of hook_menu().   * Implementation of hook_menu().
# Line 442  function casetracker_services_cases($pid Line 442  function casetracker_services_cases($pid
442        DISTINCT(n.nid), n.title, ncs.last_comment_timestamp,        DISTINCT(n.nid), n.title, ncs.last_comment_timestamp,
443        cc.pid, cc.case_number, cc.case_priority_id, cc.case_status_id, cc.case_type_id, cc.assign_to,        cc.pid, cc.case_number, cc.case_priority_id, cc.case_status_id, cc.case_type_id, cc.assign_to,
444        cp.project_number, n2.title AS project_title, n2.uid as project_author        cp.project_number, n2.title AS project_title, n2.uid as project_author
445      FROM {node} n LEFT JOIN casetracker_case cc ON (n.vid = cc.vid)      FROM {node} n LEFT JOIN {casetracker_case} cc ON (n.vid = cc.vid)
446      LEFT JOIN {casetracker_project} cp      LEFT JOIN {casetracker_project} cp
447        ON (cp.nid = cc.pid)        ON (cp.nid = cc.pid)
448      LEFT JOIN {node} n2      LEFT JOIN {node} n2
# Line 454  function casetracker_services_cases($pid Line 454  function casetracker_services_cases($pid
454        AND n.type IN ($types_in)        AND n.type IN ($types_in)
455        AND cc.pid IN ($projects_in)        AND cc.pid IN ($projects_in)
456        ". (($authors_in) ? " AND n.uid IN ($authors_in) " : '') ."        ". (($authors_in) ? " AND n.uid IN ($authors_in) " : '') ."
457      ORDER BY ncs.last_comment_timestamp DESC      ORDER BY cc.case_status_id, ncs.last_comment_timestamp DESC
458      ";      ";
459    
460  //  watchdog('ct', casetracker_services_get_key() .' '.$query);  //  watchdog('ct', casetracker_services_get_key() .' '.$query);
461    
462      $pager_count =  "SELECT count(DISTINCT(n.nid))
463        FROM {node} n LEFT JOIN {casetracker_case} cc
464        ON (n.vid = cc.vid)
465        WHERE
466        n.status = 1
467        AND n.type IN ($types_in)
468        AND cc.pid IN ($projects_in)
469        ". (($authors_in) ? " AND n.uid IN ($authors_in) " : '');
470    
471    $result = pager_query($query, 100, 0);    $result = pager_query($query, 100, 9, $pager_count);
472    $rows = array();    $rows = array();
473    while ($row = db_fetch_array($result)) {    while ($row = db_fetch_array($result)) {
474      $rows[] = $row;      $rows[] = $row;
475    }    }
476    $output['data'] = $rows;    $output['data'] = $rows;
477    $output['header'] = array('PID', 'Case', 'Title', 'Updated', 'Type', 'Status', 'Prioirity');    $output['header'] = array('PID', 'Case', 'Title', 'Updated', 'Type', 'Status', 'Priority');
478    
479    $lookup = array();    $lookup = array();
480    $query = "SELECT csid, case_state_name FROM {casetracker_case_states}";    $query = "SELECT csid, case_state_name FROM {casetracker_case_states}";
# Line 475  function casetracker_services_cases($pid Line 484  function casetracker_services_cases($pid
484      $lookup[$row['csid']] = $row['case_state_name'];      $lookup[$row['csid']] = $row['case_state_name'];
485    }    }
486    $output['lookup'] = $lookup;    $output['lookup'] = $lookup;
487    $output['pager'] = theme('pager', NULL, 100, 0);    $output['pager'] = theme('pager', NULL, 100, 9);
488    
489    return $output;    return $output;
490  }  }

Legend:
Removed from v.1.2.2.9  
changed lines
  Added in v.1.2.2.10

  ViewVC Help
Powered by ViewVC 1.1.2