예제 #1
0
 public static function getTemplateHandler()
 {
     $tpl = DevblocksPlatform::getTemplateService();
     $tpl_path = dirname(__FILE__) . '/templates/';
     $tpl->assign('path', $tpl_path);
     $tpl->cache_lifetime = "0";
     $total_new_count = 0;
     foreach (DAO_WorkflowView::getGroupTotals() as $data) {
         $total_new_count += $data["total"];
     }
     $tpl->assign('total_new_count', $total_new_count);
     $newest = isset($_SESSION["fluid_latest_seen"]) ? $_SESSION["fluid_latest_seen"] : time() - 3600;
     $worker = CerberusApplication::getActiveWorker();
     $memberships = $worker->getMemberships();
     $params = array(SearchFields_Ticket::TICKET_TEAM_ID => new DevblocksSearchCriteria(SearchFields_Ticket::TICKET_TEAM_ID, 'in', array_keys($memberships)), SearchFields_Ticket::TICKET_DELETED => new DevblocksSearchCriteria(SearchFields_Ticket::TICKET_DELETED, 'eq', 0), SearchFields_Ticket::TICKET_WAITING => new DevblocksSearchCriteria(SearchFields_Ticket::TICKET_WAITING, 'eq', 0), SearchFields_Ticket::TICKET_CLOSED => new DevblocksSearchCriteria(SearchFields_Ticket::TICKET_CLOSED, 'eq', 0), SearchFields_Ticket::TICKET_UPDATED_DATE => new DevblocksSearchCriteria(SearchFields_Ticket::TICKET_UPDATED_DATE, '>', $newest));
     list($results, $total) = DAO_Ticket::search(array(SearchFields_Ticket::TICKET_ID, SearchFields_Ticket::TICKET_MASK, SearchFields_Ticket::TICKET_SUBJECT, SearchFields_Ticket::TICKET_LAST_WROTE), $params, 5, 0, SearchFields_Ticket::TICKET_UPDATED_DATE, false, true);
     $tickets = array();
     foreach ($results as $ticket) {
         if ($ticket[SearchFields_Ticket::TICKET_UPDATED_DATE] > $newest) {
             $newest = $ticket[SearchFields_Ticket::TICKET_UPDATED_DATE];
         }
         $tickets[] = $ticket;
     }
     $_SESSION["fluid_latest_seen"] = $newest;
     $tpl->assign("recent_tickets_json", json_encode($tickets));
     $tpl->assign("recent_ticket_count", json_encode($total));
     return $tpl;
 }
예제 #2
0
파일: tickets.php 프로젝트: Hildy/cerb5
 function refreshSidebarAction()
 {
     $db = DevblocksPlatform::getDatabaseService();
     $tpl = DevblocksPlatform::getTemplateService();
     $tpl->assign('path', $this->_TPL_PATH);
     $visit = CerberusApplication::getVisit();
     $active_worker = CerberusApplication::getActiveWorker();
     $section = $visit->get(CerberusVisit::KEY_MAIL_MODE, '');
     switch ($section) {
         case 'workflow':
             $groups = DAO_Group::getAll();
             $tpl->assign('groups', $groups);
             $group_buckets = DAO_Bucket::getTeams();
             $tpl->assign('group_buckets', $group_buckets);
             $group_counts = DAO_WorkflowView::getGroupTotals();
             $tpl->assign('group_counts', $group_counts);
             $tpl->display('file:' . $this->_TPL_PATH . 'tickets/workflow/sidebar.tpl');
             break;
         case 'overview':
             $groups = DAO_Group::getAll();
             $tpl->assign('groups', $groups);
             $group_buckets = DAO_Bucket::getTeams();
             $tpl->assign('group_buckets', $group_buckets);
             $workers = DAO_Worker::getAll();
             $tpl->assign('workers', $workers);
             $group_counts = DAO_Overview::getGroupTotals();
             $tpl->assign('group_counts', $group_counts);
             $waiting_counts = DAO_Overview::getWaitingTotals();
             $tpl->assign('waiting_counts', $waiting_counts);
             $worker_counts = DAO_Overview::getWorkerTotals();
             $tpl->assign('worker_counts', $worker_counts);
             $tpl->display('file:' . $this->_TPL_PATH . 'tickets/overview/sidebar.tpl');
             break;
     }
 }