Пример #1
0
 public function edit($id)
 {
     $lists = array();
     $params_values = array();
     $row = aecService::getById($id);
     if (empty($row->id)) {
         $row = new aecService();
         $row->ordering = 9999;
         $params_values['active'] = 1;
     } else {
         $params_values = $row->params;
         // We need to convert the values that are set as object properties
         $params_values['active'] = $row->active;
         $params_values['name'] = $row->name;
     }
     // params and their type values
     $params['active'] = array('toggle', 1);
     $params['visible'] = array('toggle', 0);
     $params['name'] = array('inputC', '');
     $params['type'] = array('list', '');
     $params['params_remap'] = array('subarea_change', 'services');
     $servicelist = aecServiceList::getAvailableServiceClasses(true);
     $glist = array();
     $glist[] = JHTML::_('select.option', 0, '- - - - - -');
     foreach ($servicelist as $service) {
         $info = $service->getInfo();
         $glist[] = JHTML::_('select.option', $info['slug'], $info['name'], 'value', 'text');
     }
     $lists['type'] = JHTML::_('select.genericlist', $glist, 'type', 'size="1"', 'value', 'text', $row->id ? 0 : 1);
     $settings = new aecSettings('service', 'general');
     if ($row->id) {
         $service_params = $row->getSettings();
         $params = array_merge($params, $service_params);
     } else {
         $service_params = array();
     }
     $settings->fullSettingsArray($params, $params_values, $lists);
     // Call HTML Class
     $aecHTML = new aecHTML($settings->settings, $settings->lists);
     if (!empty($service_params)) {
         foreach ($service_params as $n => $v) {
             $aecHTML->customparams[] = $n;
         }
     }
     $aecHTML->hasSettings = $id ? true : false;
     HTML_AcctExp::editService($row, $aecHTML);
 }