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 workshoprep
  5.  * @author linea21 <info@linea21.com>
  6.  * @version $id SVN
  7.  * @access public
  8.  * @license http://opensource.org/licenses/gpl-3.0.html
  9.  *  'Workshoprep' (as Workshop Report) module is used by 'Workshop' modules
  10.  */
  11.  
  12. //////////// Check Inclusion de pages ////////////
  13. if (!function_exists('AuthenthificationProcess')) {
  14.   include_once("../lib/lib_common.php");
  15.   ReloadIndex('admin');
  16. }
  17. ////////////
  18.  
  19. if(isset($_POST['id']))    $id=$_POST['id'];
  20. if(isset($_GET['id']))    $id=$_GET['id'];
  21. $cancel_action_link=$rub_link."&amp;todo=det&amp;id=".$id;
  22.  
  23.  
  24. //////////// Check Droits utilisateur ////////////
  25. if (!hasRight('workshop')) ReloadIndex('admin');
  26. if(!AuthUser4Workshop($id$sql_object&& !IsSuperAdmin()) ReloadIndex('admin');
  27. ////////////
  28.  
  29.  
  30. $mask_statut_P='';
  31. $mask_statut_D='';
  32. $mask_statut_AA='';
  33. $mask_statut_PA='';
  34.  
  35. $result=$sql_object->DBSelect($req_det);
  36. if(count($result)>1exit();
  37.  
  38. $form_title=formatText($result[0]['workrep_title']'2FIELD');
  39. $form_resume=formatText($result[0]['workrep_resume']'2FIELD');
  40. $form_comment=formatText($result[0]['workrep_comment']'2FIELD');
  41. $form_statut=$result[0]['workrep_statut'];
  42. $current_statut=$result[0]['workrep_statut'];
  43.  
  44. $workshopreport_title=formatText($result[0]['workrep_title']'2HTML');
  45. $workrep_workshop_name=formatText($result[0]['workshop_denomination']'2HTML');
  46. $current_title=$workshopreport_title.' ('.$workrep_workshop_name.')';
  47. $work_id=$result[0]['workrep_workshop_id'];
  48. $rub_link="index.php?rub=workshop";
  49. ?>
  50.  
  51. <div id="chemin">
  52. <ul>
  53.     <li><a href="index.php" class="chemin_home"><?php echo _t('way','home')?></a>
  54.     </li>
  55.     <li><a href="<?php echo $rub_link?>" id="chemin_<?php echo $rub?>"
  56.         class="chemin_rub"><?php echo _t('menu','workshop')?></a></li>
  57.     <li><span><?php echo formatnavTitle(_t('workshoprep','mod').' : '.$current_title)?></span>
  58.     </li>
  59. </ul>
  60. </div>
  61. <!--end barre haute -->
  62. <?php
  63.  
  64.  
  65. $workshop_report_objectnew workshop_report;
  66.  
  67. if(isset($_POST['enregistrer'])) {
  68.   $data_table=unserialize(urldecode($_POST['data_table']));
  69.   $result=$workshop_report_object->ModifyWorkshopReport($id$data_table$sql_object);
  70.   $link_confirm="confirm.php?rub=".$rub."&todo=".$todo."&id=".$id;
  71.   if($resultheader("Location: ".$link_confirm);
  72.   else  system_error();
  73. }
  74.  
  75. if(isset($_POST['valider'])) {
  76.   $table[0]=$_POST['workrep_title'];
  77.   $table[1]=$_POST['workrep_resume'];
  78.   $table[2]=$_POST['workrep_comment'];
  79.   $table[3]=$_POST['workrep_statut'];
  80.   $table[4]=$current_statut// statut courant
  81.  
  82.   $integrity=$workshop_report_object->CheckDataIntegrity($table$sql_object);
  83.  
  84.   if(is_string($integrity)) {
  85.     $text_format='2FIELD';
  86.   else {
  87.     $text_format='2HTML';
  88.   }
  89.   $form_title=formatText($_POST['workrep_title']$text_format);
  90.   $form_resume=formatText($_POST['workrep_resume']$text_format);
  91.   $form_comment=formatText($_POST['workrep_comment']$text_format);
  92.   $form_statut=$_POST['workrep_statut'];
  93.   $table=urlencode(serialize($table));
  94. }
  95.  
  96.  
  97. // select-box statut
  98. if($form_statut=='P'$mask_statut_P=' selected="selected"';
  99. if($form_statut=='D'$mask_statut_D=' selected="selected"';
  100. if($form_statut=='AA'$mask_statut_AA=' selected="selected"';
  101. if($form_statut=='PA'$mask_statut_PA=' selected="selected"';
  102. $select_statut="<select name=\"workrep_statut\" id=\"workrep_statut\">\n";
  103. $select_statut.="<option value=\"P\"".$mask_statut_P.">".display_statut('P')."</option>\n";
  104. $select_statut.="<option value=\"D\"".$mask_statut_D.">".display_statut('D')."</option>\n";
  105. $select_statut.="<option value=\"AA\"".$mask_statut_AA.">".display_statut('AA')."</option>\n";
  106. $select_statut.="<option value=\"PA\"".$mask_statut_PA.">".display_statut('PA')."</option>\n";
  107. $select_statut.="</select>\n";
  108.  
  109. include_once(THEME_ADMIN_PATH."quickicons.php");
  110.  
  111. ?>
  112.  
  113. <?php
  114. if(!isset($integrity|| is_string($integrity)) {
  115.   ?>
  116. <div class="contentcontainer"><?php
  117. include_once($dir."/menurub.php");
  118. ?>
  119. <div id="content"><?php
  120. if(isset($integrity&& is_string($integrity)) display_errors($integrity);
  121. ?>
  122. <h2><?php echo formatTitleh2($current_title)?></h2>
  123. <form id="modworkrep" action="<?php echo $_SERVER['SCRIPT_NAME']?>"
  124.     method="post">
  125. <p><label for="workrep_title"><?php echo _t('workshoprep','title')?> :
  126. *</label> <input name="workrep_title" type="text" class="textfield"
  127.     id="workrep_title" maxlength="200" value="<?php echo $form_title?>" />
  128. </p>
  129. <p><label for="workrep_resume"><?php echo _t('workshoprep','resume')?>
  130. : *</label> <textarea id="workrep_resume" name="workrep_resume"
  131.     class="largetextfield" <?php echo AREA_SETTINGS?>><?php echo $form_resume?></textarea>
  132. </p>
  133. <p><label for="workrep_statut"><?php echo _t('workshoprep','statut')?>
  134. : *</label> <?php echo $select_statut?></p>
  135. <p><label for="workrep_comment"><?php echo _t('workshoprep','comment')?>
  136. : </label> <textarea id="workrep_comment" name="workrep_comment"
  137.     class="largetextfield" <?php echo AREA_SETTINGS?>><?php echo $form_comment?></textarea>
  138. </p>
  139. <div><input name="id" type="hidden" value="<?php echo $id?>" id="id" />
  140. <input name="rub" type="hidden" value="<?php echo $rub?>" id="rub" />
  141. <input name="todo" type="hidden" value="<?php echo $todo?>" id="todo" />
  142. <?php echo cancel_button($cancel_action_link)?> <input name="valider"
  143.     type="submit" value="<?php echo _t('btn','valid'?>" class="button"
  144.     id="valider" /></div>
  145. </form>
  146. </div>
  147. <?php include_once($dir."/help.php")?></div>
  148. <?php
  149. // Récapitulatif
  150. else    {
  151.   $display_form_comment=empty_none($form_comment);
  152.  
  153.   ?>
  154. <div class="contentcontainer"><?php
  155. include_once($dir."/menurub.php");
  156. ?>
  157. <div id="content">
  158. <h2><?php echo formatTitleh2(_t('recap','title'))?></h2>
  159. <?php
  160. echo "<dl class=\"dl3\">\n";
  161. echo "<dt>"._t('workshoprep','title')."</dt>\n";
  162. echo "<dd>"$form_title."</dd>\n";
  163. echo "<dt>"_t('workshoprep','resume')"</dt>\n";
  164. echo "<dd>"$form_resume."</dd>\n";
  165. echo "<dt>"_t('divers','statut'."</dt>\n";
  166. echo "<dd>"display_statut($_POST['workrep_statut'])"</dd>\n";
  167. echo "<dt>"._t('workshoprep','comment'."</dt>\n";
  168. echo "<dd>"$display_form_comment"</dd>\n";
  169. echo "</dl>\n";
  170. ?>
  171. <form id="modworkrep" action="<?php echo $_SERVER['SCRIPT_NAME']?>"
  172.     method="post">
  173. <div><input name="id" type="hidden" value="<?php echo $id?>" id="id" />
  174. <input name="rub" type="hidden" value="<?php echo $rub?>" id="rub" />
  175. <input name="todo" type="hidden" value="<?php echo $todo?>" id="todo" />
  176. <input name="data_table" type="hidden" value="<?php echo $table?>"
  177.     id="data_table" /> <?php echo cancel_button($cancel_action_link)?> <input
  178.     name="retour" type="button" value="<?php echo _t('btn','preview'?>"
  179.     class="button" id="retour" onclick="history.go(-1);" /> <input
  180.     name="enregistrer" type="submit" value="<?php echo _t('btn','save'?>"
  181.     class="button" id="valider" /></div>
  182. </form>
  183. </div>
  184. <?php include_once($dir."/help.php")?></div>
  185. <?php
  186. }
  187. ?>

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