Esempio n. 1
0
 public static function user_settings()
 {
     $ret = DB::Execute('SELECT tab, caption, icon, recent, favorites, full_history FROM recordbrowser_table_properties');
     $settings = array(0 => array(), 1 => array(), 2 => array(), 3 => array());
     while ($row = $ret->FetchRow()) {
         $caption = _V($row['caption']);
         // ****** RecordBrowser - recordset caption
         if (!self::get_access($row['tab'], 'browse')) {
             continue;
         }
         if ($row['favorites'] || $row['recent']) {
             $options = array('all' => __('All'));
             if ($row['favorites']) {
                 $options['favorites'] = __('Favorites');
             }
             if ($row['recent']) {
                 $options['recent'] = __('Recent');
             }
             if (Utils_WatchdogCommon::category_exists($row['tab'])) {
                 $options['watchdog'] = __('Watched');
             }
             $settings[0][] = array('name' => $row['tab'] . '_default_view', 'label' => $caption, 'type' => 'select', 'values' => $options, 'default' => 'all');
         }
         if ($row['favorites']) {
             $settings[1][] = array('name' => $row['tab'] . '_auto_fav', 'label' => $caption, 'type' => 'select', 'values' => array(__('Disabled'), __('Enabled')), 'default' => 0);
         }
         if (Utils_WatchdogCommon::category_exists($row['tab'])) {
             $settings[2][] = array('name' => $row['tab'] . '_auto_subs', 'label' => $caption, 'type' => 'select', 'values' => array(__('Disabled'), __('Enabled')), 'default' => 0);
         }
         $settings[0][] = array('name' => $row['tab'] . '_show_filters', 'label' => '', 'type' => 'hidden', 'default' => 0);
     }
     $final_settings = array();
     $subscribe_settings = array();
     $final_settings[] = array('name' => 'add_in_table_shown', 'label' => __('Quick new record - show by default'), 'type' => 'checkbox', 'default' => 0);
     $final_settings[] = array('name' => 'hide_empty', 'label' => __('Hide empty fields'), 'type' => 'checkbox', 'default' => 0);
     $final_settings[] = array('name' => 'enable_autocomplete', 'label' => __('Enable autocomplete in select/multiselect at'), 'type' => 'select', 'default' => 50, 'values' => array(0 => __('Always'), 20 => __('%s records', array(20)), 50 => __('%s records', array(50)), 100 => __('%s records', array(100))));
     $final_settings[] = array('name' => 'grid', 'label' => __('Grid edit (experimental)'), 'type' => 'checkbox', 'default' => 0);
     $final_settings[] = array('name' => 'save_filters', 'label' => __('Save filters'), 'type' => 'checkbox', 'default' => 0);
     $final_settings[] = array('name' => 'confirm_leave', 'label' => __('Confirm before leave edit page'), 'type' => 'checkbox', 'default' => 1);
     $final_settings[] = array('name' => 'header_default_view', 'label' => __('Default data view'), 'type' => 'header');
     $final_settings = array_merge($final_settings, $settings[0]);
     $final_settings[] = array('name' => 'header_auto_fav', 'label' => __('Automatically add to favorites records created by me'), 'type' => 'header');
     $final_settings = array_merge($final_settings, $settings[1]);
     $final_settings[] = array('name' => 'header_auto_subscriptions', 'label' => __('Automatically watch records created by me'), 'type' => 'header');
     $final_settings = array_merge($final_settings, $settings[2]);
     return array(__('Browsing records') => $final_settings);
 }
Esempio n. 2
0
    public function init($admin=false, $force=false) {
        if($this->tab=='__RECORDSETS__' || preg_match('/,/',$this->tab)) $params=array('','',0,0,0);
        else $params = DB::GetRow('SELECT caption, icon, recent, favorites, full_history FROM recordbrowser_table_properties WHERE tab=%s', array($this->tab));
        if ($params==false) trigger_error('There is no such recordSet as '.$this->tab.'.', E_USER_ERROR);
        list($this->caption,$this->icon,$this->recent,$this->favorites,$this->full_history) = $params;
        $this->favorites &= !$this->disabled['fav'];
        $this->watchdog = Utils_WatchdogCommon::category_exists($this->tab) && !$this->disabled['watchdog'];
        $this->clipboard_pattern = Utils_RecordBrowserCommon::get_clipboard_pattern($this->tab);

        //If Caption or icon not specified assign default values
        if ($this->caption=='') $this->caption='Record Browser';
        if ($this->icon=='') $this->icon = Base_ThemeCommon::get_template_file('Base_ActionBar','icons/settings.png');
        else $this->icon = Base_ThemeCommon::get_template_file($this->icon);

        $this->table_rows = Utils_RecordBrowserCommon::init($this->tab, $admin, $force);
        $this->requires = array();
        $this->display_callback_table = array();
        $this->QFfield_callback_table = array();
        if($this->tab=='__RECORDSETS__' || preg_match('/,/',$this->tab)) return;
        $ret = DB::Execute('SELECT * FROM '.$this->tab.'_callback');
        while ($row = $ret->FetchRow())
            if ($row['freezed']==1) $this->display_callback_table[$row['field']] = explode('::',$row['callback']);
            else $this->QFfield_callback_table[$row['field']] = explode('::',$row['callback']);
    }