コード例 #1
0
ファイル: sensors.php プロジェクト: jstanden/portsensor
 function showSensorPeekAction()
 {
     @($id = DevblocksPlatform::importGPC($_REQUEST['id'], 'integer', 0));
     @($view_id = DevblocksPlatform::importGPC($_REQUEST['view_id'], 'string', ''));
     $tpl = DevblocksPlatform::getTemplateService();
     $tpl->assign('path', $this->_TPL_PATH);
     $tpl->assign('view_id', $view_id);
     if (null == ($sensor = DAO_Sensor::get($id))) {
         $sensor = new Model_Sensor();
         $sensor->extension_id = 'sensor.external';
     }
     $tpl->assign('sensor', $sensor);
     $sensor_types = DevblocksPlatform::getExtensions('portsensor.sensor', false);
     $tpl->assign('sensor_types', $sensor_types);
     // Sensor extension instance
     if (!empty($sensor->extension_id) && isset($sensor_types[$sensor->extension_id])) {
         $tpl->assign('sensor_extension', DevblocksPlatform::getExtension($sensor->extension_id, true));
     }
     // Custom Fields
     $custom_fields = DAO_CustomField::getBySource(PsCustomFieldSource_Sensor::ID);
     $tpl->assign('custom_fields', $custom_fields);
     $custom_field_values = DAO_CustomFieldValue::getValuesBySourceIds(PsCustomFieldSource_Sensor::ID, $id);
     if (isset($custom_field_values[$id])) {
         $tpl->assign('custom_field_values', $custom_field_values[$id]);
     }
     $tpl->display('file:' . $this->_TPL_PATH . 'sensors/peek.tpl');
 }
コード例 #2
0
ファイル: plugin.php プロジェクト: rmiddle/cerb4_plugins
 function renderConfig(Model_PreParseRule $filter = null)
 {
     $tpl = DevblocksPlatform::getTemplateService();
     $path = dirname(__FILE__) . '/templates/';
     $groups = DAO_Group::getAll();
     $tpl->assign('groups', $groups);
     $ticket_fields = DAO_CustomField::getBySource('cerberusweb.fields.source.ticket');
     $tpl->assign('ticket_fields', $ticket_fields);
     $params = $filter->actions[self::EXTENSION_ID];
     $tpl->assign('headers', $params['headers']);
     $tpl->assign('custom_fields', $params['custom_fields']);
     $tpl->display($path . 'header_filter_action.tpl');
 }
コード例 #3
0
ファイル: Model.class.php プロジェクト: rmiddle/feg
 public static function _doBulkSetCustomFields($source_extension, $custom_fields, $ids)
 {
     $fields = DAO_CustomField::getAll();
     if (!empty($custom_fields)) {
         foreach ($custom_fields as $cf_id => $params) {
             if (!is_array($params) || !isset($params['value'])) {
                 continue;
             }
             $cf_val = $params['value'];
             // Data massaging
             switch ($fields[$cf_id]->type) {
                 case Model_CustomField::TYPE_DATE:
                     $cf_val = intval(@strtotime($cf_val));
                     break;
                 case Model_CustomField::TYPE_CHECKBOX:
                 case Model_CustomField::TYPE_NUMBER:
                     $cf_val = 0 == strlen($cf_val) ? '' : intval($cf_val);
                     break;
             }
             // If multi-selection types, handle delta changes
             if (Model_CustomField::TYPE_MULTI_PICKLIST == $fields[$cf_id]->type || Model_CustomField::TYPE_MULTI_CHECKBOX == $fields[$cf_id]->type) {
                 if (is_array($cf_val)) {
                     foreach ($cf_val as $val) {
                         $op = substr($val, 0, 1);
                         $val = substr($val, 1);
                         if (is_array($ids)) {
                             foreach ($ids as $id) {
                                 if ($op == '+') {
                                     DAO_CustomFieldValue::setFieldValue($source_extension, $id, $cf_id, $val, true);
                                 } elseif ($op == '-') {
                                     DAO_CustomFieldValue::unsetFieldValue($source_extension, $id, $cf_id, $val);
                                 }
                             }
                         }
                     }
                 }
                 // Otherwise, set/unset as a single field
             } else {
                 if (is_array($ids)) {
                     foreach ($ids as $id) {
                         if (0 != strlen($cf_val)) {
                             DAO_CustomFieldValue::setFieldValue($source_extension, $id, $cf_id, $cf_val);
                         } else {
                             DAO_CustomFieldValue::unsetFieldValue($source_extension, $id, $cf_id);
                         }
                     }
                 }
             }
         }
     }
 }
コード例 #4
0
ファイル: App.php プロジェクト: Hildy/cerb5
 private function _getValueCounts($field_id)
 {
     $db = DevblocksPlatform::getDatabaseService();
     // Selected custom field
     if (null == ($field = DAO_CustomField::get($field_id))) {
         return;
     }
     if (null == ($table = DAO_CustomFieldValue::getValueTableName($field_id))) {
         return;
     }
     $sql = sprintf("SELECT field_value, count(field_value) AS hits " . "FROM %s " . "WHERE source_extension = %s " . "AND field_id = %d " . "GROUP BY field_value", $table, $db->qstr($field->source_extension), $field->id);
     $rs_values = $db->Execute($sql);
     $value_counts = array();
     while (!$rs_values->EOF) {
         $value = $rs_values->fields['field_value'];
         $hits = intval($rs_values->fields['hits']);
         $value_counts[$value] = intval($hits);
         $rs_values->MoveNext();
     }
     arsort($value_counts);
     return $value_counts;
 }
コード例 #5
0
ファイル: contacts.php プロジェクト: Hildy/cerb5
 function showOrgPeekAction()
 {
     @($id = DevblocksPlatform::importGPC($_REQUEST['id'], 'integer', ''));
     @($view_id = DevblocksPlatform::importGPC($_REQUEST['view_id'], 'string', ''));
     $tpl = DevblocksPlatform::getTemplateService();
     $tpl->assign('path', $this->_TPL_PATH);
     $contact = DAO_ContactOrg::get($id);
     $tpl->assign('contact', $contact);
     // Custom fields
     $custom_fields = DAO_CustomField::getBySource(ChCustomFieldSource_Org::ID);
     $tpl->assign('custom_fields', $custom_fields);
     $custom_field_values = DAO_CustomFieldValue::getValuesBySourceIds(ChCustomFieldSource_Org::ID, $id);
     if (isset($custom_field_values[$id])) {
         $tpl->assign('custom_field_values', $custom_field_values[$id]);
     }
     $types = Model_CustomField::getTypes();
     $tpl->assign('types', $types);
     // View
     $tpl->assign('view_id', $view_id);
     $tpl->display('file:' . $this->_TPL_PATH . 'contacts/orgs/org_peek.tpl');
 }
コード例 #6
0
ファイル: filter.php プロジェクト: rmiddle/cerb4_plugins
 function run(Model_PreParseRule $filter, CerberusParserMessage $message)
 {
     $message_headers = $message->headers;
     $subject = $message->headers['subject'];
     $ticket_fields = DAO_CustomField::getAll();
     $params = $filter->actions[self::EXTENSION_ID];
     $day_of_week = date('N');
     $logger = DevblocksPlatform::getConsoleLog();
     $logger->info("Answernet: Running Filter on New Mail");
     // Houser,Colin <1034179><Missing Serviced Customer information>
     // Current custom_fields numbers
     // 1 = Due Date
     // 2 = RM Employee ID
     // 3 = RM Name
     // 4 = Topic_metlife /0/2/4/6/8/10/12/14
     // 5 = SLA
     // 6 = New Hire Yes = 0 / No = 2
     //
     $sub = explode(',', $subject, 2);
     $lname = $sub[0];
     $sub2 = explode("<", $sub[1]);
     $fname = $sub2[0];
     $emp_id = $sub2[1];
     $topic_metlife = $sub2[2];
     $message->custom_fields['2'] = substr($emp_id, 0, -1);
     $message->custom_fields['3'] = trim($fname) . " " . trim($lname);
     // If topic == Import contacts
     if (preg_match('/import/i', $topic_metlife)) {
         $message->custom_fields['4'] = "Import contacts";
         $message->custom_fields['5'] = 1;
         $message->custom_fields['6'] = "Yes";
     }
     // If topic == Create mailing list from existing data
     if (preg_match('/mailing/i', $topic_metlife)) {
         $message->custom_fields['4'] = "Create mailing list from existing data";
         $message->custom_fields['5'] = 3;
         $message->custom_fields['6'] = "Yes";
     }
     // If topic == Update existing contacts
     if (preg_match('/Update/i', $topic_metlife)) {
         $message->custom_fields['4'] = "Update existing contacts";
         $message->custom_fields['5'] = 3;
         $message->custom_fields['6'] = "No";
     }
     // If topic == Research missing customer info
     if (preg_match('/Research/i', $topic_metlife)) {
         $message->custom_fields['4'] = "Research missing customer info";
         $message->custom_fields['5'] = 5;
         $message->custom_fields['6'] = "No";
     }
     // If topic == Create labels
     if (preg_match('/labels/i', $topic_metlife)) {
         $message->custom_fields['4'] = "Create labels";
         $message->custom_fields['5'] = 1;
         $message->custom_fields['6'] = "No";
     }
     // If topic == Export third-party file
     if (preg_match('/third/i', $topic_metlife)) {
         $message->custom_fields['4'] = "Export third-party file";
         $message->custom_fields['5'] = 3;
         $message->custom_fields['6'] = "No";
     }
     // If topic == Other
     if (preg_match('/Other/i', $topic_metlife)) {
         $message->custom_fields['4'] = "Other";
         $message->custom_fields['5'] = 5;
         $message->custom_fields['6'] = "No";
     }
     // SLA of 1.  Process day of week Busness Days suck.
     if ($message->custom_fields['5'] == 1) {
         if ($day_of_week < 5 || $day_of_week == 7) {
             $message->custom_fields['1'] = strtotime("+1 Days");
         }
         if ($day_of_week == 6) {
             $message->custom_fields['1'] = strtotime("+2 Days");
         }
         if ($day_of_week == 5) {
             $message->custom_fields['1'] = strtotime("+3 Days");
         }
     }
     // SLA of 3.  Process day of week Busness Days suck.
     if ($message->custom_fields['5'] == 3) {
         if ($day_of_week < 4 || $day_of_week == 7) {
             $message->custom_fields['1'] = strtotime("+3 Days");
         }
         if ($day_of_week == 6) {
             $message->custom_fields['1'] = strtotime("+4 Days");
         }
         if ($day_of_week > 3 && $day_of_week < 6) {
             $message->custom_fields['1'] = strtotime("+5 Days");
         }
     }
     // SLA of 5.  Process day of week Busness Days suck.
     if ($message->custom_fields['5'] == 5) {
         if ($day_of_week == 1 || $day_of_week == 7) {
             $message->custom_fields['1'] = strtotime("+5 Days");
         }
         if ($day_of_week == 6) {
             $message->custom_fields['1'] = strtotime("+6 Days");
         }
         if ($day_of_week > 1 && $day_of_week < 6) {
             $message->custom_fields['1'] = strtotime("+7 Days");
         }
     }
 }
