Пример #1
0
 /**
  *@brief Display a form for modifying the name or/and the category of an existing
  * anticipation
  *@return html string with the form
  */
 private function form_cat_mod()
 {
     global $g_user;
     $a = new Forecast($this->cn, $this->f_id);
     $a->load();
     $name = new IText('an_name');
     $name->value = $a->get_parameter("name");
     $str_name = $name->input();
     $str_action = _('Modification');
     $start_date = new IPeriod('start_date');
     $start_date->type = ALL;
     $start_date->cn = $this->cn;
     $start_date->show_end_date = false;
     $start_date->show_start_date = true;
     $start_date->user = $g_user;
     $start_date->filter_year = false;
     $end_date = new IPeriod('end_date');
     $end_date->type = ALL;
     $end_date->cn = $this->cn;
     $end_date->show_end_date = true;
     $end_date->show_start_date = false;
     $end_date->user = $g_user;
     $end_date->filter_year = false;
     $start_date->value = $a->f_start_date;
     $end_date->value = $a->f_end_date;
     $str_start_date = $start_date->input();
     $str_end_date = $end_date->input();
     $r = HtmlInput::hidden('f_id', $this->f_id);
     $array = Forecast_Cat::load_all($this->cn, $this->f_id);
     for ($i = 0; $i < MAX_CAT; $i++) {
         /* category name */
         $name_name = isset($array[$i]['fc_id']) ? 'fr_cat' . $array[$i]['fc_id'] : 'fr_cat_new' . $i;
         $name = new IText($name_name);
         $name->value = isset($array[$i]['fc_desc']) ? $array[$i]['fc_desc'] : '';
         $aCat[$i]['name'] = $name->input();
         /* category order */
         $order_name = isset($array[$i]['fc_id']) ? 'fc_order' . $array[$i]['fc_id'] : 'fc_order_new' . $i;
         $order = new IText($order_name);
         $order->value = isset($array[$i]['fc_order']) ? $array[$i]['fc_order'] : $i + 1;
         $aCat[$i]['order'] = $order->input();
     }
     ob_start();
     require_once NOALYSS_INCLUDE . '/template/forecast_cat.php';
     $r .= ob_get_contents();
     ob_end_clean();
     return $r;
 }