当前位置: 首页>>代码示例>>PHP>>正文


PHP CerberusApplication::runGroupRouting方法代码示例

本文整理汇总了PHP中CerberusApplication::runGroupRouting方法的典型用法代码示例。如果您正苦于以下问题:PHP CerberusApplication::runGroupRouting方法的具体用法?PHP CerberusApplication::runGroupRouting怎么用?PHP CerberusApplication::runGroupRouting使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CerberusApplication的用法示例。


在下文中一共展示了CerberusApplication::runGroupRouting方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: saveTabInboxAddAction


//.........这里部分代码省略.........
                     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
                             // number
                             case 'C':
                                 // checkbox
                                 $value = DevblocksPlatform::importGPC($_REQUEST['do_cf_' . $field_id], 'string', '');
                                 $action['value'] = intval($value);
                                 break;
                         }
                     } else {
                         continue;
                     }
                     break;
             }
             $actions[$act] = $action;
         }
     }
     $fields = array(DAO_GroupInboxFilter::NAME => $name, DAO_GroupInboxFilter::IS_STICKY => $is_sticky, DAO_GroupInboxFilter::CRITERIA_SER => serialize($criterion), DAO_GroupInboxFilter::ACTIONS_SER => serialize($actions));
     // Only sticky filters can manual order and be stackable
     if (!$is_sticky) {
         $fields[DAO_GroupInboxFilter::STICKY_ORDER] = 0;
         $fields[DAO_GroupInboxFilter::IS_STACKABLE] = 0;
     } else {
         // is sticky
         $fields[DAO_GroupInboxFilter::IS_STACKABLE] = $is_stackable;
     }
     // Create
     if (empty($id)) {
         $fields[DAO_GroupInboxFilter::GROUP_ID] = $group_id;
         $fields[DAO_GroupInboxFilter::POS] = 0;
         $id = DAO_GroupInboxFilter::create($fields);
         // Update
     } else {
         DAO_GroupInboxFilter::update($id, $fields);
     }
     $defaults = new C4_AbstractViewModel();
     $defaults->class_name = 'C4_TicketView';
     $defaults->id = $view_id;
     $view = C4_AbstractViewLoader::getView($view_id, $defaults);
     if (!empty($view_id) && null != $view) {
         /* @var $view C4_TicketView */
         // Loop through all the tickets in this inbox
         list($inbox_tickets, $null) = DAO_Ticket::search(null, array(new DevblocksSearchCriteria(SearchFields_Ticket::TICKET_TEAM_ID, '=', $group_id), new DevblocksSearchCriteria(SearchFields_Ticket::TICKET_CATEGORY_ID, '=', '0')), -1, 0, null, null, false);
         if (is_array($inbox_tickets)) {
             foreach ($inbox_tickets as $inbox_ticket) {
                 /* @var $inbox_ticket CerberusTicket */
                 // Run only this new rule against all tickets in the group inbox
                 CerberusApplication::runGroupRouting($group_id, intval($inbox_ticket[SearchFields_Ticket::TICKET_ID]), $id);
             }
         }
         $view->render();
         return;
     }
     DevblocksPlatform::redirect(new DevblocksHttpResponse(array('groups', $group_id, 'inbox')));
 }
开发者ID:Hildy,项目名称:cerb5,代码行数:101,代码来源:groups.php

示例2: saveAddInboxRulePanelAction