コード例 #7
0
ファイル: App.php プロジェクト: Hildy/cerb5
 /**
  * @return Model_WatcherMailFilter[]|false
  */
 static function getMatches(CerberusTicket $ticket, $event, $only_worker_id = null)
 {
     $matches = array();
     if (!empty($only_worker_id)) {
         $filters = DAO_WatcherMailFilter::getWhere(sprintf("%s = %d AND %s = %d", DAO_WatcherMailFilter::WORKER_ID, $only_worker_id, DAO_WatcherMailFilter::IS_DISABLED, 0));
     } else {
         $filters = DAO_WatcherMailFilter::getWhere(sprintf("%s = %d", DAO_WatcherMailFilter::IS_DISABLED, 0));
     }
     // [JAS]: Don't send obvious spam to watchers.
     if ($ticket->spam_score >= 0.9) {
         return false;
     }
     // Build our objects
     $ticket_from = DAO_Address::get($ticket->last_wrote_address_id);
     $ticket_group_id = $ticket->team_id;
     // [TODO] These expensive checks should only populate when needed
     $messages = DAO_Ticket::getMessagesByTicket($ticket->id);
     $message_headers = array();
     if (empty($messages)) {
         return false;
     }
     if (null != @($message_last = array_pop($messages))) {
         /* @var $message_last CerberusMessage */
         $message_headers = $message_last->getHeaders();
     }
     // Clear the rest of the message manifests
     unset($messages);
     $custom_fields = DAO_CustomField::getAll();
     // Lazy load when needed on criteria basis
     $ticket_field_values = null;
     $address_field_values = null;
     $org_field_values = null;
     // Worker memberships (for checking permissions)
     $workers = DAO_Worker::getAll();
     $group_rosters = DAO_Group::getRosters();
     // Check filters
     if (is_array($filters)) {
         foreach ($filters as $filter) {
             /* @var $filter Model_WatcherMailFilter */
             $passed = 0;
             // check the worker's group memberships
             if (!isset($workers[$filter->worker_id]) || $workers[$filter->worker_id]->is_disabled || !$workers[$filter->worker_id]->is_superuser && !isset($group_rosters[$ticket->team_id][$filter->worker_id])) {
                 // no membership
                 continue;
             }
             // check criteria
             foreach ($filter->criteria as $rule_key => $rule) {
                 @($value = $rule['value']);
                 switch ($rule_key) {
                     case 'dayofweek':
                         $current_day = strftime('%w');
                         //$current_day = 1;
                         // Forced to English abbrevs as indexes
                         $days = array('sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat');
                         // Is the current day enabled?
                         if (isset($rule[$days[$current_day]])) {
                             $passed++;
                         }
                         break;
                     case 'timeofday':
                         $current_hour = strftime('%H');
                         $current_min = strftime('%M');
                         //$current_hour = 17;
                         //$current_min = 5;
                         if (null != ($from_time = @$rule['from'])) {
                             list($from_hour, $from_min) = explode(':', $from_time);
                         }
                         if (null != ($to_time = @$rule['to'])) {
                             if (list($to_hour, $to_min) = explode(':', $to_time)) {
                             }
                         }
                         // Do we need to wrap around to the next day's hours?
                         if ($from_hour > $to_hour) {
                             // yes
                             $to_hour += 24;
                             // add 24 hrs to the destination (1am = 25th hour)
                         }
                         // Are we in the right 24 hourly range?
                         if ((int) $current_hour >= $from_hour && (int) $current_hour <= $to_hour) {
                             // If we're in the first hour, are we minutes early?
                             if ($current_hour == $from_hour && (int) $current_min < $from_min) {
                                 break;
                             }
                             // If we're in the last hour, are we minutes late?
                             if ($current_hour == $to_hour && (int) $current_min > $to_min) {
                                 break;
                             }
                             $passed++;
                         }
                         break;
                     case 'event':
                         if (!empty($event) && is_array($rule) && isset($rule[$event])) {
                             $passed++;
                         }
                         break;
                     case 'groups':
                         if (null !== @($group_buckets = $rule['groups'][$ticket->team_id]) && (empty($group_buckets) || in_array($ticket->category_id, $group_buckets))) {
                             $passed++;
                         }
                         break;
                     case 'next_worker_id':
                         // If it's an assigned event, we only care about the filter's owner
                         if (!empty($event) && 0 == strcasecmp($event, 'ticket_assignment')) {
                             if (intval($value) == intval($filter->worker_id)) {
                                 $passed++;
                                 break;
                             }
                         }
                         if (intval($value) == intval($ticket->next_worker_id)) {
                             $passed++;
                         }
                         break;
                     case 'mask':
                         $regexp_mask = DevblocksPlatform::strToRegExp($value);
                         if (@preg_match($regexp_mask, $ticket->mask)) {
                             $passed++;
                         }
                         break;
                     case 'from':
                         $regexp_from = DevblocksPlatform::strToRegExp($value);
                         if (@preg_match($regexp_from, $ticket_from->email)) {
                             $passed++;
                         }
                         break;
                     case 'subject':
                         $regexp_subject = DevblocksPlatform::strToRegExp($value);
                         if (@preg_match($regexp_subject, $ticket->subject)) {
                             $passed++;
                         }
                         break;
                     case 'body':
                         if (null == ($message_body = $message_last->getContent())) {
                             break;
                         }
                         // Line-by-line body scanning (sed-like)
                         $lines = preg_split("/[\r\n]/", $message_body);
                         if (is_array($lines)) {
                             foreach ($lines as $line) {
                                 if (@preg_match($value, $line)) {
                                     $passed++;
                                     break;
                                 }
                             }
                         }
                         break;
                     case 'header1':
                     case 'header2':
                     case 'header3':
                     case 'header4':
                     case 'header5':
                         @($header = strtolower($rule['header']));
                         if (empty($header)) {
                             $passed++;
                             break;
                         }
                         if (empty($value)) {
                             // we're checking for null/blanks
                             if (!isset($message_headers[$header]) || empty($message_headers[$header])) {
                                 $passed++;
                             }
                         } elseif (isset($message_headers[$header]) && !empty($message_headers[$header])) {
                             $regexp_header = DevblocksPlatform::strToRegExp($value);
                             // Flatten CRLF
                             if (@preg_match($regexp_header, str_replace(array("\r", "\n"), ' ', $message_headers[$header]))) {
                                 $passed++;
                             }
                         }
                         break;
                     default:
                         // ignore invalids
                         // Custom Fields
                         if (0 == strcasecmp('cf_', substr($rule_key, 0, 3))) {
                             $field_id = substr($rule_key, 3);
                             // Make sure it exists
                             if (null == @($field = $custom_fields[$field_id])) {
                                 continue;
                             }
                             // Lazy values loader
                             $field_values = array();
                             switch ($field->source_extension) {
                                 case ChCustomFieldSource_Address::ID:
                                     if (null == $address_field_values) {
                                         $address_field_values = array_shift(DAO_CustomFieldValue::getValuesBySourceIds(ChCustomFieldSource_Address::ID, $ticket_from->id));
                                     }
                                     $field_values =& $address_field_values;
                                     break;
                                 case ChCustomFieldSource_Org::ID:
                                     if (null == $org_field_values) {
                                         $org_field_values = array_shift(DAO_CustomFieldValue::getValuesBySourceIds(ChCustomFieldSource_Org::ID, $ticket_from->contact_org_id));
                                     }
                                     $field_values =& $org_field_values;
                                     break;
                                 case ChCustomFieldSource_Ticket::ID:
                                     if (null == $ticket_field_values) {
                                         $ticket_field_values = array_shift(DAO_CustomFieldValue::getValuesBySourceIds(ChCustomFieldSource_Ticket::ID, $ticket->id));
                                     }
                                     $field_values =& $ticket_field_values;
                                     break;
                             }
                             // Type sensitive value comparisons
                             // [TODO] Operators
                             switch ($field->type) {
                                 case 'S':
                                     // string
                                 // string
                                 case 'T':
                                     // clob
                                 // clob
                                 case 'U':
                                     // URL
                                     $field_val = isset($field_values[$field_id]) ? $field_values[$field_id] : '';
                                     $oper = isset($rule['oper']) ? $rule['oper'] : "=";
                                     if ($oper == "=" && @preg_match(DevblocksPlatform::strToRegExp($value, true), $field_val)) {
                                         $passed++;
                                     } elseif ($oper == "!=" && @(!preg_match(DevblocksPlatform::strToRegExp($value, true), $field_val))) {
                                         $passed++;
                                     }
                                     break;
                                 case 'N':
                                     // number
                                     $field_val = isset($field_values[$field_id]) ? $field_values[$field_id] : 0;
                                     $oper = isset($rule['oper']) ? $rule['oper'] : "=";
                                     if ($oper == "=" && intval($field_val) == intval($value)) {
                                         $passed++;
                                     } elseif ($oper == "!=" && intval($field_val) != intval($value)) {
                                         $passed++;
                                     } elseif ($oper == ">" && intval($field_val) > intval($value)) {
                                         $passed++;
                                     } elseif ($oper == "<" && intval($field_val) < intval($value)) {
                                         $passed++;
                                     }
                                     break;
                                 case 'E':
                                     // date
                                     $field_val = isset($field_values[$field_id]) ? intval($field_values[$field_id]) : 0;
                                     $from = isset($rule['from']) ? $rule['from'] : "0";
                                     $to = isset($rule['to']) ? $rule['to'] : "now";
                                     if (intval(@strtotime($from)) <= $field_val && intval(@strtotime($to)) >= $field_val) {
                                         $passed++;
                                     }
                                     break;
                                 case 'C':
                                     // checkbox
                                     $field_val = isset($field_values[$field_id]) ? $field_values[$field_id] : 0;
                                     if (intval($value) == intval($field_val)) {
                                         $passed++;
                                     }
                                     break;
                                 case 'D':
                                     // dropdown
                                 // dropdown
                                 case 'X':
                                     // multi-checkbox
                                 // multi-checkbox
                                 case 'M':
                                     // multi-picklist
                                 // multi-picklist
                                 case 'W':
                                     // worker
                                     $field_val = isset($field_values[$field_id]) ? $field_values[$field_id] : array();
                                     if (!is_array($value)) {
                                         $value = array($value);
                                     }
                                     if (is_array($field_val)) {
                                         // if multiple things set
                                         foreach ($field_val as $v) {
                                             // loop through possible
                                             if (isset($value[$v])) {
                                                 // is any possible set?
                                                 $passed++;
                                                 break;
                                             }
                                         }
                                     } else {
                                         // single
                                         if (isset($value[$field_val])) {
                                             // is our set field in possibles?
                                             $passed++;
                                             break;
                                         }
                                     }
                                     break;
                             }
                         }
                         break;
                 }
             }
             // If our rule matched every criteria, stop and return the filter
             if ($passed == count($filter->criteria)) {
                 DAO_WatcherMailFilter::increment($filter->id);
                 // ++ the times we've matched
                 $matches[$filter->id] = $filter;
             }
         }
     }
     if (!empty($matches)) {
         return $matches;
     }
     // No matches
     return false;
 }
