function reset_sub_arrays($name)
{
    Utils_CommonDataCommon::reset_array_positions($name);
    $arr = Utils_CommonDataCommon::get_array($name, false, false, true);
    foreach ($arr as $k => $v) {
        if (empty($k)) {
            continue;
        }
        reset_sub_arrays($name . '/' . $k);
    }
}
Example #2
0
 public static function crm_clearance($all = false)
 {
     $clearance = array();
     $all |= Base_AclCommon::i_am_sa();
     $me = CRM_ContactsCommon::get_my_record();
     //$mc = CRM_ContactsCommon::get_main_company();
     if ($all || $me['id'] != -1) {
         $access_vals = Utils_CommonDataCommon::get_array('Contacts/Access', true);
         if ($all) {
             $access = array_keys($access_vals);
         } else {
             $access = $me['access'];
         }
         foreach ($access as $g) {
             $clearance[__('Access') . ': ' . $access_vals[$g]] = 'ACCESS:' . $g;
         }
     }
     return $clearance;
 }
Example #3
0
 public function applet($conf, &$opts)
 {
     $opts['go'] = true;
     $opts['title'] = __('Tasks') . ($conf['related'] == 0 ? ' - ' . __('Todo') : '') . ($conf['related'] == 1 ? ' - ' . __('Related') : '') . ($conf['term'] == 's' ? ' - ' . __('Short-term') : ($conf['term'] == 'l' ? ' - ' . __('Long-term') : ''));
     $me = CRM_ContactsCommon::get_my_record();
     if ($me['id'] == -1) {
         CRM_ContactsCommon::no_contact_message();
         return;
     }
     $short = $conf['term'] == 's' || $conf['term'] == 'b';
     $long = $conf['term'] == 'l' || $conf['term'] == 'b';
     $related = $conf['related'];
     $rb = $this->init_module(Utils_RecordBrowser::module_name(), 'task', 'task');
     $status = array();
     foreach (Utils_CommonDataCommon::get_array('CRM/Status') as $status_id => $label) {
         if (isset($conf['status_' . $status_id]) && $conf['status_' . $status_id]) {
             $status[] = $status_id;
         }
     }
     $crits = array();
     $crits['status'] = $status;
     if ($short && !$long) {
         $crits['!longterm'] = 1;
     }
     if (!$short && $long) {
         $crits['longterm'] = 1;
     }
     if ($related == 0) {
         $crits['employees'] = array($me['id']);
     }
     if ($related == 1) {
         $crits['customers'] = array($me['id']);
     }
     if ($related == 2) {
         $crits['(employees'] = array($me['id']);
         $crits['|customers'] = array($me['id']);
     }
     $conds = array(array(array('field' => 'title', 'width' => 20, 'callback' => array('CRM_TasksCommon', 'display_title_with_mark')), array('field' => 'deadline', 'width' => 10), array('field' => 'status', 'width' => 6)), $crits, array('deadline' => 'ASC', 'status' => 'ASC', 'priority' => 'DESC'), array('CRM_TasksCommon', 'applet_info_format'), 15, $conf, &$opts);
     $opts['actions'][] = Utils_RecordBrowserCommon::applet_new_record_button('task', array('employees' => array($me['id']), 'status' => 0, 'permission' => 0, 'priority' => CRM_CommonCommon::get_default_priority()));
     $this->display_module($rb, $conds, 'mini_view');
 }