本文整理汇总了PHP中CerberusApplication类的典型用法代码示例。如果您正苦于以下问题:PHP CerberusApplication类的具体用法?PHP CerberusApplication怎么用?PHP CerberusApplication使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CerberusApplication类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: showTab
function showTab()
{
@($ticket_id = DevblocksPlatform::importGPC($_REQUEST['ticket_id'], 'integer', 0));
$visit = CerberusApplication::getVisit();
/* @var $visit CerberusVisit */
$translate = DevblocksPlatform::getTranslationService();
$tpl = DevblocksPlatform::getTemplateService();
$tpl->assign('path', $this->tpl_path);
$tpl->cache_lifetime = "0";
$view = C4_AbstractViewLoader::getView('', 'audit_log');
if (null == $view) {
$view = new C4_TicketAuditLogView();
$view->id = 'audit_log';
$view->name = $translate->_('auditlog.audit_log');
$view->view_columns = array(SearchFields_TicketAuditLog::CHANGE_DATE, SearchFields_TicketAuditLog::WORKER_ID, SearchFields_TicketAuditLog::CHANGE_FIELD, SearchFields_TicketAuditLog::CHANGE_VALUE);
$view->params = array();
$view->renderLimit = 15;
$view->renderPage = 0;
$view->renderSortBy = SearchFields_TicketAuditLog::CHANGE_DATE;
$view->renderSortAsc = false;
}
$view->params = array(SearchFields_TicketAuditLog::TICKET_ID => new DevblocksSearchCriteria(SearchFields_TicketAuditLog::TICKET_ID, DevblocksSearchCriteria::OPER_EQ, $ticket_id));
$view->renderPage = 0;
C4_AbstractViewLoader::setView($view->id, $view);
$tpl->assign('view', $view);
$tpl->display('file:' . $this->tpl_path . '/display/log/index.tpl');
}
开发者ID:jsjohnst,项目名称:cerb4,代码行数:27,代码来源:App.php
示例2: 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;
}
开发者ID:jsjohnst,项目名称:cerb4_fluidapp,代码行数:28,代码来源:plugin.php
示例3: 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;
}
}
开发者ID:jsjohnst,项目名称:cerb4,代码行数:35,代码来源:App.php
示例4: isVisible
function isVisible()
{
// check login
$visit = CerberusApplication::getVisit();
if (empty($visit)) {
return false;
} else {
return true;
}
}
开发者ID:jsjohnst,项目名称:cerb4,代码行数:10,代码来源:activity.php
示例5: 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');
}
开发者ID:Hildy,项目名称:cerb5,代码行数:21,代码来源:research.php
示例6: 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;
}
开发者ID:joegeck,项目名称:cerb4,代码行数:39,代码来源:files.php
示例7: savePluginsAction
function savePluginsAction()
{
$translate = DevblocksPlatform::getTranslationService();
$worker = CerberusApplication::getActiveWorker();
if (!$worker || !$worker->is_superuser) {
echo $translate->_('common.access_denied');
return;
}
if (DEMO_MODE) {
DevblocksPlatform::setHttpResponse(new DevblocksHttpResponse(array('config', 'plugins')));
return;
}
@($plugins_enabled = DevblocksPlatform::importGPC($_REQUEST['plugins_enabled'], 'array'));
$pluginStack = DevblocksPlatform::getPluginRegistry();
if (is_array($plugins_enabled)) {
foreach ($plugins_enabled as $plugin_id) {
$plugin = $pluginStack[$plugin_id];
$plugin->setEnabled(true);
unset($pluginStack[$plugin_id]);
}
}
// [JAS]: Clear unchecked plugins
foreach ($pluginStack as $plugin) {
// [JAS]: We can't force disable core here [TODO] Improve
if ($plugin->id == 'cerberusweb.core') {
continue;
}
$plugin->setEnabled(false);
}
DevblocksPlatform::clearCache();
// Run any enabled plugin patches
// [TODO] Should the platform do this automatically on enable in order?
$patchMgr = DevblocksPlatform::getPatchService();
$patches = DevblocksPlatform::getExtensions("devblocks.patch.container", false, true);
if (is_array($patches)) {
foreach ($patches as $patch_manifest) {
/* @var $patch_manifest DevblocksExtensionManifest */
$container = $patch_manifest->createInstance();
/* @var $container DevblocksPatchContainerExtension */
$patchMgr->registerPatchContainer($container);
}
}
if (!$patchMgr->run()) {
// fail
die("Failed updating plugins.");
// [TODO] Make this more graceful
}
// Reload plugin translations
DAO_Translation::reloadPluginStrings();
DevblocksPlatform::redirect(new DevblocksHttpResponse(array('config', 'plugins')));
}
开发者ID:Hildy,项目名称:cerb5,代码行数:51,代码来源:config.php
示例8: doRegisterAction
function doRegisterAction()
{
@($email = DevblocksPlatform::importGPC($_REQUEST['email'], 'string', ''));
$tpl = DevblocksPlatform::getTemplateService();
$settings = CerberusSettings::getInstance();
$from = $settings->get(CerberusSettings::DEFAULT_REPLY_FROM, null);
$from_personal = $settings->get(CerberusSettings::DEFAULT_REPLY_PERSONAL, "Support Dept.");
$url = DevblocksPlatform::getUrlService();
$mail_service = DevblocksPlatform::getMailService();
$mailer = $mail_service->getMailer(CerberusMail::getMailerDefaults());
$code = CerberusApplication::generatePassword(8);
if (!empty($email) && null != ($addy = DAO_Address::lookupAddress($email, true))) {
// Already registered?
if ($addy->is_registered) {
$tpl->assign('register_error', sprintf("'%s' is already registered.", $email));
DevblocksPlatform::setHttpResponse(new DevblocksHttpResponse(array('portal', UmPortalHelper::getCode(), 'register')));
return;
}
$fields = array(DAO_Address::IS_REGISTERED => 0, DAO_Address::PASS => $code);
DAO_Address::update($addy->id, $fields);
} else {
$tpl->assign('register_error', sprintf("'%s' is an invalid e-mail address.", $email));
DevblocksPlatform::setHttpResponse(new DevblocksHttpResponse(array('portal', UmPortalHelper::getCode(), 'register')));
return;
}
$message = $mail_service->createMessage();
$message->setTo($email);
$message->setFrom(array($from => $from_personal));
$message->setSubject("Confirming your support e-mail address");
$message->setBody(sprintf("This is a message to confirm your recent registration request at:\r\n" . "%s\r\n" . "\r\n" . "Your confirmation code is: %s\r\n" . "\r\n" . "If you've closed the browser window, you can continue by visiting:\r\n" . "%s\r\n" . "\r\n" . "Thanks!\r\n" . "%s\r\n", $url->write('', true), $code, $url->write('c=register&a=confirm', true), $from_personal));
$headers = $message->getHeaders();
$headers->addTextHeader('X-Mailer', 'Cerberus Helpdesk (Build ' . APP_BUILD . ')');
$result = $mailer->send($message);
DevblocksPlatform::setHttpResponse(new DevblocksHttpResponse(array('portal', UmPortalHelper::getCode(), 'register', 'confirm')));
}
开发者ID:rmiddle,项目名称:cerb4,代码行数:35,代码来源:register.php
示例9: 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')));
}
开发者ID:rmiddle,项目名称:cerb4,代码行数:34,代码来源:login.php
示例10: parseMessage
/**
* Enter description here...
*
* @param CerberusParserMessage $message
* @return integer
*/
public static function parseMessage(CerberusParserMessage $message, $options = array())
{
/*
* options:
* 'no_autoreply'
*/
$logger = DevblocksPlatform::getConsoleLog();
$settings = DevblocksPlatform::getPluginSettingsService();
$helpdesk_senders = CerberusApplication::getHelpdeskSenders();
// Pre-parse mail filters
$pre_filters = Model_PreParseRule::getMatches($message);
if (is_array($pre_filters) && !empty($pre_filters)) {
// Load filter action manifests for reuse
$ext_action_mfts = DevblocksPlatform::getExtensions('cerberusweb.mail_filter.action', false);
// Loop through all matching filters
foreach ($pre_filters as $pre_filter) {
// Do something with matching filter's actions
foreach ($pre_filter->actions as $action_key => $action) {
switch ($action_key) {
case 'blackhole':
return NULL;
break;
case 'redirect':
@($to = $action['to']);
CerberusMail::reflect($message, $to);
return NULL;
break;
case 'bounce':
@($msg = $action['message']);
@($subject = 'Delivery failed: ' . self::fixQuotePrintableString($message->headers['subject']));
// [TODO] Follow the RFC spec on a true bounce
if (null != ($fromAddressInst = CerberusParser::getAddressFromHeaders($message->headers))) {
CerberusMail::quickSend($fromAddressInst->email, $subject, $msg);
}
return NULL;
break;
default:
// Plugin pre-parser filter actions
if (isset($ext_action_mfts[$action_key])) {
if (null != @($ext_action = $ext_action_mfts[$action_key]->createInstance())) {
try {
/* @var $ext_action Extension_MailFilterAction */
$ext_action->run($pre_filter, $message);
} catch (Exception $e) {
}
}
}
break;
}
}
}
}
$headers =& $message->headers;
// From
if (null == ($fromAddressInst = CerberusParser::getAddressFromHeaders($headers))) {
$logger->err("[Parser] 'From' address could not be created.");
return NULL;
}
// To/Cc/Bcc
$to = array();
$sTo = @$headers['to'];
$bIsNew = true;
if (!empty($sTo)) {
// [TODO] Do we still need this RFC address parser?
$to = CerberusParser::parseRfcAddress($sTo);
}
// Subject
// Fix quote printable subject (quoted blocks can appear anywhere in subject)
$sSubject = "";
if (isset($headers['subject']) && !empty($headers['subject'])) {
$sSubject = $headers['subject'];
if (is_array($sSubject)) {
$sSubject = array_shift($sSubject);
}
}
// The subject can still end up empty after QP decode
if (empty($sSubject)) {
$sSubject = "(no subject)";
}
// Date
$iDate = @strtotime($headers['date']);
// If blank, or in the future, set to the current date
if (empty($iDate) || $iDate > time()) {
$iDate = time();
}
// Is banned?
if (1 == $fromAddressInst->is_banned) {
$logger->info("[Parser] Ignoring ticket from banned address: " . $fromAddressInst->email);
return NULL;
}
// Overloadable
$enumSpamTraining = '';
// Message Id / References / In-Reply-To
@($sMessageId = $headers['message-id']);
//.........这里部分代码省略.........
开发者ID:Hildy,项目名称:cerb5,代码行数:101,代码来源:Parser.php
示例11: getCommunityToolAction
function getCommunityToolAction()
{
$worker = CerberusApplication::getActiveWorker();
if (!$worker || !$worker->is_superuser) {
echo "Access denied.";
return;
}
@($portal = DevblocksPlatform::importGPC($_REQUEST['portal'], 'string', ''));
@($is_submitted = DevblocksPlatform::importGPC($_POST['is_submitted'], 'integer', 0));
UmPortalHelper::setCode($portal);
if (!empty($is_submitted)) {
$is_submitted = time();
}
$tpl = DevblocksPlatform::getTemplateService();
$tpl->cache_lifetime = "0";
$tpl_path = dirname(__FILE__) . '/templates/';
$tpl->assign('path', $tpl_path);
$tpl->assign('portal', $portal);
$tpl->assign('is_submitted', $is_submitted);
if (null != ($instance = DAO_CommunityTool::getByCode($portal))) {
$tpl->assign('instance', $instance);
$manifest = DevblocksPlatform::getExtension($instance->extension_id, false, true);
if (null != ($tool = $manifest->createInstance())) {
/* @var $app Extension_UsermeetTool */
$tpl->assign('tool', $tool);
}
}
// Community Record
$community_id = $instance->community_id;
$community = DAO_Community::get($community_id);
$tpl->assign('community', $community);
// Install
$url_writer = DevblocksPlatform::getUrlService();
$url = $url_writer->write('c=portal&a=' . $portal, true);
$url_parts = parse_url($url);
$host = $url_parts['host'];
@($port = $_SERVER['SERVER_PORT']);
$base = substr(DEVBLOCKS_WEBPATH, 0, -1);
// consume trailing
$path = substr($url_parts['path'], strlen(DEVBLOCKS_WEBPATH) - 1);
// consume trailing slash
@($parts = explode('/', $path));
if ($parts[1] == 'index.php') {
// 0 is null from /part1/part2 paths.
unset($parts[1]);
}
$path = implode('/', $parts);
$tpl->assign('host', $host);
$tpl->assign('is_ssl', $url_writer->isSSL() ? 1 : 0);
$tpl->assign('port', $port);
$tpl->assign('base', $base);
$tpl->assign('path', $path);
$tpl->display('file:' . $tpl_path . 'community/config/tab/tool_config.tpl');
}
开发者ID:jsjohnst,项目名称:cerb4,代码行数:54,代码来源:classes.php
示例12: saveKbCategoryEditPanelAction
function saveKbCategoryEditPanelAction()
{
$active_worker = CerberusApplication::getActiveWorker();
if (!$active_worker->hasPriv('core.kb.categories.modify')) {
return;
}
@($id = DevblocksPlatform::importGPC($_REQUEST['id'], 'integer', 0));
@($name = DevblocksPlatform::importGPC($_REQUEST['name'], 'string'));
@($parent_id = DevblocksPlatform::importGPC($_REQUEST['parent_id'], 'integer', 0));
@($delete = DevblocksPlatform::importGPC($_REQUEST['delete_box'], 'integer', 0));
@($return = DevblocksPlatform::importGPC($_REQUEST['return']));
if (!empty($id) && !empty($delete)) {
$ids = DAO_KbCategory::getDescendents($id);
DAO_KbCategory::delete($ids);
// Change $return to category parent
$return = "research/kb/" . sprintf("%06d", $parent_id);
} elseif (empty($id)) {
// create
$fields = array(DAO_KbCategory::NAME => $name, DAO_KbCategory::PARENT_ID => $parent_id);
DAO_KbCategory::create($fields);
} else {
// update
$fields = array(DAO_KbCategory::NAME => $name, DAO_KbCategory::PARENT_ID => $parent_id);
DAO_KbCategory::update($id, $fields);
}
if (!empty($return)) {
$return_path = explode('/', $return);
DevblocksPlatform::redirect(new DevblocksHttpResponse($return_path));
}
}
开发者ID:rmiddle,项目名称:cerb4,代码行数:30,代码来源:App.php
示例13: saveEntryAction
function saveEntryAction()
{
$active_worker = CerberusApplication::getActiveWorker();
// Make sure we're an active worker
if (empty($active_worker) || empty($active_worker->id)) {
return;
}
@($id = DevblocksPlatform::importGPC($_REQUEST['id'], 'integer', 0));
@($do_delete = DevblocksPlatform::importGPC($_REQUEST['do_delete'], 'integer', 0));
@($email = DevblocksPlatform::importGPC($_POST['email'], 'string', ''));
@($mood = DevblocksPlatform::importGPC($_POST['mood'], 'integer', 0));
@($quote = DevblocksPlatform::importGPC($_POST['quote'], 'string', ''));
@($url = DevblocksPlatform::importGPC($_POST['url'], 'string', ''));
@($source_extension_id = DevblocksPlatform::importGPC($_POST['source_extension_id'], 'string', ''));
@($source_id = DevblocksPlatform::importGPC($_POST['source_id'], 'integer', 0));
// Translate email string into addy id, if exists
$address_id = 0;
if (!empty($email)) {
if (null != ($author_address = DAO_Address::lookupAddress($email, true))) {
$address_id = $author_address->id;
}
}
// Delete entries
if (!empty($id) && !empty($do_delete)) {
if (null != ($entry = DAO_FeedbackEntry::get($id))) {
// Only superusers and owners can delete entries
if ($active_worker->is_superuser || $active_worker->id == $entry->worker_id) {
DAO_FeedbackEntry::delete($id);
}
}
return;
}
// New or modify
$fields = array(DAO_FeedbackEntry::QUOTE_MOOD => intval($mood), DAO_FeedbackEntry::QUOTE_TEXT => $quote, DAO_FeedbackEntry::QUOTE_ADDRESS_ID => intval($address_id), DAO_FeedbackEntry::SOURCE_URL => $url);
// Only on new
if (empty($id)) {
$fields[DAO_FeedbackEntry::LOG_DATE] = time();
$fields[DAO_FeedbackEntry::WORKER_ID] = $active_worker->id;
}
if (empty($id)) {
// create
$id = DAO_FeedbackEntry::create($fields);
// Post-create actions
if (!empty($source_extension_id) && !empty($source_id)) {
switch ($source_extension_id) {
case 'feedback.source.ticket':
// Create a ticket comment about the feedback (to prevent dupes)
if (null == ($worker_address = DAO_Address::lookupAddress($active_worker->email))) {
break;
}
$comment_text = sprintf("== Capture Feedback ==\n" . "Author: %s\n" . "Mood: %s\n" . "\n" . "%s\n", !empty($author_address) ? $author_address->email : 'Anonymous', empty($mood) ? 'Neutral' : (1 == $mood ? 'Praise' : 'Criticism'), $quote);
$fields = array(DAO_TicketComment::ADDRESS_ID => $worker_address->id, DAO_TicketComment::COMMENT => $comment_text, DAO_TicketComment::CREATED => time(), DAO_TicketComment::TICKET_ID => intval($source_id));
DAO_TicketComment::create($fields);
break;
}
}
} else {
// modify
DAO_FeedbackEntry::update($id, $fields);
}
// Custom field saves
@($field_ids = DevblocksPlatform::importGPC($_POST['field_ids'], 'array', array()));
DAO_CustomFieldValue::handleFormPost(ChCustomFieldSource_FeedbackEntry::ID, $id, $field_ids);
}
开发者ID:Hildy,项目名称:cerb5,代码行数:64,代码来源:App.php
示例14: saveTaskPeekAction
function saveTaskPeekAction()
{
@($id = DevblocksPlatform::importGPC($_REQUEST['id'], 'integer', ''));
@($view_id = DevblocksPlatform::importGPC($_REQUEST['view_id'], 'string', ''));
@($link_namespace = DevblocksPlatform::importGPC($_REQUEST['link_namespace'], 'string', ''));
@($link_object_id = DevblocksPlatform::importGPC($_REQUEST['link_object_id'], 'integer', 0));
@($do_delete = DevblocksPlatform::importGPC($_REQUEST['do_delete'], 'integer', 0));
$active_worker = CerberusApplication::getActiveWorker();
if (!empty($id) && !empty($do_delete)) {
// delete
$task = DAO_Task::get($id);
// Check privs
if ($active_worker->hasPriv('core.tasks.actions.create') && $active_worker->id == $task->worker_id || $active_worker->hasPriv('core.tasks.actions.update_nobody') && empty($task->worker_id) || $active_worker->hasPriv('core.tasks.actions.update_all')) {
DAO_Task::delete($id);
}
} else {
// create|update
$fields = array();
// Title
@($title = DevblocksPlatform::importGPC($_REQUEST['title'], 'string', ''));
if (!empty($title)) {
$fields[DAO_Task::TITLE] = $title;
}
// Completed
@($completed = DevblocksPlatform::importGPC($_REQUEST['completed'], 'integer', 0));
$fields[DAO_Task::IS_COMPLETED] = intval($completed);
// [TODO] This shouldn't constantly update the completed date (it should compare)
if ($completed) {
$fields[DAO_Task::COMPLETED_DATE] = time();
} else {
$fields[DAO_Task::COMPLETED_DATE] = 0;
}
// Due Date
@($due_date = DevblocksPlatform::importGPC($_REQUEST['due_date'], 'string', ''));
@($fields[DAO_Task::DUE_DATE] = empty($due_date) ? 0 : intval(strtotime($due_date)));
// Worker
@($worker_id = DevblocksPlatform::importGPC($_REQUEST['worker_id'], 'integer', 0));
@($fields[DAO_Task::WORKER_ID] = intval($worker_id));
// Content
@($content = DevblocksPlatform::importGPC($_REQUEST['content'], 'string', ''));
@($fields[DAO_Task::CONTENT] = $content);
// Link to object (optional)
if (!empty($link_namespace) && !empty($link_object_id)) {
@($fields[DAO_Task::SOURCE_EXTENSION] = $link_namespace);
@($fields[DAO_Task::SOURCE_ID] = $link_object_id);
}
// Save
if (!empty($id)) {
DAO_Task::update($id, $fields);
} else {
$id = DAO_Task::create($fields);
// Write a notification (if not assigned to ourselves)
// $url_writer = DevblocksPlatform::getUrlService();
$source_extensions = DevblocksPlatform::getExtensions('cerberusweb.task.source', true);
if (!empty($worker_id)) {
// && $active_worker->id != $worker_id (Temporarily allow self notifications)
if (null != @($source_renderer = $source_extensions[$link_namespace])) {
/* @var $source_renderer Extension_TaskSource */
$source_info = $source_renderer->getSourceInfo($link_object_id);
$source_name = $source_info['name'];
$source_url = $source_info['url'];
if (empty($source_name) || empty($source_url)) {
break;
}
$fields = array(DAO_WorkerEvent::CREATED_DATE => time(), DAO_WorkerEvent::WORKER_ID => $worker_id, DAO_WorkerEvent::URL => $source_url, DAO_WorkerEvent::TITLE => 'New Task Assignment', DAO_WorkerEvent::CONTENT => sprintf("%s\n%s says: %s", $source_name, $active_worker->getName(), $title), DAO_WorkerEvent::IS_READ => 0);
DAO_WorkerEvent::create($fields);
}
}
}
// Custom field saves
@($field_ids = DevblocksPlatform::importGPC($_POST['field_ids'], 'array', array()));
DAO_CustomFieldValue::handleFormPost(ChCustomFieldSource_Task::ID, $id, $field_ids);
}
if (!empty($view_id) && null != ($view = C4_AbstractViewLoader::getView('', $view_id))) {
$view->render();
}
exit;
}
开发者ID:joegeck,项目名称:cerb4,代码行数:78,代码来源:tasks.php
示例15: saveOrgPeekAction
function saveOrgPeekAction()
{
$active_worker = CerberusApplication::getActiveWorker();
@($id = DevblocksPlatform::importGPC($_REQUEST['id'], 'integer', 0));
@($view_id = DevblocksPlatform::importGPC($_REQUEST['view_id'], 'string', ''));
@($org_name = DevblocksPlatform::importGPC($_REQUEST['org_name'], 'string', ''));
@($street = DevblocksPlatform::importGPC($_REQUEST['street'], 'string', ''));
@($city = DevblocksPlatform::importGPC($_REQUEST['city'], 'string', ''));
@($province = DevblocksPlatform::importGPC($_REQUEST['province'], 'string', ''));
@($postal = DevblocksPlatform::importGPC($_REQUEST['postal'], 'string', ''));
@($country = DevblocksPlatform::importGPC($_REQUEST['country'], 'string', ''));
@($phone = DevblocksPlatform::importGPC($_REQUEST['phone'], 'string', ''));
@($website = DevblocksPlatform::importGPC($_REQUEST['website'], 'string', ''));
@($delete = DevblocksPlatform::importGPC($_REQUEST['do_delete'], 'integer', 0));
if (!empty($id) && !empty($delete)) {
// delete
if ($active_worker->hasPriv('core.addybook.org.actions.delete')) {
DAO_ContactOrg::delete($id);
}
} else {
// create/edit
if ($active_worker->hasPriv('core.addybook.org.actions.update')) {
$fields = array(DAO_ContactOrg::NAME => $org_name, DAO_ContactOrg::STREET => $street, DAO_ContactOrg::CITY => $city, DAO_ContactOrg::PROVINCE => $province, DAO_ContactOrg::POSTAL => $postal, DAO_ContactOrg::COUNTRY => $country, DAO_ContactOrg::PHONE => $phone, DAO_ContactOrg::WEBSITE => $website);
if ($id == 0) {
$id = DAO_ContactOrg::create($fields);
} else {
DAO_ContactOrg::update($id, $fields);
}
// Custom field saves
@($field_ids = DevblocksPlatform::importGPC($_POST['field_ids'], 'array', array()));
DAO_CustomFieldValue::handleFormPost(ChCustomFieldSource_Org::ID, $id, $field_ids);
}
}
$view = C4_AbstractViewLoader::getView($view_id);
$view->render();
}
开发者ID:Hildy,项目名称:cerb5,代码行数:36,代码来源:contacts.php
示例16: viewSaveCustomizeAction
function viewSaveCustomizeAction()
{
$translate = DevblocksPlatform::getTranslationService();
@($id = DevblocksPlatform::importGPC($_REQUEST['id']));
@($columns = DevblocksPlatform::importGPC($_REQUEST['columns'], 'array', array()));
@($num_rows = DevblocksPlatform::importGPC($_REQUEST['num_rows'], 'integer', 10));
$num_rows = max($num_rows, 1);
// make 1 the minimum
$view = C4_AbstractViewLoader::getView($id);
$view->doCustomize($columns, $num_rows);
$active_worker = CerberusApplication::getActiveWorker();
// Conditional Persist
if (substr($id, 0, 5) == "cust_") {
// custom workspace
$list_view_id = intval(substr($id, 5));
// Special custom view fields
@($title = DevblocksPlatform::importGPC($_REQUEST['title'], 'string', $translate->_('views.new_list')));
$view->name = $title;
// Persist Object
$list_view = new Model_WorkerWorkspaceListView();
$list_view->title = $title;
$list_view->columns = $view->view_columns;
$list_view->num_rows = $view->renderLimit;
$list_view->params = $view->params;
$list_view->sort_by = $view->renderSortBy;
$list_view->sort_asc = $view->renderSortAsc;
DAO_WorkerWorkspaceList::update($list_view_id, array(DAO_WorkerWorkspaceList::LIST_VIEW => serialize($list_view)));
} else {
$prefs = new C4_AbstractViewModel();
$prefs->class_name = get_class($view);
$prefs->view_columns = $view->view_columns;
$prefs->renderLimit = $view->renderLimit;
$prefs->renderSortBy = $view->renderSortBy;
$prefs->renderSortAsc = $view->renderSortAsc;
DAO_WorkerPref::set($active_worker->id, 'view' . $view->id, serialize($prefs));
}
C4_AbstractViewLoader::setView($id, $view);
$view->render();
}
开发者ID:rmiddle,项目名称:cerb4,代码行数:39,代码来源:internal.php
示例17: saveRequestersPanelAction
function saveRequestersPanelAction()
{
@($ticket_id = DevblocksPlatform::importGPC($_POST['ticket_id'], 'integer'));
@($msg_id = DevblocksPlatform::importGPC($_POST['msg_id'], 'integer'));
// Dels
@($req_deletes = DevblocksPlatform::importGPC($_POST['req_deletes'], 'array', array()));
if (!empty($req_deletes)) {
foreach ($req_deletes as $del_id) {
DAO_Ticket::deleteRequester($ticket_id, $del_id);
}
}
// Adds
@($req_adds = DevblocksPlatform::importGPC($_POST['req_adds'], 'string', ''));
$req_list = DevblocksPlatform::parseCrlfString($req_adds);
$req_addys = array();
if (is_array($req_list) && !empty($req_list)) {
foreach ($req_list as $req) {
if (empty($req)) {
continue;
}
$rfc_addys = imap_rfc822_parse_adrlist($req, 'localhost');
foreach ($rfc_addys as $rfc_addy) {
$addy = $rfc_addy->mailbox . '@' . $rfc_addy->host;
if (null != ($req_addy = CerberusApplication::hashLookupAddress($addy, true))) {
DAO_Ticket::createRequester($req_addy->id, $ticket_id);
}
}
}
}
$requesters = DAO_Ticket::getRequestersByTicket($ticket_id);
$list = array();
foreach ($requesters as $requester) {
$list[] = $requester->email;
}
echo implode(', ', $list);
exit;
}
开发者ID:jsjohnst,项目名称:cerb4,代码行数:37,代码来源:display.php
示例18: doImportAction
function doImportAction()
{
$active_worker = CerberusApplication::getActiveWorker();
if (!$active_worker->hasPriv('crm.opp.actions.import')) {
return;
}
@($pos = DevblocksPlatform::importGPC($_REQUEST['pos'], 'array', array()));
@($field = DevblocksPlatform::importGPC($_REQUEST['field'], 'array', array()));
@($sync_dupes = DevblocksPlatform::importGPC($_REQUEST['sync_dupes'], 'array', array()));
@($include_first = DevblocksPlatform::importGPC($_REQUEST['include_first'], 'integer', 0));
@($is_blank_unset = DevblocksPlatform::importGPC($_REQUEST['is_blank_unset'], 'integer', 0));
@($opt_assign = DevblocksPlatform::importGPC($_REQUEST['opt_assign'], 'integer', 0));
@($opt_assign_worker_id = DevblocksPlatform::importGPC($_REQUEST['opt_assign_worker_id'], 'integer', 0));
$visit = CerberusApplication::getVisit();
$db = DevblocksPlatform::getDatabaseService();
$workers = DAO_Worker::getAllActive();
$csv_file = $visit->get('crm.import.last.csv', '');
$fp = fopen($csv_file, "rt");
if (!$fp) {
return;
}
// [JAS]: Do we need to consume a first row of headings?
if (!$include_first) {
@fgetcsv($fp, 8192, ',', '"');
}
while (!feof($fp)) {
$parts = fgetcsv($fp, 8192, ',', '"');
if (empty($parts) || 1 == count($parts) && is_null($parts[0])) {
continue;
}
$fields = array();
$custom_fields = array();
$sync_fields = array();
foreach ($pos as $idx => $p) {
$key = $field[$idx];
$val = $parts[$idx];
// Special handling
if (!empty($key)) {
switch ($key) {
case 'amount':
if (0 != strlen($val) && is_numeric($val)) {
@($val = floatval($val));
} else {
unset($key);
}
break;
// Translate e-mail address to ID
// Translate e-mail address to ID
case 'email':
if (null != ($addy = CerberusApplication::hashLookupAddress($val, true))) {
$key = 'primary_email_id';
$val = $addy->id;
} else {
unset($key);
}
break;
// Bools
// Bools
case 'is_won':
case 'is_closed':
if (0 != strlen($val)) {
@($val = !empty($val) ? 1 : 0);
} else {
unset($key);
}
break;
// Dates
// Dates
case 'created_date':
case 'updated_date':
case 'closed_date':
if (0 != strlen($val)) {
@($val = !is_numeric($val) ? strtotime($val) : $val);
} else {
unset($key);
}
break;
// Worker by name
// Worker by name
case 'worker':
unset($key);
if (is_array($workers)) {
foreach ($workers as $worker_id => $worker) {
if (0 == strcasecmp($val, $worker->getName())) {
|
请发表评论