コード例 #8
0
ファイル: Model.class.php プロジェクト: rmiddle/usermeet
 function render()
 {
     $this->_sanitize();
     $tpl = DevblocksPlatform::getTemplateService();
     $tpl->assign('id', $this->id);
     $tpl->assign('view', $this);
     $custom_fields = DAO_CustomField::getBySource(UmCustomFieldSource_Worker::ID);
     $tpl->assign('custom_fields', $custom_fields);
     $tpl->assign('view_fields', $this->getColumns());
     $tpl->display('file:' . APP_PATH . '/features/usermeet.core/templates/setup/tabs/workers/view.tpl');
 }
コード例 #9
0
ファイル: display.php プロジェクト: jsjohnst/cerb4
 function showPropertiesAction()
 {
     @($ticket_id = DevblocksPlatform::importGPC($_REQUEST['ticket_id'], 'integer'));
     $tpl = DevblocksPlatform::getTemplateService();
     $tpl->assign('path', $this->_TPL_PATH);
     $tpl->assign('ticket_id', $ticket_id);
     $ticket = DAO_Ticket::getTicket($ticket_id);
     $tpl->assign('ticket', $ticket);
     $requesters = DAO_Ticket::getRequestersByTicket($ticket_id);
     $tpl->assign('requesters', $requesters);
     $workers = DAO_Worker::getAllActive();
     $tpl->assign('workers', $workers);
     // Groups (for custom fields)
     $groups = DAO_Group::getAll();
     $tpl->assign('groups', $groups);
     // Custom fields
     $fields = DAO_CustomField::getBySource(ChCustomFieldSource_Ticket::ID);
     $tpl->assign('ticket_fields', $fields);
     $field_values = DAO_CustomFieldValue::getValuesBySourceIds(ChCustomFieldSource_Ticket::ID, $ticket_id);
     if (isset($field_values[$ticket->id])) {
         $tpl->assign('ticket_field_values', $field_values[$ticket->id]);
     }
     $tpl->display('file:' . $this->_TPL_PATH . 'display/modules/properties/index.tpl');
 }
コード例 #10
0
ファイル: tickets.php プロジェクト: Hildy/cerb5
 function showBatchPanelAction()
 {
     @($ids = DevblocksPlatform::importGPC($_REQUEST['ids']));
     @($view_id = DevblocksPlatform::importGPC($_REQUEST['view_id']));
     $tpl = DevblocksPlatform::getTemplateService();
     $tpl->assign('path', $this->_TPL_PATH);
     $tpl->assign('view_id', $view_id);
     $unique_sender_ids = array();
     $unique_subjects = array();
     if (!empty($ids)) {
         $ticket_ids = DevblocksPlatform::parseCsvString($ids);
         if (empty($ticket_ids)) {
             break;
         }
         $tickets = DAO_Ticket::getTickets($ticket_ids);
         if (is_array($tickets)) {
             foreach ($tickets as $ticket) {
                 /* @var $ticket CerberusTicket */
                 $ptr =& $unique_sender_ids[$ticket->first_wrote_address_id];
                 $ptr = intval($ptr) + 1;
                 $ptr =& $unique_subjects[$ticket->subject];
                 $ptr = intval($ptr) + 1;
             }
         }
         arsort($unique_subjects);
         // sort by occurrences
         $senders = DAO_Address::getWhere(sprintf("%s IN (%s)", DAO_Address::ID, implode(',', array_keys($unique_sender_ids))));
         foreach ($senders as $sender) {
             $ptr =& $unique_senders[$sender->email];
             $ptr = intval($ptr) + 1;
         }
         arsort($unique_senders);
         unset($senders);
         unset($unique_sender_ids);
         @$tpl->assign('ticket_ids', $ticket_ids);
         @$tpl->assign('unique_senders', $unique_senders);
         @$tpl->assign('unique_subjects', $unique_subjects);
     }
     // Teams
     $teams = DAO_Group::getAll();
     $tpl->assign('teams', $teams);
     // Categories
     $team_categories = DAO_Bucket::getTeams();
     // [TODO] Cache these
     $tpl->assign('team_categories', $team_categories);
     $workers = DAO_Worker::getAllActive();
     $tpl->assign('workers', $workers);
     // Custom Fields
     $custom_fields = DAO_CustomField::getBySource(ChCustomFieldSource_Ticket::ID);
     $tpl->assign('custom_fields', $custom_fields);
     $tpl->display('file:' . $this->_TPL_PATH . 'tickets/rpc/batch_panel.tpl');
 }
コード例 #11
0
ファイル: classes.php プロジェクト: jsjohnst/cerb4
 function render()
 {
     $tpl = DevblocksPlatform::getTemplateService();
     $tpl->assign('id', $this->id);
     $view_path = DEVBLOCKS_PLUGIN_PATH . 'cerberusweb.mobile/templates/tickets/';
     $tpl->assign('view_path_mobile', $view_path_mobile);
     $tpl->assign('view', $this);
     $visit = CerberusApplication::getVisit();
     $results = self::getData();
     $tpl->assign('results', $results);
     @($ids = array_keys($results[0]));
     $workers = DAO_Worker::getAll();
     $tpl->assign('workers', $workers);
     $teams = DAO_Group::getAll();
     $tpl->assign('teams', $teams);
     $buckets = DAO_Bucket::getAll();
     $tpl->assign('buckets', $buckets);
     $team_categories = DAO_Bucket::getTeams();
     $tpl->assign('team_categories', $team_categories);
     // [TODO] Is this even used here or did mfogg copy it blindly?
     $ticket_fields = DAO_CustomField::getBySource(ChCustomFieldSource_Ticket::ID);
     $tpl->assign('ticket_fields', $ticket_fields);
     // Undo?
     // [TODO] Is this even used here or did mfogg copy it blindly?
     $last_action = C4_TicketView::getLastAction($this->id);
     $tpl->assign('last_action', $last_action);
     if (!empty($last_action) && !is_null($last_action->ticket_ids)) {
         $tpl->assign('last_action_count', count($last_action->ticket_ids));
     }
     $tpl->cache_lifetime = "0";
     $tpl->assign('view_fields', $this->getColumns());
     $tpl->display('file:' . $view_path . 'ticket_view.tpl');
 }
