function showSensorPeekAction() { @($id = DevblocksPlatform::importGPC($_REQUEST['id'], 'integer', 0)); @($view_id = DevblocksPlatform::importGPC($_REQUEST['view_id'], 'string', '')); $tpl = DevblocksPlatform::getTemplateService(); $tpl->assign('path', $this->_TPL_PATH); $tpl->assign('view_id', $view_id); if (null == ($sensor = DAO_Sensor::get($id))) { $sensor = new Model_Sensor(); $sensor->extension_id = 'sensor.external'; } $tpl->assign('sensor', $sensor); $sensor_types = DevblocksPlatform::getExtensions('portsensor.sensor', false); $tpl->assign('sensor_types', $sensor_types); // Sensor extension instance if (!empty($sensor->extension_id) && isset($sensor_types[$sensor->extension_id])) { $tpl->assign('sensor_extension', DevblocksPlatform::getExtension($sensor->extension_id, true)); } // Custom Fields $custom_fields = DAO_CustomField::getBySource(PsCustomFieldSource_Sensor::ID); $tpl->assign('custom_fields', $custom_fields); $custom_field_values = DAO_CustomFieldValue::getValuesBySourceIds(PsCustomFieldSource_Sensor::ID, $id); if (isset($custom_field_values[$id])) { $tpl->assign('custom_field_values', $custom_field_values[$id]); } $tpl->display('file:' . $this->_TPL_PATH . 'sensors/peek.tpl'); }
function renderConfig(Model_PreParseRule $filter = null) { $tpl = DevblocksPlatform::getTemplateService(); $path = dirname(__FILE__) . '/templates/'; $groups = DAO_Group::getAll(); $tpl->assign('groups', $groups); $ticket_fields = DAO_CustomField::getBySource('cerberusweb.fields.source.ticket'); $tpl->assign('ticket_fields', $ticket_fields); $params = $filter->actions[self::EXTENSION_ID]; $tpl->assign('headers', $params['headers']); $tpl->assign('custom_fields', $params['custom_fields']); $tpl->display($path . 'header_filter_action.tpl'); }
function render() { $this->_sanitize(); $tpl = DevblocksPlatform::getTemplateService(); $tpl->assign('id', $this->id); $tpl->assign('view', $this); $custom_fields = DAO_CustomField::getBySource(ChCustomFieldSource_Worker::ID); $tpl->assign('custom_fields', $custom_fields); $tpl->cache_lifetime = "0"; $tpl->assign('view_fields', $this->getColumns()); $tpl->display('file:' . DEVBLOCKS_PLUGIN_PATH . 'cerberusweb.core/templates/configuration/tabs/workers/view.tpl'); }
function showRecipientPeekAction() { @($id = DevblocksPlatform::importGPC($_REQUEST['id'], 'integer', 0)); @($customer_id = DevblocksPlatform::importGPC($_REQUEST['customer_id'], 'integer', 0)); @($view_id = DevblocksPlatform::importGPC($_REQUEST['view_id'], 'string', '')); $display_view = 0; $tpl = DevblocksPlatform::getTemplateService(); $tpl->assign('path', $this->_TPL_PATH); $tpl->assign('id', $id); $tpl->assign('customer_id', $customer_id); $tpl->assign('view_id', $view_id); $customer_recipient = DAO_CustomerRecipient::get($id); $tpl->assign('customer_recipient', $customer_recipient); // Custom Fields $custom_fields = DAO_CustomField::getBySource(FegCustomFieldSource_CustomerRecipient::ID); $tpl->assign('custom_fields', $custom_fields); $custom_field_values = DAO_CustomFieldValue::getValuesBySourceIds(FegCustomFieldSource_CustomerRecipient::ID, $id); if (isset($custom_field_values[$id])) { $tpl->assign('custom_field_values', $custom_field_values[$id]); } // Below is the Audit log view only avaible is the audit log plugin is enabled. if (class_exists('View_MessageAuditLog', true)) { $display_view = 1; $defaults = new Feg_AbstractViewModel(); $defaults->class_name = 'View_MessageAuditLog'; $defaults->id = '_recipient_audit_log'; $defaults->renderLimit = 10; $defaults->renderSortBy = SearchFields_MessageAuditLog::CHANGE_DATE; $defaults->renderSortAsc = false; $defaults->params = array(); $view = Feg_AbstractViewLoader::getView($defaults->id, $defaults); $view->name = 'Recipient Audit Log'; $view->renderTemplate = 'peek_tab'; $view->params = array(SearchFields_MessageAuditLog::RECIPIENT_ID => new DevblocksSearchCriteria(SearchFields_MessageAuditLog::RECIPIENT_ID, DevblocksSearchCriteria::OPER_EQ, $id)); $view->renderPage = 0; $view->renderLimit = 10; $view->renderSortBy = SearchFields_MessageAuditLog::CHANGE_DATE; $view->renderSortAsc = false; $view->view_columns = array(SearchFields_MessageAuditLog::CHANGE_DATE, SearchFields_MessageAuditLog::MESSAGE_ID, SearchFields_MessageAuditLog::WORKER_ID, SearchFields_MessageAuditLog::CHANGE_FIELD, SearchFields_MessageAuditLog::CHANGE_VALUE); Feg_AbstractViewLoader::setView($view->id, $view); $tpl->assign('view', $view); } $tpl->assign('display_view', $display_view); $tpl->display('file:' . $this->_TPL_PATH . 'customer/tabs/recipient/peek.tpl'); }
function render() { $this->_sanitize(); $tpl = DevblocksPlatform::getTemplateService(); $tpl->assign('id', $this->id); $tpl->assign('view', $this); $custom_fields = DAO_CustomField::getBySource(FegCustomFieldSource_CustomerRecipient::ID); $tpl->assign('custom_fields', $custom_fields); $tpl->assign('view_fields', $this->getColumns()); $tpl->display('file:' . APP_PATH . '/features/feg.core/templates/internal/tabs/customer_recipient/view.tpl'); }
function doContactSendAction() { @($sFrom = DevblocksPlatform::importGPC($_POST['from'], 'string', '')); @($sSubject = DevblocksPlatform::importGPC($_POST['subject'], 'string', '')); @($sContent = DevblocksPlatform::importGPC($_POST['content'], 'string', '')); @($sCaptcha = DevblocksPlatform::importGPC($_POST['captcha'], 'string', '')); @($aFieldIds = DevblocksPlatform::importGPC($_POST['field_ids'], 'array', array())); @($aFollowUpQ = DevblocksPlatform::importGPC($_POST['followup_q'], 'array', array())); // Load the answers to any situational questions $aFollowUpA = array(); if (is_array($aFollowUpQ)) { foreach ($aFollowUpQ as $idx => $q) { @($answer = DevblocksPlatform::importGPC($_POST['followup_a_' . $idx], 'string', '')); $aFollowUpA[$idx] = $answer; } } $umsession = UmPortalHelper::getSession(); $fingerprint = UmPortalHelper::getFingerprint(); $settings = CerberusSettings::getInstance(); $default_from = $settings->get(CerberusSettings::DEFAULT_REPLY_FROM); $umsession->setProperty('support.write.last_from', $sFrom); $umsession->setProperty('support.write.last_subject', $sSubject); $umsession->setProperty('support.write.last_content', $sContent); // $umsession->setProperty('support.write.last_followup_q',$aFollowUpQ); $umsession->setProperty('support.write.last_followup_a', $aFollowUpA); $sNature = $umsession->getProperty('support.write.last_nature', ''); $captcha_enabled = DAO_CommunityToolProperty::get(UmPortalHelper::getCode(), self::PARAM_CAPTCHA_ENABLED, 1); // Subject is required if the field is on the form if (isset($_POST['subject']) && empty($sSubject)) { $umsession->setProperty('support.write.last_error', 'A subject is required.'); DevblocksPlatform::setHttpResponse(new DevblocksHttpResponse(array('portal', UmPortalHelper::getCode(), 'contact', 'step2'))); return; } // Sender and CAPTCHA required if (empty($sFrom) || $captcha_enabled && 0 != strcasecmp($sCaptcha, @$umsession->getProperty(UmScApp::SESSION_CAPTCHA, '***'))) { if (empty($sFrom)) { $umsession->setProperty('support.write.last_error', 'Invalid e-mail address.'); } else { $umsession->setProperty('support.write.last_error', 'What you typed did not match the image.'); } // Need to report the captcha didn't match and redraw the form DevblocksPlatform::setHttpResponse(new DevblocksHttpResponse(array('portal', UmPortalHelper::getCode(), 'contact', 'step2'))); return; } // Dispatch $to = $default_from; $subject = 'Contact me: Other'; $sDispatch = DAO_CommunityToolProperty::get(UmPortalHelper::getCode(), self::PARAM_SITUATIONS, ''); $dispatch = !empty($sDispatch) ? unserialize($sDispatch) : array(); foreach ($dispatch as $k => $v) { if (md5($k) == $sNature) { $to = $v['to']; $subject = 'Contact me: ' . strip_tags($k); break; } } if (!empty($sSubject)) { $subject = $sSubject; } $fieldContent = ''; if (!empty($aFollowUpQ)) { $fieldContent = "\r\n\r\n"; $fieldContent .= "--------------------------------------------\r\n"; if (!empty($sNature)) { $fieldContent .= $subject . "\r\n"; $fieldContent .= "--------------------------------------------\r\n"; } foreach ($aFollowUpQ as $idx => $q) { $answer = isset($aFollowUpA[$idx]) ? $aFollowUpA[$idx] : ''; $fieldContent .= "Q) " . $q . "\r\n" . "A) " . $answer . "\r\n"; if ($idx + 1 < count($aFollowUpQ)) { $fieldContent .= "\r\n"; } } $fieldContent .= "--------------------------------------------\r\n"; "\r\n"; } $message = new CerberusParserMessage(); $message->headers['date'] = date('r'); $message->headers['to'] = $to; $message->headers['subject'] = $subject; $message->headers['message-id'] = CerberusApplication::generateMessageId(); $message->headers['x-cerberus-portal'] = 1; // Sender $fromList = imap_rfc822_parse_adrlist($sFrom, ''); if (empty($fromList) || !is_array($fromList)) { return; // abort with message } $from = array_shift($fromList); $message->headers['from'] = $from->mailbox . '@' . $from->host; $message->body = 'IP: ' . $fingerprint['ip'] . "\r\n\r\n" . $sContent . $fieldContent; $ticket_id = CerberusParser::parseMessage($message); $ticket = DAO_Ticket::getTicket($ticket_id); // Auto-save any custom fields $fields = DAO_CustomField::getBySource('cerberusweb.fields.source.ticket'); if (!empty($aFieldIds)) { foreach ($aFieldIds as $iIdx => $iFieldId) { if (!empty($iFieldId)) { $field =& $fields[$iFieldId]; /* @var $field Model_CustomField */ $value = ""; switch ($field->type) { case Model_CustomField::TYPE_SINGLE_LINE: case Model_CustomField::TYPE_MULTI_LINE: @($value = trim($aFollowUpA[$iIdx])); break; case Model_CustomField::TYPE_NUMBER: @($value = intval($aFollowUpA[$iIdx])); break; case Model_CustomField::TYPE_DATE: if (false !== ($time = strtotime($aFollowUpA[$iIdx]))) { @($value = intval($time)); } break; case Model_CustomField::TYPE_DROPDOWN: @($value = $aFollowUpA[$iIdx]); break; case Model_CustomField::TYPE_CHECKBOX: @($value = isset($aFollowUpA[$iIdx]) && !empty($aFollowUpA[$iIdx]) ? 1 : 0); break; } if (!empty($value)) { DAO_CustomFieldValue::setFieldValue('cerberusweb.fields.source.ticket', $ticket_id, $iFieldId, $value); } } } } // Clear any errors $umsession->setProperty('support.write.last_nature', null); $umsession->setProperty('support.write.last_nature_string', null); $umsession->setProperty('support.write.last_content', null); $umsession->setProperty('support.write.last_error', null); $umsession->setProperty('support.write.last_opened', $ticket->mask); DevblocksPlatform::setHttpResponse(new DevblocksHttpResponse(array('portal', UmPortalHelper::getCode(), 'contact', 'confirm'))); }
function showWatcherPanelAction() { @($id = DevblocksPlatform::importGPC($_REQUEST['id'], 'integer', 0)); @($view_id = DevblocksPlatform::importGPC($_REQUEST['view_id'])); $tpl = DevblocksPlatform::getTemplateService(); $tpl->assign('path', $this->_TPL_PATH); $tpl->assign('view_id', $view_id); $active_worker = CerberusApplication::getActiveWorker(); if (null != ($filter = DAO_WatcherMailFilter::get($id))) { $tpl->assign('filter', $filter); } $groups = DAO_Group::getAll(); $tpl->assign('groups', $groups); $buckets = DAO_Bucket::getAll(); $tpl->assign('buckets', $buckets); $group_buckets = DAO_Bucket::getTeams(); $tpl->assign('group_buckets', $group_buckets); $memberships = $active_worker->getMemberships(); $tpl->assign('memberships', $memberships); if (null == @($worker_id = $filter->worker_id)) { $worker_id = $active_worker->id; } $addresses = DAO_AddressToWorker::getByWorker($worker_id); $tpl->assign('addresses', $addresses); $tpl->assign('workers', DAO_Worker::getAllActive()); $tpl->assign('all_workers', DAO_Worker::getAll()); // Custom Fields: Ticket $ticket_fields = DAO_CustomField::getBySource(ChCustomFieldSource_Ticket::ID); $tpl->assign('ticket_fields', $ticket_fields); // 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); $tpl->display('file:' . $this->_TPL_PATH . 'preferences/peek.tpl'); }
function showBulkPanelAction() { @($id_csv = DevblocksPlatform::importGPC($_REQUEST['ids'])); @($view_id = DevblocksPlatform::importGPC($_REQUEST['view_id'])); $tpl = DevblocksPlatform::getTemplateService(); $path = dirname(dirname(__FILE__)) . '/templates/'; $tpl->assign('path', $path); $tpl->assign('view_id', $view_id); if (!empty($id_csv)) { $ids = DevblocksPlatform::parseCsvString($id_csv); $tpl->assign('ids', implode(',', $ids)); } // Custom Fields $custom_fields = DAO_CustomField::getBySource(ChCustomFieldSource_FeedbackEntry::ID); $tpl->assign('custom_fields', $custom_fields); $tpl->display('file:' . $path . 'feedback/bulk.tpl'); }
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'); }
function showTasksPropertiesTabAction() { @($task_id = DevblocksPlatform::importGPC($_REQUEST['id'], 'integer')); $tpl = DevblocksPlatform::getTemplateService(); $tpl_path = dirname(dirname(dirname(__FILE__))) . '/templates/'; $tpl->assign('path', $tpl_path); $task = DAO_Task::get($task_id); $tpl->assign('task', $task); $active_workers = DAO_Worker::getAllActive(); $tpl->assign('active_workers', $active_workers); $workers = DAO_Worker::getAllWithDisabled(); $tpl->assign('workers', $workers); // Custom fields $custom_fields = DAO_CustomField::getBySource(ChCustomFieldSource_Task::ID); $tpl->assign('custom_fields', $custom_fields); $custom_field_values = DAO_CustomFieldValue::getValuesBySourceIds(ChCustomFieldSource_Task::ID, $task_id); if (isset($custom_field_values[$task_id])) { $tpl->assign('custom_field_values', $custom_field_values[$task_id]); } $tpl->display('file:' . $tpl_path . 'tasks/display/tabs/properties.tpl'); }
function render() { $this->_sanitize(); $tpl = DevblocksPlatform::getTemplateService(); $tpl->assign('id', $this->id); $tpl->assign('view', $this); $custom_fields = DAO_CustomField::getBySource(FegCustomFieldSource_Message::ID); $tpl->assign('custom_fields', $custom_fields); $tpl->assign('view_fields', $this->getColumns()); switch ($this->renderTemplate) { case 'failed': $tpl->display('file:' . APP_PATH . '/features/feg.core/templates/setup/tabs/message/view_failed.tpl'); break; case 'format': $tpl->display('file:' . APP_PATH . '/features/feg.core/templates/setup/tabs/message/view_format.tpl'); break; default: $tpl->display('file:' . APP_PATH . '/features/feg.core/templates/setup/tabs/message/view.tpl'); break; } }
function render() { $this->_sanitize(); $tpl = DevblocksPlatform::getTemplateService(); $tpl->assign('id', $this->id); $tpl->assign('view', $this); // Tool Manifests $tools = DevblocksPlatform::getExtensions('usermeet.tool', false, true); $tpl->assign('tool_extensions', $tools); // Pull the results so we can do some row introspection $results = $this->getData(); $tpl->assign('results', $results); // Custom fields $custom_fields = DAO_CustomField::getBySource(CustomFieldSource_CommunityPortal::ID); $tpl->assign('custom_fields', $custom_fields); $tpl->assign('view_fields', $this->getColumns()); $tpl->display('file:' . APP_PATH . '/features/usermeet.core/templates/community/config/tab/view.tpl'); }
function render($type, $list) { $fields = DAO_CustomField::getBySource(ChCustomFieldSource_Ticket::ID); foreach ($fields as $field_id => $field) { if ($field->group_id == 0) { $cf_ticket['#cf_ticket_' . $field->name . '#'] = $field->name; } } $list['Custom Ticket Fields'] = $cf_ticket; return; }
function render() { $this->_sanitize(); $tpl = DevblocksPlatform::getTemplateService(); $tpl->assign('id', $this->id); $tpl->assign('view', $this); $custom_fields = DAO_CustomField::getBySource(UmCustomFieldSource_Worker::ID); $tpl->assign('custom_fields', $custom_fields); $tpl->assign('view_fields', $this->getColumns()); $tpl->display('file:' . APP_PATH . '/features/usermeet.core/templates/setup/tabs/workers/view.tpl'); }
function render() { $this->_sanitize(); $tpl = DevblocksPlatform::getTemplateService(); $tpl->assign('id', $this->id); $tpl->assign('view', $this); $workers = DAO_Worker::getAll(); $tpl->assign('workers', $workers); $tpl->assign('timestamp_now', time()); // Pull the results so we can do some row introspection $results = $this->getData(); $tpl->assign('results', $results); // $source_renderers = DevblocksPlatform::getExtensions('cerberusweb.task.source', true); // Make a list of unique source_extension and load their renderers $source_extensions = array(); if (is_array($results) && isset($results[0])) { foreach ($results[0] as $rows) { $source_extension = $rows[SearchFields_Task::SOURCE_EXTENSION]; if (!isset($source_extensions[$source_extension]) && !empty($source_extension) && null != ($mft = DevblocksPlatform::getExtension($source_extension))) { $source_extensions[$source_extension] = $mft->createInstance(); } } } $tpl->assign('source_renderers', $source_extensions); // Custom fields $custom_fields = DAO_CustomField::getBySource(ChCustomFieldSource_Task::ID); $tpl->assign('custom_fields', $custom_fields); $tpl->cache_lifetime = "0"; $tpl->assign('view_fields', $this->getColumns()); $tpl->display('file:' . DEVBLOCKS_PLUGIN_PATH . 'cerberusweb.core/templates/tasks/view.tpl'); }
/** * @return DevblocksSearchField[] */ static function getFields() { $translate = DevblocksPlatform::getTranslationService(); $columns = array(self::ID => new DevblocksSearchField(self::ID, 't', 'id', null, $translate->_('task.id')), self::UPDATED_DATE => new DevblocksSearchField(self::UPDATED_DATE, 't', 'updated_date', null, $translate->_('task.updated_date')), self::TITLE => new DevblocksSearchField(self::TITLE, 't', 'title', null, $translate->_('task.title')), self::IS_COMPLETED => new DevblocksSearchField(self::IS_COMPLETED, 't', 'is_completed', null, $translate->_('task.is_completed')), self::DUE_DATE => new DevblocksSearchField(self::DUE_DATE, 't', 'due_date', null, $translate->_('task.due_date')), self::COMPLETED_DATE => new DevblocksSearchField(self::COMPLETED_DATE, 't', 'completed_date', null, $translate->_('task.completed_date')), self::WORKER_ID => new DevblocksSearchField(self::WORKER_ID, 't', 'worker_id', null, $translate->_('task.worker_id')), self::SOURCE_EXTENSION => new DevblocksSearchField(self::SOURCE_EXTENSION, 't', 'source_extension', null, $translate->_('task.source_extension')), self::SOURCE_ID => new DevblocksSearchField(self::SOURCE_ID, 't', 'source_id', null, $translate->_('task.source_id'))); // Custom Fields $fields = DAO_CustomField::getBySource(ChCustomFieldSource_Task::ID); if (is_array($fields)) { foreach ($fields as $field_id => $field) { $key = 'cf_' . $field_id; $columns[$key] = new DevblocksSearchField($key, $key, 'field_value', null, $field->name); } } // Sort by label (translation-conscious) uasort($columns, create_function('$a, $b', "return strcasecmp(\$a->db_label,\$b->db_label);\n")); return $columns; }
function showOrgPeekAction() { @($id = DevblocksPlatform::importGPC($_REQUEST['id'], 'integer', '')); @($view_id = DevblocksPlatform::importGPC($_REQUEST['view_id'], 'string', '')); $tpl = DevblocksPlatform::getTemplateService(); $tpl->assign('path', $this->_TPL_PATH); $contact = DAO_ContactOrg::get($id); $tpl->assign('contact', $contact); // Custom fields $custom_fields = DAO_CustomField::getBySource(ChCustomFieldSource_Org::ID); $tpl->assign('custom_fields', $custom_fields); $custom_field_values = DAO_CustomFieldValue::getValuesBySourceIds(ChCustomFieldSource_Org::ID, $id); if (isset($custom_field_values[$id])) { $tpl->assign('custom_field_values', $custom_field_values[$id]); } $types = Model_CustomField::getTypes(); $tpl->assign('types', $types); // View $tpl->assign('view_id', $view_id); $tpl->display('file:' . $this->_TPL_PATH . 'contacts/orgs/org_peek.tpl'); }
function showBatchPanelAction() { @($ids = DevblocksPlatform::importGPC($_REQUEST['ids'])); @($view_id = DevblocksPlatform::importGPC($_REQUEST['view_id'])); $tpl = DevblocksPlatform::getTemplateService(); $tpl->assign('path', $this->_TPL_PATH); $tpl->assign('view_id', $view_id); $unique_sender_ids = array(); $unique_subjects = array(); if (!empty($ids)) { $ticket_ids = DevblocksPlatform::parseCsvString($ids); if (empty($ticket_ids)) { break; } $tickets = DAO_Ticket::getTickets($ticket_ids); if (is_array($tickets)) { foreach ($tickets as $ticket) { /* @var $ticket CerberusTicket */ $ptr =& $unique_sender_ids[$ticket->first_wrote_address_id]; $ptr = intval($ptr) + 1; $ptr =& $unique_subjects[$ticket->subject]; $ptr = intval($ptr) + 1; } } arsort($unique_subjects); // sort by occurrences $senders = DAO_Address::getWhere(sprintf("%s IN (%s)", DAO_Address::ID, implode(',', array_keys($unique_sender_ids)))); foreach ($senders as $sender) { $ptr =& $unique_senders[$sender->email]; $ptr = intval($ptr) + 1; } arsort($unique_senders); unset($senders); unset($unique_sender_ids); @$tpl->assign('ticket_ids', $ticket_ids); @$tpl->assign('unique_senders', $unique_senders); @$tpl->assign('unique_subjects', $unique_subjects); } // Teams $teams = DAO_Group::getAll(); $tpl->assign('teams', $teams); // Categories $team_categories = DAO_Bucket::getTeams(); // [TODO] Cache these $tpl->assign('team_categories', $team_categories); $workers = DAO_Worker::getAllActive(); $tpl->assign('workers', $workers); // Custom Fields $custom_fields = DAO_CustomField::getBySource(ChCustomFieldSource_Ticket::ID); $tpl->assign('custom_fields', $custom_fields); $tpl->display('file:' . $this->_TPL_PATH . 'tickets/rpc/batch_panel.tpl'); }
function showTaskBulkPanelAction() { @($ids = DevblocksPlatform::importGPC($_REQUEST['ids'])); @($view_id = DevblocksPlatform::importGPC($_REQUEST['view_id'])); $tpl = DevblocksPlatform::getTemplateService(); $tpl->assign('view_id', $view_id); if (!empty($ids)) { $id_list = DevblocksPlatform::parseCsvString($ids); $tpl->assign('ids', implode(',', $id_list)); } $workers = DAO_Worker::getAllActive(); $tpl->assign('workers', $workers); // Custom Fields $custom_fields = DAO_CustomField::getBySource(ChCustomFieldSource_Task::ID); $tpl->assign('custom_fields', $custom_fields); $tpl->cache_lifetime = "0"; $tpl->display('file:' . $this->_TPL_PATH . 'tasks/rpc/bulk.tpl'); }
function render() { $this->_sanitize(); $tpl = DevblocksPlatform::getTemplateService(); $tpl->assign('id', $this->id); $tpl->assign('view', $this); $workers = DAO_Worker::getAll(); $tpl->assign('workers', $workers); // Custom fields $custom_fields = DAO_CustomField::getBySource(CrmCustomFieldSource_Opportunity::ID); $tpl->assign('custom_fields', $custom_fields); $tpl->cache_lifetime = "0"; $tpl->assign('view_fields', $this->getColumns()); $tpl->display('file:' . DEVBLOCKS_PLUGIN_PATH . 'cerberusweb.crm/templates/crm/opps/view.tpl'); }
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'); }
public static function handleFormPost($source_ext_id, $source_id, $field_ids) { $fields = DAO_CustomField::getBySource($source_ext_id); if (is_array($field_ids)) { foreach ($field_ids as $field_id) { if (!isset($fields[$field_id])) { continue; } switch ($fields[$field_id]->type) { case Model_CustomField::TYPE_MULTI_LINE: case Model_CustomField::TYPE_SINGLE_LINE: case Model_CustomField::TYPE_URL: @($field_value = DevblocksPlatform::importGPC($_POST['field_' . $field_id], 'string', '')); if (0 != strlen($field_value)) { DAO_CustomFieldValue::setFieldValue($source_ext_id, $source_id, $field_id, $field_value); } else { DAO_CustomFieldValue::unsetFieldValue($source_ext_id, $source_id, $field_id); } break; case Model_CustomField::TYPE_DROPDOWN: @($field_value = DevblocksPlatform::importGPC($_POST['field_' . $field_id], 'string', '')); if (0 != strlen($field_value)) { DAO_CustomFieldValue::setFieldValue($source_ext_id, $source_id, $field_id, $field_value); } else { DAO_CustomFieldValue::unsetFieldValue($source_ext_id, $source_id, $field_id); } break; case Model_CustomField::TYPE_MULTI_PICKLIST: @($field_value = DevblocksPlatform::importGPC($_POST['field_' . $field_id], 'array', array())); if (!empty($field_value)) { DAO_CustomFieldValue::setFieldValue($source_ext_id, $source_id, $field_id, $field_value); } else { DAO_CustomFieldValue::unsetFieldValue($source_ext_id, $source_id, $field_id); } break; case Model_CustomField::TYPE_CHECKBOX: @($field_value = DevblocksPlatform::importGPC($_POST['field_' . $field_id], 'integer', 0)); $set = !empty($field_value) ? 1 : 0; DAO_CustomFieldValue::setFieldValue($source_ext_id, $source_id, $field_id, $set); break; case Model_CustomField::TYPE_MULTI_CHECKBOX: @($field_value = DevblocksPlatform::importGPC($_POST['field_' . $field_id], 'array', array())); if (!empty($field_value)) { DAO_CustomFieldValue::setFieldValue($source_ext_id, $source_id, $field_id, $field_value); } else { DAO_CustomFieldValue::unsetFieldValue($source_ext_id, $source_id, $field_id); } break; case Model_CustomField::TYPE_DATE: @($field_value = DevblocksPlatform::importGPC($_POST['field_' . $field_id], 'string', '')); @($date = strtotime($field_value)); if (!empty($date)) { DAO_CustomFieldValue::setFieldValue($source_ext_id, $source_id, $field_id, $date); } else { DAO_CustomFieldValue::unsetFieldValue($source_ext_id, $source_id, $field_id); } break; case Model_CustomField::TYPE_NUMBER: case Model_CustomField::TYPE_WORKER: @($field_value = DevblocksPlatform::importGPC($_POST['field_' . $field_id], 'string', '')); if (0 != strlen($field_value)) { DAO_CustomFieldValue::setFieldValue($source_ext_id, $source_id, $field_id, intval($field_value)); } else { DAO_CustomFieldValue::unsetFieldValue($source_ext_id, $source_id, $field_id); } break; } } } return true; }
function writeResponse(DevblocksHttpResponse $response) { $tpl = DevblocksPlatform::getTemplateService(); $tpl_path = dirname(dirname(__FILE__)) . '/templates/'; $theme = DAO_CommunityToolProperty::get($this->getPortal(), UmScApp::PARAM_THEME, UmScApp::DEFAULT_THEME); if (!is_dir($tpl_path . 'portal/sc/themes/' . $theme)) { $theme = UmScApp::DEFAULT_THEME; } $umsession = $this->getSession(); $active_user = $umsession->getProperty('sc_login', null); $stack = $response->path; @($module = array_shift($stack)); switch ($module) { default: case 'home': $sHomeRss = DAO_CommunityToolProperty::get($this->getPortal(), UmScApp::PARAM_HOME_RSS, ''); $aHomeRss = !empty($sHomeRss) ? unserialize($sHomeRss) : array(); $feeds = array(); // [TODO] Implement a feed cache so we aren't bombing out foreach ($aHomeRss as $title => $url) { $feed = null; try { $feed = Zend_Feed::import($url); } catch (Exception $e) { } if (!empty($feed) && $feed->count()) { $feeds[] = array('name' => $title, 'feed' => $feed); } } $tpl->assign('feeds', $feeds); $tpl->display("file:{$tpl_path}portal/sc/internal/home/index.tpl"); break; case 'account': if (!$this->allow_logins || empty($active_user)) { break; } $address = DAO_Address::get($active_user->id); $tpl->assign('address', $address); $tpl->display("file:{$tpl_path}portal/sc/internal/account/index.tpl"); break; case 'kb': // KB Roots $sKbRoots = DAO_CommunityToolProperty::get($this->getPortal(), UmScApp::PARAM_KB_ROOTS, ''); $kb_roots = !empty($sKbRoots) ? unserialize($sKbRoots) : array(); $kb_roots_str = '0'; if (!empty($kb_roots)) { $kb_roots_str = implode(',', array_keys($kb_roots)); } switch (array_shift($stack)) { case 'article': if (empty($kb_roots)) { return; } $id = intval(array_shift($stack)); list($articles, $count) = DAO_KbArticle::search(array(new DevblocksSearchCriteria(SearchFields_KbArticle::ID, '=', $id), new DevblocksSearchCriteria(SearchFields_KbArticle::TOP_CATEGORY_ID, 'in', array_keys($kb_roots))), -1, 0, null, null, false); if (!isset($articles[$id])) { break; } $article = DAO_KbArticle::get($id); $tpl->assign('article', $article); @($article_list = $umsession->getProperty(UmScApp::SESSION_ARTICLE_LIST, array())); if (!empty($article) && !isset($article_list[$id])) { DAO_KbArticle::update($article->id, array(DAO_KbArticle::VIEWS => ++$article->views)); $article_list[$id] = $id; $umsession->setProperty(UmScApp::SESSION_ARTICLE_LIST, $article_list); } $categories = DAO_KbCategory::getWhere(); $tpl->assign('categories', $categories); $cats = DAO_KbArticle::getCategoriesByArticleId($id); $breadcrumbs = array(); foreach ($cats as $cat_id) { if (!isset($breadcrumbs[$cat_id])) { $breadcrumbs[$cat_id] = array(); } $pid = $cat_id; while ($pid) { $breadcrumbs[$cat_id][] = $pid; $pid = $categories[$pid]->parent_id; } $breadcrumbs[$cat_id] = array_reverse($breadcrumbs[$cat_id]); // Remove any breadcrumbs not in this SC profile $pid = reset($breadcrumbs[$cat_id]); if (!isset($kb_roots[$pid])) { unset($breadcrumbs[$cat_id]); } } $tpl->assign('breadcrumbs', $breadcrumbs); $tpl->display("file:{$tpl_path}portal/sc/internal/kb/article.tpl"); break; default: case 'browse': @($root = intval(array_shift($stack))); $tpl->assign('root_id', $root); $categories = DAO_KbCategory::getWhere(); $tpl->assign('categories', $categories); $tree_map = DAO_KbCategory::getTreeMap(0); // Remove other top-level categories if (is_array($tree_map[0])) { foreach ($tree_map[0] as $child_id => $count) { if (!isset($kb_roots[$child_id])) { unset($tree_map[0][$child_id]); } } } // Remove empty categories if (is_array($tree_map[0])) { foreach ($tree_map as $node_id => $children) { foreach ($children as $child_id => $count) { if (empty($count)) { @($pid = $categories[$child_id]->parent_id); unset($tree_map[$pid][$child_id]); unset($tree_map[$child_id]); } } } } $tpl->assign('tree', $tree_map); // Breadcrumb // [TODO] API-ize inside Model_KbTree ? $breadcrumb = array(); $pid = $root; while (0 != $pid) { $breadcrumb[] = $pid; $pid = $categories[$pid]->parent_id; } $tpl->assign('breadcrumb', array_reverse($breadcrumb)); $tpl->assign('mid', @intval(ceil(count($tree_map[$root]) / 2))); // Articles if (!empty($root)) { list($articles, $count) = DAO_KbArticle::search(array(new DevblocksSearchCriteria(SearchFields_KbArticle::CATEGORY_ID, '=', $root), new DevblocksSearchCriteria(SearchFields_KbArticle::TOP_CATEGORY_ID, 'in', array_keys($kb_roots))), -1, 0, null, null, false); } $tpl->assign('articles', $articles); $tpl->display("file:{$tpl_path}portal/sc/internal/kb/index.tpl"); break; } break; case 'answers': $query = rawurldecode(array_shift($stack)); $tpl->assign('query', $query); $sFnrSources = DAO_CommunityToolProperty::get($this->getPortal(), UmScApp::PARAM_FNR_SOURCES, ''); $aFnrSources = !empty($sFnrSources) ? unserialize($sFnrSources) : array(); if (!empty($query)) { // [JAS]: If we've been customized with specific sources, use them $where = !empty($aFnrSources) ? sprintf("%s IN (%s)", DAO_FnrExternalResource::ID, implode(',', array_keys($aFnrSources))) : sprintf("%s IN (-1)", DAO_FnrExternalResource::ID); $resources = DAO_FnrExternalResource::getWhere($where); $feeds = Model_FnrExternalResource::searchResources($resources, $query); $tpl->assign('feeds', $feeds); $fields = array(DAO_FnrQuery::QUERY => $query, DAO_FnrQuery::CREATED => time(), DAO_FnrQuery::SOURCE => $this->getPortal(), DAO_FnrQuery::NO_MATCH => empty($feeds) ? 1 : 0); DAO_FnrQuery::create($fields); } // KB $sKbRoots = DAO_CommunityToolProperty::get($this->getPortal(), UmScApp::PARAM_KB_ROOTS, ''); $kb_roots = !empty($sKbRoots) ? unserialize($sKbRoots) : array(); list($articles, $count) = DAO_KbArticle::search(array(array(DevblocksSearchCriteria::GROUP_OR, new DevblocksSearchCriteria(SearchFields_KbArticle::TITLE, 'fulltext', $query), new DevblocksSearchCriteria(SearchFields_KbArticle::CONTENT, 'fulltext', $query)), new DevblocksSearchCriteria(SearchFields_KbArticle::TOP_CATEGORY_ID, 'in', array_keys($kb_roots))), 100, 0, null, null, true); $tpl->assign('articles', $articles); $tpl->display("file:{$tpl_path}portal/sc/internal/answers/index.tpl"); break; case 'contact': $response = array_shift($stack); $settings = CerberusSettings::getInstance(); $default_from = $settings->get(CerberusSettings::DEFAULT_REPLY_FROM); $tpl->assign('default_from', $default_from); switch ($response) { case 'confirm': $tpl->assign('last_opened', $umsession->getProperty('support.write.last_opened', '')); $tpl->display("file:{$tpl_path}portal/sc/internal/contact/confirm.tpl"); break; default: case 'step1': $umsession->setProperty('support.write.last_error', null); case 'step2': $sFrom = $umsession->getProperty('support.write.last_from', ''); $sSubject = $umsession->getProperty('support.write.last_subject', ''); $sNature = $umsession->getProperty('support.write.last_nature', ''); $sContent = $umsession->getProperty('support.write.last_content', ''); // $aLastFollowupQ = $umsession->getProperty('support.write.last_followup_q',''); $aLastFollowupA = $umsession->getProperty('support.write.last_followup_a', ''); $sError = $umsession->getProperty('support.write.last_error', ''); $tpl->assign('last_from', $sFrom); $tpl->assign('last_subject', $sSubject); $tpl->assign('last_nature', $sNature); $tpl->assign('last_content', $sContent); // $tpl->assign('last_followup_q', $aLastFollowupQ); $tpl->assign('last_followup_a', $aLastFollowupA); $tpl->assign('last_error', $sError); $sDispatch = DAO_CommunityToolProperty::get($this->getPortal(), UmScApp::PARAM_DISPATCH, ''); // $dispatch = !empty($sDispatch) ? (is_array($sDispatch) ? unserialize($sDispatch): array($sDispatch)) : array(); $dispatch = !empty($sDispatch) ? unserialize($sDispatch) : array(); $tpl->assign('dispatch', $dispatch); switch ($response) { default: // If there's only one situation, skip to step2 if (1 == count($dispatch)) { @($sNature = md5(key($dispatch))); $umsession->setProperty('support.write.last_nature', $sNature); reset($dispatch); } else { $tpl->display("file:{$tpl_path}portal/sc/internal/contact/step1.tpl"); break; } case 'step2': // Cache along with answers? if (is_array($dispatch)) { foreach ($dispatch as $k => $v) { if (md5($k) == $sNature) { $umsession->setProperty('support.write.last_nature_string', $k); $tpl->assign('situation', $k); $tpl->assign('situation_params', $v); break; } } } $ticket_fields = DAO_CustomField::getBySource('cerberusweb.fields.source.ticket'); $tpl->assign('ticket_fields', $ticket_fields); $tpl->display("file:{$tpl_path}portal/sc/internal/contact/step2.tpl"); break; } break; } break; // $tpl->display("file:${tpl_path}portal/sc/internal/contact/index.tpl"); // break; // $tpl->display("file:${tpl_path}portal/sc/internal/contact/index.tpl"); // break; case 'history': if (!$this->allow_logins || empty($active_user)) { break; } $mask = array_shift($stack); if (empty($mask)) { list($open_tickets) = DAO_Ticket::search(array(), array(new DevblocksSearchCriteria(SearchFields_Ticket::TICKET_FIRST_WROTE_ID, '=', $active_user->id), new DevblocksSearchCriteria(SearchFields_Ticket::TICKET_CLOSED, '=', 0)), -1, 0, SearchFields_Ticket::TICKET_UPDATED_DATE, false, false); $tpl->assign('open_tickets', $open_tickets); list($closed_tickets) = DAO_Ticket::search(array(), array(new DevblocksSearchCriteria(SearchFields_Ticket::TICKET_FIRST_WROTE_ID, '=', $active_user->id), new DevblocksSearchCriteria(SearchFields_Ticket::TICKET_CLOSED, '=', 1)), -1, 0, SearchFields_Ticket::TICKET_UPDATED_DATE, false, false); $tpl->assign('closed_tickets', $closed_tickets); $tpl->display("file:{$tpl_path}portal/sc/internal/history/index.tpl"); } else { // Secure retrieval (address + mask) list($tickets) = DAO_Ticket::search(array(), array(new DevblocksSearchCriteria(SearchFields_Ticket::TICKET_MASK, '=', $mask), new DevblocksSearchCriteria(SearchFields_Ticket::TICKET_FIRST_WROTE_ID, '=', $active_user->id)), 1, 0, null, null, false); $ticket = array_shift($tickets); // Security check (mask compare) if (0 == strcasecmp($ticket[SearchFields_Ticket::TICKET_MASK], $mask)) { $messages = DAO_Ticket::getMessagesByTicket($ticket[SearchFields_Ticket::TICKET_ID]); $messages = array_reverse($messages, true); $tpl->assign('ticket', $ticket); $tpl->assign('messages', $messages); $tpl->display("file:{$tpl_path}portal/sc/internal/history/display.tpl"); } } break; case 'register': if (!$this->allow_logins) { break; } @($step = array_shift($stack)); switch ($step) { case 'forgot': $tpl->display("file:{$tpl_path}portal/sc/internal/register/forgot.tpl"); break; case 'forgot2': $tpl->display("file:{$tpl_path}portal/sc/internal/register/forgot_confirm.tpl"); break; case 'confirm': $tpl->display("file:{$tpl_path}portal/sc/internal/register/confirm.tpl"); break; default: $tpl->display("file:{$tpl_path}portal/sc/internal/register/index.tpl"); break; } break; } // print_r($response); }
function showAlertPeekAction() { @($id = DevblocksPlatform::importGPC($_REQUEST['id'], 'integer', 0)); @($view_id = DevblocksPlatform::importGPC($_REQUEST['view_id'], 'string', '')); $tpl = DevblocksPlatform::getTemplateService(); $tpl->assign('path', $this->_TPL_PATH); $tpl->assign('view_id', $view_id); $active_worker = PortSensorApplication::getActiveWorker(); if (null != ($alert = DAO_Alert::get($id))) { $tpl->assign('alert', $alert); } if (null == @($worker_id = $alert->worker_id)) { $worker_id = $active_worker->id; } $sensor_type_mfts = DevblocksPlatform::getExtensions('portsensor.sensor', false); $tpl->assign('sensor_type_mfts', $sensor_type_mfts); $tpl->assign('workers', DAO_Worker::getAllActive()); $tpl->assign('all_workers', DAO_Worker::getAll()); // Custom Fields: Sensor $sensor_fields = DAO_CustomField::getBySource(PsCustomFieldSource_Sensor::ID); $tpl->assign('sensor_fields', $sensor_fields); // Criteria extensions $alert_criteria_exts = DevblocksPlatform::getExtensions('portsensor.alert.criteria', true); $tpl->assign('alert_criteria_exts', $alert_criteria_exts); // Action extensions $alert_action_exts = DevblocksPlatform::getExtensions('portsensor.alert.action', true); $tpl->assign('alert_action_exts', $alert_action_exts); $tpl->display('file:' . $this->_TPL_PATH . 'alerts/peek.tpl'); }
function showPropertiesAction() { @($ticket_id = DevblocksPlatform::importGPC($_REQUEST['ticket_id'], 'integer')); $tpl = DevblocksPlatform::getTemplateService(); $tpl->assign('path', $this->_TPL_PATH); $tpl->assign('ticket_id', $ticket_id); $ticket = DAO_Ticket::getTicket($ticket_id); $tpl->assign('ticket', $ticket); $requesters = DAO_Ticket::getRequestersByTicket($ticket_id); $tpl->assign('requesters', $requesters); $workers = DAO_Worker::getAllActive(); $tpl->assign('workers', $workers); // Groups (for custom fields) $groups = DAO_Group::getAll(); $tpl->assign('groups', $groups); // Custom fields $fields = DAO_CustomField::getBySource(ChCustomFieldSource_Ticket::ID); $tpl->assign('ticket_fields', $fields); $field_values = DAO_CustomFieldValue::getValuesBySourceIds(ChCustomFieldSource_Ticket::ID, $ticket_id); if (isset($field_values[$ticket->id])) { $tpl->assign('ticket_field_values', $field_values[$ticket->id]); } $tpl->display('file:' . $this->_TPL_PATH . 'display/modules/properties/index.tpl'); }
/** * @return DevblocksSearchField[] */ static function getFields() { $translate = DevblocksPlatform::getTranslationService(); $columns = array(SearchFields_CommunityTool::ID => new DevblocksSearchField(SearchFields_CommunityTool::ID, 'ct', 'id', null, $translate->_('common.id')), SearchFields_CommunityTool::NAME => new DevblocksSearchField(SearchFields_CommunityTool::NAME, 'ct', 'name', null, $translate->_('community_portal.name')), SearchFields_CommunityTool::CODE => new DevblocksSearchField(SearchFields_CommunityTool::CODE, 'ct', 'code', null, $translate->_('community_portal.code')), SearchFields_CommunityTool::EXTENSION_ID => new DevblocksSearchField(SearchFields_CommunityTool::EXTENSION_ID, 'ct', 'extension_id', null, $translate->_('community_portal.extension_id'))); // Custom Fields $fields = DAO_CustomField::getBySource(CustomFieldSource_CommunityPortal::ID); if (is_array($fields)) { foreach ($fields as $field_id => $field) { $key = 'cf_' . $field_id; $columns[$key] = new DevblocksSearchField($key, $key, 'field_value', null, $field->name); } } // Sort by label (translation-conscious) uasort($columns, create_function('$a, $b', "return strcasecmp(\$a->db_label,\$b->db_label);\n")); return $columns; }
private function _getFieldSource($ext_id) { $tpl = DevblocksPlatform::getTemplateService(); $tpl->assign('path', $this->_TPL_PATH); $tpl->assign('ext_id', $ext_id); // [TODO] Make sure the extension exists before continuing $source_manifest = DevblocksPlatform::getExtension($ext_id, false); $tpl->assign('source_manifest', $source_manifest); $types = Model_CustomField::getTypes(); $tpl->assign('types', $types); // Look up the defined global fields by the given extension $fields = DAO_CustomField::getBySource($ext_id); $tpl->assign('fields', $fields); $tpl->display('file:' . $this->_TPL_PATH . 'setup/tabs/fields/edit_source.tpl'); }
/** * @return DevblocksSearchField[] */ static function getFields() { $translate = DevblocksPlatform::getTranslationService(); $columns = array(self::ID => new DevblocksSearchField(self::ID, 'w', 'id', $translate->_('common.id')), self::FIRST_NAME => new DevblocksSearchField(self::FIRST_NAME, 'w', 'first_name', $translate->_('worker.first_name')), self::LAST_NAME => new DevblocksSearchField(self::LAST_NAME, 'w', 'last_name', $translate->_('worker.last_name')), self::TITLE => new DevblocksSearchField(self::TITLE, 'w', 'title', $translate->_('worker.title')), self::EMAIL => new DevblocksSearchField(self::EMAIL, 'w', 'email', null, ucwords($translate->_('common.email'))), self::IS_SUPERUSER => new DevblocksSearchField(self::IS_SUPERUSER, 'w', 'is_superuser', $translate->_('worker.is_superuser')), self::LAST_ACTIVITY => new DevblocksSearchField(self::LAST_ACTIVITY, 'w', 'last_activity', $translate->_('worker.last_activity')), self::LAST_ACTIVITY_DATE => new DevblocksSearchField(self::LAST_ACTIVITY_DATE, 'w', 'last_activity_date', $translate->_('worker.last_activity_date')), self::IS_DISABLED => new DevblocksSearchField(self::IS_DISABLED, 'w', 'is_disabled', ucwords($translate->_('common.disabled')))); // Custom Fields $fields = DAO_CustomField::getBySource(UmCustomFieldSource_Worker::ID); if (is_array($fields)) { foreach ($fields as $field_id => $field) { $key = 'cf_' . $field_id; $columns[$key] = new DevblocksSearchField($key, $key, 'field_value', $field->name); } } // Sort by label (translation-conscious) uasort($columns, create_function('$a, $b', "return strcasecmp(\$a->db_label,\$b->db_label);\n")); return $columns; }
function showMailRoutingRulePanelAction() { @($id = DevblocksPlatform::importGPC($_REQUEST['id'], 'integer', 0)); @($group_id = DevblocksPlatform::importGPC($_REQUEST['group_id'], 'integer', 0)); $active_worker = CerberusApplication::getActiveWorker(); $tpl = DevblocksPlatform::getTemplateService(); $tpl_path = $this->_TPL_PATH; $tpl->assign('path', $tpl_path); $tpl->assign('group_id', $group_id); if (null != ($rule = DAO_MailToGroupRule::get($id))) { $tpl->assign('rule', $rule); } // Make sure we're allowed to change this group's setup if (!$active_worker->isTeamManager($group_id) && !$active_worker->is_superuser) { return; } $groups = DAO_Group::getAll(); $tpl->assign('groups', $groups); $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: Ticket $ticket_fields = DAO_CustomField::getBySource(ChCustomFieldSource_Ticket::ID); $tpl->assign('ticket_fields', $ticket_fields); $tpl->display('file:' . $tpl_path . 'configuration/tabs/mail/routing/peek.tpl'); }
/** * @return DevblocksSearchField[] */ static function getFields() { $translate = DevblocksPlatform::getTranslationService(); $columns = array(self::ID => new DevblocksSearchField(self::ID, 't', 'id', null, $translate->_('task.id')), self::TITLE => new DevblocksSearchField(self::TITLE, 't', 'title', null, $translate->_('task.title')), self::IS_COMPLETED => new DevblocksSearchField(self::IS_COMPLETED, 't', 'is_completed', null, $translate->_('task.is_completed')), self::DUE_DATE => new DevblocksSearchField(self::DUE_DATE, 't', 'due_date', null, $translate->_('task.due_date')), self::COMPLETED_DATE => new DevblocksSearchField(self::COMPLETED_DATE, 't', 'completed_date', null, $translate->_('task.completed_date')), self::CONTENT => new DevblocksSearchField(self::CONTENT, 't', 'content', null, $translate->_('task.content')), self::WORKER_ID => new DevblocksSearchField(self::WORKER_ID, 't', 'worker_id', null, $translate->_('task.worker_id')), self::SOURCE_EXTENSION => new DevblocksSearchField(self::SOURCE_EXTENSION, 't', 'source_extension', null, $translate->_('task.source_extension')), self::SOURCE_ID => new DevblocksSearchField(self::SOURCE_ID, 't', 'source_id', null, $translate->_('task.source_id'))); // Custom Fields $fields = DAO_CustomField::getBySource(ChCustomFieldSource_Task::ID); if (is_array($fields)) { foreach ($fields as $field_id => $field) { $key = 'cf_' . $field_id; $columns[$key] = new DevblocksSearchField($key, $key, 'field_value', null, $field->name); } } return $columns; }