//.........这里部分代码省略.........
     if (empty($name)) {
         $name = $translate->_('mail.inbox_filter');
     }
     $criterion = array();
     $actions = array();
     // Criteria
     if (is_array($rules)) {
         foreach ($rules as $rule) {
             $rule = DevblocksPlatform::strAlphaNumDash($rule);
             @($value = DevblocksPlatform::importGPC($_POST['value_' . $rule], 'string', ''));
             // [JAS]: Allow empty $value (null/blank checking)
             $criteria = array('value' => $value);
             // Any special rule handling
             switch ($rule) {
                 case 'subject':
                     break;
                 case 'from':
                     break;
                 case 'tocc':
                     break;
                 case 'header1':
                 case 'header2':
                 case 'header3':
                 case 'header4':
                 case 'header5':
                     if (null != @($header = DevblocksPlatform::importGPC($_POST[$rule], 'string', null))) {
                         $criteria['header'] = strtolower($header);
                     }
                     break;
                 case 'body':
                     break;
                 case 'attachment':
                     break;
                 default:
                     // ignore invalids
                     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_closed' => 0 == $status ? 0 : 1, 'is_deleted' => 2 == $status ? 1 : 0);
                     }
                     break;
                 default:
                     // ignore invalids
                     continue;
                     break;
             }
             $actions[$act] = $action;
         }
     }
     $fields = array(DAO_GroupInboxFilter::NAME => $name, DAO_GroupInboxFilter::GROUP_ID => $group_id, DAO_GroupInboxFilter::CRITERIA_SER => serialize($criterion), DAO_GroupInboxFilter::ACTIONS_SER => serialize($actions), DAO_GroupInboxFilter::POS => 0);
     $routing_id = DAO_GroupInboxFilter::create($fields);
     // Loop through all the tickets in this inbox
     list($inbox_tickets, $null) = DAO_Ticket::search(null, array(new DevblocksSearchCriteria(SearchFields_Ticket::TEAM_ID, '=', $group_id), new DevblocksSearchCriteria(SearchFields_Ticket::TICKET_CATEGORY_ID, '=', '0')), -1, 0, null, null, false);
     if (is_array($inbox_tickets)) {
         foreach ($inbox_tickets as $inbox_ticket) {
             /* @var $inbox_ticket CerberusTicket */
             // Run only this new rule against all tickets in the group inbox
             CerberusApplication::runGroupRouting($group_id, intval($inbox_ticket[SearchFields_Ticket::TICKET_ID]), $routing_id);
         }
     }
     $view->render();
     exit;
 }
开发者ID:joegeck,项目名称:cerb4,代码行数:101,代码来源:tickets.php

示例3: _handleTicketMoved

 private function _handleTicketMoved($event)
 {
     @($ticket_ids = $event->params['ticket_ids']);
     @($changed_fields = $event->params['changed_fields']);
     if (!isset($changed_fields[DAO_Ticket::TEAM_ID])) {
         return;
     }
     @($team_id = $changed_fields[DAO_Ticket::TEAM_ID]);
     @($bucket_id = $changed_fields[DAO_Ticket::CATEGORY_ID]);
     $final_moves = array();
     // If we're landing in an inbox we need to check its filters
     if (!empty($ticket_ids) && !empty($team_id) && empty($bucket_id)) {
         // moving to an inbox
         if (is_array($ticket_ids)) {
             foreach ($ticket_ids as $ticket_id) {
                 // Run the new inbox filters
                 $matches = CerberusApplication::runGroupRouting($team_id, $ticket_id);
                 // If we matched no rules, we're stuck in the destination inbox.
                 if (empty($matches)) {
                     $final_moves[] = $ticket_id;
                 } else {
                     // If more inbox rules want to move this ticket don't consider this finished
                     if (is_array($matches)) {
                         foreach ($matches as $match) {
                             if (isset($match->actions['move'])) {
                                 // any moves
                                 break;
                             }
                             $final_moves[] = $ticket_id;
                         }
                     }
                 }
             }
         }
         // Anything dropping into a non-inbox bucket is done chain-moving
     } elseif (!empty($ticket_ids) && !empty($team_id) && !empty($bucket_id)) {
         $final_moves = $ticket_ids;
     }
     // Did we have any tickets finish chain-moving?
     if (!empty($final_moves)) {
         // Trigger an inbound event for all moves
         if (is_array($final_moves)) {
             foreach ($final_moves as $ticket_id) {
                 // Inbound Reply Event
                 $eventMgr = DevblocksPlatform::getEventService();
                 $eventMgr->trigger(new Model_DevblocksEvent('ticket.reply.inbound', array('ticket_id' => $ticket_id)));
             }
         }
     }
 }
开发者ID:jsjohnst,项目名称:cerb4,代码行数:50,代码来源:listeners.classes.php

示例4: parseMessage