コード例 #12
0
ファイル: message.php プロジェクト: rmiddle/feg
 function render()
 {
     $this->_sanitize();
     $tpl = DevblocksPlatform::getTemplateService();
     $tpl->assign('id', $this->id);
     $tpl->assign('view', $this);
     $custom_fields = DAO_CustomField::getBySource(FegCustomFieldSource_Message::ID);
     $tpl->assign('custom_fields', $custom_fields);
     $tpl->assign('view_fields', $this->getColumns());
     switch ($this->renderTemplate) {
         case 'failed':
             $tpl->display('file:' . APP_PATH . '/features/feg.core/templates/setup/tabs/message/view_failed.tpl');
             break;
         case 'format':
             $tpl->display('file:' . APP_PATH . '/features/feg.core/templates/setup/tabs/message/view_format.tpl');
             break;
         default:
             $tpl->display('file:' . APP_PATH . '/features/feg.core/templates/setup/tabs/message/view.tpl');
             break;
     }
 }
コード例 #13
0
ファイル: App.php プロジェクト: joegeck/cerb4
 function getReportAction()
 {
     @($field_id = DevblocksPlatform::importGPC($_REQUEST['field_id'], 'integer', 0));
     $tpl = DevblocksPlatform::getTemplateService();
     $tpl->cache_lifetime = "0";
     $tpl->assign('path', $this->tpl_path);
     // Custom Field sources (tickets, orgs, etc.)
     $source_manifests = DevblocksPlatform::getExtensions('cerberusweb.fields.source', false);
     uasort($source_manifests, create_function('$a, $b', "return strcasecmp(\$a->name,\$b->name);\n"));
     $tpl->assign('source_manifests', $source_manifests);
     $field = DAO_CustomField::get($field_id);
     $tpl->assign('field', $field);
     $value_counts = self::_getValueCounts($field_id);
     $tpl->assign('value_counts', $value_counts);
     $tpl->display('file:' . $this->tpl_path . '/reports/custom_fields/usage/html.tpl');
 }
コード例 #14
0
ファイル: tasks.php プロジェクト: Hildy/cerb5
 function showTasksPropertiesTabAction()
 {
     @($task_id = DevblocksPlatform::importGPC($_REQUEST['id'], 'integer'));
     $tpl = DevblocksPlatform::getTemplateService();
     $tpl_path = dirname(dirname(dirname(__FILE__))) . '/templates/';
     $tpl->assign('path', $tpl_path);
     $task = DAO_Task::get($task_id);
     $tpl->assign('task', $task);
     $active_workers = DAO_Worker::getAllActive();
     $tpl->assign('active_workers', $active_workers);
     $workers = DAO_Worker::getAllWithDisabled();
     $tpl->assign('workers', $workers);
     // Custom fields
     $custom_fields = DAO_CustomField::getBySource(ChCustomFieldSource_Task::ID);
     $tpl->assign('custom_fields', $custom_fields);
     $custom_field_values = DAO_CustomFieldValue::getValuesBySourceIds(ChCustomFieldSource_Task::ID, $task_id);
     if (isset($custom_field_values[$task_id])) {
         $tpl->assign('custom_field_values', $custom_field_values[$task_id]);
     }
     $tpl->display('file:' . $tpl_path . 'tasks/display/tabs/properties.tpl');
 }
コード例 #15
0
ファイル: App.php プロジェクト: rmiddle/cerb4_plugins
 function render($type, $list)
 {
     $fields = DAO_CustomField::getBySource(ChCustomFieldSource_Ticket::ID);
     foreach ($fields as $field_id => $field) {
         if ($field->group_id == 0) {
             $cf_ticket['#cf_ticket_' . $field->name . '#'] = $field->name;
         }
     }
     $list['Custom Ticket Fields'] = $cf_ticket;
     return;
 }
コード例 #16
0
ファイル: Model.php プロジェクト: Hildy/cerb5
 function render()
 {
     $this->_sanitize();
     $tpl = DevblocksPlatform::getTemplateService();
     $tpl->assign('id', $this->id);
     $tpl->assign('view', $this);
     // Tool Manifests
     $tools = DevblocksPlatform::getExtensions('usermeet.tool', false, true);
     $tpl->assign('tool_extensions', $tools);
     // Pull the results so we can do some row introspection
     $results = $this->getData();
     $tpl->assign('results', $results);
     // Custom fields
     $custom_fields = DAO_CustomField::getBySource(CustomFieldSource_CommunityPortal::ID);
     $tpl->assign('custom_fields', $custom_fields);
     $tpl->assign('view_fields', $this->getColumns());
     $tpl->display('file:' . APP_PATH . '/features/usermeet.core/templates/community/config/tab/view.tpl');
 }
コード例 #17
0
ファイル: tasks.php プロジェクト: joegeck/cerb4
 function showTaskBulkPanelAction()
 {
     @($ids = DevblocksPlatform::importGPC($_REQUEST['ids']));
     @($view_id = DevblocksPlatform::importGPC($_REQUEST['view_id']));
     $tpl = DevblocksPlatform::getTemplateService();
     $tpl->assign('view_id', $view_id);
     if (!empty($ids)) {
         $id_list = DevblocksPlatform::parseCsvString($ids);
         $tpl->assign('ids', implode(',', $id_list));
     }
     $workers = DAO_Worker::getAllActive();
     $tpl->assign('workers', $workers);
     // Custom Fields
     $custom_fields = DAO_CustomField::getBySource(ChCustomFieldSource_Task::ID);
     $tpl->assign('custom_fields', $custom_fields);
     $tpl->cache_lifetime = "0";
     $tpl->display('file:' . $this->_TPL_PATH . 'tasks/rpc/bulk.tpl');
 }
