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

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