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

Documentation generated on Fri, 16 Oct 2009 09:28:10 +0200 by phpDocumentor 1.4.1