コード例 #18
0
ファイル: UmScApp.php プロジェクト: joegeck/cerb4
 function writeResponse(DevblocksHttpResponse $response)
 {
     $tpl = DevblocksPlatform::getTemplateService();
     $tpl_path = dirname(dirname(__FILE__)) . '/templates/';
     $theme = DAO_CommunityToolProperty::get($this->getPortal(), UmScApp::PARAM_THEME, UmScApp::DEFAULT_THEME);
     if (!is_dir($tpl_path . 'portal/sc/themes/' . $theme)) {
         $theme = UmScApp::DEFAULT_THEME;
     }
     $umsession = $this->getSession();
     $active_user = $umsession->getProperty('sc_login', null);
     $stack = $response->path;
     @($module = array_shift($stack));
     switch ($module) {
         default:
         case 'home':
             $sHomeRss = DAO_CommunityToolProperty::get($this->getPortal(), UmScApp::PARAM_HOME_RSS, '');
             $aHomeRss = !empty($sHomeRss) ? unserialize($sHomeRss) : array();
             $feeds = array();
             // [TODO] Implement a feed cache so we aren't bombing out
             foreach ($aHomeRss as $title => $url) {
                 $feed = null;
                 try {
                     $feed = Zend_Feed::import($url);
                 } catch (Exception $e) {
                 }
                 if (!empty($feed) && $feed->count()) {
                     $feeds[] = array('name' => $title, 'feed' => $feed);
                 }
             }
             $tpl->assign('feeds', $feeds);
             $tpl->display("file:{$tpl_path}portal/sc/internal/home/index.tpl");
             break;
         case 'account':
             if (!$this->allow_logins || empty($active_user)) {
                 break;
             }
             $address = DAO_Address::get($active_user->id);
             $tpl->assign('address', $address);
             $tpl->display("file:{$tpl_path}portal/sc/internal/account/index.tpl");
             break;
         case 'kb':
             // KB Roots
             $sKbRoots = DAO_CommunityToolProperty::get($this->getPortal(), UmScApp::PARAM_KB_ROOTS, '');
             $kb_roots = !empty($sKbRoots) ? unserialize($sKbRoots) : array();
             $kb_roots_str = '0';
             if (!empty($kb_roots)) {
                 $kb_roots_str = implode(',', array_keys($kb_roots));
             }
             switch (array_shift($stack)) {
                 case 'article':
                     if (empty($kb_roots)) {
                         return;
                     }
                     $id = intval(array_shift($stack));
                     list($articles, $count) = DAO_KbArticle::search(array(new DevblocksSearchCriteria(SearchFields_KbArticle::ID, '=', $id), new DevblocksSearchCriteria(SearchFields_KbArticle::TOP_CATEGORY_ID, 'in', array_keys($kb_roots))), -1, 0, null, null, false);
                     if (!isset($articles[$id])) {
                         break;
                     }
                     $article = DAO_KbArticle::get($id);
                     $tpl->assign('article', $article);
                     @($article_list = $umsession->getProperty(UmScApp::SESSION_ARTICLE_LIST, array()));
                     if (!empty($article) && !isset($article_list[$id])) {
                         DAO_KbArticle::update($article->id, array(DAO_KbArticle::VIEWS => ++$article->views));
                         $article_list[$id] = $id;
                         $umsession->setProperty(UmScApp::SESSION_ARTICLE_LIST, $article_list);
                     }
                     $categories = DAO_KbCategory::getWhere();
                     $tpl->assign('categories', $categories);
                     $cats = DAO_KbArticle::getCategoriesByArticleId($id);
                     $breadcrumbs = array();
                     foreach ($cats as $cat_id) {
                         if (!isset($breadcrumbs[$cat_id])) {
                             $breadcrumbs[$cat_id] = array();
                         }
                         $pid = $cat_id;
                         while ($pid) {
                             $breadcrumbs[$cat_id][] = $pid;
                             $pid = $categories[$pid]->parent_id;
                         }
                         $breadcrumbs[$cat_id] = array_reverse($breadcrumbs[$cat_id]);
                         // Remove any breadcrumbs not in this SC profile
                         $pid = reset($breadcrumbs[$cat_id]);
                         if (!isset($kb_roots[$pid])) {
                             unset($breadcrumbs[$cat_id]);
                         }
                     }
                     $tpl->assign('breadcrumbs', $breadcrumbs);
                     $tpl->display("file:{$tpl_path}portal/sc/internal/kb/article.tpl");
                     break;
                 default:
                 case 'browse':
                     @($root = intval(array_shift($stack)));
                     $tpl->assign('root_id', $root);
                     $categories = DAO_KbCategory::getWhere();
                     $tpl->assign('categories', $categories);
                     $tree_map = DAO_KbCategory::getTreeMap(0);
                     // Remove other top-level categories
                     if (is_array($tree_map[0])) {
                         foreach ($tree_map[0] as $child_id => $count) {
                             if (!isset($kb_roots[$child_id])) {
                                 unset($tree_map[0][$child_id]);
                             }
                         }
                     }
                     // Remove empty categories
                     if (is_array($tree_map[0])) {
                         foreach ($tree_map as $node_id => $children) {
                             foreach ($children as $child_id => $count) {
                                 if (empty($count)) {
                                     @($pid = $categories[$child_id]->parent_id);
                                     unset($tree_map[$pid][$child_id]);
                                     unset($tree_map[$child_id]);
                                 }
                             }
                         }
                     }
                     $tpl->assign('tree', $tree_map);
                     // Breadcrumb // [TODO] API-ize inside Model_KbTree ?
                     $breadcrumb = array();
                     $pid = $root;
                     while (0 != $pid) {
                         $breadcrumb[] = $pid;
                         $pid = $categories[$pid]->parent_id;
                     }
                     $tpl->assign('breadcrumb', array_reverse($breadcrumb));
                     $tpl->assign('mid', @intval(ceil(count($tree_map[$root]) / 2)));
                     // Articles
                     if (!empty($root)) {
                         list($articles, $count) = DAO_KbArticle::search(array(new DevblocksSearchCriteria(SearchFields_KbArticle::CATEGORY_ID, '=', $root), new DevblocksSearchCriteria(SearchFields_KbArticle::TOP_CATEGORY_ID, 'in', array_keys($kb_roots))), -1, 0, null, null, false);
                     }
                     $tpl->assign('articles', $articles);
                     $tpl->display("file:{$tpl_path}portal/sc/internal/kb/index.tpl");
                     break;
             }
             break;
         case 'answers':
             $query = rawurldecode(array_shift($stack));
             $tpl->assign('query', $query);
             $sFnrSources = DAO_CommunityToolProperty::get($this->getPortal(), UmScApp::PARAM_FNR_SOURCES, '');
             $aFnrSources = !empty($sFnrSources) ? unserialize($sFnrSources) : array();
             if (!empty($query)) {
                 // [JAS]: If we've been customized with specific sources, use them
                 $where = !empty($aFnrSources) ? sprintf("%s IN (%s)", DAO_FnrExternalResource::ID, implode(',', array_keys($aFnrSources))) : sprintf("%s IN (-1)", DAO_FnrExternalResource::ID);
                 $resources = DAO_FnrExternalResource::getWhere($where);
                 $feeds = Model_FnrExternalResource::searchResources($resources, $query);
                 $tpl->assign('feeds', $feeds);
                 $fields = array(DAO_FnrQuery::QUERY => $query, DAO_FnrQuery::CREATED => time(), DAO_FnrQuery::SOURCE => $this->getPortal(), DAO_FnrQuery::NO_MATCH => empty($feeds) ? 1 : 0);
                 DAO_FnrQuery::create($fields);
             }
             // KB
             $sKbRoots = DAO_CommunityToolProperty::get($this->getPortal(), UmScApp::PARAM_KB_ROOTS, '');
             $kb_roots = !empty($sKbRoots) ? unserialize($sKbRoots) : array();
             list($articles, $count) = DAO_KbArticle::search(array(array(DevblocksSearchCriteria::GROUP_OR, new DevblocksSearchCriteria(SearchFields_KbArticle::TITLE, 'fulltext', $query), new DevblocksSearchCriteria(SearchFields_KbArticle::CONTENT, 'fulltext', $query)), new DevblocksSearchCriteria(SearchFields_KbArticle::TOP_CATEGORY_ID, 'in', array_keys($kb_roots))), 100, 0, null, null, true);
             $tpl->assign('articles', $articles);
             $tpl->display("file:{$tpl_path}portal/sc/internal/answers/index.tpl");
             break;
         case 'contact':
             $response = array_shift($stack);
             $settings = CerberusSettings::getInstance();
             $default_from = $settings->get(CerberusSettings::DEFAULT_REPLY_FROM);
             $tpl->assign('default_from', $default_from);
             switch ($response) {
                 case 'confirm':
                     $tpl->assign('last_opened', $umsession->getProperty('support.write.last_opened', ''));
                     $tpl->display("file:{$tpl_path}portal/sc/internal/contact/confirm.tpl");
                     break;
                 default:
                 case 'step1':
                     $umsession->setProperty('support.write.last_error', null);
                 case 'step2':
                     $sFrom = $umsession->getProperty('support.write.last_from', '');
                     $sSubject = $umsession->getProperty('support.write.last_subject', '');
                     $sNature = $umsession->getProperty('support.write.last_nature', '');
                     $sContent = $umsession->getProperty('support.write.last_content', '');
                     //		    			$aLastFollowupQ = $umsession->getProperty('support.write.last_followup_q','');
                     $aLastFollowupA = $umsession->getProperty('support.write.last_followup_a', '');
                     $sError = $umsession->getProperty('support.write.last_error', '');
                     $tpl->assign('last_from', $sFrom);
                     $tpl->assign('last_subject', $sSubject);
                     $tpl->assign('last_nature', $sNature);
                     $tpl->assign('last_content', $sContent);
                     //						$tpl->assign('last_followup_q', $aLastFollowupQ);
                     $tpl->assign('last_followup_a', $aLastFollowupA);
                     $tpl->assign('last_error', $sError);
                     $sDispatch = DAO_CommunityToolProperty::get($this->getPortal(), UmScApp::PARAM_DISPATCH, '');
                     //		    			$dispatch = !empty($sDispatch) ? (is_array($sDispatch) ? unserialize($sDispatch): array($sDispatch)) : array();
                     $dispatch = !empty($sDispatch) ? unserialize($sDispatch) : array();
                     $tpl->assign('dispatch', $dispatch);
                     switch ($response) {
                         default:
                             // If there's only one situation, skip to step2
                             if (1 == count($dispatch)) {
                                 @($sNature = md5(key($dispatch)));
                                 $umsession->setProperty('support.write.last_nature', $sNature);
                                 reset($dispatch);
                             } else {
                                 $tpl->display("file:{$tpl_path}portal/sc/internal/contact/step1.tpl");
                                 break;
                             }
                         case 'step2':
                             // Cache along with answers?
                             if (is_array($dispatch)) {
                                 foreach ($dispatch as $k => $v) {
                                     if (md5($k) == $sNature) {
                                         $umsession->setProperty('support.write.last_nature_string', $k);
                                         $tpl->assign('situation', $k);
                                         $tpl->assign('situation_params', $v);
                                         break;
                                     }
                                 }
                             }
                             $ticket_fields = DAO_CustomField::getBySource('cerberusweb.fields.source.ticket');
                             $tpl->assign('ticket_fields', $ticket_fields);
                             $tpl->display("file:{$tpl_path}portal/sc/internal/contact/step2.tpl");
                             break;
                     }
                     break;
             }
             break;
             //				$tpl->display("file:${tpl_path}portal/sc/internal/contact/index.tpl");
             //				break;
         //				$tpl->display("file:${tpl_path}portal/sc/internal/contact/index.tpl");
         //				break;
         case 'history':
             if (!$this->allow_logins || empty($active_user)) {
                 break;
             }
             $mask = array_shift($stack);
             if (empty($mask)) {
                 list($open_tickets) = DAO_Ticket::search(array(), array(new DevblocksSearchCriteria(SearchFields_Ticket::TICKET_FIRST_WROTE_ID, '=', $active_user->id), new DevblocksSearchCriteria(SearchFields_Ticket::TICKET_CLOSED, '=', 0)), -1, 0, SearchFields_Ticket::TICKET_UPDATED_DATE, false, false);
                 $tpl->assign('open_tickets', $open_tickets);
                 list($closed_tickets) = DAO_Ticket::search(array(), array(new DevblocksSearchCriteria(SearchFields_Ticket::TICKET_FIRST_WROTE_ID, '=', $active_user->id), new DevblocksSearchCriteria(SearchFields_Ticket::TICKET_CLOSED, '=', 1)), -1, 0, SearchFields_Ticket::TICKET_UPDATED_DATE, false, false);
                 $tpl->assign('closed_tickets', $closed_tickets);
                 $tpl->display("file:{$tpl_path}portal/sc/internal/history/index.tpl");
             } else {
                 // Secure retrieval (address + mask)
                 list($tickets) = DAO_Ticket::search(array(), array(new DevblocksSearchCriteria(SearchFields_Ticket::TICKET_MASK, '=', $mask), new DevblocksSearchCriteria(SearchFields_Ticket::TICKET_FIRST_WROTE_ID, '=', $active_user->id)), 1, 0, null, null, false);
                 $ticket = array_shift($tickets);
                 // Security check (mask compare)
                 if (0 == strcasecmp($ticket[SearchFields_Ticket::TICKET_MASK], $mask)) {
                     $messages = DAO_Ticket::getMessagesByTicket($ticket[SearchFields_Ticket::TICKET_ID]);
                     $messages = array_reverse($messages, true);
                     $tpl->assign('ticket', $ticket);
                     $tpl->assign('messages', $messages);
                     $tpl->display("file:{$tpl_path}portal/sc/internal/history/display.tpl");
                 }
             }
             break;
         case 'register':
             if (!$this->allow_logins) {
                 break;
             }
             @($step = array_shift($stack));
             switch ($step) {
                 case 'forgot':
                     $tpl->display("file:{$tpl_path}portal/sc/internal/register/forgot.tpl");
                     break;
                 case 'forgot2':
                     $tpl->display("file:{$tpl_path}portal/sc/internal/register/forgot_confirm.tpl");
                     break;
                 case 'confirm':
                     $tpl->display("file:{$tpl_path}portal/sc/internal/register/confirm.tpl");
                     break;
                 default:
                     $tpl->display("file:{$tpl_path}portal/sc/internal/register/index.tpl");
                     break;
             }
             break;
     }
     //		print_r($response);
 }
