function getFeedAsRss($feed) { $xmlstr = <<<XML \t\t<rss version='2.0' xmlns:atom='http://www.w3.org/2005/Atom'> \t\t</rss> XML; $xml = new SimpleXMLElement($xmlstr); $translate = DevblocksPlatform::getTranslationService(); $url = DevblocksPlatform::getUrlService(); // Channel $channel = $xml->addChild('channel'); $channel->addChild('title', $feed->title); $channel->addChild('link', $url->write('', true)); $channel->addChild('description', ''); // View $view = new C4_TicketView(); $view->name = $feed->title; $view->params = $feed->params['params']; $view->renderLimit = 100; $view->renderSortBy = $feed->params['sort_by']; $view->renderSortAsc = $feed->params['sort_asc']; // Results list($tickets, $count) = $view->getData(); // [TODO] We should probably be building this feed with Zend Framework for compliance foreach ($tickets as $ticket) { $created = intval($ticket[SearchFields_Ticket::TICKET_UPDATED_DATE]); if (empty($created)) { $created = time(); } $eItem = $channel->addChild('item'); $escapedSubject = htmlspecialchars($ticket[SearchFields_Ticket::TICKET_SUBJECT], null, LANG_CHARSET_CODE); //filter out a couple non-UTF-8 characters (0xC and ESC) $escapedSubject = preg_replace("/[\f]/", '', $escapedSubject); $eTitle = $eItem->addChild('title', $escapedSubject); $eDesc = $eItem->addChild('description', $this->_getTicketLastAction($ticket)); $link = $url->write('c=display&id=' . $ticket[SearchFields_Ticket::TICKET_MASK], true); $eLink = $eItem->addChild('link', $link); $eDate = $eItem->addChild('pubDate', gmdate('D, d M Y H:i:s T', $created)); $eGuid = $eItem->addChild('guid', md5($escapedSubject . $link . $created)); $eGuid->addAttribute('isPermaLink', "false"); } return $xml->asXML(); }
function render() { $tpl = DevblocksPlatform::getTemplateService(); $tpl->assign('id', $this->id); $view_path = DEVBLOCKS_PLUGIN_PATH . 'cerberusweb.mobile/templates/tickets/'; $tpl->assign('view_path_mobile', $view_path_mobile); $tpl->assign('view', $this); $visit = CerberusApplication::getVisit(); $results = self::getData(); $tpl->assign('results', $results); @($ids = array_keys($results[0])); $workers = DAO_Worker::getAll(); $tpl->assign('workers', $workers); $teams = DAO_Group::getAll(); $tpl->assign('teams', $teams); $buckets = DAO_Bucket::getAll(); $tpl->assign('buckets', $buckets); $team_categories = DAO_Bucket::getTeams(); $tpl->assign('team_categories', $team_categories); // [TODO] Is this even used here or did mfogg copy it blindly? $ticket_fields = DAO_CustomField::getBySource(ChCustomFieldSource_Ticket::ID); $tpl->assign('ticket_fields', $ticket_fields); // Undo? // [TODO] Is this even used here or did mfogg copy it blindly? $last_action = C4_TicketView::getLastAction($this->id); $tpl->assign('last_action', $last_action); if (!empty($last_action) && !is_null($last_action->ticket_ids)) { $tpl->assign('last_action_count', count($last_action->ticket_ids)); } $tpl->cache_lifetime = "0"; $tpl->assign('view_fields', $this->getColumns()); $tpl->display('file:' . $view_path . 'ticket_view.tpl'); }
function render() { $this->_sanitize(); $tpl = DevblocksPlatform::getTemplateService(); $tpl->assign('id', $this->id); $view_path = APP_PATH . '/features/cerberusweb.core/templates/tickets/'; $tpl->assign('view_path', $view_path); $tpl->assign('view', $this); $visit = CerberusApplication::getVisit(); $results = self::getData(); $tpl->assign('results', $results); @($ids = array_keys($results[0])); $workers = DAO_Worker::getAll(); $tpl->assign('workers', $workers); $teams = DAO_Group::getAll(); $tpl->assign('teams', $teams); $buckets = DAO_Bucket::getAll(); $tpl->assign('buckets', $buckets); $team_categories = DAO_Bucket::getTeams(); $tpl->assign('team_categories', $team_categories); $custom_fields = DAO_CustomField::getBySource(ChCustomFieldSource_Ticket::ID); $tpl->assign('custom_fields', $custom_fields); // Undo? $last_action = C4_TicketView::getLastAction($this->id); $tpl->assign('last_action', $last_action); if (!empty($last_action) && !is_null($last_action->ticket_ids)) { $tpl->assign('last_action_count', count($last_action->ticket_ids)); } $tpl->assign('timestamp_now', time()); $tpl->assign('view_fields', $this->getColumns()); $tpl->display('file:' . $view_path . 'ticket_view.tpl'); }
function showAddressTicketsAction() { @($id = DevblocksPlatform::importGPC($_REQUEST['id'], 'integer', 0)); @($closed = DevblocksPlatform::importGPC($_REQUEST['closed'], 'integer', 0)); if (null == ($address = DAO_Address::get($id))) { return; } if (null == ($search_view = C4_AbstractViewLoader::getView(CerberusApplication::VIEW_SEARCH))) { $search_view = C4_TicketView::createSearchView(); } $search_view->params = array(SearchFields_Ticket::TICKET_CLOSED => new DevblocksSearchCriteria(SearchFields_Ticket::TICKET_CLOSED, '=', $closed), SearchFields_Ticket::REQUESTER_ADDRESS => new DevblocksSearchCriteria(SearchFields_Ticket::REQUESTER_ADDRESS, '=', $address->email)); $search_view->renderPage = 0; C4_AbstractViewLoader::setView(CerberusApplication::VIEW_SEARCH, $search_view); DevblocksPlatform::redirect(new DevblocksHttpResponse(array('tickets', 'search'))); }
function searchviewAction() { $visit = CerberusApplication::getVisit(); $response = DevblocksPlatform::getHttpRequest(); $path = $response->path; array_shift($path); // tickets array_shift($path); // searchview $id = array_shift($path); $view = C4_AbstractViewLoader::getView($id); if (!empty($view->params)) { $params = array(); // Index by field name for search system if (is_array($view->params)) { foreach ($view->params as $key => $criteria) { /* @var $criteria DevblocksSearchCriteria */ $params[$key] = $criteria; } } } if (null == ($search_view = C4_AbstractViewLoader::getView(CerberusApplication::VIEW_SEARCH))) { $search_view = C4_TicketView::createSearchView(); } $search_view->params = $params; $search_view->renderPage = 0; C4_AbstractViewLoader::setView($search_view->id, $search_view); DevblocksPlatform::setHttpResponse(new DevblocksHttpResponse(array('tickets', 'search'))); }