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 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.  
  20. if(isset($_GET['work_id'])) $work_id=$_GET['work_id'];
  21. if(isset($_POST['work_id'])) $work_id=$_POST['work_id'];
  22. $cancel_action_link="?rub=workshop&amp;todo=det&amp;id=".$work_id;
  23.  
  24.  
  25. $requete=SQL_getWorkshopDenomination($work_id);
  26. $result=$sql_object->DBSelect($requete);
  27. if(count($result)>1exit();
  28. $workrep_workshop_name=$result[0]['workshop_denomination'];
  29.  
  30. //////////// Check Droits utilisateur ////////////
  31. if (!hasRight('workshop')) ReloadIndex('admin');
  32. if(!AuthUser4Workshop($work_id$sql_object&& !IsSuperAdmin()) ReloadIndex('admin');
  33. ////////////
  34. $rub_link="index.php?rub=workshop";
  35. ?>
  36.  
  37. <div id="chemin">
  38. <ul>
  39.     <li><a href="index.php" class="chemin_home"><?php echo _t('way','home')?></a></li>
  40.     <li><a href="<?php echo $rub_link?>" id="chemin_<?php echo $rub?>" class="chemin_rub"><?php echo _t('menu','workshop')?></a></li>
  41.     <li><span><?php echo formatNavTitle(_t('workshoprep','add')" (" .$workrep_workshop_name.")")?></span></li>
  42. </ul>
  43. </div>
  44. <!--end barre haute -->
  45. <?php
  46. $form_title='';
  47. $form_resume='';
  48. $form_comment='';
  49. $mask_statut_P='';
  50. $mask_statut_D="checked=\"checked\"";
  51.  
  52.  
  53. $workshop_report_objectnew workshop_report;
  54.  
  55. if(isset($_POST['enregistrer'])) {
  56.   $data_table=unserialize(urldecode($_POST['data_table']));
  57.   $result=$workshop_report_object->AddWorkshopReport($data_table$sql_object);
  58.   $link_confirm="confirm.php?rub=".$rub."&todo=".$todo."&id=".$result;
  59.   if(is_numeric($result)) header("Location: ".$link_confirm);
  60.   else  system_error();
  61. }
  62.  
  63. if(isset($_POST['valider'])) {
  64.   $table[0]=$_POST['workrep_title'];
  65.   $table[1]=$_POST['workrep_resume'];
  66.   $table[2]=$_POST['workrep_comment'];
  67.   $table[3]=$_POST['workrep_statut'];
  68.   $table[4]=$_POST['work_id'];
  69.  
  70.   $integrity=$workshop_report_object->CheckDataIntegrity($table$sql_object);
  71.  
  72.   if(is_string($integrity)) {
  73.     $text_format='2FIELD';
  74.   else {
  75.     $text_format='2HTML';
  76.   }
  77.   $form_title=formatText($_POST['workrep_title']$text_format);
  78.   $form_resume=formatText($_POST['workrep_resume']$text_format);
  79.  
  80.   $form_comment=formatText($_POST['workrep_comment']$text_format);
  81.  
  82.   if($_POST['workrep_statut']=='D'$mask_statut_D="checked=\"checked\""else $mask_statut_D='';
  83.   if($_POST['workrep_statut']=='P'$mask_statut_P="checked=\"checked\""else $mask_statut_P='';
  84.   $table=urlencode(serialize($table));
  85. }
  86.  
  87. include_once(THEME_ADMIN_PATH."quickicons.php");
  88.  
  89. ?>
  90.  
  91. <?php
  92. if(!isset($integrity|| is_string($integrity)) {
  93. ?>
  94. <div class="contentcontainer">
  95. <?php
  96. include_once($dir."/menurub.php");
  97. ?>
  98. <div id="content">
  99. <?php
  100. if(isset($integrity&& is_string($integrity)) display_errors($integrity);
  101. ?>
  102. <h2><?php echo formatTitleh2(_t('workshoprep','add_title')" (" .$workrep_workshop_name.")")?></h2>
  103. <form id="addworkrep" action="<?php echo $_SERVER['SCRIPT_NAME']?>" method="post">
  104. <p>
  105.     <label for="workrep_title"><?php echo _t('workshoprep','title')?> : *</label>
  106.     <input name="workrep_title" type="text" class="textfield" id="workrep_title" maxlength="200" value="<?php echo $form_title?>" />
  107. </p>
  108. <p>
  109.     <label for="workrep_resume"><?php echo _t('workshoprep','resume')?> : *</label>
  110.     <textarea id="workrep_resume" name="workrep_resume" class="largetextfield" <?php echo AREA_SETTINGS?>><?php echo $form_resume?></textarea>
  111. </p>
  112. <div class="label"><?php echo _t('workshoprep','statut')?> : *</div>
  113. <div class="rightpanel">
  114.   <input name="workrep_statut" type="radio" id="statut_P" value="P" <?php echo $mask_statut_P?> />
  115.   <label for="statut_P"><?php echo _t('statut','public')?></label>
  116.   <input name="workrep_statut" type="radio" id="statut_D" value="D" <?php echo $mask_statut_D?> />
  117.   <label for="statut_D"><?php echo _t('statut','draft')?></label>
  118. </div>
  119. <p>
  120.     <label for="workrep_comment"><?php echo _t('workshoprep','comment')?> : </label>
  121.     <textarea id="workrep_comment" name="workrep_comment" class="largetextfield" <?php echo AREA_SETTINGS?>><?php echo $form_comment?></textarea>
  122. </p>
  123.   <div>
  124.       <input name="work_id" type="hidden" value="<?php echo $work_id?>" id="work_id" />
  125.       <input name="rub" type="hidden"    value="<?php echo $rub?>" id="rub" />
  126.       <input name="todo"    type="hidden" value="<?php echo $todo?>" id="todo" />
  127.       <?php echo cancel_button($cancel_action_link)?>
  128.       <input name="valider" type="submit" value="<?php echo _t('btn','valid'?>" class="button" id="valider" />
  129.   </div>
  130. </form>
  131. </div>
  132. <?php include_once($dir."/help.php")?></div>
  133. <?php
  134. // Récapitulatif
  135. else    {
  136.  
  137.   if(empty($form_comment)) $display_form_comment=_t('divers','none');
  138.   else $display_form_comment=$form_comment;
  139.  
  140.   ?>
  141. <div class="contentcontainer">
  142. <?php
  143. include_once($dir."/menurub.php");
  144. ?>
  145. <div id="content">
  146. <h2><?php echo _t('recap','title'?></h2>
  147. <?php
  148. echo "<dl class=\"dl3\">\n";
  149. echo "<dt>"._t('workshoprep','title')."</dt>\n";
  150. echo "<dd>"$form_title."</dd>\n";
  151. echo "<dt>"_t('workshoprep','resume')"</dt>\n";
  152. echo "<dd>"$form_resume."</dd>\n";
  153. echo "<dt>"_t('divers','statut'."</dt>\n";
  154. echo "<dd>"display_statut($_POST['workrep_statut'])"</dd>\n";
  155. echo "<dt>"._t('workshoprep','comment'."</dt>\n";
  156. echo "<dd>"$display_form_comment"</dd>\n";
  157. echo "</dl>\n";
  158. ?>
  159. <form id="addworkrep" action="<?php echo $_SERVER['SCRIPT_NAME']?>" method="post">
  160.   <div>
  161.     <input name="work_id" type="hidden" value="<?php echo $work_id?>" id="work_id" />
  162.     <input name="rub" type="hidden" value="<?php echo $rub?>" id="rub" />
  163.     <input name="todo" type="hidden" value="<?php echo $todo?>" id="todo" />
  164.     <input name="data_table" type="hidden" value="<?php echo $table?>" id="data_table" />
  165.     <input name="retour" type="button" value="<?php echo _t('btn','preview'?>" class="button" id="retour" onclick="history.go(-1);" />
  166.     <input name="enregistrer" type="submit" value="<?php echo _t('btn','save'?>" class="button" id="valider" />
  167.   </div>
  168. </form>
  169. </div>
  170. <?php include_once($dir."/help.php")?></div>
  171. <?php
  172. }
  173. ?>

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