本文整理汇总了PHP中DevblocksPlatform::getTranslationService方法的典型用法代码示例。如果您正苦于以下问题:PHP DevblocksPlatform::getTranslationService方法的具体用法?PHP DevblocksPlatform::getTranslationService怎么用?PHP DevblocksPlatform::getTranslationService使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DevblocksPlatform
的用法示例。
在下文中一共展示了DevblocksPlatform::getTranslationService方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _handleCronSensorsPost
private function _handleCronSensorsPost($event)
{
$logger = DevblocksPlatform::getConsoleLog();
$translate = DevblocksPlatform::getTranslationService();
$sensors = DAO_Sensor::getAll();
// Check that all external sensors aren't over their M.I.A. time
if (is_array($sensors)) {
foreach ($sensors as $sensor) {
/* @var $sensor Model_Sensor */
// Only external sensors
if ('sensor.external' != $sensor->extension_id) {
continue;
}
// Skip if the sensor hasn't run once yet
if (0 == $sensor->updated_date) {
continue;
}
$mia_secs = intval($sensor->params->mia_secs);
$elapsed = time() - $sensor->updated_date;
if ($mia_secs && $elapsed > $mia_secs) {
$fields = array(DAO_Sensor::STATUS => 2, DAO_Sensor::FAIL_COUNT => intval($sensor->fail_count) + 1, DAO_Sensor::METRIC => $translate->_('sensor.status.mia'), DAO_Sensor::OUTPUT => $translate->_('sensor.status.mia'));
DAO_Sensor::update($sensor->id, $fields);
$logger->info($sensor->name . " is M.I.A. for {$elapsed} seconds.");
}
}
}
}
示例2: showTab
function showTab()
{
$visit = CerberusApplication::getVisit();
$translate = DevblocksPlatform::getTranslationService();
$tpl = DevblocksPlatform::getTemplateService();
$tpl->cache_lifetime = "0";
$tpl_path = dirname(dirname(__FILE__)) . '/templates/';
$tpl->assign('path', $tpl_path);
@($request_path = DevblocksPlatform::importGPC($_REQUEST['request'], 'string', ''));
$tpl->assign('request_path', $request_path);
@($stack = explode('/', $request_path));
@array_shift($stack);
// research
@array_shift($stack);
// fnr
@($action = array_shift($stack));
switch ($action) {
default:
// if(null == ($view = C4_AbstractViewLoader::getView(null, self::VIEW_RESEARCH_FNR_SEARCH))) {
// $view = new C4_KbArticleView();
// $view->id = self::VIEW_RESEARCH_FNR_SEARCH;
// $view->name = $translate->_('common.search_results');
// C4_AbstractViewLoader::setView($view->id, $view);
// }
//
// $tpl->assign('view', $view);
// $tpl->assign('view_fields', C4_KbArticleView::getFields());
// $tpl->assign('view_searchable_fields', C4_KbArticleView::getSearchFields());
// $tpl->assign('response_uri', 'research/fnr/search');
$fnr_topics = DAO_FnrTopic::getWhere();
$tpl->assign('fnr_topics', $fnr_topics);
$tpl->display($tpl_path . 'research_tab/index.tpl');
break;
}
}
示例3: showTabNotificationsAction
function showTabNotificationsAction()
{
$visit = UsermeetApplication::getVisit();
$translate = DevblocksPlatform::getTranslationService();
$active_worker = UsermeetApplication::getActiveWorker();
$tpl = DevblocksPlatform::getTemplateService();
$tpl->assign('path', $this->_TPL_PATH);
// Select tab
$visit->set(UsermeetVisit::KEY_HOME_SELECTED_TAB, 'notifications');
// My Notifications
$myNotificationsView = Um_AbstractViewLoader::getView(self::VIEW_MY_NOTIFICATIONS);
$title = vsprintf($translate->_('home.my_notifications.view.title'), $active_worker->getName());
if (null == $myNotificationsView) {
$myNotificationsView = new Um_WorkerEventView();
$myNotificationsView->id = self::VIEW_MY_NOTIFICATIONS;
$myNotificationsView->name = $title;
$myNotificationsView->renderLimit = 25;
$myNotificationsView->renderPage = 0;
$myNotificationsView->renderSortBy = SearchFields_WorkerEvent::CREATED_DATE;
$myNotificationsView->renderSortAsc = 0;
}
// Overload criteria
$myNotificationsView->name = $title;
$myNotificationsView->params = array(SearchFields_WorkerEvent::WORKER_ID => new DevblocksSearchCriteria(SearchFields_WorkerEvent::WORKER_ID, '=', $active_worker->id), SearchFields_WorkerEvent::IS_READ => new DevblocksSearchCriteria(SearchFields_WorkerEvent::IS_READ, '=', 0));
/*
* [TODO] This doesn't need to save every display, but it was possible to
* lose the params in the saved version of the view in the DB w/o recovery.
* This should be moved back into the if(null==...) check in a later build.
*/
Um_AbstractViewLoader::setView($myNotificationsView->id, $myNotificationsView);
$tpl->assign('view', $myNotificationsView);
$tpl->display('file:' . $this->_TPL_PATH . 'home/tabs/my_notifications/index.tpl');
}
示例4: showWorkspacesIntroTabAction
function showWorkspacesIntroTabAction()
{
$translate = DevblocksPlatform::getTranslationService();
$active_worker = CerberusApplication::getActiveWorker();
$tpl = DevblocksPlatform::getTemplateService();
$tpl->assign('path', $this->_TPL_PATH);
$tpl->display('file:' . $this->_TPL_PATH . 'home/tabs/workspaces_intro/index.tpl');
}
示例5: toString
public function toString(Model_Worker $worker = null)
{
if (null == $worker) {
return;
}
$translate = DevblocksPlatform::getTranslationService();
$params = $this->params;
// Prepend the worker name to the activity's param list
array_unshift($params, sprintf("<b>%s</b>%s", $worker->getName(), !empty($worker->title) ? ' (' . $worker->title . ')' : ''));
return vsprintf($translate->_($this->translation_code), $params);
}
示例6: renderLoginForm
function renderLoginForm()
{
// draws HTML form of controls needed for login information
$tpl = DevblocksPlatform::getTemplateService();
// add translations for calls from classes that aren't Page Extensions (mobile plugin, specifically)
$translate = DevblocksPlatform::getTranslationService();
$tpl->assign('translate', $translate);
@($redir_path = explode('/', urldecode(DevblocksPlatform::importGPC($_REQUEST["url"], "string", ""))));
$tpl->assign('original_path', count($redir_path) == 0 ? 'login' : implode(',', $redir_path));
$tpl->display('file:' . dirname(dirname(__FILE__)) . '/templates/login/login_form_default.tpl');
}
示例7: showTab
function showTab()
{
$translate = DevblocksPlatform::getTranslationService();
$tpl = DevblocksPlatform::getTemplateService();
$tpl_path = dirname(dirname(__FILE__)) . '/templates/';
$tpl->assign('path', $tpl_path);
// Google Search Engines
$engines = DAO_WgmGoogleCse::getWhere();
$tpl->assign('engines', $engines);
$tpl->display($tpl_path . 'research_tab/index.tpl');
}
示例8: _renderRecentChangesRss
private function _renderRecentChangesRss($portal)
{
header("Content-Type: text/xml");
$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();
// Portal details
$portal_name = DAO_CommunityToolProperty::get($portal, UmScApp::PARAM_PAGE_TITLE, '');
// Channel
$channel = $xml->addChild('channel');
$channel->addChild('title', (!empty($portal_name) ? '[' . $portal_name . '] ' : '') . "Recently Changed Articles");
$channel->addChild('link', $url->write(sprintf('c=rss&kb=kb&a=recent_changes', $portal), true));
$channel->addChild('description', '');
// Limit topics to portal config
@($topics = unserialize(DAO_CommunityToolProperty::get($portal, UmScKbController::PARAM_KB_ROOTS, '')));
if (empty($topics)) {
return;
}
// Search Results
list($results, $null) = DAO_KbArticle::search(array(SearchFields_KbArticle::TOP_CATEGORY_ID => new DevblocksSearchCriteria(SearchFields_KbArticle::TOP_CATEGORY_ID, 'in', array_keys($topics))), 25, 0, SearchFields_KbArticle::UPDATED, false, false);
// [TODO] We should probably be building this feed with Zend Framework for compliance
foreach ($results as $article) {
$created = intval($article[SearchFields_KbArticle::UPDATED]);
if (empty($created)) {
$created = time();
}
$eItem = $channel->addChild('item');
$escapedSubject = htmlspecialchars($article[SearchFields_KbArticle::TITLE], 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', htmlspecialchars($article[SearchFields_KbArticle::CONTENT], null, LANG_CHARSET_CODE));
$link = $url->write('c=kb&a=article&id=' . $article[SearchFields_KbArticle::ID], 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");
}
echo $xml->asXML();
}
示例9: render
function render()
{
$tpl = DevblocksPlatform::getTemplateService();
$translate = DevblocksPlatform::getTranslationService();
$tpl_path = dirname(dirname(__FILE__)) . '/templates/';
$tpl->assign('path', $tpl_path);
$tpl->assign('core_tplpath', $core_tplpath);
$tpl->assign('view_id', $view_id);
$title = $translate->_('account.tab.account.title');
$defaults = new Feg_AbstractViewModel();
$defaults->id = "customer_view_account";
$defaults->class_name = 'View_CustomerAccount';
$defaults->renderSortBy = SearchFields_CustomerAccount::ID;
$defaults->renderSortAsc = 1;
$defaults->name = $title;
$view = Feg_AbstractViewLoader::getView($defaults->id, $defaults);
$tpl->assign('view', $view);
$tpl->assign('view_fields', View_CustomerAccount::getFields());
$tpl->assign('view_searchable_fields', View_CustomerAccount::getSearchFields());
$tpl->display('file:' . $this->_TPL_PATH . 'account/accounts.tpl');
}
示例10: render
function render()
{
$tpl = DevblocksPlatform::getTemplateService();
$tpl->assign('path', $this->_TPL_PATH);
$visit = CerberusApplication::getVisit();
$translate = DevblocksPlatform::getTranslationService();
$response = DevblocksPlatform::getHttpResponse();
$tpl->assign('request_path', implode('/', $response->path));
$stack = $response->path;
array_shift($stack);
// research
$tab_manifests = DevblocksPlatform::getExtensions('cerberusweb.research.tab', false);
uasort($tab_manifests, create_function('$a, $b', "return strcasecmp(\$a->name,\$b->name);\n"));
$tpl->assign('tab_manifests', $tab_manifests);
@($tab_selected = array_shift($stack));
if (empty($tab_selected)) {
$tab_selected = '';
}
$tpl->assign('tab_selected', $tab_selected);
$tpl->display('file:' . $this->_TPL_PATH . 'research/index.tpl');
}
示例11: showTab
function showTab()
{
$tpl = DevblocksPlatform::getTemplateService();
$tpl->cache_lifetime = "0";
$tpl_path = $this->_TPL_PATH;
$tpl->assign('path', $tpl_path);
$translate = DevblocksPlatform::getTranslationService();
if (null == ($view = C4_AbstractViewLoader::getView('', self::VIEW_ACTIVITY_TASKS))) {
$view = new C4_TaskView();
$view->id = self::VIEW_ACTIVITY_TASKS;
$view->renderSortBy = SearchFields_Task::DUE_DATE;
$view->renderSortAsc = 1;
$view->name = $translate->_('activity.tab.tasks');
C4_AbstractViewLoader::setView($view->id, $view);
}
$tpl->assign('response_uri', 'activity/tasks');
$tpl->assign('view', $view);
$tpl->assign('view_fields', C4_TaskView::getFields());
$tpl->assign('view_searchable_fields', C4_TaskView::getSearchFields());
$tpl->display($tpl_path . 'tasks/activity_tab/index.tpl');
}
示例12: showTab
function showTab() {
$translate = DevblocksPlatform::getTranslationService();
$tpl = DevblocksPlatform::getTemplateService();
$defaults = new C4_AbstractViewModel();
$defaults->class_name = 'View_Issue';
$defaults->id = self::VIEW_ACTIVITY_ISSUES;
$defaults->name = $translate->_('issues.activity.tab');
$defaults->view_columns = array(
SearchFields_Issue::CREATED_DATE,
SearchFields_Issue::UPDATED_DATE
);
$defaults->renderSortBy = SearchFields_Issue::CREATED_DATE;
$defaults->renderSortAsc = 0;
$view = C4_AbstractViewLoader::getView(self::VIEW_ACTIVITY_ISSUES, $defaults);
$tpl->assign('view', $view);
$tpl->display('devblocks:wgm.issues::activity_tab/index.tpl');
}
示例13: handleRequest
function handleRequest(DevblocksHttpRequest $request)
{
$translate = DevblocksPlatform::getTranslationService();
$stack = $request->path;
// URLS like: /files/10000/plaintext.txt
array_shift($stack);
// files
$file_id = array_shift($stack);
// 10000
$file_name = array_shift($stack);
// plaintext.txt
// Security
if (null == ($active_worker = CerberusApplication::getActiveWorker())) {
die($translate->_('common.access_denied'));
}
if (empty($file_id) || empty($file_name) || null == ($file = DAO_Attachment::get($file_id))) {
die($translate->_('files.not_found'));
}
// Security
$message = DAO_Ticket::getMessage($file->message_id);
if (null == ($ticket = DAO_Ticket::getTicket($message->ticket_id))) {
die($translate->_('common.access_denied'));
}
// Security
$active_worker_memberships = $active_worker->getMemberships();
if (null == $active_worker_memberships[$ticket->team_id]) {
die($translate->_('common.access_denied'));
}
// Set headers
header("Expires: Mon, 26 Nov 1962 00:00:00 GMT\n");
header("Last-Modified: " . gmdate("D,d M YH:i:s") . " GMT\n");
header("Cache-control: private\n");
header("Pragma: no-cache\n");
header("Content-Type: " . $file->mime_type . "\n");
header("Content-transfer-encoding: binary\n");
header("Content-Length: " . $file->getFileSize() . "\n");
echo $file->getFileContents();
exit;
}
示例14: handleRequest
function handleRequest(DevblocksHttpRequest $request)
{
$translate = DevblocksPlatform::getTranslationService();
// [TODO] Do we want any concept of authentication here?
$stack = $request->path;
array_shift($stack);
// rss
$hash = array_shift($stack);
$feed = DAO_ViewRss::getByHash($hash);
if (empty($feed)) {
die($translate->_('rss.bad_feed'));
}
// Sources
$rss_sources = DevblocksPlatform::getExtensions('cerberusweb.rss.source', true);
if (isset($rss_sources[$feed->source_extension])) {
$rss_source =& $rss_sources[$feed->source_extension];
/* @var $rss_source Extension_RssSource */
header("Content-Type: text/xml");
echo $rss_source->getFeedAsRss($feed);
}
exit;
}
示例15: doRecoverStep1Action
function doRecoverStep1Action()
{
$translate = DevblocksPlatform::getTranslationService();
@($email = DevblocksPlatform::importGPC($_REQUEST['email'], 'string'));
$worker = DAO_Worker::lookupAgentEmail($email);
if (empty($email) || empty($worker)) {
return;
}
$_SESSION[self::KEY_FORGOT_EMAIL] = $email;
try {
$mail_service = DevblocksPlatform::getMailService();
$mailer = $mail_service->getMailer(CerberusMail::getMailerDefaults());
$mail = $mail_service->createMessage();
$code = CerberusApplication::generatePassword(10);
$_SESSION[self::KEY_FORGOT_SENTCODE] = $code;
$settings = CerberusSettings::getInstance();
$from = $settings->get(CerberusSettings::DEFAULT_REPLY_FROM);
$personal = $settings->get(CerberusSettings::DEFAULT_REPLY_PERSONAL);
// Headers
$mail->setTo(array($email));
$mail->setFrom(array($from => $personal));
$mail->setSubject($translate->_('signin.forgot.mail.subject'));
$mail->generateId();
$headers = $mail->getHeaders();
$headers->addTextHeader('X-Mailer', 'Cerberus Helpdesk (Build ' . APP_BUILD . ')');
$mail->setBody(vsprintf($translate->_('signin.forgot.mail.body'), $code));
if (!$mailer->send($mail)) {
throw new Exception('Password Forgot confirmation email failed to send.');
}
} catch (Exception $e) {
DevblocksPlatform::redirect(new DevblocksHttpResponse(array('login', 'forgot', 'step1', 'failed')));
}
DevblocksPlatform::redirect(new DevblocksHttpResponse(array('login', 'forgot', 'step2')));
}