コード例 #1
0
ファイル: groups.php プロジェクト: Hildy/cerb5
 function showInboxFilterPanelAction()
 {
     @($id = DevblocksPlatform::importGPC($_REQUEST['id'], 'integer', 0));
     @($group_id = DevblocksPlatform::importGPC($_REQUEST['group_id'], 'integer', 0));
     @($ticket_id = DevblocksPlatform::importGPC($_REQUEST['ticket_id'], 'integer', 0));
     @($view_id = DevblocksPlatform::importGPC($_REQUEST['view_id'], 'string', ''));
     $active_worker = CerberusApplication::getActiveWorker();
     $tpl = DevblocksPlatform::getTemplateService();
     $tpl_path = $this->_TPL_PATH;
     $tpl->assign('path', $tpl_path);
     $tpl->assign('group_id', $group_id);
     $tpl->assign('view_id', $view_id);
     if (null != ($filter = DAO_GroupInboxFilter::get($id))) {
         $tpl->assign('filter', $filter);
     }
     // Make sure we're allowed to change this group's setup
     if (!$active_worker->isTeamManager($group_id) && !$active_worker->is_superuser) {
         return;
     }
     // Load the example ticket + headers if provided
     if (!empty($ticket_id)) {
         $ticket = DAO_Ticket::getTicket($ticket_id);
         $tpl->assign('ticket', $ticket);
         $messages = $ticket->getMessages();
         $message = array_shift($messages);
         /* @var $message CerberusMessage */
         $message_headers = $message->getHeaders();
         $tpl->assign('message', $message);
         $tpl->assign('message_headers', $message_headers);
     }
     $category_name_hash = DAO_Bucket::getCategoryNameHash();
     $tpl->assign('category_name_hash', $category_name_hash);
     $groups = DAO_Group::getAll();
     $tpl->assign('groups', $groups);
     $team_categories = DAO_Bucket::getTeams();
     $tpl->assign('team_categories', $team_categories);
     $workers = DAO_Worker::getAll();
     $tpl->assign('workers', $workers);
     // Custom Fields: Address
     $address_fields = DAO_CustomField::getBySource(ChCustomFieldSource_Address::ID);
     $tpl->assign('address_fields', $address_fields);
     // Custom Fields: Orgs
     $org_fields = DAO_CustomField::getBySource(ChCustomFieldSource_Org::ID);
     $tpl->assign('org_fields', $org_fields);
     // Custom Fields: Tickets
     $ticket_fields = DAO_CustomField::getBySource(ChCustomFieldSource_Ticket::ID);
     $tpl->assign('ticket_fields', $ticket_fields);
     $tpl->display('file:' . $tpl_path . 'groups/manage/filters/peek.tpl');
 }
コード例 #2
0
ファイル: tickets.php プロジェクト: Hildy/cerb5
 function showViewAutoAssistAction()
 {
     @($view_id = DevblocksPlatform::importGPC($_REQUEST['view_id'], 'string'));
     @($mode = DevblocksPlatform::importGPC($_REQUEST['mode'], 'string', 'senders'));
     @($mode_param = DevblocksPlatform::importGPC($_REQUEST['mode_param'], 'string', ''));
     $tpl = DevblocksPlatform::getTemplateService();
     $tpl_path = $this->_TPL_PATH;
     $tpl->assign('path', $tpl_path);
     $visit = CerberusApplication::getVisit();
     /* @var $visit CerberusVisit */
     $view = C4_AbstractViewLoader::getView($view_id);
     $tpl->assign('view_id', $view_id);
     $tpl->assign('mode', $mode);
     if ($mode == "headers" && empty($mode_param)) {
         $headers = DAO_MessageHeader::getUnique();
         $tpl->assign('headers', $headers);
         $tpl->display($tpl_path . 'tickets/rpc/ticket_view_assist_headers.tpl');
     } else {
         $teams = DAO_Group::getAll();
         $tpl->assign('teams', $teams);
         $team_categories = DAO_Bucket::getTeams();
         $tpl->assign('team_categories', $team_categories);
         $category_name_hash = DAO_Bucket::getCategoryNameHash();
         $tpl->assign('category_name_hash', $category_name_hash);
         $workers = DAO_Worker::getAllActive();
         $tpl->assign('workers', $workers);
         // Enforce group memberships
         // [TODO] Test impact
         $active_worker = CerberusApplication::getActiveWorker();
         $memberships = $active_worker->getMemberships();
         $view->params[] = new DevblocksSearchCriteria(SearchFields_Ticket::TICKET_TEAM_ID, 'in', array_keys($memberships));
         // [JAS]: Calculate statistics about the current view (top unique senders/subjects/domains)
         $biggest = DAO_Ticket::analyze($view->params, 15, $mode, $mode_param);
         $tpl->assign('biggest', $biggest);
         $tpl->display($tpl_path . 'tickets/rpc/ticket_view_assist.tpl');
     }
 }