function showTabFieldsAction() { @($group_id = DevblocksPlatform::importGPC($_REQUEST['id'], 'integer', 0)); $tpl = DevblocksPlatform::getTemplateService(); $tpl_path = $this->_TPL_PATH; $tpl->assign('path', $tpl_path); $active_worker = CerberusApplication::getActiveWorker(); if (!$active_worker->isTeamManager($group_id) && !$active_worker->is_superuser) { return; } else { $group = DAO_Group::getTeam($group_id); $tpl->assign('team', $group); } $group_fields = DAO_CustomField::getBySourceAndGroupId(ChCustomFieldSource_Ticket::ID, $group_id); $tpl->assign('group_fields', $group_fields); $types = Model_CustomField::getTypes(); $tpl->assign('types', $types); $tpl->display('file:' . $tpl_path . 'groups/manage/fields.tpl'); }
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::getBySourceAndGroupId($ext_id, 0); $tpl->assign('fields', $fields); $tpl->display('file:' . $this->_TPL_PATH . 'configuration/tabs/fields/edit_source.tpl'); }
function showEntryAction() { @($active_worker = CerberusApplication::getActiveWorker()); @($view_id = DevblocksPlatform::importGPC($_REQUEST['view_id'], 'string', '')); $tpl = DevblocksPlatform::getTemplateService(); $tpl_path = dirname(dirname(__FILE__)) . '/templates/'; $tpl->assign('path', $this->plugin_path . '/templates/'); $tpl->assign('view_id', $view_id); // Editing @($id = DevblocksPlatform::importGPC($_REQUEST['id'], 'integer', 0)); // Creating @($msg_id = DevblocksPlatform::importGPC($_REQUEST['msg_id'], 'integer', 0)); @($quote = DevblocksPlatform::importGPC($_REQUEST['quote'], 'string', '')); @($url = DevblocksPlatform::importGPC($_REQUEST['url'], 'string', '')); @($source_ext_id = DevblocksPlatform::importGPC($_REQUEST['source_ext_id'], 'string', '')); @($source_id = DevblocksPlatform::importGPC($_REQUEST['source_id'], 'integer', 0)); /* * This treats procedurally created model objects * the same as existing objects */ if (empty($id)) { $model = new Model_FeedbackEntry(); if (!empty($msg_id)) { if (null != ($message = DAO_Ticket::getMessage($msg_id))) { $model->id = 0; $model->log_date = time(); $model->quote_address_id = $message->address_id; $model->quote_mood = 0; $model->quote_text = $quote; $model->worker_id = $active_worker->id; $model->source_url = $url; $tpl->assign('model', $model); } } } elseif (!empty($id)) { // Were we given a model ID to load? if (null != ($model = DAO_FeedbackEntry::get($id))) { $tpl->assign('model', $model); } } // Author (if not anonymous) if (!empty($model->quote_address_id)) { if (null != ($address = DAO_Address::get($model->quote_address_id))) { $tpl->assign('address', $address); } } if (!empty($source_ext_id)) { $tpl->assign('source_extension_id', $source_ext_id); $tpl->assign('source_id', $source_id); } // Custom fields $custom_fields = DAO_CustomField::getBySource(ChCustomFieldSource_FeedbackEntry::ID); $tpl->assign('custom_fields', $custom_fields); $custom_field_values = DAO_CustomFieldValue::getValuesBySourceIds(ChCustomFieldSource_FeedbackEntry::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); $tpl->display('file:' . $this->plugin_path . '/templates/feedback/ajax/feedback_entry_panel.tpl'); }
function showTaskPeekAction() { @($id = DevblocksPlatform::importGPC($_REQUEST['id'], 'integer', '')); @($view_id = DevblocksPlatform::importGPC($_REQUEST['view_id'], 'string', '')); @($link_namespace = DevblocksPlatform::importGPC($_REQUEST['link_namespace'], 'string', '')); // opt @($link_object_id = DevblocksPlatform::importGPC($_REQUEST['link_object_id'], 'integer', 0)); // opt $tpl = DevblocksPlatform::getTemplateService(); $tpl->cache_lifetime = "0"; $path = $this->_TPL_PATH; $tpl->assign('path', $path); if (!empty($id)) { $task = DAO_Task::get($id); $tpl->assign('task', $task); if (!empty($task->source_extension) && !empty($task->source_id)) { if (null != ($mft = DevblocksPlatform::getExtension($task->source_extension))) { $source_info = $mft->createInstance(); @$tpl->assign('source_info', $source_info->getSourceInfo($task->source_id)); } } } // Only used on create if (!empty($link_namespace) && !empty($link_object_id)) { $tpl->assign('link_namespace', $link_namespace); $tpl->assign('link_object_id', $link_object_id); } $workers = DAO_Worker::getAllActive(); $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, $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('id', $id); $tpl->assign('view_id', $view_id); $tpl->display('file:' . $path . 'tasks/rpc/peek.tpl'); }
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 showEntryAction($model = null) { $tpl = DevblocksPlatform::getTemplateService(); $tpl_path = dirname(dirname(__FILE__)) . '/templates/'; $tpl->assign('path', $tpl_path); $tpl->cache_lifetime = "0"; @($id = DevblocksPlatform::importGPC($_REQUEST['id'], 'integer', 0)); /* * [IMPORTANT -- Yes, this is simply a line in the sand.] * You're welcome to modify the code to meet your needs, but please respect * our licensing. Buy a legitimate copy to help support the project! * http://www.cerberusweb.com/ */ $license = CerberusLicense::getInstance(); if (empty($id) && (empty($license['serial']) || !empty($license['serial']) && isset($license['a'])) && 10 <= DAO_TimeTrackingEntry::getItemCount()) { $tpl->display('file:' . $tpl_path . 'timetracking/rpc/trial.tpl'); return; } /* * This treats procedurally created model objects * the same as existing objects */ if (!empty($id)) { // Were we given a model ID to load? if (null != ($model = DAO_TimeTrackingEntry::get($id))) { $tpl->assign('model', $model); } } elseif (!empty($model)) { // Were we passed a model object without an ID? $tpl->assign('model', $model); } /* @var $model Model_TimeTrackingEntry */ // Source extension if (!empty($model->source_extension_id)) { if (null != ($source = DevblocksPlatform::getExtension($model->source_extension_id, true))) { $tpl->assign('source', $source); } } // Org Name if (!empty($model->debit_org_id)) { if (null != ($org = DAO_ContactOrg::get($model->debit_org_id))) { $tpl->assign('org', $org); } } // Activities // [TODO] Cache $billable_activities = DAO_TimeTrackingActivity::getWhere(sprintf("%s!=0", DAO_TimeTrackingActivity::RATE)); $tpl->assign('billable_activities', $billable_activities); $nonbillable_activities = DAO_TimeTrackingActivity::getWhere(sprintf("%s=0", DAO_TimeTrackingActivity::RATE)); $tpl->assign('nonbillable_activities', $nonbillable_activities); // Custom fields $custom_fields = DAO_CustomField::getBySource(ChCustomFieldSource_TimeEntry::ID); $tpl->assign('custom_fields', $custom_fields); $custom_field_values = DAO_CustomFieldValue::getValuesBySourceIds(ChCustomFieldSource_TimeEntry::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); $tpl->display('file:' . $tpl_path . 'timetracking/rpc/time_entry_panel.tpl'); }
function configure() { $tpl = DevblocksPlatform::getTemplateService(); $tpl_path = dirname(dirname(dirname(dirname(__FILE__)))) . '/templates/'; $settings = CerberusSettings::getInstance(); $default_from = $settings->get(CerberusSettings::DEFAULT_REPLY_FROM); $tpl->assign('default_from', $default_from); $captcha_enabled = DAO_CommunityToolProperty::get(UmPortalHelper::getCode(), self::PARAM_CAPTCHA_ENABLED, 1); $tpl->assign('captcha_enabled', $captcha_enabled); $allow_subjects = DAO_CommunityToolProperty::get(UmPortalHelper::getCode(), self::PARAM_ALLOW_SUBJECTS, 0); $tpl->assign('allow_subjects', $allow_subjects); $attachments_mode = DAO_CommunityToolProperty::get(UmPortalHelper::getCode(), self::PARAM_ATTACHMENTS_MODE, 0); $tpl->assign('attachments_mode', $attachments_mode); $sDispatch = DAO_CommunityToolProperty::get(UmPortalHelper::getCode(), self::PARAM_SITUATIONS, ''); $dispatch = !empty($sDispatch) ? unserialize($sDispatch) : array(); $tpl->assign('dispatch', $dispatch); $groups = DAO_Group::getAll(); $tpl->assign('groups', $groups); // Contact: Fields $ticket_fields = DAO_CustomField::getBySource('cerberusweb.fields.source.ticket'); $tpl->assign('ticket_fields', $ticket_fields); // Custom field types $types = Model_CustomField::getTypes(); $tpl->assign('field_types', $types); $tpl->display("file:{$tpl_path}portal/sc/config/module/contact.tpl"); }