コード例 #19
0
ファイル: App.php プロジェクト: Hildy/cerb5
 function showBulkPanelAction()
 {
     @($id_csv = DevblocksPlatform::importGPC($_REQUEST['ids']));
     @($view_id = DevblocksPlatform::importGPC($_REQUEST['view_id']));
     $tpl = DevblocksPlatform::getTemplateService();
     $path = dirname(dirname(__FILE__)) . '/templates/';
     $tpl->assign('path', $path);
     $tpl->assign('view_id', $view_id);
     if (!empty($id_csv)) {
         $ids = DevblocksPlatform::parseCsvString($id_csv);
         $tpl->assign('ids', implode(',', $ids));
     }
     // Custom Fields
     $custom_fields = DAO_CustomField::getBySource(ChCustomFieldSource_FeedbackEntry::ID);
     $tpl->assign('custom_fields', $custom_fields);
     $tpl->display('file:' . $path . 'feedback/bulk.tpl');
 }
コード例 #20
0
ファイル: DAO.class.php プロジェクト: rmiddle/cerb4
 /**
  * @return DevblocksSearchField[]
  */
 static function getFields()
 {
     $translate = DevblocksPlatform::getTranslationService();
     $columns = array(self::ID => new DevblocksSearchField(self::ID, 't', 'id', null, $translate->_('task.id')), self::UPDATED_DATE => new DevblocksSearchField(self::UPDATED_DATE, 't', 'updated_date', null, $translate->_('task.updated_date')), self::TITLE => new DevblocksSearchField(self::TITLE, 't', 'title', null, $translate->_('task.title')), self::IS_COMPLETED => new DevblocksSearchField(self::IS_COMPLETED, 't', 'is_completed', null, $translate->_('task.is_completed')), self::DUE_DATE => new DevblocksSearchField(self::DUE_DATE, 't', 'due_date', null, $translate->_('task.due_date')), self::COMPLETED_DATE => new DevblocksSearchField(self::COMPLETED_DATE, 't', 'completed_date', null, $translate->_('task.completed_date')), self::WORKER_ID => new DevblocksSearchField(self::WORKER_ID, 't', 'worker_id', null, $translate->_('task.worker_id')), self::SOURCE_EXTENSION => new DevblocksSearchField(self::SOURCE_EXTENSION, 't', 'source_extension', null, $translate->_('task.source_extension')), self::SOURCE_ID => new DevblocksSearchField(self::SOURCE_ID, 't', 'source_id', null, $translate->_('task.source_id')));
     // Custom Fields
     $fields = DAO_CustomField::getBySource(ChCustomFieldSource_Task::ID);
     if (is_array($fields)) {
         foreach ($fields as $field_id => $field) {
             $key = 'cf_' . $field_id;
             $columns[$key] = new DevblocksSearchField($key, $key, 'field_value', null, $field->name);
         }
     }
     // Sort by label (translation-conscious)
     uasort($columns, create_function('$a, $b', "return strcasecmp(\$a->db_label,\$b->db_label);\n"));
     return $columns;
 }
コード例 #21
0
ファイル: groups.php プロジェクト: Hildy/cerb5
 function saveTabFieldsAction()
 {
     @($group_id = DevblocksPlatform::importGPC($_POST['team_id'], 'integer'));
     @($active_worker = CerberusApplication::getActiveWorker());
     if (!$active_worker->isTeamManager($group_id) && !$active_worker->is_superuser) {
         return;
     }
     @($ids = DevblocksPlatform::importGPC($_POST['ids'], 'array', array()));
     @($names = DevblocksPlatform::importGPC($_POST['names'], 'array', array()));
     @($orders = DevblocksPlatform::importGPC($_POST['orders'], 'array', array()));
     @($options = DevblocksPlatform::importGPC($_POST['options'], 'array', array()));
     @($allow_delete = DevblocksPlatform::importGPC($_POST['allow_delete'], 'integer', 0));
     @($deletes = DevblocksPlatform::importGPC($_POST['deletes'], 'array', array()));
     if (!empty($ids)) {
         foreach ($ids as $idx => $id) {
             @($name = $names[$idx]);
             @($order = intval($orders[$idx]));
             @($option = $options[$idx]);
             @($delete = false !== array_search($id, $deletes) ? 1 : 0);
             if ($allow_delete && $delete) {
                 DAO_CustomField::delete($id);
             } else {
                 $fields = array(DAO_CustomField::NAME => $name, DAO_CustomField::POS => $order, DAO_CustomField::OPTIONS => !is_null($option) ? $option : '');
                 DAO_CustomField::update($id, $fields);
             }
         }
     }
     // Add custom field
     @($add_name = DevblocksPlatform::importGPC($_POST['add_name'], 'string', ''));
     @($add_type = DevblocksPlatform::importGPC($_POST['add_type'], 'string', ''));
     @($add_options = DevblocksPlatform::importGPC($_POST['add_options'], 'string', ''));
     if (!empty($add_name) && !empty($add_type)) {
         $fields = array(DAO_CustomField::NAME => $add_name, DAO_CustomField::TYPE => $add_type, DAO_CustomField::GROUP_ID => $group_id, DAO_CustomField::SOURCE_EXTENSION => ChCustomFieldSource_Ticket::ID, DAO_CustomField::OPTIONS => $add_options);
         $id = DAO_CustomField::create($fields);
     }
     DevblocksPlatform::setHttpResponse(new DevblocksHttpResponse(array('groups', $group_id, 'fields')));
 }
コード例 #22
0
ファイル: DAO.php プロジェクト: Hildy/cerb5
 /**
  * @return DevblocksSearchField[]
  */
 static function getFields()
 {
     $translate = DevblocksPlatform::getTranslationService();
     $columns = array(SearchFields_CommunityTool::ID => new DevblocksSearchField(SearchFields_CommunityTool::ID, 'ct', 'id', null, $translate->_('common.id')), SearchFields_CommunityTool::NAME => new DevblocksSearchField(SearchFields_CommunityTool::NAME, 'ct', 'name', null, $translate->_('community_portal.name')), SearchFields_CommunityTool::CODE => new DevblocksSearchField(SearchFields_CommunityTool::CODE, 'ct', 'code', null, $translate->_('community_portal.code')), SearchFields_CommunityTool::EXTENSION_ID => new DevblocksSearchField(SearchFields_CommunityTool::EXTENSION_ID, 'ct', 'extension_id', null, $translate->_('community_portal.extension_id')));
     // Custom Fields
     $fields = DAO_CustomField::getBySource(CustomFieldSource_CommunityPortal::ID);
     if (is_array($fields)) {
         foreach ($fields as $field_id => $field) {
             $key = 'cf_' . $field_id;
             $columns[$key] = new DevblocksSearchField($key, $key, 'field_value', null, $field->name);
         }
     }
     // Sort by label (translation-conscious)
     uasort($columns, create_function('$a, $b', "return strcasecmp(\$a->db_label,\$b->db_label);\n"));
     return $columns;
 }
