get("action", "string", ""); $ac=$http->request("ac"); $forecast_id=$http->request('f_id', 'number',-1); echo '
'; $sa=$http->request("sa", "string", "list"); /* * ******************************************************************** * Remove a anticipation * * * ******************************************************************** */ if ($action=='del') { $f_id=$http->get("f_id", "number"); $forecast=new Forecast_SQL($cn, $f_id); $forecast->delete(); } /* * ******************************************************************* * Cloning * ******************************************************************* */ if ($action=='clone') { echo "

cloning

"; /* * We need to clone the forecast */ $f_id=$http->get("f_id", "number"); $anti=new Anticipation($cn, $f_id); $forecast_id=$anti->object_clone(); $action="mod_view"; } /* * ******************************************************************** * Save first the data for new * * * ******************************************************************** */ if ($sa=='new') { try { $f_name=$http->post("f_name"); $p_start=$http->post("p_start","number"); $p_end=$http->post("p_end","number"); if ( $f_name == "") { throw new Exception(_("Le nom ne peut pas être vide")); } $forecast_sql=new Forecast_SQL($cn); $forecast_sql->setp("f_name",$f_name); $forecast_sql->setp("f_start_date",$p_start); $forecast_sql->setp("f_end_date",$p_end); $forecast_sql->save(); $action="mod_item"; $forecast_id=$forecast_sql->getp("f_id"); } catch (Exception $exc) { echo_warning($exc->getMessage()); $sa="list"; } } /* * ******************************************************************** * If we request to modify the items * * * ******************************************************************** */ if ($action=='mod_item') { /* Propose a form for the items */ $anticipation=new Anticipation($cn, $forecast_id); $anticipation->input_form(); return; } /* * ******************************************************************** * if a forecast is asked we display the result * * * ******************************************************************** */ if ($sa=="vw") { echo '
'; $forecast=new Anticipation($cn); $forecast->setForecastId($forecast_id); try { echo $forecast->display(); echo '
'; echo '
'; echo dossier::hidden(); echo HtmlInput::hidden('action', ''); echo HtmlInput::hidden('f_id', $forecast_id); echo HtmlInput::submit('mod_item_bt', _('Modifier éléments'), 'onclick="$(\'action\').value=\'mod_item\';"'); //echo HtmlInput::submit('cvs',_('Export CVS')); echo HtmlInput::hidden('ac', $ac); $href=http_build_query(array('ac'=>$ac, 'gDossier'=>Dossier::id())); echo ''._('Retour').''; echo '
'; echo '
'; echo '
'; return; } catch (Exception $e) { echo "

"._("Erreur")." : ".$e->getMessage(). '

'._('Vous devez corriger').'

'; $anc=new Anticipation($cn, $forecast_id); echo '
'; /* display a blank form for name and category */ echo '
'; echo dossier::hidden(); echo HtmlInput::hidden('sa', 'mod'); echo HtmlInput::hidden('ac', $ac); echo $anc->form_cat(); echo HtmlInput::submit('mod_cat_save', _('Sauver')); echo '
'; echo '
'; } } /* * ******************************************************************** * Display menu * * * ******************************************************************** */ // display button add and list of forecast to display if ($sa=='list') { $aForecast= Anticipation::load_all($cn); $menu=array(); $get_dossier=dossier::get(); require_once NOALYSS_TEMPLATE."/forecast-new.php"; echo '
'; echo _('Filtre')." ".HtmlInput::filter_table("forecast_table_id", '0', 1); echo ''; $href="?ac=".$ac."&sa=new&".$get_dossier; echo ''; $forecast_id=$http->request('f_id', 'number', -1); for ($i=0; $i'; } echo "
'._("Ajout d'une prévision").'
'.h($name).'
"; echo '
'; return; } ?>