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

Source for file mod.php

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

Documentation generated on Thu, 03 May 2012 15:06:33 +0200 by phpDocumentor 1.4.1