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 workshop
  5.  * @author linea21 <info@linea21.com>
  6.  * @version $id SVN
  7.  * @access public
  8.  * @license http://opensource.org/licenses/gpl-3.0.html
  9.  */
  10.  
  11. include_once("../lib/input_helpers.php");
  12. $form_denomination='';
  13. $form_resume='';
  14. $form_comment='';
  15. $form_organizer='';
  16. $form_theme='';
  17. $form_level='';
  18. $mask_statut_P='';
  19. $mask_statut_D="checked=\"checked\"";
  20.  
  21. //////////// Check Inclusion de pages //////////// 
  22. if (!function_exists('AuthenthificationProcess'))
  23. include_once("../lib/lib_common.php");
  24. ReloadIndex('admin');
  25. }
  26. ////////////
  27.  
  28. //////////// Check Droits utilisateur ////////////  
  29. if (!IsSuperAdmin())
  30. ReloadIndex('admin');  
  31. ////////////
  32.  
  33. $workshop_objectnew workshop;
  34.  
  35. if(isset($_POST['enregistrer'])) {
  36.     $data_table=unserialize(urldecode($_POST['data_table']));
  37.     $result=$workshop_object->AddWorkshop($data_table$sql_object);
  38.     $data_table[6]=str_replace(" ",""$data_table[6]);    
  39.     $table_organizer=@explode(MAIL_SEPARATOR,$data_table[6]);
  40.         for ($i=0;$i<count($table_organizer);$i++){
  41.     $result2=$workshop_object->AddUserWorkshop($result$table_organizer[$i]"O" $sql_object);
  42.     }
  43.     $link_confirm="confirm.php?rub=".$rub."&todo=".$todo;
  44.     if(is_numeric($result)) header("Location: ".$link_confirm);
  45.     else  system_error();
  46. }
  47.  
  48. if(isset($_POST['valider'])) {
  49.  
  50.     $table[0]=$_POST['workshop_denomination'];
  51.     $table[1]=$_POST['workshop_resume'];
  52.     $table[2]=$_POST['workshop_theme'];
  53.     $table[3]=$_POST['workshop_comment'];
  54.     $table[4]=$_POST['workshop_level'];
  55.     $table[5]=$_POST['workshop_statut'];
  56.     $table[6]=$_POST['workshop_organizer'];
  57.  
  58.     
  59.     $workshop_objectnew workshop;
  60.     $integrity=$workshop_object->CheckDataIntegrity($table$sql_object);
  61.     if(is_string($integrity)) {
  62.         $text_format='2FIELD';
  63.     else {
  64.         $text_format='2HTML';
  65.         }
  66.     $form_denomination=formatText($_POST['workshop_denomination']$text_format);
  67.     $form_resume=formatText($_POST['workshop_resume']$text_format);
  68.     $form_theme=$_POST['workshop_theme'];
  69.     $form_level=$_POST['workshop_level'];
  70.     $form_organizer=formatText($_POST['workshop_organizer']$text_format);
  71.     $form_comment=formatText($_POST['workshop_comment']$text_format);
  72.  
  73.     if($_POST['workshop_statut']=='D'$mask_statut_D="checked=\"checked\""else $mask_statut_D='';
  74.     if($_POST['workshop_statut']=='P'$mask_statut_P="checked=\"checked\""else $mask_statut_P='';
  75.     $table=urlencode(serialize($table));
  76. }
  77.  
  78.  
  79. if(!isset($integrity|| is_string($integrity)) {
  80.  
  81. // select-box de thèmes
  82. $data=$sql_object->DBSelect($req_list_theme);
  83. $select_theme=ThemeSelectBox($data"workshop_theme"$form_theme);
  84.  
  85. // select-box des niveaux
  86. $data=$sql_object->DBSelect($req_list_level);
  87. $select_level=LevelSelectBox($data"workshop_level"$form_level);
  88. }
  89.  
  90. include_once(THEME_ADMIN_PATH."quickicons.php");
  91.  
  92. ?>
  93. <div id="chemin">
  94.     <ul>
  95.         <li>
  96.             <a href="index.php" class="chemin_home"><? echo _t('way','home'?></a>
  97.         </li>
  98.         <li>
  99.                <a href="<?php echo $rub_link?>" id="chemin_<? echo $rub?>" class="chemin_rub"><? echo _t('menu','workshop')?></a>
  100.         </li>
  101.         <li>
  102.             <span><? echo formatnavTitle(_t('workshop','add'))?></span>
  103.         </li>
  104.     </ul>
  105. </div>
  106. <!--end barre haute -->
  107. <?php
  108. if(!isset($integrity|| is_string($integrity)) {
  109. ?>
  110. <div class="contentcontainer">
  111.         <?php
  112.         include_once($dir."/menurub.php");
  113. ?>
  114.         <div id="content">
  115.             <?php
  116.             if(isset($integrity&& is_string($integrity)) display_errors($integrity);
  117.             ?>
  118.             <h2><? echo _t('workshop','add_title'?></h2>
  119.             <form id="addworkshop" action="<?php echo $_SERVER['SCRIPT_NAME']?>" method="post">
  120.                 <p>
  121.                 <label for="workshop_denomination"><? echo _t('workshop','title')?> * : </label>
  122.                 <input name="workshop_denomination" type="text" class="textfield" id="workshop_denomination" maxlength="255" value="<?php echo $form_denomination?>" />
  123.                 </p>
  124.                 <p>
  125.                 <label for="workshop_resume"><? echo _t('workshop','resume')?> * : </label>
  126.                 <textarea id="workshop_resume" name="workshop_resume" <?php echo AREA_SETTINGS?> class="largetextfield" ><?php echo $form_resume?></textarea>
  127.                 </p>
  128.                 <p>
  129.                 <label for="workshop_theme" ><? echo _t('workshop','theme')?> * : </label>
  130.                 <?php echo $select_theme?>
  131.                 </p>
  132.                 <p>
  133.                 <label for="workshop_level" ><? echo _t('workshop','level')?> : </label>
  134.                 <?php echo $select_level?>
  135.                 </p>
  136.                 <p>
  137.                 <label for="workshop_organizer"><? echo _t('workshop','organizer')?> * : </label>
  138.                 <input name="workshop_organizer" type="text" class="textfield" id="workshop_organizer" maxlength="150" value="<?php echo $form_organizer?>" />
  139.                 </p>
  140.                 <p>
  141.                 <label for="workshop_statut"><? echo _t('workshop','statut')?> * : </label>
  142.                 <input name="workshop_statut" type="radio" id="statut_P" value="P" <?php echo $mask_statut_P?> /><span class="radio"><?php echo _t('statut','public')?></span>
  143.                 <input name="workshop_statut" type="radio" id="statut_D" value="D" <?php echo $mask_statut_D?> /><span class="radio"><?php echo _t('statut','draft')?></span>
  144.                 <br />
  145.                 </p>
  146.                 <p>
  147.                 <label for="workshop_comment"><? echo _t('workshop','comment')?> : </label>
  148.                 <textarea id="workshop_comment" name="workshop_comment" <?php echo AREA_SETTINGS?> class="largetextfield" ><?php echo $form_comment?></textarea>
  149.                 </p>
  150.                 <div>
  151.                 <input name="rub" type="hidden" value="<?php echo $rub?>" id="rub" />
  152.                 <input name="todo" type="hidden" value="<?php echo $todo?>" id="todo" />
  153.                 <? echo cancel_button($rub_link."&amp;todo=list")?>
  154.                 <input name="valider" type="submit" value="<? echo _t('btn','valid'?>" class="button" id="valider" />
  155.                 </div>
  156.             </form>
  157.         </div>
  158. <?php include_once($dir."/help.php")?>
  159. </div>
  160. <?php
  161. // Récapitulatif
  162. else    {
  163. $requete=SQL_getonethemeName($form_theme);
  164. $result=$sql_object->DBSelect($requete);
  165. if($result==|| count($result)!=1exit;
  166. else $theme_denomination=formatText($result[0]['theme_name']'2HTML');
  167.  
  168. if($form_level <> -1{
  169. $requete=SQL_getonelevelName($form_level);
  170. $result=$sql_object->DBSelect($requete);
  171. if($result==|| count($result)!=1exit;
  172. else $level_denomination=formatText($result[0]['level_name']'2HTML');
  173. }else $level_denomination=_t('divers','none');
  174.  
  175.  
  176. $display_form_resume=empty_nc($form_resume);
  177. $display_form_comment=empty_nc($form_comment);
  178.  
  179. ?>
  180. <div class="contentcontainer">
  181. <?php
  182. include_once($dir."/menurub.php");
  183. ?>
  184. <div id="content">
  185.             <h2><? echo _t('recap','title'?></h2>
  186.             <?php
  187.             echo "<dl class=\"dl3\">\n";
  188.             echo "<dt>"._t('workshop','title')."</dt>\n";
  189.             echo "<dd>"$form_denomination."</dd>\n";
  190.             echo "<dt>"_t('workshop','resume')"</dt>\n";
  191.             echo "<dd>".$display_form_resume."</dd>\n";
  192.             echo "<dt>"._t('workshop','theme')." :</dt>\n";
  193.             echo "<dd>".$theme_denomination."</dd>\n";
  194.             echo "<dt>"._t('workshop','level')." :</dt>\n";
  195.             echo "<dd>".$level_denomination."</dd>\n";
  196.             echo "<dt>"._t('workshop','organizer')." :</dt>\n";
  197.             echo "<dd>".$form_organizer."</dd>\n";
  198.             echo "<dt>"._t('divers','statut'."</dt>\n";
  199.             echo "<dd>"display_statut($_POST['workshop_statut'])"</dd>\n";
  200.             echo "<dt>"._t('workshop','comment'."</dt>\n";
  201.             echo "<dd>"$display_form_comment"</dd>\n";
  202.             echo "</dl>\n";
  203.             ?>
  204.             <form id="addworkshop" action="<?php echo $_SERVER['SCRIPT_NAME']?>" method="post">
  205.                 <div>
  206.                 <input name="rub" type="hidden" value="<?php echo $rub?>" id="rub" />
  207.                 <input name="todo" type="hidden" value="<?php echo $todo?>" id="todo" />
  208.                 <? echo cancel_button($rub_link."&amp;todo=list")?>
  209.                 <input name="data_table" type="hidden" value="<?php echo $table?>" id="data_table" />
  210.                 <input name="retour" type="button" value="<? echo _t('btn','preview'?>" class="button" id="retour" onclick="history.go(-1);" />
  211.                 <input name="enregistrer" type="submit" value="<? echo _t('btn','save'?>" class="button" id="valider" />
  212.                 </div>
  213.             </form>
  214.         </div>
  215.     <?php include_once($dir."/help.php")?>
  216. </div>
  217. <?php
  218. }
  219. ?>

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