function index() { if (!$this->acl_read) { $this->bocommon->no_access(); return; } if (phpgw::get_var('phpgw_return_as') == 'json') { return $this->index_json(); } phpgwapi_yui::load_widget('datatable'); phpgwapi_yui::load_widget('paginator'); // $GLOBALS['phpgw']->js->validate_file( 'yahoo', 'generic.index', 'property' ); self::add_javascript('phpgwapi', 'yahoo', 'datatable.js'); $receipt = $GLOBALS['phpgw']->session->appsession('session_data', "general_receipt_{$this->type}_{$this->type_id}"); $this->save_sessiondata(); $GLOBALS['phpgw_info']['apps']['manual']['section'] = "general.index.{$this->type}"; $item = array(); foreach ($this->location_info['fields'] as $field) { if (isset($field['filter']) && $field['filter']) { $list = array(); if ($field['values_def']['valueset']) { $list = $field['values_def']['valueset']; // TODO find selected value } else { if (isset($field['values_def']['method'])) { foreach ($field['values_def']['method_input'] as $_argument => $_argument_value) { if (preg_match('/^##/', $_argument_value)) { $_argument_value_name = trim($_argument_value, '#'); $_argument_value = $values[$_argument_value_name]; } if (preg_match('/^\\$this->/', $_argument_value)) { $_argument_value_name = ltrim($_argument_value, '$this->'); $_argument_value = $this->{$_argument_value_name}; } $method_input[$_argument] = $_argument_value; } $list = execMethod($field['values_def']['method'], $method_input); } } $default_value = array('id' => '', 'name' => lang('select') . ' ' . $field['descr']); array_unshift($list, $default_value); $item[] = array('type' => 'filter', 'name' => $field['name'], 'text' => $field['descr'], 'list' => $list); } } $item[] = array('type' => 'text', 'text' => lang('searchfield'), 'name' => 'query'); $item[] = array('type' => 'submit', 'name' => 'search', 'value' => lang('Search')); $item[] = array('type' => 'link', 'value' => lang('add'), 'href' => self::link(array('menuaction' => 'property.uigeneric.edit', 'appname' => $this->appname, 'type' => $this->type, 'type_id' => $this->type_id))); $item[] = array('type' => 'link', 'value' => $_SESSION['showall'] ? lang('Show only active') : lang('Show all'), 'href' => self::link(array('menuaction' => $this->url_prefix . '.toggle_show_showall'))); $item[] = array('type' => 'link', 'value' => lang('download'), 'href' => 'javascript:onDownloadClick()'); if ($GLOBALS['phpgw']->locations->get_attrib_table($this->location_info['acl_app'], $this->location_info['acl_location'])) { $item[] = array('type' => 'button', 'onClick' => "javascript:window.open('" . $GLOBALS['phpgw']->link('/index.php', array('menuaction' => 'property.uigeneric.columns', 'appname' => $this->appname, 'type' => $this->type, 'type_id' => $this->type_id)) . "','','width=350,height=370')", 'value' => lang('columns')); } $data = array('js_lang' => js_lang('edit', 'add'), 'form' => array('toolbar' => array('item' => $item))); $data['datatable']['source'] = self::link(array('menuaction' => 'property.uigeneric_test.index', 'appname' => $this->appname, 'type' => $this->type, 'type_id' => $this->type_id, 'phpgw_return_as' => 'json')); // $data['datatable']['source'] = self::link(array('menuaction' => 'registration.uipending.index2', 'phpgw_return_as' => 'json')); // $data['js_lang'] = js_lang('edit', 'add'); $values = $this->bo->read(array('dry_run' => true)); $uicols = $this->bo->uicols; $count_uicols_name = count($uicols['name']); for ($i = 0; $i < $count_uicols_name; $i++) { $data['datatable']['field'][] = array('key' => $uicols['name'][$i], 'label' => $uicols['descr'][$i], 'sortable' => $uicols['sortable'][$i], 'className' => $uicols['classname'][$i], 'resizeable' => true, 'hidden' => $uicols['input_type'][$i] == 'hidden'); } $data['datatable']['field'][] = array('key' => 'link', 'hidden' => true); $data['datatable']['actions'] = $this->get_actions(); $appname = $this->location_info['name']; $function_msg = lang('list %1', $appname); if (!isset($GLOBALS['phpgw']->css) || !is_object($GLOBALS['phpgw']->css)) { $GLOBALS['phpgw']->css = createObject('phpgwapi.css'); } $GLOBALS['phpgw']->css->add_external_file('booking/templates/base/css/base.css'); $GLOBALS['phpgw_info']['flags']['app_header'] = $GLOBALS['phpgw']->translation->translate($this->location_info['acl_app'], array(), false, $this->location_info['acl_app']) . "::{$appname}::{$function_msg}"; self::render_template_xsl(array('datatable_common'), $data); }
function index2() { if (phpgw::get_var('phpgw_return_as') == 'json') { return $this->query(); } self::add_javascript('phpgwapi', 'yahoo', 'datatable.js'); self::add_javascript('registration', 'yahoo', 'pending.index2.js'); phpgwapi_yui::load_widget('datatable'); phpgwapi_yui::load_widget('paginator'); $status_list = array(array('id' => 0, 'name' => lang('Select status')), array('id' => 1, 'name' => lang('approved')), array('id' => 2, 'name' => lang('pending'))); $data = array('datatable_name' => lang('Pending for approval'), 'js_lang' => js_lang('edit', 'add'), 'form' => array('toolbar' => array('item' => array(array('type' => 'link', 'value' => lang('invert checkboxes'), 'href' => "javascript:checkAll('mychecks')"), array('type' => 'link', 'value' => lang('save'), 'href' => "javascript:onSave()"), array('type' => 'filter', 'name' => 'reg_dla', 'text' => lang('status') . ':', 'list' => $status_list), array('type' => 'text', 'text' => lang('searchfield'), 'name' => 'query'), array('type' => 'submit', 'name' => 'search', 'value' => lang('Search')), array('type' => 'link', 'value' => $_SESSION['showall'] ? lang('Show only active') : lang('Show all'), 'href' => self::link(array('menuaction' => $this->url_prefix . '.toggle_show_showall')))))), 'datatable' => array('source' => self::link(array('menuaction' => 'registration.uipending.index2', 'phpgw_return_as' => 'json')), 'field' => array(array('key' => 'reg_id', 'label' => lang('id'), 'sortable' => true, 'formatter' => 'formatLinkPending'), array('key' => 'reg_lid', 'label' => lang('user'), 'sortable' => true), array('key' => 'reg_dla', 'label' => lang('time'), 'sortable' => true), array('key' => 'reg_approved', 'label' => lang('approved'), 'sortable' => true, 'formatter' => "''"), array('key' => 'location_code', 'label' => lang('location'), 'sortable' => false), array('key' => 'checked', 'label' => lang('approve'), 'sortable' => false, 'formatter' => 'formatterCheckPending', 'className' => 'mychecks')))); $parameters = array('parameter' => array(array('name' => 'id', 'source' => 'id'))); $data['datatable']['actions'][] = array('my_name' => 'edit', 'text' => lang('edit'), 'action' => $GLOBALS['phpgw']->link('/index.php', array('menuaction' => 'registration.uipending.edit')), 'parameters' => json_encode($parameters)); // $data['datatable']['editor_action'] = 'rental.uiprice_item.set_value'; //_debug_array($data);die(); self::render_template_xsl(array('datatable_common'), $data); }