linea21-modules
[ class tree: linea21-modules ] [ index: linea21-modules ] [ all elements ]

Source for file add.php

Documentation is available at add.php

  1. <?php
  2. /**
  3.  * @package linea21.modules
  4.  * @subpackage project
  5.  * @author linea21 <info@linea21.com>
  6.  * @version $id SVN
  7.  * @access public
  8.  * @license http://opensource.org/licenses/gpl-3.0.html
  9.  */
  10.  
  11. //////////// Check Inclusion de pages ////////////
  12. if (!function_exists('AuthenthificationProcess')) {
  13.   include_once("../lib/lib_common.php");
  14.   ReloadIndex('admin');
  15. }
  16. ////////////
  17.  
  18. //////////// Check Droits utilisateur ////////////
  19. if (!IsSuperAdmin()) ReloadIndex('admin');
  20. ////////////
  21. ?>
  22.  
  23. <div id="chemin">
  24.   <ul>
  25.       <li><a href="index.php" class="chemin_home"><?php echo _t('way','home')?></a></li>
  26.       <li><a href="<?php echo $rub_link?>" id="chemin_<?php echo $rub?>" class="chemin_rub"><?php echo _t('menu','project')?></a></li>
  27.       <li><span><?php echo formatNavTitle(_t('project','add'))?></span></li>
  28.   </ul>
  29. </div>
  30. <!--end barre haute -->
  31. <?php
  32. $form_name='';
  33. $form_description='';
  34. $form_body='';
  35. $form_progression=0;
  36. $form_parent_id=-1;
  37. $form_theme_id=-1;
  38. $form_scale_id=-1;
  39. $form_priority_id=-1;
  40. $form_workshop_id=-1;
  41. $form_sdiarray();
  42. $mask_statut_P="checked=\"checked\"";
  43. $mask_statut_D='';
  44. $form_begin_date='';
  45. $form_estimated_date='';
  46. $form_end_date='';
  47.  
  48.  
  49. $project_object new project;
  50.  
  51. if(isset($_POST['enregistrer'])) {
  52.   $data_table=unserialize(urldecode($_POST['data_table']));
  53.   $result=$project_object->AddProject($data_table$sql_object);
  54.   $link_confirm="confirm.php?rub=".$rub."&todo=".$todo;
  55.   if(is_numeric($result)) header("Location: ".$link_confirm);
  56.   else  system_error();
  57. }
  58.  
  59. if(isset($_POST['valider'])) {
  60.  
  61.   isset($_POST['choose_sdi']$form_sdi=$_POST['choose_sdi'$form_sdi=array();
  62.  
  63.   $table[0]=$_POST['project_name'];
  64.   $table[1]=$_POST['project_description'];
  65.   $table[2]=$_POST['project_body'];
  66.   $table[3]=$_POST['project_parent_id'];
  67.   $table[4]=$_POST['project_scale_id'];
  68.   $table[5]=$_POST['project_priority_id'];
  69.   $table[6]=$_POST['project_begin_date'];
  70.   $table[7]=$_POST['project_estimated_date'];
  71.   $table[8]=$_POST['project_end_date'];
  72.   $table[9]=GetSessionElement('id')// ID posteur
  73.   $table[10]=$_POST['project_statut'];
  74.   $table[11]=$_POST['project_theme_id'];
  75.   $table[12]=$_POST['project_workshop_id'];
  76.   $table[13]=$form_sdi;
  77.   $table[14]=$_POST['project_progression'];
  78.   $project_objectnew project;
  79.   $integrity=$project_object->CheckDataIntegrity($table);
  80.   
  81.  
  82.   if(is_string($integrity)) {
  83.     $text_format='2FIELD';
  84.   else {
  85.     $text_format='2HTML';
  86.   }
  87.   $form_name=formatText($_POST['project_name']$text_format);
  88.   $form_description=formatText($_POST['project_description']$text_format);
  89.   $form_body=formatText($_POST['project_body']$text_format);
  90.   $form_begin_date=$_POST['project_begin_date'];
  91.   $form_estimated_date=$_POST['project_estimated_date'];
  92.   $form_end_date=$_POST['project_end_date'];
  93.   $form_progression=$_POST['project_progression'];
  94.  
  95.   $form_theme_id=$_POST['project_theme_id'];
  96.   $form_workshop_id=$_POST['project_workshop_id'];
  97.   $form_scale_id=$_POST['project_scale_id'];
  98.   $form_parent_id=$_POST['project_parent_id'];
  99.   $form_priority_id=$_POST['project_priority_id'];
  100.  
  101.  
  102.   if($_POST['project_statut']=='D'$mask_statut_D="checked=\"checked\""else $mask_statut_D='';
  103.   if($_POST['project_statut']=='P'$mask_statut_P="checked=\"checked\""else $mask_statut_P='';
  104.   $table=urlencode(serialize($table));
  105. }
  106.  
  107.  
  108. if(!isset($integrity|| is_string($integrity)) {
  109.   include_once("../lib/input_helpers.php");
  110.  
  111.   // select-box de thèmes
  112.   $data=$sql_object->DBSelect($req_list_theme);
  113.   $select_theme=ThemeSelectBox($data"project_theme_id"$form_theme_id);
  114.  
  115.   // select-box de workshops
  116.   $data=$sql_object->DBSelect($req_list_workshop);
  117.   $select_workshop=WorkshopSelectBox($data"project_workshop_id"$form_workshop_id);
  118.  
  119.   // select-box des projets
  120.   $data=$sql_object->DBSelect(SQL_getProjectsList(0,1000'public'));
  121.   $select_parent=ProjectSelectBox($data"project_parent_id"$form_parent_id);
  122.  
  123.   // select-box des échelles
  124.   $data=$sql_object->DBSelect($req_list_scale);
  125.   $select_scale=ScaleSelectBox($data"project_scale_id"$form_scale_id);
  126.  
  127.   // select-box des priorités
  128.   $data=$sql_object->DBSelect($req_list_priority);
  129.   $select_priority=PrioritySelectBox($data"project_priority_id"$form_priority_id);
  130.  
  131.   // select-box des indicateurs
  132.   $data=$sql_object->DBSelect($req_list_sdi);
  133.   $select_sdi=SDIMultiSelectBox($data"choose_sdi"$form_sdi);
  134.  
  135. }
  136.  
  137. include_once(THEME_ADMIN_PATH."quickicons.php");
  138.  
  139. footerAddJS('../lib/js/jquery.datePicker.l10n/jquery.ui.datepicker-'.U_L.'.js');
  140. ?>
  141.  
  142. <script type="text/javascript">
  143.     
  144.     $(document).ready( function()
  145.     {
  146.         $("#choose_sdi").multiselect({ noneSelectedText: '<?php echo _t('divers','select_choice')?>', selectedList:2, minWidth:'596px' } ).multiselectfilter(); 
  147.         
  148.         $( "#project_slider" ).slider({
  149.             range: "min",
  150.             value:<?php echo $form_progression?>,
  151.             min: 0,
  152.             max: 100,
  153.             step: <?php echo PROJECT_STEP?>,
  154.             slide: function( event, ui ) {
  155.                 $( "#project_progression" ).val( ui.value );
  156.                 $( "#progression_value" ).html( ui.value + ' %' );
  157.             }
  158.         });
  159.         $( "#project_progression" ).val($( "#project_slider" ).slider( "value" ));
  160.         $( "#project_progression" ).hide();
  161.         $( "#progression_value" ).html( <?php echo $form_progression?> + ' %' );
  162.  
  163.         /** jquery UI datePicker integration
  164.         ---------------------------------------------------*/
  165.         
  166.         var dateFormat = "<?php echo DATE_FORMAT?>";
  167.         dateFormat = dateFormat.replace("yyyy", "yy");
  168.         
  169.         $(".date-pick").datepicker({
  170.             showOn: "button",
  171.             beforeShow: getAvailableRange,
  172.             buttonImage: "../lib/js/calendar.png",
  173.             buttonImageOnly: true,
  174.             dateFormat: dateFormat
  175.         });
  176.         $( ".date-pick" ).datepicker( $.datepicker.regional[ "<?php echo U_L?>" ] );
  177.  
  178.  
  179.         function getAvailableRange(input) 
  180.         { 
  181.                 var min = new Date(2000, 1 - 1, 1); //Set this to your absolute minimum date
  182.                 var dateMin = min;
  183.                 var dateMax = null;
  184.                 
  185.                 if (input.id == "project_begin_date") 
  186.                 {
  187.                     dateMin = min; // absolute minimum date                  
  188.                 }
  189.                 else if (input.id == "project_estimated_date")
  190.                 {
  191.                         if ($("#project_begin_date").datepicker("getDate") != null) 
  192.                         {
  193.                                 dateMin = $("#project_begin_date").datepicker("getDate");
  194.                                 dateMin.setDate(dateMin.getDate() + 1);
  195.  
  196.                         }
  197.                 }
  198.                 else if (input.id == "project_end_date")
  199.                 {
  200.                         if ($("#project_begin_date").datepicker("getDate") != null) 
  201.                         {
  202.                                 dateMin = $("#project_begin_date").datepicker("getDate");
  203.                                 dateMin.setDate(dateMin.getDate() + 1);
  204.                         }
  205.                 }
  206.             return {
  207.                         minDate: dateMin, 
  208.                         maxDate: dateMax,
  209.                     }; 
  210.  
  211.         }
  212.         
  213.         
  214.     });
  215. </script>
  216.  
  217.  
  218. <?php
  219. if(!isset($integrity|| is_string($integrity)) {
  220. ?>
  221. <div class="contentcontainer">
  222. <?php
  223. include_once($dir."/menurub.php");
  224. ?>
  225. <div id="content">
  226. <?php
  227. if(isset($integrity&& is_string($integrity)) display_errors($integrity);
  228. ?>
  229. <h2><?php echo formatTitleh2(_t('project','add'))?></h2>
  230. <form id="addproject" action="<?php echo $_SERVER['SCRIPT_NAME']?>" method="post">
  231. <p>
  232.     <label for="project_name"><?php echo _t('project','name')?> : *</label>
  233.     <input name="project_name" type="text" maxlength="200" id="project_name" class="textfield" value="<?php echo $form_name?>" />
  234. </p>
  235. <p>
  236.     <label for="project_parent_id"><?php echo _t('project','parent')?> :</label>
  237.     <?php echo $select_parent?>
  238.     </p>
  239. <p>
  240.     <label for="project_description"><?php echo _t('project','description')?> : *</label>
  241.     <textarea id="project_description" name="project_description" class="largetextfield" <?php echo AREA_SETTINGS?>><?php echo $form_description?></textarea>
  242. </p>
  243. <p>
  244.     <label for="project_body"><?php echo _t('project','body')?> : *</label>
  245.     <textarea id="project_body" name="project_body" class="largetextfield" <?php echo AREA_SETTINGS?>><?php echo $form_body?></textarea>
  246. </p>
  247. <p>
  248.     <label for="project_begin_date"><?php echo _t('project','begin_date')?> : </label>
  249.     <input name="project_begin_date" type="text" maxlength="10"    id="project_begin_date" class="date-pick shorttextfield" value="<?php echo $form_begin_date?>" />
  250. </p>
  251. <p>
  252.     <label for="project_estimated_date"><?php echo _t('project','estimated_date')?> : </label>
  253.     <input name="project_estimated_date" type="text" maxlength="10" id="project_estimated_date"    class="date-pick shorttextfield"    value="<?php echo $form_estimated_date?>" />
  254. </p>
  255. <p>
  256.     <label for="project_end_date"><?php echo _t('project','end_date')?> : </label>
  257.     <input name="project_end_date" type="text" maxlength="10" id="project_end_date" class="date-pick shorttextfield" value="<?php echo $form_end_date?>" />
  258. </p>
  259. <div>
  260.     <label for="project_progression"><?php echo _t('project','progression')?> : </label>
  261.     <div id="project_slider"></div><div id="progression_value"></div>
  262.     <input type="text" name="project_progression" id="project_progression" value="<?php echo $form_progression?>" maxlength="3" class="shorttextfield"  />
  263. </div>
  264. <p>
  265.     <label for="project_priority_id"><?php echo _t('project','priority')?> : *</label>
  266.     <?php echo $select_priority?>
  267. </p>
  268. <p>
  269.     <label for="project_theme_id"><?php echo _t('project','theme')?> : </label>
  270.      <?php echo $select_theme?>
  271. </p>
  272. <p>
  273.     <label for="project_theme_id"><?php echo _t('project','workshop')?> : </label>
  274.     <?php echo $select_workshop?>
  275. </p>
  276. <p>
  277.     <label for="project_scale_id"><?php echo _t('project','scale')?> : *</label>
  278.     <?php echo $select_scale?>
  279. </p>
  280. <p>
  281.     <label for="choose_sdi"><?php echo _t('project','sdi')?> : </label>
  282.     <?php echo $select_sdi?>
  283. </p>
  284. <div class="label"><?php echo _t('project','statut')?> : </div>
  285.     <div class="rightpanel">
  286.         <input name="project_statut" type="radio" id="statut_P" value="P" <?php echo $mask_statut_P?> />
  287.         <label for="statut_P"><?php echo _t('statut','public')?></label>
  288.         <input name="project_statut" type="radio" id="statut_D" value="D" <?php echo $mask_statut_D?> />
  289.         <label for="statut_D"><?php echo _t('statut','draft')?></label>
  290.     </div>
  291.  
  292. <div>
  293. <input name="rub" type="hidden" value="<?php echo $rub?>" id="rub" />
  294. <input name="todo" type="hidden" value="<?php echo $todo?>" id="todo" />
  295. <?php echo cancel_button('javascript:history.go(-1);')?>
  296. <input name="valider" type="submit" value="<?php echo _t('btn','valid'?>" class="button" id="valider" />
  297. </div>
  298. </form>
  299. </div>
  300.     <?php include_once($dir."/help.php")?></div>
  301.     <?php
  302.     // Récapitulatif
  303. else    {
  304.  
  305.   if($form_theme_id != -1{
  306.     $requete=SQL_getonethemeName($form_theme_id);
  307.     $result=$sql_object->DBSelect($requete);
  308.     if($result==|| count($result)!=1exit;
  309.     else $theme_denomination=formatText($result[0]['theme_name']'2HTML');
  310.   else $theme_denomination=_t('divers','none');
  311.  
  312.   $query=SQL_getonescaleDenomination($form_scale_id);
  313.   $result=$sql_object->DBSelect($query);
  314.   if($result==|| count($result)!=1exit;
  315.   else $scale_denomination=formatText($result[0]['scale_denomination']'2HTML');
  316.  
  317.   $query=SQL_getonepriorityName($form_priority_id);
  318.   $result=$sql_object->DBSelect($query);
  319.   if($result==|| count($result)!=1exit;
  320.   else $priority_name=formatText($result[0]['priority_name']'2HTML');
  321.  
  322.   if($form_parent_id != -1{
  323.     $query=SQL_getProjectName($form_parent_id);
  324.     $result=$sql_object->DBSelect($query);
  325.     if($result==|| count($result)!=1exit;
  326.     else $parent_name=formatText($result[0]['project_name']'2HTML');
  327.   else $parent_name=_t('divers','none');
  328.  
  329.   if($form_workshop_id != -1{
  330.     $query=SQL_getWorkshopName($form_workshop_id);
  331.     $result=$sql_object->DBSelect($query);
  332.     if($result==|| count($result)!=1exit;
  333.     else $workshop_name=formatText($result[0]['workshop_denomination']'2HTML');
  334.   else $workshop_name=_t('divers','none');
  335.  
  336.   if(count($form_sdi0{
  337.     $sdi_list='<ul style="padding:0">';
  338.     foreach ($form_sdi as &$value{
  339.       $query=SQL_getSdiName($value);
  340.       $result $sql_object->DBSelect($query);
  341.       if($result==|| count($result)!=1exit;
  342.       else $sdi_list.= '<li>'.formatText($result[0]['sdii_name']'2HTML').'</li>'.END_LINE;
  343.     }
  344.     $sdi_list.='</ul>';
  345.   else $sdi_list=_t('divers','none');
  346.  
  347.   ?>
  348. <div class="contentcontainer"><?php
  349. include_once($dir."/menurub.php");
  350. ?>
  351. <div id="content">
  352. <h2><?php echo formatTitleh2(_t('recap','title'))?></h2>
  353. <?php
  354. echo "<dl class=\"dl3\">\n";
  355. echo "<dt>"._t('project','name')."</dt>\n";
  356. echo "<dd>"$form_name."</dd>\n";
  357. echo "<dt>"._t('project','parent')."</dt>\n";
  358. echo "<dd>"$parent_name."</dd>\n";
  359. echo "<dt>"_t('project','description')"</dt>\n";
  360. echo "<dd>".empty_nc(linkin_content($form_description))."</dd>\n";
  361. echo "<dt>"._t('project','body')." :</dt>\n";
  362. echo "<dd>".linkin_content($form_body)."</dd>\n";
  363. echo "<dt>"._t('project','begin_date')." :</dt>\n";
  364. echo "<dd>".empty_nc($form_begin_date)."</dd>\n";
  365. echo "<dt>"._t('project','estimated_date')." :</dt>\n";
  366. echo "<dd>".empty_nc($form_estimated_date)."</dd>\n";
  367. echo "<dt>"._t('project','end_date')." :</dt>\n";
  368. echo "<dd>".empty_nc($form_end_date)."</dd>\n";
  369. echo "<dt>"._t('project','progression')." :</dt>\n";
  370. echo "<dd>".getProgressbar($form_progression100'%')."</dd>\n";
  371. echo "<dt>"._t('project','priority')." :</dt>\n";
  372. echo "<dd>".$priority_name."</dd>\n";
  373. echo "<dt>"._t('project','theme')." :</dt>\n";
  374. echo "<dd>".$theme_denomination."</dd>\n";
  375. echo "<dt>"._t('project','scale')." :</dt>\n";
  376. echo "<dd>".$scale_denomination."</dd>\n";
  377. echo "<dt>"._t('project','workshop')." :</dt>\n";
  378. echo "<dd>".$workshop_name."</dd>\n";
  379. echo "<dt>"._t('project','sdi')." :</dt>\n";
  380. echo "<dd>".$sdi_list."</dd>\n";
  381. echo "<dt>"._t('divers','statut')."</dt>\n";
  382. echo "<dd>"display_statut($_POST['project_statut'])"</dd>\n";
  383. echo "</dl>\n";
  384. ?>
  385. <form id="addproject" action="<?php echo $_SERVER['SCRIPT_NAME']?>" method="post">
  386.   <div>
  387.     <input name="rub" type="hidden" value="<?php echo $rub?>" id="rub" />
  388.     <input name="todo" type="hidden" value="<?php echo $todo?>" id="todo" />
  389.     <input name="data_table" type="hidden" value="<?php echo $table?>" id="data_table" />
  390.     <?php echo cancel_button('?rub_project&amp;todo=list')?>
  391.     <input name="retour" type="button" value="<?php echo _t('btn','preview')?>" class="button" id="retour" onclick="history.go(-1);" />
  392.     <input name="enregistrer" type="submit" value="<?php echo _t('btn','save')?>" class="button" id="valider" />
  393.   </div>
  394. </form>
  395. </div>
  396. <?php include_once($dir."/help.php")?></div>
  397. <?php
  398. }
  399. ?>

Documentation generated on Thu, 03 May 2012 15:01:55 +0200 by phpDocumentor 1.4.1