//.........这里部分代码省略.........
         foreach ($message->files as $filename => $file) {
             /* @var $file ParserFile */
             //[mdf] skip rfc822 messages since we extracted their content above
             if ($file->mime_type == 'message/rfc822') {
                 continue;
             }
             $fields = array(DAO_Attachment::MESSAGE_ID => $email_id, DAO_Attachment::DISPLAY_NAME => $filename, DAO_Attachment::MIME_TYPE => $file->mime_type, DAO_Attachment::FILE_SIZE => intval($file->file_size));
             $file_id = DAO_Attachment::create($fields);
             if (empty($file_id)) {
                 @unlink($file->tmpname);
                 // remove our temp file
                 continue;
             }
             // Make file attachments use buckets so we have a max per directory
             $attachment_bucket = sprintf("%03d/", mt_rand(1, 100));
             $attachment_file = $file_id;
             if (!file_exists($attachment_path . $attachment_bucket)) {
                 @mkdir($attachment_path . $attachment_bucket, 0770, true);
                 // [TODO] Needs error checking
             }
             rename($file->getTempFile(), $attachment_path . $attachment_bucket . $attachment_file);
             // [TODO] Split off attachments into its own DAO
             DAO_Attachment::update($file_id, array(DAO_Attachment::FILEPATH => $attachment_bucket . $attachment_file));
         }
     }
     // First Thread
     if ($bIsNew && !empty($email_id)) {
         // First thread
         DAO_Ticket::updateTicket($id, array(DAO_Ticket::FIRST_MESSAGE_ID => $email_id));
     }
     // New ticket processing
     if ($bIsNew) {
         // Don't replace this with the master event listener
         if (false !== ($rules = CerberusApplication::runGroupRouting($team_id, $id))) {
             /* @var $rule Model_GroupInboxFilter */
             // Check the last match which moved the ticket
             if (is_array($rules)) {
                 foreach ($rules as $rule) {
                     // If a rule changed our destination, replace the scope variable $team_id
                     if (isset($rule->actions['move']) && isset($rule->actions['move']['group_id'])) {
                         $team_id = intval($rule->actions['move']['group_id']);
                     }
                 }
             }
         }
         // Allow spam training overloading
         if (!empty($enumSpamTraining)) {
             if ($enumSpamTraining == CerberusTicketSpamTraining::SPAM) {
                 CerberusBayes::markTicketAsSpam($id);
                 DAO_Ticket::updateTicket($id, array(DAO_Ticket::IS_CLOSED => 1, DAO_Ticket::IS_DELETED => 1));
             } elseif ($enumSpamTraining == CerberusTicketSpamTraining::NOT_SPAM) {
                 CerberusBayes::markTicketAsNotSpam($id);
             }
         } else {
             // No overload
             $out = CerberusBayes::calculateTicketSpamProbability($id);
             // [TODO] Move this group logic to a post-parse event listener
             if (!empty($team_id)) {
                 @($spam_threshold = DAO_GroupSettings::get($team_id, DAO_GroupSettings::SETTING_SPAM_THRESHOLD, 80));
                 @($spam_action = DAO_GroupSettings::get($team_id, DAO_GroupSettings::SETTING_SPAM_ACTION, ''));
                 @($spam_action_param = DAO_GroupSettings::get($team_id, DAO_GroupSettings::SETTING_SPAM_ACTION_PARAM, ''));
                 if ($out['probability'] * 100 >= $spam_threshold) {
                     $enumSpamTraining = CerberusTicketSpamTraining::SPAM;
                     switch ($spam_action) {
                         default:
                         case 0:
开发者ID:Hildy,项目名称:cerb4,代码行数:67,代码来源:Parser.php

示例5: _handleTicketMoved

 private function _handleTicketMoved($event)
 {
     @($ticket_ids = $event->params['ticket_ids']);
     @($changed_fields = $event->params['changed_fields']);
     if (!isset($changed_fields[DAO_Ticket::TEAM_ID]) || !isset($changed_fields[DAO_Ticket::CATEGORY_ID])) {
         return;
     }
     @($team_id = $changed_fields[DAO_Ticket::TEAM_ID]);
     @($bucket_id = $changed_fields[DAO_Ticket::CATEGORY_ID]);
     //============ Check Team Inbox Rules ================
     if (!empty($ticket_ids) && !empty($team_id) && empty($bucket_id)) {
         // moving to an inbox
         // [JAS]: Build hashes for our event ([TODO] clean up)
         $tickets = DAO_Ticket::getTickets($ticket_ids);
         $from_ids = array();
         foreach ($tickets as $ticket) {
             /* @var $ticket CerberusTicket */
             $from_ids[$ticket->id] = $ticket->first_wrote_address_id;
         }
         $from_addresses = DAO_Address::getWhere(sprintf("%s IN (%s)", DAO_Address::ID, implode(',', $from_ids)));
         unset($from_ids);
         if (is_array($tickets)) {
             foreach ($tickets as $ticket_id => $ticket) {
                 $matches = CerberusApplication::runGroupRouting($team_id, $ticket_id);
             }
         }
         unset($from_addresses);
     }
 }
开发者ID:joegeck,项目名称:cerb4,代码行数:29,代码来源:listeners.classes.php


注:本文中的CerberusApplication::runGroupRouting方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。