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

Documentation generated on Sat, 08 Nov 2008 14:50:35 +0100 by phpDocumentor 1.4.1