本文整理汇总了PHP中CerberusApplication::translateTeamCategoryCode方法的典型用法代码示例。如果您正苦于以下问题:PHP CerberusApplication::translateTeamCategoryCode方法的具体用法?PHP CerberusApplication::translateTeamCategoryCode怎么用?PHP CerberusApplication::translateTeamCategoryCode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CerberusApplication
的用法示例。
在下文中一共展示了CerberusApplication::translateTeamCategoryCode方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: saveMailRoutingRuleAddAction
//.........这里部分代码省略.........
$to = DevblocksPlatform::importGPC($_REQUEST['value_cf_' . $field_id . '_to'], 'string', 'now');
$criteria['from'] = $from;
$criteria['to'] = $to;
unset($criteria['value']);
break;
case 'N':
// number
$oper = DevblocksPlatform::importGPC($_REQUEST['value_cf_' . $field_id . '_oper'], 'string', '=');
$criteria['oper'] = $oper;
$criteria['value'] = intval($value);
break;
case 'C':
// checkbox
$criteria['value'] = intval($value);
break;
}
} else {
continue;
}
break;
}
$criterion[$rule] = $criteria;
}
}
// Actions
if (is_array($do)) {
foreach ($do as $act) {
$action = array();
switch ($act) {
// Move group/bucket
case 'move':
@($move_code = DevblocksPlatform::importGPC($_REQUEST['do_move'], 'string', null));
if (0 != strlen($move_code)) {
list($g_id, $b_id) = CerberusApplication::translateTeamCategoryCode($move_code);
$action = array('group_id' => intval($g_id), 'bucket_id' => intval($b_id));
}
break;
default:
// ignore invalids
// Custom fields
if ("cf_" == substr($act, 0, 3)) {
$field_id = intval(substr($act, 3));
if (!isset($custom_fields[$field_id])) {
continue;
}
$action = array();
switch ($custom_fields[$field_id]->type) {
case 'S':
// string
// string
case 'T':
// clob
// clob
case 'U':
// URL
// URL
case 'D':
// dropdown
// dropdown
case 'W':
// worker
$value = DevblocksPlatform::importGPC($_REQUEST['do_cf_' . $field_id], 'string', '');
$action['value'] = $value;
break;
case 'M':
// multi-dropdown
示例2: saveTabInboxAddAction
//.........这里部分代码省略.........
$to = DevblocksPlatform::importGPC($_REQUEST['value_cf_' . $field_id . '_to'], 'string', 'now');
$criteria['from'] = $from;
$criteria['to'] = $to;
unset($criteria['value']);
break;
case 'N':
// number
$oper = DevblocksPlatform::importGPC($_REQUEST['value_cf_' . $field_id . '_oper'], 'string', '=');
$criteria['oper'] = $oper;
$criteria['value'] = intval($value);
break;
case 'C':
// checkbox
$criteria['value'] = intval($value);
break;
}
} else {
continue;
}
break;
}
$criterion[$rule] = $criteria;
}
}
// Actions
if (is_array($do)) {
foreach ($do as $act) {
$action = array();
switch ($act) {
// Move group/bucket
case 'move':
@($move_code = DevblocksPlatform::importGPC($_REQUEST['do_move'], 'string', null));
if (0 != strlen($move_code)) {
list($g_id, $b_id) = CerberusApplication::translateTeamCategoryCode($move_code);
$action = array('group_id' => intval($g_id), 'bucket_id' => intval($b_id));
}
break;
// Assign to worker
// Assign to worker
case 'assign':
@($worker_id = DevblocksPlatform::importGPC($_REQUEST['do_assign'], 'string', null));
if (0 != strlen($worker_id)) {
$action = array('worker_id' => intval($worker_id));
}
break;
// Spam training
// Spam training
case 'spam':
@($is_spam = DevblocksPlatform::importGPC($_REQUEST['do_spam'], 'string', null));
if (0 != strlen($is_spam)) {
$action = array('is_spam' => !$is_spam ? 0 : 1);
}
break;
// Set status
// Set status
case 'status':
@($status = DevblocksPlatform::importGPC($_REQUEST['do_status'], 'string', null));
if (0 != strlen($status)) {
$action = array('is_waiting' => 3 == $status ? 1 : 0, 'is_closed' => 0 == $status || 3 == $status ? 0 : 1, 'is_deleted' => 2 == $status ? 1 : 0);
}
break;
default:
// ignore invalids
// Custom fields
if ("cf_" == substr($act, 0, 3)) {
$field_id = intval(substr($act, 3));
示例3: updatePropertiesAction
function updatePropertiesAction()
{
@($id = DevblocksPlatform::importGPC($_REQUEST['id']));
// ticket id
@($closed = DevblocksPlatform::importGPC($_REQUEST['closed'], 'integer', 0));
@($spam = DevblocksPlatform::importGPC($_REQUEST['spam'], 'integer', 0));
@($deleted = DevblocksPlatform::importGPC($_REQUEST['deleted'], 'integer', 0));
@($bucket = DevblocksPlatform::importGPC($_REQUEST['bucket_id'], 'string'));
@($next_worker_id = DevblocksPlatform::importGPC($_REQUEST['next_worker_id'], 'integer', 0));
@($unlock_date = DevblocksPlatform::importGPC($_REQUEST['unlock_date'], 'integer', 0));
@($ticket = DAO_Ticket::getTicket($id));
// Anti-Spam
if (!empty($spam)) {
CerberusBayes::markTicketAsSpam($id);
// [mdf] if the spam button was clicked override the default params for deleted/closed
$closed = 1;
$deleted = 1;
}
$categories = DAO_Bucket::getAll();
// Properties
$properties = array(DAO_Ticket::IS_CLOSED => intval($closed), DAO_Ticket::IS_DELETED => intval($deleted));
// Undeleting?
if (empty($spam) && empty($closed) && empty($deleted) && $ticket->spam_training == CerberusTicketSpamTraining::SPAM && $ticket->is_closed) {
$score = CerberusBayes::calculateTicketSpamProbability($id);
$properties[DAO_Ticket::SPAM_SCORE] = $score['probability'];
$properties[DAO_Ticket::SPAM_TRAINING] = CerberusTicketSpamTraining::BLANK;
}
// Team/Category
if (!empty($bucket)) {
list($team_id, $bucket_id) = CerberusApplication::translateTeamCategoryCode($bucket);
if (!empty($team_id)) {
$properties[DAO_Ticket::TEAM_ID] = $team_id;
$properties[DAO_Ticket::CATEGORY_ID] = $bucket_id;
}
}
if ($next_worker_id != $ticket->next_worker_id) {
$properties[DAO_Ticket::NEXT_WORKER_ID] = $next_worker_id;
}
// Reset the unlock date (next worker "until")
$properties[DAO_Ticket::UNLOCK_DATE] = $unlock_date;
DAO_Ticket::updateTicket($id, $properties);
DevblocksPlatform::setHttpResponse(new DevblocksHttpResponse(array('display', $id)));
}
示例4: doBatchUpdateAction
function doBatchUpdateAction()
{
@($ticket_id_str = DevblocksPlatform::importGPC($_REQUEST['ticket_ids'], 'string'));
@($shortcut_name = DevblocksPlatform::importGPC($_REQUEST['shortcut_name'], 'string', ''));
@($filter = DevblocksPlatform::importGPC($_REQUEST['filter'], 'string', ''));
@($senders = DevblocksPlatform::importGPC($_REQUEST['senders'], 'string', ''));
@($subjects = DevblocksPlatform::importGPC($_REQUEST['subjects'], 'string', ''));
@($view_id = DevblocksPlatform::importGPC($_REQUEST['view_id'], 'string'));
$view = C4_AbstractViewLoader::getView($view_id);
$subjects = DevblocksPlatform::parseCrlfString($subjects);
$senders = DevblocksPlatform::parseCrlfString($senders);
$do = array();
// [TODO] This logic is repeated in several places -- try to condense (like custom field form handlers)
// Move to Group/Bucket
@($move_code = DevblocksPlatform::importGPC($_REQUEST['do_move'], 'string', null));
if (0 != strlen($move_code)) {
list($g_id, $b_id) = CerberusApplication::translateTeamCategoryCode($move_code);
$do['move'] = array('group_id' => intval($g_id), 'bucket_id' => intval($b_id));
}
// Assign to worker
@($worker_id = DevblocksPlatform::importGPC($_REQUEST['do_assign'], 'string', null));
if (0 != strlen($worker_id)) {
$do['assign'] = array('worker_id' => intval($worker_id));
}
// Spam training
@($is_spam = DevblocksPlatform::importGPC($_REQUEST['do_spam'], 'string', null));
if (0 != strlen($is_spam)) {
$do['spam'] = array('is_spam' => !$is_spam ? 0 : 1);
}
// Set status
@($status = DevblocksPlatform::importGPC($_REQUEST['do_status'], 'string', null));
if (0 != strlen($status)) {
$do['status'] = array('is_waiting' => 3 == $status ? 1 : 0, 'is_closed' => 0 == $status || 3 == $status ? 0 : 1, 'is_deleted' => 2 == $status ? 1 : 0);
}
$data = array();
$ticket_ids = array();
if ($filter == 'sender') {
$data = $senders;
} elseif ($filter == 'subject') {
$data = $subjects;
} elseif ($filter == 'checks') {
$filter = '';
// bulk update just looks for $ticket_ids == !null
$ticket_ids = DevblocksPlatform::parseCsvString($ticket_id_str);
}
// Restrict to current worker groups
$active_worker = CerberusApplication::getActiveWorker();
$memberships = $active_worker->getMemberships();
$view->params['tmp'] = new DevblocksSearchCriteria(SearchFields_Ticket::TICKET_TEAM_ID, 'in', array_keys($memberships));
// Do: Custom fields
$do = DAO_CustomFieldValue::handleBulkPost($do);
$view->doBulkUpdate($filter, '', $data, $do, $ticket_ids);
// Clear our temporary group restriction before re-rendering
unset($view->params['tmp']);
$view->render();
return;
}
示例5: sendTicketMessage
//.........这里部分代码省略.........
// Content
DAO_MessageContent::create($message_id, $content);
$headers = $mail->getHeaders();
// Headers
foreach ($headers->getAll() as $hdr) {
if (null != ($hdr_val = $hdr->getFieldBody())) {
if (!empty($hdr_val)) {
DAO_MessageHeader::create($message_id, $hdr->getFieldName(), CerberusParser::fixQuotePrintableString($hdr_val));
}
}
}
// Attachments
if (is_array($files) && !empty($files)) {
$attachment_path = APP_STORAGE_PATH . '/attachments/';
reset($files);
foreach ($files['tmp_name'] as $idx => $file) {
if (empty($file) || empty($files['name'][$idx]) || !file_exists($file)) {
continue;
}
$fields = array(DAO_Attachment::MESSAGE_ID => $message_id, DAO_Attachment::DISPLAY_NAME => $files['name'][$idx], DAO_Attachment::MIME_TYPE => $files['type'][$idx], DAO_Attachment::FILE_SIZE => filesize($file));
$file_id = DAO_Attachment::create($fields);
$attachment_bucket = sprintf("%03d/", mt_rand(1, 100));
$attachment_file = $file_id;
if (!file_exists($attachment_path . $attachment_bucket)) {
mkdir($attachment_path . $attachment_bucket, 0775, true);
}
if (!is_writeable($attachment_path . $attachment_bucket)) {
echo "Can't write to bucket " . $attachment_path . $attachment_bucket . "<BR>";
}
copy($file, $attachment_path . $attachment_bucket . $attachment_file);
@unlink($file);
DAO_Attachment::update($file_id, array(DAO_Attachment::FILEPATH => $attachment_bucket . $attachment_file));
}
}
// add note to message if email failed
if ($mail_succeeded === false) {
$fields = array(DAO_MessageNote::MESSAGE_ID => $message_id, DAO_MessageNote::CREATED => time(), DAO_MessageNote::WORKER_ID => 0, DAO_MessageNote::CONTENT => 'Exception thrown while sending email: ' . $e->getMessage(), DAO_MessageNote::TYPE => Model_MessageNote::TYPE_ERROR);
DAO_MessageNote::create($fields);
}
}
// Post-Reply Change Properties
if (isset($properties['closed'])) {
switch ($properties['closed']) {
case 0:
// open
$change_fields[DAO_Ticket::IS_WAITING] = 0;
$change_fields[DAO_Ticket::IS_CLOSED] = 0;
$change_fields[DAO_Ticket::IS_DELETED] = 0;
$change_fields[DAO_Ticket::DUE_DATE] = 0;
break;
case 1:
// closed
$change_fields[DAO_Ticket::IS_WAITING] = 0;
$change_fields[DAO_Ticket::IS_CLOSED] = 1;
$change_fields[DAO_Ticket::IS_DELETED] = 0;
if (isset($properties['ticket_reopen'])) {
@($time = intval(strtotime($properties['ticket_reopen'])));
$change_fields[DAO_Ticket::DUE_DATE] = $time;
}
break;
case 2:
// waiting
$change_fields[DAO_Ticket::IS_WAITING] = 1;
$change_fields[DAO_Ticket::IS_CLOSED] = 0;
$change_fields[DAO_Ticket::IS_DELETED] = 0;
if (isset($properties['ticket_reopen'])) {
@($time = intval(strtotime($properties['ticket_reopen'])));
$change_fields[DAO_Ticket::DUE_DATE] = $time;
}
break;
}
}
// Who should handle the followup?
if (isset($properties['next_worker_id'])) {
$change_fields[DAO_Ticket::NEXT_WORKER_ID] = $properties['next_worker_id'];
}
// Allow anybody to reply after
if (isset($properties['unlock_date']) && !empty($properties['unlock_date'])) {
$unlock = strtotime($properties['unlock_date']);
if (intval($unlock) > 0) {
$change_fields[DAO_Ticket::UNLOCK_DATE] = $unlock;
}
}
// Move
if (!empty($properties['bucket_id'])) {
// [TODO] Use API to move, or fire event
// [TODO] Ensure team/bucket exist
list($team_id, $bucket_id) = CerberusApplication::translateTeamCategoryCode($properties['bucket_id']);
$change_fields[DAO_Ticket::TEAM_ID] = $team_id;
$change_fields[DAO_Ticket::CATEGORY_ID] = $bucket_id;
}
if (!empty($ticket_id) && !empty($change_fields)) {
DAO_Ticket::updateTicket($ticket_id, $change_fields);
}
// Outbound Reply Event (not automated reply, etc.)
if (!empty($worker_id)) {
$eventMgr = DevblocksPlatform::getEventService();
$eventMgr->trigger(new Model_DevblocksEvent('ticket.reply.outbound', array('ticket_id' => $ticket_id, 'worker_id' => $worker_id)));
}
}
示例6: saveMacroPanelAction
function saveMacroPanelAction()
{
$translate = DevblocksPlatform::getTranslationService();
@($id = DevblocksPlatform::importGPC($_REQUEST['id'], 'integer', 0));
@($name = DevblocksPlatform::importGPC($_REQUEST['name'], 'string'));
@($source_ext_id = DevblocksPlatform::importGPC($_REQUEST['source_ext_id'], 'string'));
@($do = DevblocksPlatform::importGPC($_REQUEST['do'], 'array', array()));
// @$values = DevblocksPlatform::importGPC($_REQUEST['values'],'array',array());
if (empty($name)) {
$name = $translate->_('Macro Action');
}
// Actions
if (is_array($do)) {
foreach ($do as $act) {
$action = array();
$shortact = array_pop(explode('.', $act));
$value = DevblocksPlatform::importGPC($_REQUEST['do_' . $shortact]);
switch ($act) {
// Move group/bucket
case 'cerberusweb.macros.action.move':
@($move_code = $value);
if (0 != strlen($move_code)) {
list($g_id, $b_id) = CerberusApplication::translateTeamCategoryCode($move_code);
$action = array('group_id' => intval($g_id), 'bucket_id' => intval($b_id));
}
break;
// Assign to worker
// Assign to worker
case 'cerberusweb.macros.action.assign':
@($worker_id = $value);
if (0 != strlen($worker_id)) {
$action = array('worker_id' => intval($worker_id));
}
break;
// Spam training
// Spam training
case 'spam':
@($is_spam = DevblocksPlatform::importGPC($_REQUEST['do_spam'], 'string', null));
if (0 != strlen($is_spam)) {
$action = array('is_spam' => !$is_spam ? 0 : 1);
}
break;
// Set status
// Set status
case 'cerberusweb.macros.action.status':
@($status = DevblocksPlatform::importGPC($_REQUEST['do_status'], 'string', null));
if (0 != strlen($status)) {
$action = array('is_waiting' => 3 == $status ? 1 : 0, 'is_closed' => 0 == $status || 3 == $status ? 0 : 1, 'is_deleted' => 2 == $status ? 1 : 0);
}
break;
default:
// ignore invalids
// Custom fields
if ("cf_" == substr($act, 0, 3)) {
$field_id = intval(substr($act, 3));
if (!isset($custom_fields[$field_id])) {
continue;
}
$action = array();
// [TODO] Operators
switch ($custom_fields[$field_id]->type) {
case 'S':
// string
// string
case 'T':
// clob
// clob
case 'D':
// dropdown
// dropdown
case 'U':
// URL
// URL
case 'W':
// worker
$value = DevblocksPlatform::importGPC($_REQUEST['do_cf_' . $field_id], 'string', '');
$action['value'] = $value;
break;
case 'M':
// multi-dropdown
// multi-dropdown
case 'X':
// multi-checkbox
$in_array = DevblocksPlatform::importGPC($_REQUEST['do_cf_' . $field_id], 'array', array());
$out_array = array();
// Hash key on the option for quick lookup later
if (is_array($in_array)) {
foreach ($in_array as $k => $v) {
$out_array[$v] = $v;
}
}
$action['value'] = $out_array;
break;
case 'E':
// date
$value = DevblocksPlatform::importGPC($_REQUEST['do_cf_' . $field_id], 'string', '');
$action['value'] = $value;
break;
case 'N':
// number
//.........这里部分代码省略.........
示例7: getTimeSpentTicketChartAction
function getTimeSpentTicketChartAction()
{
$sql_array = array();
// import form data
@($start = DevblocksPlatform::importGPC($_REQUEST['start'], 'string', ''));
@($end = DevblocksPlatform::importGPC($_REQUEST['end'], 'string', ''));
@($countonly = DevblocksPlatform::importGPC($_REQUEST['countonly'], 'integer', 0));
@($sel_worker_id = DevblocksPlatform::importGPC($_REQUEST['worker_id'], 'integer', 0));
@($sel_group_id = DevblocksPlatform::importGPC($_REQUEST['group_id'], 'string', ''));
list($g_id, $b_id) = CerberusApplication::translateTeamCategoryCode($sel_group_id);
// use date range if specified, else use duration prior to now
$start_time = 0;
$end_time = 0;
if (empty($start) && empty($end)) {
$start = "-30 days";
$end = "now";
$start_time = strtotime($start);
$end_time = strtotime($end);
} else {
$start_time = strtotime($start);
$end_time = strtotime($end);
}
$db = DevblocksPlatform::getDatabaseService();
// $groups = DAO_Group::getAll();
// $buckets = DAO_Bucket::getAll();
$sql = "SELECT sum(tte.time_actual_mins) mins, t.mask ";
$sql .= "FROM timetracking_entry tte ";
$sql .= "INNER JOIN ticket t ON tte.source_id = t.id ";
$sql .= sprintf("WHERE log_date > %d AND log_date <= %d ", $start_time, $end_time);
$sql .= "AND tte.source_extension_id = 'timetracking.source.ticket' ";
if ($sel_worker_id) {
$sql .= sprintf("AND tte.worker_id = %d ", $sel_worker_id);
}
if ($g_id > 0) {
$sql .= sprintf("AND t.team_id = %d ", $g_id);
if ($b_id > -1) {
$sql .= sprintf("AND t.category_id = %d ", $b_id);
}
}
$sql .= "GROUP BY t.mask ";
$sql .= "ORDER BY mins ";
$rs = $db->Execute($sql);
if ($countonly) {
echo intval($rs->RecordCount());
return;
}
if (is_a($rs, 'ADORecordSet')) {
while (!$rs->EOF) {
$mins = intval($rs->fields['mins']);
$ticket_mask = $rs->fields['mask'];
echo $ticket_mask, "\t", $mins . "\n";
$rs->MoveNext();
}
}
}
示例8: saveTabInboxAddAction
//.........这里部分代码省略.........
$to = DevblocksPlatform::importGPC($_REQUEST['value_cf_' . $field_id . '_to'], 'string', 'now');
$criteria['from'] = $from;
$criteria['to'] = $to;
unset($criteria['value']);
break;
case 'N':
// number
$oper = DevblocksPlatform::importGPC($_REQUEST['value_cf_' . $field_id . '_oper'], 'string', '=');
$criteria['oper'] = $oper;
$criteria['value'] = intval($value);
break;
case 'C':
// checkbox
$criteria['value'] = intval($value);
break;
}
} else {
continue;
}
break;
}
$criterion[$rule] = $criteria;
}
}
// Actions
if (is_array($do)) {
foreach ($do as $act) {
$action = array();
switch ($act) {
// Move group/bucket
case 'move':
@($move_code = DevblocksPlatform::importGPC($_REQUEST['do_move'], 'string', null));
if (0 != strlen($move_code)) {
list($g_id, $b_id) = CerberusApplication::translateTeamCategoryCode($move_code);
$action = array('group_id' => intval($g_id), 'bucket_id' => intval($b_id));
}
break;
// Assign to worker
// Assign to worker
case 'assign':
@($worker_id = DevblocksPlatform::importGPC($_REQUEST['do_assign'], 'string', null));
if (0 != strlen($worker_id)) {
$action = array('worker_id' => intval($worker_id));
}
break;
// Spam training
// Spam training
case 'spam':
@($is_spam = DevblocksPlatform::importGPC($_REQUEST['do_spam'], 'string', null));
if (0 != strlen($is_spam)) {
$action = array('is_spam' => !$is_spam ? 0 : 1);
}
break;
// Set status
// Set status
case 'status':
@($status = DevblocksPlatform::importGPC($_REQUEST['do_status'], 'string', null));
if (0 != strlen($status)) {
$action = array('is_waiting' => 3 == $status ? 1 : 0, 'is_closed' => 0 == $status || 3 == $status ? 0 : 1, 'is_deleted' => 2 == $status ? 1 : 0);
}
break;
default:
// ignore invalids
// Custom fields
if ("cf_" == substr($act, 0, 3)) {
$field_id = intval(substr($act, 3));