本文整理汇总了PHP中DevblocksPlatform类的典型用法代码示例。如果您正苦于以下问题:PHP DevblocksPlatform类的具体用法?PHP DevblocksPlatform怎么用?PHP DevblocksPlatform使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了DevblocksPlatform类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: saveConfiguration
function saveConfiguration(Model_CommunityTool $instance)
{
// KB
@($aFnrTopics = DevblocksPlatform::importGPC($_POST['topic_ids'], 'array', array()));
$aFnrTopics = array_flip($aFnrTopics);
DAO_CommunityToolProperty::set($instance->code, self::PARAM_FNR_TOPICS, serialize($aFnrTopics));
}
示例2: _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.");
}
}
}
}
示例3: getTemplateHandler
public static function getTemplateHandler()
{
$tpl = DevblocksPlatform::getTemplateService();
$tpl_path = dirname(__FILE__) . '/templates/';
$tpl->assign('path', $tpl_path);
$tpl->cache_lifetime = "0";
$total_new_count = 0;
foreach (DAO_WorkflowView::getGroupTotals() as $data) {
$total_new_count += $data["total"];
}
$tpl->assign('total_new_count', $total_new_count);
$newest = isset($_SESSION["fluid_latest_seen"]) ? $_SESSION["fluid_latest_seen"] : time() - 3600;
$worker = CerberusApplication::getActiveWorker();
$memberships = $worker->getMemberships();
$params = array(SearchFields_Ticket::TICKET_TEAM_ID => new DevblocksSearchCriteria(SearchFields_Ticket::TICKET_TEAM_ID, 'in', array_keys($memberships)), SearchFields_Ticket::TICKET_DELETED => new DevblocksSearchCriteria(SearchFields_Ticket::TICKET_DELETED, 'eq', 0), SearchFields_Ticket::TICKET_WAITING => new DevblocksSearchCriteria(SearchFields_Ticket::TICKET_WAITING, 'eq', 0), SearchFields_Ticket::TICKET_CLOSED => new DevblocksSearchCriteria(SearchFields_Ticket::TICKET_CLOSED, 'eq', 0), SearchFields_Ticket::TICKET_UPDATED_DATE => new DevblocksSearchCriteria(SearchFields_Ticket::TICKET_UPDATED_DATE, '>', $newest));
list($results, $total) = DAO_Ticket::search(array(SearchFields_Ticket::TICKET_ID, SearchFields_Ticket::TICKET_MASK, SearchFields_Ticket::TICKET_SUBJECT, SearchFields_Ticket::TICKET_LAST_WROTE), $params, 5, 0, SearchFields_Ticket::TICKET_UPDATED_DATE, false, true);
$tickets = array();
foreach ($results as $ticket) {
if ($ticket[SearchFields_Ticket::TICKET_UPDATED_DATE] > $newest) {
$newest = $ticket[SearchFields_Ticket::TICKET_UPDATED_DATE];
}
$tickets[] = $ticket;
}
$_SESSION["fluid_latest_seen"] = $newest;
$tpl->assign("recent_tickets_json", json_encode($tickets));
$tpl->assign("recent_ticket_count", json_encode($total));
return $tpl;
}
示例4: saveConfiguration
function saveConfiguration()
{
// KB
@($aFnrTopics = DevblocksPlatform::importGPC($_POST['topic_ids'], 'array', array()));
$aFnrTopics = array_flip($aFnrTopics);
DAO_CommunityToolProperty::set(UmPortalHelper::getCode(), self::PARAM_FNR_TOPICS, serialize($aFnrTopics));
}
示例5: 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();
}
}
示例6: configure
function configure($instance)
{
$tpl = DevblocksPlatform::getTemplateService();
$tpl_path = dirname(dirname(__FILE__)) . '/templates/';
$tpl->assign('path', $tpl_path);
$tpl->display($tpl_path . 'cron/heartbeat/config.tpl');
}
示例7: render
function render()
{
$tpl = DevblocksPlatform::getTemplateService();
$tpl->assign('path', $this->_TPL_PATH);
$response = DevblocksPlatform::getHttpResponse();
$stack = $response->path;
$tpl->display('file:' . $this->_TPL_PATH . 'welcome/index.tpl');
}
示例8: isDatabaseEmpty
public static function isDatabaseEmpty()
{
$db = DevblocksPlatform::getDatabaseService();
if (is_null($db)) {
return true;
}
$tables = $db->MetaTables('TABLE', true);
return empty($tables);
}
示例9: generateTicketsAction
function generateTicketsAction()
{
require_once dirname(__FILE__) . '/api/API.class.php';
$tpl = DevblocksPlatform::getTemplateService();
$tpl_path = dirname(__FILE__) . '/templates/';
$tpl->assign('path', $tpl_path);
$tpl->cache_lifetime = "0";
@($address = DevblocksPlatform::importGPC($_POST['address'], 'string'));
@($dataset = DevblocksPlatform::importGPC($_POST['dataset'], 'string'));
@($how_many = DevblocksPlatform::importGPC($_POST['how_many'], 'integer', 0));
if (empty($address)) {
$tpl->assign('error', sprintf("Oops! '%s' is not a valid e-mail address.", htmlspecialchars($address)));
$tpl->display('file:' . $tpl_path . 'config_tab/output.tpl');
return;
}
// [JAS]: [TODO] This should probably move to an extension point later
switch ($dataset) {
default:
case "retail":
$dataset = new RetailDataset();
break;
case "hosting":
$dataset = new HostingDataset();
break;
case "edu":
$dataset = new EduDataset();
break;
case "gov":
$dataset = new GovDataset();
break;
case "npo":
$dataset = new NPODataset();
break;
case "spam":
$dataset = new SpamDataset();
break;
}
$simulator = CerberusSimulator::getInstance();
$emails = $simulator->generateEmails($dataset, $how_many);
foreach ($emails as $template) {
if (preg_match("/\"(.*?)\" \\<(.*?)\\>/", $template['sender'], $matches)) {
$personal = $matches[1];
$from = $matches[1];
}
// [TODO] error checking
$message = new CerberusParserMessage();
$message->headers['from'] = $template['sender'];
$message->headers['to'] = $address;
$message->headers['subject'] = $template['subject'];
$message->headers['message-id'] = CerberusApplication::generateMessageId();
$message->body = sprintf("%s\r\n" . "\r\n" . "--\r\n%s\r\n", $template['body'], $personal);
CerberusParser::parseMessage($message, array('no_autoreply' => true));
}
$tpl->assign('output', sprintf("Success! %d simulated tickets were generated for %s", $how_many, htmlspecialchars($address)));
$tpl->display('file:' . $tpl_path . 'config_tab/output.tpl');
}
示例10: smarty_block_devblocks_url
function smarty_block_devblocks_url($params, $content, &$smarty)
{
$url = DevblocksPlatform::getUrlService();
$contents = $url->write($content, !empty($params['full']) ? true : false);
if (!empty($params['assign'])) {
$smarty->assign($params['assign'], $contents);
} else {
return $contents;
}
}
示例11: saveConfiguration
function saveConfiguration()
{
// RSS Feeds
@($aNewsRssTitles = DevblocksPlatform::importGPC($_POST['news_rss_title'], 'array', array()));
@($aNewsRssUrls = DevblocksPlatform::importGPC($_POST['news_rss_url'], 'array', array()));
$aNewsRss = array();
foreach ($aNewsRssUrls as $idx => $rss) {
if (empty($rss)) {
unset($aNewsRss[$idx]);
continue;
}
$aNewsRss[$aNewsRssTitles[$idx]] = $rss;
}
DAO_CommunityToolProperty::set(UmPortalHelper::getCode(), self::PARAM_NEWS_RSS, serialize($aNewsRss));
}
示例12: authenticate
function authenticate()
{
// Pull from $_POST
@($email = DevblocksPlatform::importGPC($_POST['email']));
@($password = DevblocksPlatform::importGPC($_POST['password']));
$worker = DAO_Worker::login($email, $password);
if (!is_null($worker)) {
$session = DevblocksPlatform::getSessionService();
$visit = new CerberusVisit();
$visit->setWorker($worker);
$session->setVisit($visit);
// [TODO] Only direct to /welcome when tour is enabled
return true;
} else {
return false;
}
}
示例13: _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();
}
示例14: showTab
function showTab()
{
@($ticket_id = DevblocksPlatform::importGPC($_REQUEST['ticket_id'], 'integer', 0));
$tpl = DevblocksPlatform::getTemplateService();
$tpl->cache_lifetime = "0";
$tpl_path = dirname(dirname(__FILE__)) . '/templates/';
// $tpl->assign('response_uri', 'config/attachments');
$defaults = new C4_AbstractViewModel();
$defaults->class_name = 'C4_AttachmentView';
$defaults->name = 'Attachements View';
$defaults->id = 'ticket_view_attachements';
$defaults->renderLimit = 15;
$view_attachements = C4_AbstractViewLoader::getView('ticket_view_attachements', $defaults);
$view_attachements->params = array(SearchFields_Attachment::TICKET_ID => new DevblocksSearchCriteria(SearchFields_Attachment::TICKET_ID, DevblocksSearchCriteria::OPER_EQ, $ticket_id));
$view_attachements->renderPage = 0;
C4_AbstractViewLoader::setView($view_attachements->id, $view_attachements);
$tpl->assign('view_attachements', $view_attachements);
$tpl->display('file:' . $tpl_path . 'attachments/index.tpl');
}
示例15: sendFax
/**
* exec_sendfax
*
* @param string command
* @return array
*/
function sendFax($phone_number, $message, $subject, $to, $account_name, $from = null)
{
// sendfax -f "robert.middleswarth@answernet.com" -D -R -r "Test Fax" -x "Account Name" -d "RecipientName@4106311699" /home/rmiddle/test.txt
$settings = DevblocksPlatform::getPluginSettingsService();
if (empty($from)) {
@($from = $settings->get('feg.core', FegSettings::DEFAULT_REPLY_FROM, $_SERVER['SERVER_ADMIN']));
}
$command = "sendfax ";
$command .= sprintf("-f '%s' ", $from);
$command .= "-D -R ";
$command .= sprintf("-r '%s' ", $subject);
$command .= sprintf("-x '%s' ", $account_name);
$command .= sprintf("-d '%s@%s' ", $to, $phone_number);
$tempfilename = tempnam(APP_TEMP_PATH . "/fax_cache", 'fax_message-');
$temp_fh = fopen($tempfilename, 'w') or die($php_errormsg);
fputs($temp_fh, $message);
fclose($temp_fh) or die($php_errormsg);
// Generate Text file of message.
$command .= sprintf("'%s' ", $tempfilename);
$o = exec($command . " 2>&1", $sendfax_output, $retval);
$debug = DEBUG_MODE;
if ($retval == 0) {
// success
if ($debug) {
echo "<p>{$command}";
}
$result = str_replace("(", "", $sendfax_output[0]);
$result = str_replace(")", "", $result);
// request id is 80 (group id 80) for host localhost (3 files)
// request id is 81 (group id 81) for host localhost (1 file)
$output = split(" ", $result);
return array('status' => true, 'jobid' => $output[3], 'groupid' => $output[6], 'host' => $output[9], 'numfiles' => $output[10]);
}
if ($debug) {
echo "<p>";
print_r($o);
echo "<p>";
print_r($sendfax_output);
echo "<p>{$command}<br>";
}
$forlog = implode("\n", $sendfax_output);
return array('status' => false, 'output' => $forlog);
}