コード例 #23
0
ファイル: App.php プロジェクト: joegeck/cerb4
 function render()
 {
     $this->_sanitize();
     $tpl = DevblocksPlatform::getTemplateService();
     $tpl->assign('id', $this->id);
     $tpl->assign('view', $this);
     $workers = DAO_Worker::getAll();
     $tpl->assign('workers', $workers);
     // Custom fields
     $custom_fields = DAO_CustomField::getBySource(CrmCustomFieldSource_Opportunity::ID);
     $tpl->assign('custom_fields', $custom_fields);
     $tpl->cache_lifetime = "0";
     $tpl->assign('view_fields', $this->getColumns());
     $tpl->display('file:' . DEVBLOCKS_PLUGIN_PATH . 'cerberusweb.crm/templates/crm/opps/view.tpl');
 }
コード例 #24
0
ファイル: DAO.class.php プロジェクト: rmiddle/usermeet
 /**
  * @return DevblocksSearchField[]
  */
 static function getFields()
 {
     $translate = DevblocksPlatform::getTranslationService();
     $columns = array(self::ID => new DevblocksSearchField(self::ID, 'w', 'id', $translate->_('common.id')), self::FIRST_NAME => new DevblocksSearchField(self::FIRST_NAME, 'w', 'first_name', $translate->_('worker.first_name')), self::LAST_NAME => new DevblocksSearchField(self::LAST_NAME, 'w', 'last_name', $translate->_('worker.last_name')), self::TITLE => new DevblocksSearchField(self::TITLE, 'w', 'title', $translate->_('worker.title')), self::EMAIL => new DevblocksSearchField(self::EMAIL, 'w', 'email', null, ucwords($translate->_('common.email'))), self::IS_SUPERUSER => new DevblocksSearchField(self::IS_SUPERUSER, 'w', 'is_superuser', $translate->_('worker.is_superuser')), self::LAST_ACTIVITY => new DevblocksSearchField(self::LAST_ACTIVITY, 'w', 'last_activity', $translate->_('worker.last_activity')), self::LAST_ACTIVITY_DATE => new DevblocksSearchField(self::LAST_ACTIVITY_DATE, 'w', 'last_activity_date', $translate->_('worker.last_activity_date')), self::IS_DISABLED => new DevblocksSearchField(self::IS_DISABLED, 'w', 'is_disabled', ucwords($translate->_('common.disabled'))));
     // Custom Fields
     $fields = DAO_CustomField::getBySource(UmCustomFieldSource_Worker::ID);
     if (is_array($fields)) {
         foreach ($fields as $field_id => $field) {
             $key = 'cf_' . $field_id;
             $columns[$key] = new DevblocksSearchField($key, $key, 'field_value', $field->name);
         }
     }
     // Sort by label (translation-conscious)
     uasort($columns, create_function('$a, $b', "return strcasecmp(\$a->db_label,\$b->db_label);\n"));
     return $columns;
 }
コード例 #25
0
ファイル: DAO.class.php プロジェクト: rmiddle/feg
 public static function getValuesBySourceIds($source_ext_id, $source_ids)
 {
     if (is_null($source_ids)) {
         return array();
     } elseif (!is_array($source_ids)) {
         $source_ids = array($source_ids);
     }
     if (empty($source_ids)) {
         return array();
     }
     $db = DevblocksPlatform::getDatabaseService();
     $results = array();
     $fields = DAO_CustomField::getAll();
     // [TODO] This is inefficient (and redundant)
     // STRINGS
     $sql = sprintf("SELECT source_id, field_id, field_value " . "FROM custom_field_stringvalue " . "WHERE source_extension = '%s' AND source_id IN (%s)", $source_ext_id, implode(',', $source_ids));
     $rs = $db->Execute($sql) or die(__CLASS__ . '(' . __LINE__ . ')' . ':' . $db->ErrorMsg());
     while ($row = mysql_fetch_assoc($rs)) {
         $source_id = intval($row['source_id']);
         $field_id = intval($row['field_id']);
         $field_value = $row['field_value'];
         if (!isset($results[$source_id])) {
             $results[$source_id] = array();
         }
         $source =& $results[$source_id];
         // If multiple value type (multi-picklist, multi-checkbox)
         if ($fields[$field_id]->type == 'M' || $fields[$field_id]->type == 'X') {
             if (!isset($source[$field_id])) {
                 $source[$field_id] = array();
             }
             $source[$field_id][$field_value] = $field_value;
         } else {
             // single value
             $source[$field_id] = $field_value;
         }
     }
     mysql_free_result($rs);
     // CLOBS
     $sql = sprintf("SELECT source_id, field_id, field_value " . "FROM custom_field_clobvalue " . "WHERE source_extension = '%s' AND source_id IN (%s)", $source_ext_id, implode(',', $source_ids));
     $rs = $db->Execute($sql) or die(__CLASS__ . '(' . __LINE__ . ')' . ':' . $db->ErrorMsg());
     while ($row = mysql_fetch_assoc($rs)) {
         $source_id = intval($row['source_id']);
         $field_id = intval($row['field_id']);
         $field_value = $row['field_value'];
         if (!isset($results[$source_id])) {
             $results[$source_id] = array();
         }
         $source =& $results[$source_id];
         $source[$field_id] = $field_value;
     }
     mysql_free_result($rs);
     // NUMBERS
     $sql = sprintf("SELECT source_id, field_id, field_value " . "FROM custom_field_numbervalue " . "WHERE source_extension = '%s' AND source_id IN (%s)", $source_ext_id, implode(',', $source_ids));
     $rs = $db->Execute($sql) or die(__CLASS__ . '(' . __LINE__ . ')' . ':' . $db->ErrorMsg());
     while ($row = mysql_fetch_assoc($rs)) {
         $source_id = intval($row['source_id']);
         $field_id = intval($row['field_id']);
         $field_value = $row['field_value'];
         if (!isset($results[$source_id])) {
             $results[$source_id] = array();
         }
         $source =& $results[$source_id];
         $source[$field_id] = $field_value;
     }
     mysql_free_result($rs);
     return $results;
 }
コード例 #26
0
ファイル: DAO.class.php プロジェクト: jsjohnst/cerb4
 /**
  * @return DevblocksSearchField[]
  */
 static function getFields()
 {
     $translate = DevblocksPlatform::getTranslationService();
     $columns = array(self::ID => new DevblocksSearchField(self::ID, 't', 'id', null, $translate->_('task.id')), self::TITLE => new DevblocksSearchField(self::TITLE, 't', 'title', null, $translate->_('task.title')), self::IS_COMPLETED => new DevblocksSearchField(self::IS_COMPLETED, 't', 'is_completed', null, $translate->_('task.is_completed')), self::DUE_DATE => new DevblocksSearchField(self::DUE_DATE, 't', 'due_date', null, $translate->_('task.due_date')), self::COMPLETED_DATE => new DevblocksSearchField(self::COMPLETED_DATE, 't', 'completed_date', null, $translate->_('task.completed_date')), self::CONTENT => new DevblocksSearchField(self::CONTENT, 't', 'content', null, $translate->_('task.content')), self::WORKER_ID => new DevblocksSearchField(self::WORKER_ID, 't', 'worker_id', null, $translate->_('task.worker_id')), self::SOURCE_EXTENSION => new DevblocksSearchField(self::SOURCE_EXTENSION, 't', 'source_extension', null, $translate->_('task.source_extension')), self::SOURCE_ID => new DevblocksSearchField(self::SOURCE_ID, 't', 'source_id', null, $translate->_('task.source_id')));
     // Custom Fields
     $fields = DAO_CustomField::getBySource(ChCustomFieldSource_Task::ID);
     if (is_array($fields)) {
         foreach ($fields as $field_id => $field) {
             $key = 'cf_' . $field_id;
             $columns[$key] = new DevblocksSearchField($key, $key, 'field_value', null, $field->name);
         }
     }
     return $columns;
 }
コード例 #27
0
ファイル: setup.php プロジェクト: rmiddle/feg
 function saveFieldsAction()
 {
     $translate = DevblocksPlatform::getTranslationService();
     $worker = FegApplication::getActiveWorker();
     if (!$worker || !$worker->is_superuser) {
         echo $translate->_('common.access_denied');
         return;
     }
     // Type of custom fields
     @($ext_id = DevblocksPlatform::importGPC($_POST['ext_id'], 'string', ''));
     // Properties
     @($ids = DevblocksPlatform::importGPC($_POST['ids'], 'array', array()));
     @($names = DevblocksPlatform::importGPC($_POST['names'], 'array', array()));
     @($orders = DevblocksPlatform::importGPC($_POST['orders'], 'array', array()));
     @($options = DevblocksPlatform::importGPC($_POST['options'], 'array', array()));
     @($deletes = DevblocksPlatform::importGPC($_POST['deletes'], 'array', array()));
     if (!empty($ids) && !empty($ext_id)) {
         foreach ($ids as $idx => $id) {
             @($name = $names[$idx]);
             @($order = intval($orders[$idx]));
             @($option = $options[$idx]);
             @($delete = false !== array_search($id, $deletes) ? 1 : 0);
             if ($delete) {
                 DAO_CustomField::delete($id);
             } else {
                 $fields = array(DAO_CustomField::NAME => $name, DAO_CustomField::POS => $order, DAO_CustomField::OPTIONS => !is_null($option) ? $option : '');
                 DAO_CustomField::update($id, $fields);
             }
         }
     }
     // Adding
     @($add_name = DevblocksPlatform::importGPC($_POST['add_name'], 'string', ''));
     @($add_type = DevblocksPlatform::importGPC($_POST['add_type'], 'string', ''));
     @($add_options = DevblocksPlatform::importGPC($_POST['add_options'], 'string', ''));
     if (!empty($add_name) && !empty($add_type)) {
         $fields = array(DAO_CustomField::NAME => $add_name, DAO_CustomField::TYPE => $add_type, DAO_CustomField::SOURCE_EXTENSION => $ext_id, DAO_CustomField::OPTIONS => $add_options);
         $id = DAO_CustomField::create($fields);
     }
     // Redraw the form
     $this->_getFieldSource($ext_id);
 }
