public function body($def_order=array(), $crits=array(), $cols=array(), $filters_set=array()) { Base_HelpCommon::screen_name('browse_'.$this->tab); unset($_SESSION['client']['recordbrowser']['admin_access']); if ($this->check_for_jump()) return; $this->fullscreen_table=true; $this->init(); $this->jump_to_new_record = true; if ($this->get_access('browse')===false) { print(__('You are not authorised to browse this data.')); return; } if ($this->watchdog) Utils_WatchdogCommon::add_actionbar_change_subscription_button($this->tab); $this->is_on_main_page = true; $this->data_gb = $this->init_module('Utils/GenericBrowser', null, $this->tab); if (!$this->disabled['filters']) $filters = $this->show_filters($filters_set); else $filters = ''; if ($this->get_access('add',$this->custom_defaults)!==false && $this->add_button!==false) { if (!$this->multiple_defaults) { if ($this->add_button===null) { Base_ActionBarCommon::add('add',__('New'), $this->create_callback_href(array($this,'navigate'),array('view_entry', 'add', null, $this->custom_defaults))); Utils_ShortcutCommon::add(array('Ctrl','N'), 'function(){'.$this->create_callback_href_js(array($this,'navigate'),array('view_entry', 'add', null, $this->custom_defaults)).'}'); } elseif($this->add_button!=='') { Base_ActionBarCommon::add('add',__('New'), $this->add_button); } } else { Base_ActionBarCommon::add('add',__('New'), Utils_RecordBrowserCommon::create_new_record_href($this->tab,$this->custom_defaults,'multi',true,true)); } } $this->crits = $this->crits+$crits; $theme = $this->init_module('Base/Theme'); $theme->assign('filters', $filters); $opts = array('all'=>__('All')); if ($this->recent>0) $opts['recent'] = __('Recent'); if ($this->favorites) $opts['favorites'] = __('Favorites'); if ($this->watchdog) $opts['watchdog'] = __('Watched'); if ($this->data_gb->show_all()) { $this->set_module_variable('browse_mode', 'all'); } if (count($opts)>1) { if ($this->disabled['browse_mode']) $this->browse_mode='all'; else { $this->browse_mode = $this->get_module_variable('browse_mode', Base_User_SettingsCommon::get('Utils/RecordBrowser',$this->tab.'_default_view')); if (!$this->browse_mode) $this->browse_mode='all'; if (($this->browse_mode=='recent' && $this->recent==0) || ($this->browse_mode=='favorites' && !$this->favorites)) $this->set_module_variable('browse_mode', $this->browse_mode='all'); $form = $this->init_module('Libs/QuickForm'); $form->addElement('select', 'browse_mode', '', $opts, array('onchange'=>$form->get_submit_form_js())); $form->setDefaults(array('browse_mode'=>$this->browse_mode)); if ($form->validate()) { $vals = $form->exportValues(); if (isset($opts[$vals['browse_mode']])) { $this->switch_view($vals['browse_mode']); location(array()); return; } } $form->assign_theme('form', $theme); } } ob_start(); $this->show_data($this->crits, $cols, array_merge($def_order, $this->default_order)); $table = ob_get_contents(); ob_end_clean(); $theme->assign('table', $table); if (!$this->disabled['headline']) $theme->assign('caption', _V($this->caption).($this->additional_caption?' - '.$this->additional_caption:'').($this->get_jump_to_id_button())); $theme->assign('icon', $this->icon); $theme->display('Browsing_records'); }