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 '
';
return;
}
catch (Exception $e)
{
echo ""._("Erreur")." : ".$e->getMessage(). '
'._('Vous devez corriger').'
';
/* display a blank form for name and category */
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 '
";
echo '
';
return;
}
?>
| '._("Ajout d'une prévision").' | '.h($name).' | '; } echo "