コード例 #28
0
ファイル: customer_recipient.php プロジェクト: rmiddle/feg
 function render()
 {
     $this->_sanitize();
     $tpl = DevblocksPlatform::getTemplateService();
     $tpl->assign('id', $this->id);
     $tpl->assign('view', $this);
     $custom_fields = DAO_CustomField::getBySource(FegCustomFieldSource_CustomerRecipient::ID);
     $tpl->assign('custom_fields', $custom_fields);
     $tpl->assign('view_fields', $this->getColumns());
     $tpl->display('file:' . APP_PATH . '/features/feg.core/templates/internal/tabs/customer_recipient/view.tpl');
 }
コード例 #29
0
ファイル: config.php プロジェクト: Hildy/cerb5
 function saveMailRoutingRuleAddAction()
 {
     $translate = DevblocksPlatform::getTranslationService();
     @($id = DevblocksPlatform::importGPC($_REQUEST['id'], 'integer', 0));
     @($active_worker = CerberusApplication::getActiveWorker());
     if (!$active_worker->is_superuser) {
         return;
     }
     /*****************************/
     @($name = DevblocksPlatform::importGPC($_POST['name'], 'string', ''));
     @($is_sticky = DevblocksPlatform::importGPC($_POST['is_sticky'], 'integer', 0));
     //		@$is_stackable = DevblocksPlatform::importGPC($_POST['is_stackable'],'integer',0);
     @($rules = DevblocksPlatform::importGPC($_POST['rules'], 'array', array()));
     @($do = DevblocksPlatform::importGPC($_POST['do'], 'array', array()));
     if (empty($name)) {
         $name = $translate->_('Mail Routing Rule');
     }
     $criterion = array();
     $actions = array();
     // Custom fields
     $custom_fields = DAO_CustomField::getAll();
     // 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 'dayofweek':
                     // days
                     $days = DevblocksPlatform::importGPC($_REQUEST['value_dayofweek'], 'array', array());
                     if (in_array(0, $days)) {
                         $criteria['sun'] = 'Sunday';
                     }
                     if (in_array(1, $days)) {
                         $criteria['mon'] = 'Monday';
                     }
                     if (in_array(2, $days)) {
                         $criteria['tue'] = 'Tuesday';
                     }
                     if (in_array(3, $days)) {
                         $criteria['wed'] = 'Wednesday';
                     }
                     if (in_array(4, $days)) {
                         $criteria['thu'] = 'Thursday';
                     }
                     if (in_array(5, $days)) {
                         $criteria['fri'] = 'Friday';
                     }
                     if (in_array(6, $days)) {
                         $criteria['sat'] = 'Saturday';
                     }
                     unset($criteria['value']);
                     break;
                 case 'timeofday':
                     $from = DevblocksPlatform::importGPC($_REQUEST['timeofday_from'], 'string', '');
                     $to = DevblocksPlatform::importGPC($_REQUEST['timeofday_to'], 'string', '');
                     $criteria['from'] = $from;
                     $criteria['to'] = $to;
                     unset($criteria['value']);
                     break;
                 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;
                 //				case 'attachment':
                 //					break;
                 default:
                     // ignore invalids // [TODO] Very redundant
                     // Custom fields
                     if ("cf_" == substr($rule, 0, 3)) {
                         $field_id = intval(substr($rule, 3));
                         if (!isset($custom_fields[$field_id])) {
                             continue;
                         }
                         switch ($custom_fields[$field_id]->type) {
                             case 'S':
                                 // string
                             // string
                             case 'T':
                                 // clob
                             // clob
                             case 'U':
                                 // URL
                                 $oper = DevblocksPlatform::importGPC($_REQUEST['value_cf_' . $field_id . '_oper'], 'string', 'regexp');
                                 $criteria['oper'] = $oper;
                                 break;
                             case 'D':
                                 // dropdown
                             // dropdown
                             case 'M':
                                 // multi-dropdown
                             // multi-dropdown
                             case 'X':
                                 // multi-checkbox
                             // multi-checkbox
                             case 'W':
                                 // worker
                                 $in_array = DevblocksPlatform::importGPC($_REQUEST['value_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;
                                     }
                                 }
                                 $criteria['value'] = $out_array;
                                 break;
                             case 'E':
                                 // date
                                 $from = DevblocksPlatform::importGPC($_REQUEST['value_cf_' . $field_id . '_from'], 'string', '0');
                                 $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
                             // 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_MailToGroupRule::NAME => $name, DAO_MailToGroupRule::IS_STICKY => $is_sticky, DAO_MailToGroupRule::CRITERIA_SER => serialize($criterion), DAO_MailToGroupRule::ACTIONS_SER => serialize($actions));
     // Only sticky filters can manual order and be stackable
     if (!$is_sticky) {
         $fields[DAO_MailToGroupRule::STICKY_ORDER] = 0;
         //   			$fields[DAO_MailToGroupRule::IS_STACKABLE] = 0;
         //   		} else { // is sticky
         //   			$fields[DAO_MailToGroupRule::IS_STACKABLE] = $is_stackable;
     }
     // Create
     if (empty($id)) {
         $fields[DAO_MailToGroupRule::POS] = 0;
         $id = DAO_MailToGroupRule::create($fields);
         // Update
     } else {
         DAO_MailToGroupRule::update($id, $fields);
     }
     DevblocksPlatform::redirect(new DevblocksHttpResponse(array('config', 'parser')));
 }
コード例 #30
0
ファイル: Model.class.php プロジェクト: rmiddle/cerb4
 /**
  * @param integer[] $ticket_ids
  */
 function run($ticket_ids)
 {
     if (!is_array($ticket_ids)) {
         $ticket_ids = array($ticket_ids);
     }
     $fields = array();
     $field_values = array();
     $groups = DAO_Group::getAll();
     $buckets = DAO_Bucket::getAll();
     //		$workers = DAO_Worker::getAll();
     $custom_fields = DAO_CustomField::getAll();
     // actions
     if (is_array($this->actions)) {
         foreach ($this->actions as $action => $params) {
             switch ($action) {
                 //				case 'status':
                 //					if(isset($params['is_waiting']))
                 //						$fields[DAO_Ticket::IS_WAITING] = intval($params['is_waiting']);
                 //					if(isset($params['is_closed']))
                 //						$fields[DAO_Ticket::IS_CLOSED] = intval($params['is_closed']);
                 //					if(isset($params['is_deleted']))
                 //						$fields[DAO_Ticket::IS_DELETED] = intval($params['is_deleted']);
                 //					break;
                 //				case 'assign':
                 //					if(isset($params['worker_id'])) {
                 //						$w_id = intval($params['worker_id']);
                 //						if(0 == $w_id || isset($workers[$w_id]))
                 //							$fields[DAO_Ticket::NEXT_WORKER_ID] = $w_id;
                 //					}
                 //					break;
                 case 'move':
                     if (isset($params['group_id']) && isset($params['bucket_id'])) {
                         $g_id = intval($params['group_id']);
                         $b_id = intval($params['bucket_id']);
                         if (isset($groups[$g_id]) && (0 == $b_id || isset($buckets[$b_id]))) {
                             $fields[DAO_Ticket::TEAM_ID] = $g_id;
                             $fields[DAO_Ticket::CATEGORY_ID] = $b_id;
                         }
                     }
                     break;
                     //				case 'spam':
                     //					if(isset($params['is_spam'])) {
                     //						if(intval($params['is_spam'])) {
                     //							foreach($ticket_ids as $ticket_id)
                     //								CerberusBayes::markTicketAsSpam($ticket_id);
                     //						} else {
                     //							foreach($ticket_ids as $ticket_id)
                     //								CerberusBayes::markTicketAsNotSpam($ticket_id);
                     //						}
                     //					}
                     //					break;
                 //				case 'spam':
                 //					if(isset($params['is_spam'])) {
                 //						if(intval($params['is_spam'])) {
                 //							foreach($ticket_ids as $ticket_id)
                 //								CerberusBayes::markTicketAsSpam($ticket_id);
                 //						} else {
                 //							foreach($ticket_ids as $ticket_id)
                 //								CerberusBayes::markTicketAsNotSpam($ticket_id);
                 //						}
                 //					}
                 //					break;
                 default:
                     // Custom fields
                     if (substr($action, 0, 3) == "cf_") {
                         $field_id = intval(substr($action, 3));
                         if (!isset($custom_fields[$field_id]) || !isset($params['value'])) {
                             break;
                         }
                         $field_values[$field_id] = $params;
                     }
                     break;
             }
         }
     }
     if (!empty($ticket_ids)) {
         if (!empty($fields)) {
             DAO_Ticket::updateTicket($ticket_ids, $fields);
         }
         // Custom Fields
         C4_AbstractView::_doBulkSetCustomFields(ChCustomFieldSource_Ticket::ID, $field_values, $ticket_ids);
     }
 }