True, 'add' => True, 'edit' => True, 'delete' => True ); var $bo; var $nextmatchs; function uiapplications() { $this->bo = CreateObject('admin.boapplications'); $this->nextmatchs = CreateObject('phpgwapi.nextmatchs'); } function get_list() { $GLOBALS['phpgw']->common->phpgw_header(); $GLOBALS['phpgw']->template->set_file(array('applications' => 'applications.tpl')); $GLOBALS['phpgw']->template->set_block('applications','list','list'); $GLOBALS['phpgw']->template->set_block('applications','row','row'); $start = $GLOBALS['HTTP_POST_VARS']['start']; $sort = $GLOBALS['HTTP_GET_VARS']['sort']; $order = $GLOBALS['HTTP_GET_VARS']['order']; $offset = $GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs']; $apps = $this->bo->get_list(); $total = count($apps); $sort = $sort ? $sort : 'ASC'; if($sort == 'ASC') { ksort($apps); } else { krsort($apps); } if ($start && $offset) { $limit = $start + $offset; } elseif ($start && !$offset) { $limit = $start; } elseif(!$start && !$offset) { $limit = $total; } else { $start = 0; $limit = $offset; } if ($limit > $total) { $limit = $total; } $i = 0; $applications = array(); while(list($app,$data) = @each($apps)) { if($i >= $start && $i<= $limit) { $applications[$app] = $data; } $i++; } $GLOBALS['phpgw']->template->set_var('lang_installed',lang('Installed applications')); $GLOBALS['phpgw']->template->set_var('bg_color',$GLOBALS['phpgw_info']['theme']['bg_color']); $GLOBALS['phpgw']->template->set_var('th_bg',$GLOBALS['phpgw_info']['theme']['th_bg']); $GLOBALS['phpgw']->template->set_var('sort_title',$this->nextmatchs->show_sort_order($sort,'title','title','/index.php',lang('Title'),'&menuaction=admin.uiapplications.get_list')); $GLOBALS['phpgw']->template->set_var('lang_showing',$this->nextmatchs->show_hits($total,$start)); $GLOBALS['phpgw']->template->set_var('left',$this->nextmatchs->left('/index.php',$start,$total,'menuaction=admin.uiapplications.get_list')); $GLOBALS['phpgw']->template->set_var('right',$this->nextmatchs->right('index.php',$start,$total,'menuaction=admin.uiapplications.get_list')); $GLOBALS['phpgw']->template->set_var('lang_edit',lang('Edit')); $GLOBALS['phpgw']->template->set_var('lang_delete',lang('Delete')); $GLOBALS['phpgw']->template->set_var('lang_enabled',lang('Enabled')); $GLOBALS['phpgw']->template->set_var('new_action',$GLOBALS['phpgw']->link('/index.php','menuaction=admin.uiapplications.add')); $GLOBALS['phpgw']->template->set_var('lang_add',lang('add')); @reset($applications); while (list($key,$app) = @each($applications)) { $tr_color = $this->nextmatchs->alternate_row_color($tr_color); if($app['title']) { $name = $app['title']; } elseif($app['name']) { $name = $app['name']; } else { $name = ' '; } $GLOBALS['phpgw']->template->set_var('tr_color',$tr_color); $GLOBALS['phpgw']->template->set_var('name',$name); $GLOBALS['phpgw']->template->set_var('edit',' ' . lang('Edit') . ' '); $GLOBALS['phpgw']->template->set_var('delete',' ' . lang('Delete') . ' '); if ($app['status']) { $status = lang('Yes'); } else { $status = '' . lang('No') . ''; } $GLOBALS['phpgw']->template->set_var('status',$status); $GLOBALS['phpgw']->template->parse('rows','row',True); } $GLOBALS['phpgw']->template->pparse('out','list'); } function display_row($label, $value) { $GLOBALS['phpgw']->template->set_var('tr_color',$this->nextmatchs->alternate_row_color()); $GLOBALS['phpgw']->template->set_var('label',$label); $GLOBALS['phpgw']->template->set_var('value',$value); $GLOBALS['phpgw']->template->parse('rows','row',True); } function add() { $GLOBALS['phpgw']->template->set_file(array('application' => 'application_form.tpl')); $GLOBALS['phpgw']->template->set_block('application','form','form'); $GLOBALS['phpgw']->template->set_block('application','row','row'); if ($GLOBALS['HTTP_POST_VARS']['submit']) { $totalerrors = 0; $app_order = $GLOBALS['HTTP_POST_VARS']['app_order'] ? $GLOBALS['HTTP_POST_VARS']['app_order'] : 0; $n_app_name = chop($GLOBALS['HTTP_POST_VARS']['n_app_name']); $n_app_title = chop($GLOBALS['HTTP_POST_VARS']['n_app_title']); $n_app_status = $GLOBALS['HTTP_POST_VARS']['n_app_status']; if ($this->bo->exists($n_app_name)) { $error[$totalerrors++] = lang('That application name already exists.'); } if (preg_match("/\D/",$app_order)) { $error[$totalerrors++] = lang('That application order must be a number.'); } if (!$n_app_name) { $error[$totalerrors++] = lang('You must enter an application name.'); } if (!$n_app_title) { $error[$totalerrors++] = lang('You must enter an application title.'); } if (!$totalerrors) { $this->bo->add(array( 'n_app_name' => $n_app_name, 'n_app_title' => $n_app_title, 'n_app_status' => $n_app_status, 'app_order' => $app_order )); Header('Location: ' . $GLOBALS['phpgw']->link('/index.php','menuaction=admin.uiapplications.get_list')); $GLOBALS['phpgw']->common->phpgw_exit(); } else { $GLOBALS['phpgw']->template->set_var('error','