本文整理汇总了PHP中DevblocksPlatform::getExtension方法的典型用法代码示例。如果您正苦于以下问题:PHP DevblocksPlatform::getExtension方法的具体用法?PHP DevblocksPlatform::getExtension怎么用?PHP DevblocksPlatform::getExtension使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DevblocksPlatform
的用法示例。
在下文中一共展示了DevblocksPlatform::getExtension方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render
function render()
{
$active_worker = FegApplication::getActiveWorker();
$tpl = DevblocksPlatform::getTemplateService();
$tpl->assign('path', $this->tpl_path);
$response = DevblocksPlatform::getHttpResponse();
$stack = $response->path;
array_shift($stack);
// reports
@($reportId = array_shift($stack));
$report = null;
// We're given a specific report to display
if (!empty($reportId)) {
if (null != ($reportMft = DevblocksPlatform::getExtension($reportId))) {
// Make sure we have a report group
if (null == ($report_group_mft_id = $reportMft->params['report_group'])) {
return;
}
// Make sure the report group exists
if (null == ($report_group_mft = DevblocksPlatform::getExtension($report_group_mft_id))) {
return;
}
// Check our permissions on the parent report group before rendering the report
if (isset($report_group_mft->params['acl']) && !$active_worker->hasPriv($report_group_mft->params['acl'])) {
return;
}
// Render
if (null != ($report = $reportMft->createInstance()) && $report instanceof Extension_Report) {
/* @var $report Extension_Report */
$report->render();
return;
}
}
}
// If we don't have a selected report yet
if (empty($report)) {
// Organize into report groups
$report_groups = array();
$reportGroupMfts = DevblocksPlatform::getExtensions('feg.report.group', false);
// [TODO] Alphabetize groups and nested reports
// Load report groups
if (!empty($reportGroupMfts)) {
foreach ($reportGroupMfts as $reportGroupMft) {
$report_groups[$reportGroupMft->id] = array('manifest' => $reportGroupMft, 'reports' => array());
}
}
$reportMfts = DevblocksPlatform::getExtensions('feg.report', false);
// Load reports and file them under groups according to manifest
if (!empty($reportMfts)) {
foreach ($reportMfts as $reportMft) {
$report_group = $reportMft->params['report_group'];
if (isset($report_group)) {
$report_groups[$report_group]['reports'][] = $reportMft;
}
}
}
$tpl->assign('report_groups', $report_groups);
}
$tpl->display('file:' . $this->tpl_path . '/reports/index.tpl');
}
示例2: showTabAction
function showTabAction()
{
@($ext_id = DevblocksPlatform::importGPC($_REQUEST['ext_id'], 'string', ''));
if (null != ($tab_mft = DevblocksPlatform::getExtension($ext_id)) && null != ($inst = $tab_mft->createInstance()) && $inst instanceof Extension_ResearchTab) {
$inst->showTab();
}
}
示例3: run
function run()
{
// Get the controller and run the import action
if (null != ($extension = DevblocksPlatform::getExtension(ChForumsController::EXTENSION_ID, true))) {
if (method_exists($extension, 'import')) {
$extension->import();
}
}
}
示例4: handleTabActionAction
function handleTabActionAction()
{
@($tab = DevblocksPlatform::importGPC($_REQUEST['tab'], 'string', ''));
@($action = DevblocksPlatform::importGPC($_REQUEST['action'], 'string', ''));
if (null != ($tab_mft = DevblocksPlatform::getExtension($tab)) && null != ($inst = $tab_mft->createInstance()) && $inst instanceof Extension_HomeTab) {
if (method_exists($inst, $action . 'Action')) {
call_user_func(array(&$inst, $action . 'Action'));
}
}
}
示例5: authenticateAction
function authenticateAction()
{
@($original_path = explode(',', DevblocksPlatform::importGPC($_POST['original_path'])));
$manifest = DevblocksPlatform::getExtension('login.default');
$inst = $manifest->createInstance();
/* @var $inst Extension_LoginAuthenticator */
$url_service = DevblocksPlatform::getUrlService();
if ($inst->authenticate()) {
//authentication passed
if ($original_path[0] == '') {
unset($original_path[0]);
}
$devblocks_response = new DevblocksHttpResponse($original_path);
// Worker
$worker = CerberusApplication::getActiveWorker();
// Timezone
if (null != ($timezone = DAO_WorkerPref::get($worker->id, 'timezone'))) {
$_SESSION['timezone'] = $timezone;
@date_default_timezone_set($timezone);
}
// Language
if (null != ($lang_code = DAO_WorkerPref::get($worker->id, 'locale'))) {
$_SESSION['locale'] = $lang_code;
DevblocksPlatform::setLocale($lang_code);
}
if (!empty($devblocks_response->path) && $devblocks_response->path[0] == 'login') {
$tour_enabled = intval(DAO_WorkerPref::get($worker->id, 'assist_mode', 1));
$next_page = $tour_enabled ? 'welcome' : 'home';
$devblocks_response = new DevblocksHttpResponse(array($next_page));
}
} else {
//authentication failed
$devblocks_response = new DevblocksHttpResponse(array('login', 'failed'));
}
DevblocksPlatform::redirect($devblocks_response);
}
示例6: saveCommunityToolAction
function saveCommunityToolAction()
{
@($code = DevblocksPlatform::importGPC($_POST['portal'], 'string'));
@($name = DevblocksPlatform::importGPC($_POST['portal_name'], 'string', ''));
@($iDelete = DevblocksPlatform::importGPC($_POST['do_delete'], 'integer', 0));
UmPortalHelper::setCode($code);
if (DEMO_MODE) {
if ($iDelete) {
DevblocksPlatform::redirect(new DevblocksHttpResponse(array('config', 'communities')));
} else {
self::getCommunityToolAction();
}
return;
}
if (null != ($instance = DAO_CommunityTool::getByCode($code))) {
// Deleting?
if (!empty($iDelete)) {
$tool = DAO_CommunityTool::getByCode($code);
/* @var $tool Model_CommunityTool */
DAO_CommunityTool::delete($tool->id);
DevblocksPlatform::redirect(new DevblocksHttpResponse(array('config', 'communities')));
return;
} else {
$manifest = DevblocksPlatform::getExtension($instance->extension_id, false, true);
$tool = $manifest->createInstance();
/* @var $tool Extension_UsermeetTool */
// Update the tool name if it has changed
if (0 != strcmp($instance->name, $name)) {
DAO_CommunityTool::update($instance->id, array(DAO_CommunityTool::NAME => $name));
}
// Defer the rest to tool instances and extensions
$tool->saveConfiguration();
}
}
self::getCommunityToolAction();
}
示例7: IN
$db->Execute(sprintf("DELETE FROM requester WHERE address_id IN (%s)", implode(',', $ids_not_best)));
// Ticket: First Wrote (merge dupe reqs)
$db->Execute(sprintf("UPDATE ticket SET first_wrote_address_id = %d WHERE first_wrote_address_id IN (%s)", $best_id, implode(',', $ids_not_best)));
$db->Execute(sprintf("DELETE FROM ticket WHERE first_wrote_address_id IN (%s)", implode(',', $ids_not_best)));
// Ticket: Last Wrote (merge dupe reqs)
$db->Execute(sprintf("UPDATE ticket SET last_wrote_address_id = %d WHERE last_wrote_address_id IN (%s)", $best_id, implode(',', $ids_not_best)));
$db->Execute(sprintf("DELETE FROM ticket WHERE last_wrote_address_id IN (%s)", implode(',', $ids_not_best)));
// Addresses
$db->Execute(sprintf("DELETE FROM address WHERE id IN (%s)", implode(',', $ids_not_best)));
}
$rs->MoveNext();
}
}
// Fix blank ticket.first_message_id links (compose)
$rs = $db->Execute('select t.id,max(m.id) as max_id,min(m.id) as min_id from ticket t inner join message m on (m.ticket_id=t.id) where t.first_message_id = 0 group by t.id;');
while (!$rs->EOF) {
$db->Execute(sprintf("UPDATE ticket SET first_message_id = %d WHERE id = %d", $rs->fields['max_id'], $rs->fields['id']));
$rs->MoveNext();
}
// [TODO] This should probably be checked (though MySQL needs special BINARY syntax)
$db->Execute("UPDATE address SET email = LOWER(email)");
// Enable heartbeat cron
if (null != ($cron_mf = DevblocksPlatform::getExtension('cron.heartbeat'))) {
if (null != ($cron = $cron_mf->createInstance())) {
$cron->setParam(CerberusCronPageExtension::PARAM_ENABLED, true);
$cron->setParam(CerberusCronPageExtension::PARAM_DURATION, '5');
$cron->setParam(CerberusCronPageExtension::PARAM_TERM, 'm');
$cron->setParam(CerberusCronPageExtension::PARAM_LASTRUN, strtotime('Yesterday'));
}
}
return TRUE;
示例8: mergeTicket
private function mergeTicket($event)
{
// Listen for ticket merges and update our internal ticket_id records
@($new_ticket_id = $event->params['new_ticket_id']);
@($old_ticket_ids = $event->params['old_ticket_ids']);
$translate = DevblocksPlatform::getTranslationService();
if (empty($new_ticket_id) || empty($old_ticket_ids)) {
return;
}
$setting_manifest = DevblocksPlatform::getExtension(AnswernetLastActionAndAuditLogConfigTab::ID);
$setting = $setting_manifest->createInstance();
$al_merge_enabled = intval($setting->getParam(AnswernetLastActionAndAuditLogConfigTab::AL_MERGE_ENABLED, 0));
$uf_merge_enabled = intval($setting->getParam(AnswernetLastActionAndAuditLogConfigTab::UF_MERGE_ENABLED, 0));
if (!($al_merge_enabled || $uf_merge_enabled)) {
return;
}
$active_worker = CerberusApplication::getActiveWorker();
$worker_id = $active_worker->id;
if (class_exists('DAO_TicketAuditLog', true)) {
if ($al_merge_enabled) {
foreach ($old_ticket_ids as $old_id) {
$old_ticket = DAO_Ticket::getTicket($old_id);
$translate_str = $translate->_('answernet.last_action_and_audit_log.post.merge.new_ticket');
$translated = sprintf($translate_str, $old_id, $old_ticket->mask);
$fields = array(DAO_TicketAuditLog::TICKET_ID => $new_ticket_id, DAO_TicketAuditLog::WORKER_ID => $worker_id, DAO_TicketAuditLog::CHANGE_DATE => time(), DAO_TicketAuditLog::CHANGE_FIELD => "answernet.last_action_and_audit_log.type.merge", DAO_TicketAuditLog::CHANGE_VALUE => substr($translated, 0, 128));
$log_id = DAO_TicketAuditLog::create($fields);
}
unset($fields);
}
}
if ($uf_merge_enabled) {
$new_change_fields[DAO_Ticket::UPDATED_DATE] = time();
DAO_Ticket::updateTicket($new_ticket_id, $new_change_fields);
unset($new_change_fields);
}
}
示例9: _workerAssignedTask
private function _workerAssignedTask($event)
{
$translate = DevblocksPlatform::getTranslationService();
$events = DevblocksPlatform::getEventService();
$worker_id = $event->params['worker_id'];
$context = $event->params['context'];
$task_id = $event->params['context_id'];
$mail_service = DevblocksPlatform::getMailService();
$mailer = null;
// lazy load
$settings = DevblocksPlatform::getPluginSettingsService();
$reply_to = $settings->get('cerberusweb.core', CerberusSettings::DEFAULT_REPLY_FROM, CerberusSettingsDefaults::DEFAULT_REPLY_FROM);
$reply_personal = $settings->get('cerberusweb.core', CerberusSettings::DEFAULT_REPLY_PERSONAL, CerberusSettingsDefaults::DEFAULT_REPLY_PERSONAL);
$task = DAO_Task::get($task_id);
// Sanitize and combine all the destination addresses
$next_worker = DAO_Worker::get($worker_id);
$notify_emails = $next_worker->email;
if (empty($notify_emails)) {
return;
}
try {
if (null == $mailer) {
$mailer = $mail_service->getMailer(CerberusMail::getMailerDefaults());
}
// Create the message
$mail = $mail_service->createMessage();
$mail->setTo(array($notify_emails));
$mail->setFrom(array($reply_to => $reply_personal));
$mail->setReplyTo($reply_to);
$mail->setSubject(sprintf("[Task Assignment #%d]: %s", $task->id, $task->title));
$headers = $mail->getHeaders();
$headers->addTextHeader('X-Mailer', 'Cerberus Helpdesk (Build ' . APP_BUILD . ')');
$headers->addTextHeader('Precedence', 'List');
$headers->addTextHeader('Auto-Submitted', 'auto-generated');
$body = sprintf("[Task Assignment #%d]: %s", $task->id, $task->title);
$mft = DevblocksPlatform::getExtension($context, false, true);
$ext = $mft->createInstance();
$url = $ext->getPermalink($task_id);
$body .= "\r\n" . $url;
// Comments
$comments = DAO_Comment::getByContext(CerberusContexts::CONTEXT_TASK, $task_id);
foreach ($comments as $comment_id => $comment) {
$address = DAO_Address::get($comment->address_id);
$body .= "\r\nCommented By: " . $address->first_name . " " . $address->last_name;
$body .= "\r\n" . $comment->comment;
}
unset($comments);
$body .= "\r\n";
$mail->setBody($body);
$result = $mailer->send($mail);
} catch (Exception $e) {
echo "Task Email Notification failed to send<br>";
}
}
示例10: handleRequest
function handleRequest(DevblocksHttpRequest $request)
{
@($path = $request->path);
if (empty($path) || !is_array($path)) {
return;
}
$uri = array_shift($path);
$rss_controllers = DevblocksPlatform::getExtensions('usermeet.sc.rss.controller');
foreach ($rss_controllers as $extension_id => $rss_controller) {
if (0 == strcasecmp($rss_controller->params['uri'], $uri)) {
$controller = DevblocksPlatform::getExtension($extension_id, true);
$controller->handleRequest(new DevblocksHttpRequest($path));
return;
}
}
// [TOOD] subcontroller not found
}
示例11: strtotime
$sql = "UPDATE view_rss SET source_extension = 'core.rss.source.ticket' WHERE source_extension = ''";
$db->Execute($sql);
}
// `worker` ========================
$columns = $datadict->MetaColumns('worker');
$indexes = $datadict->MetaIndexes('worker', false);
if (!isset($columns['IS_DISABLED'])) {
$sql = $datadict->AddColumnSQL('worker', "is_disabled I1 DEFAULT 0 NOTNULL");
$datadict->ExecuteSQLArray($sql);
}
if (!isset($indexes['pos'])) {
$sql = $datadict->CreateIndexSQL('last_activity_date', 'worker', 'last_activity_date');
$datadict->ExecuteSQLArray($sql);
}
// Configure import cron
if (null != ($cron_mf = DevblocksPlatform::getExtension('cron.import'))) {
if (null != ($cron = $cron_mf->createInstance())) {
$cron->setParam(CerberusCronPageExtension::PARAM_ENABLED, false);
$cron->setParam(CerberusCronPageExtension::PARAM_DURATION, '0');
$cron->setParam(CerberusCronPageExtension::PARAM_TERM, 'm');
$cron->setParam(CerberusCronPageExtension::PARAM_LASTRUN, strtotime('Yesterday'));
}
}
// `worker_event` =============================
if (!isset($tables['worker_event'])) {
$flds = "\r\n\t\tid I4 DEFAULT 0 NOTNULL PRIMARY,\r\n\t\tcreated_date I4 DEFAULT 0 NOTNULL,\r\n\t\tworker_id I4 DEFAULT 0 NOTNULL,\r\n\t\ttitle C(255) DEFAULT '' NOTNULL,\r\n\t\tcontent XL,\r\n\t\tis_read I1 DEFAULT 0 NOTNULL,\r\n\t\turl C(255) DEFAULT '' NOTNULL\r\n\t";
$sql = $datadict->CreateTableSQL('worker_event', $flds);
$datadict->ExecuteSQLArray($sql);
if (!isset($indexes['created_date'])) {
$sql = $datadict->CreateIndexSQL('created_date', 'worker_event', 'created_date');
$datadict->ExecuteSQLArray($sql);
示例12: writeResponse
public function writeResponse(DevblocksHttpResponse $response)
{
$path = $response->path;
// [JAS]: Ajax? // [TODO] Explore outputting whitespace here for Safari
// if(empty($path))
// return;
$tpl = DevblocksPlatform::getTemplateService();
$session = DevblocksPlatform::getSessionService();
$settings = CerberusSettings::getInstance();
$translate = DevblocksPlatform::getTranslationService();
$active_worker = CerberusApplication::getActiveWorker();
$visit = $session->getVisit();
$page_manifests = $this->_getAllowedPages();
$controller = array_shift($path);
// Default page [TODO] This is supposed to come from framework.config.php
if (empty($controller)) {
$controller = 'home';
}
// [JAS]: Require us to always be logged in for Cerberus pages
if (empty($visit) && 0 != strcasecmp($controller, 'login')) {
$query = array();
if (!empty($response->path)) {
$query = array('url' => urlencode(implode('/', $response->path)));
}
DevblocksPlatform::redirect(new DevblocksHttpRequest(array('login'), $query));
}
$page_id = $this->_getPageIdByUri($controller);
@($page = DevblocksPlatform::getExtension($page_id, true));
/* @var $page CerberusPageExtension */
if (empty($page)) {
header("Status: 404");
return;
// [TODO] 404
}
// [JAS]: Listeners (Step-by-step guided tour, etc.)
$listenerManifests = DevblocksPlatform::getExtensions('devblocks.listener.http');
foreach ($listenerManifests as $listenerManifest) {
/* @var $listenerManifest DevblocksExtensionManifest */
$inst = $listenerManifest->createInstance();
/* @var $inst DevblocksHttpRequestListenerExtension */
$inst->run($response, $tpl);
}
$tpl->assign('active_worker', $active_worker);
$tour_enabled = false;
if (!empty($visit) && !is_null($active_worker)) {
$tour_enabled = intval(DAO_WorkerPref::get($active_worker->id, 'assist_mode', 1));
if (DEMO_MODE) {
$tour_enabled = 1;
}
// override for DEMO
$keyboard_shortcuts = intval(DAO_WorkerPref::get($active_worker->id, 'keyboard_shortcuts', 1));
$tpl->assign('pref_keyboard_shortcuts', $keyboard_shortcuts);
$active_worker_memberships = $active_worker->getMemberships();
$tpl->assign('active_worker_memberships', $active_worker_memberships);
$unread_notifications = DAO_WorkerEvent::getUnreadCountByWorker($active_worker->id);
$tpl->assign('active_worker_notify_count', $unread_notifications);
DAO_Worker::logActivity($active_worker->id, $page->getActivity());
}
$tpl->assign('tour_enabled', $tour_enabled);
// [JAS]: Variables provided to all page templates
$tpl->assign('settings', $settings);
$tpl->assign('session', $_SESSION);
$tpl->assign('translate', $translate);
$tpl->assign('visit', $visit);
$tpl->assign('license', CerberusLicense::getInstance());
$tpl->assign('page_manifests', $page_manifests);
$tpl->assign('page', $page);
$tpl->assign('response_uri', implode('/', $response->path));
$core_tpl = DEVBLOCKS_PLUGIN_PATH . 'cerberusweb.core/templates/';
$tpl->assign('core_tpl', $core_tpl);
// Prebody Renderers
$preBodyRenderers = DevblocksPlatform::getExtensions('cerberusweb.renderer.prebody', true);
if (!empty($preBodyRenderers)) {
$tpl->assign('prebody_renderers', $preBodyRenderers);
}
// Postbody Renderers
$postBodyRenderers = DevblocksPlatform::getExtensions('cerberusweb.renderer.postbody', true);
if (!empty($postBodyRenderers)) {
$tpl->assign('postbody_renderers', $postBodyRenderers);
}
// Timings
$tpl->assign('render_time', microtime(true) - DevblocksPlatform::getStartTime());
if (function_exists('memory_get_usage') && function_exists('memory_get_peak_usage')) {
$tpl->assign('render_memory', memory_get_usage() - DevblocksPlatform::getStartMemory());
$tpl->assign('render_peak_memory', memory_get_peak_usage() - DevblocksPlatform::getStartPeakMemory());
}
$tpl->display($core_tpl . 'border.tpl');
// $cache = DevblocksPlatform::getCacheService();
// $cache->printStatistics();
}
示例13: trigger
function trigger(Model_DevblocksEvent $event)
{
/*
* [TODO] Look at the hash and spawn our listeners for this particular point
*/
$events = DevblocksPlatform::getEventRegistry();
if (null == ($listeners = @$events[$event->id])) {
$listeners = array();
}
// [TODO] Make sure we can't get a double listener
if (is_array($events['*'])) {
foreach ($events['*'] as $evt) {
$listeners[] = $evt;
}
}
if (is_array($listeners) && !empty($listeners)) {
foreach ($listeners as $listener) {
/* @var $listener DevblocksExtensionManifest */
$manifest = DevblocksPlatform::getExtension($listener);
$inst = $manifest->createInstance();
/* @var $inst DevblocksEventListenerExtension */
$inst->handleEvent($event);
}
}
}
示例14: showSensorExtensionConfigAction
function showSensorExtensionConfigAction()
{
@($ext_id = DevblocksPlatform::importGPC($_REQUEST['ext_id'], 'string', ''));
@($id = DevblocksPlatform::importGPC($_REQUEST['id'], 'integer', 0));
if (null == ($sensor = DAO_Sensor::get($id))) {
$sensor = new Model_Sensor();
}
if (!empty($ext_id)) {
if (null != ($ext = DevblocksPlatform::getExtension($ext_id, true))) {
if ($ext instanceof Extension_Sensor) {
$ext->renderConfig($sensor);
}
}
}
}
示例15: showEntryAction
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');
}