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

Documentation generated on Fri, 01 Apr 2011 09:27:21 +0200 by phpDocumentor 1.4.1