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, placeholder:"<?php echo _t('textbox_js''placeholder')?>"}}});
  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_restricted='';
  31. $form_theme='';
  32. $form_level='';
  33. $mask_statut_P='';
  34. $mask_statut_D="checked=\"checked\"";
  35. $mask_restricted_N="checked=\"checked\"";
  36. $mask_restricted_Y='';
  37.  
  38. //////////// Check Inclusion de pages ////////////
  39. if (!class_exists('auth')){
  40.   include_once("../lib/lib_common.php");
  41.   ReloadIndex('admin');
  42. }
  43. ////////////
  44.  
  45. //////////// Check Droits utilisateur ////////////
  46. if (!$l21auth->isSuperAdmin())
  47. ReloadIndex('admin');
  48. ////////////
  49.  
  50. // TextboxList CSS/JS inclusion
  51. addDynamicCSS(THEME_ADMIN_PATH.'css/TextboxList.css');
  52. addDynamicCSS(THEME_ADMIN_PATH.'css/TextboxList.Autocomplete.css');
  53. footerAddJS('../lib/js/jquery.textboxList/GrowingInput.js');
  54. footerAddJS('../lib/js/jquery.textboxList/TextboxList.js');
  55. footerAddJS('../lib/js/jquery.textboxList/TextboxList.Autocomplete.js');
  56.  
  57.  
  58. $workshop_objectnew workshop;
  59.  
  60. if(isset($_POST['enregistrer'])) {
  61.   $data_table=unserialize(urldecode($_POST['data_table']));
  62.   $result=$workshop_object->AddWorkshop($data_table$sql_object);
  63.   $data_table[6]=str_replace(" ",""$data_table[6]);
  64.   $table_organizer=@explode(',',$data_table[6]);
  65.   for ($i=0;$i<count($table_organizer);$i++){
  66.     $result2=$workshop_object->AddUserWorkshop($resulttrim($table_organizer[$i])"O" $sql_object);
  67.   }
  68.   $link_confirm="confirm.php?rub=".$rub."&todo=".$todo;
  69.   if(is_numeric($result)) header("Location: ".$link_confirm);
  70.   else  system_error();
  71. }
  72.  
  73. if(isset($_POST['valider'])) {
  74.  
  75.   $table[0]=$_POST['workshop_denomination'];
  76.   $table[1]=$_POST['workshop_resume'];
  77.   $table[2]=$_POST['workshop_theme'];
  78.   $table[3]=$_POST['workshop_comment'];
  79.   $table[4]=$_POST['workshop_level'];
  80.   $table[5]=$_POST['workshop_statut'];
  81.   $table[6]=$_POST['workshop_organizer'];
  82.   $table[7]=$_POST['workshop_restricted'];
  83.  
  84.  
  85.   $workshop_objectnew workshop;
  86.   $integrity=$workshop_object->CheckDataIntegrity($table$sql_object);
  87.   if(is_string($integrity)) {
  88.     $text_format='2FIELD';
  89.   else {
  90.     $text_format='2HTML';
  91.   }
  92.   $form_denomination=formatText($_POST['workshop_denomination']$text_format);
  93.   $form_resume=formatText($_POST['workshop_resume']$text_format);
  94.   $form_theme=$_POST['workshop_theme'];
  95.   $form_level=$_POST['workshop_level'];
  96.   $form_organizer=formatText(str_replace(",",", "$_POST['workshop_organizer'])$text_format);
  97.   $form_comment=formatText($_POST['workshop_comment']$text_format);
  98.   
  99.   if($_POST['workshop_restricted'== 1{
  100.       $display_form_restricted _t('divers''yes');
  101.   else {
  102.       $display_form_restricted _t('divers''no');
  103.   }
  104.  
  105.   if($_POST['workshop_statut']=='D'$mask_statut_D="checked=\"checked\""else $mask_statut_D='';
  106.   if($_POST['workshop_statut']=='P'$mask_statut_P="checked=\"checked\""else $mask_statut_P='';
  107.   if($_POST['workshop_restricted']==0$mask_restricted_N="checked=\"checked\""else $mask_restricted_N='';
  108.   if($_POST['workshop_restricted']==1$mask_restricted_Y="checked=\"checked\""else $mask_restricted_Y='';
  109.   $table=urlencode(serialize($table));
  110. }
  111.  
  112.  
  113. if(!isset($integrity|| is_string($integrity)) {
  114.  
  115.   // select-box de thèmes
  116.   $data=$sql_object->DBSelect($req_list_theme);
  117.   $select_theme=ThemeSelectBox($data"workshop_theme"$form_theme);
  118.  
  119.   // select-box des niveaux
  120.   $data=$sql_object->DBSelect($req_list_level);
  121.   $select_level=LevelSelectBox($data"workshop_level"$form_level);
  122. }
  123.  
  124. include_once(THEME_ADMIN_PATH."quickicons.php");
  125.  
  126. ?>
  127. <div id="chemin">
  128. <ul>
  129.     <li><a href="index.php" class="chemin_home"><?php echo _t('way','home'?></a></li>
  130.     <li><a href="<?php echo $rub_link?>" id="chemin_<?php echo $rub?>" class="chemin_rub"><?php echo _t('menu','workshop')?></a></li>
  131.     <li><span><?php echo formatnavTitle(_t('workshop','add'))?></span></li>
  132. </ul>
  133. </div>
  134. <!--end barre haute -->
  135. <?php
  136. if(!isset($integrity|| is_string($integrity)) {
  137.   ?>
  138. <div class="contentcontainer"><?php
  139. include_once(override($dir.'/menurub.php'THEME_ADMIN_PATH));
  140. ?>
  141. <div id="content">
  142. <?php
  143. if(isset($integrity&& is_string($integrity)) display_errors($integrity);
  144. ?>
  145. <h2><?php echo _t('workshop','add_title'?></h2>
  146.  
  147. <form id="addworkshop" action="<?php echo $_SERVER['SCRIPT_NAME']?>" method="post">
  148. <p>
  149.     <label for="workshop_denomination"><?php echo mb_ucfirst(_t('workshop','title'))?> : *</label>
  150.     <input name="workshop_denomination" type="text" class="textfield" id="workshop_denomination" maxlength="255" value="<?php echo $form_denomination?>" />
  151. </p>
  152. <p>
  153.     <label for="workshop_resume"><?php echo mb_ucfirst(_t('workshop','resume'))?> : *</label>
  154.     <textarea id="workshop_resume" name="workshop_resume" <?php echo AREA_SETTINGS?> class="largetextfield"><?php echo $form_resume?></textarea>
  155. </p>
  156. <div class="label"><?php echo mb_ucfirst(_t('workshop','restricted'))?> : *</div>
  157. <div class="rightpanel">
  158.         <input name="workshop_restricted" type="radio" id="restricted_N" value="0" <?php echo $mask_restricted_N?> />
  159.         <label for="restricted_N"><?php echo mb_ucfirst(_t('divers','no'))?></label>
  160.         <input name="workshop_restricted" type="radio" id="restricted_Y" value="1" <?php echo $mask_restricted_Y?> />
  161.         <label for="restricted_Y"><?php echo mb_ucfirst(_t('divers','yes'))?></label>
  162. </div>
  163. <p>
  164.     <label for="workshop_theme"><?php echo mb_ucfirst(_t('workshop','theme'))?> : *</label>
  165.     <?php echo $select_theme?>
  166. </p>
  167. <p>
  168.     <label for="workshop_level"><?php echo mb_ucfirst(_t('workshop','level'))?> : </label>
  169.     <?php echo $select_level?>
  170. </p>
  171. <p>
  172.     <label for="workshop_organizer"><?php echo mb_ucfirst(_t('workshop','organizer'))?> :&nbsp;*</label>
  173.     <input name="workshop_organizer" type="text" class="textfield" id="workshop_organizer" maxlength="150" value="<?php echo $form_organizer?>" />
  174. </p>
  175.  
  176.     <div class="label"><?php echo mb_ucfirst(_t('workshop','statut'))?> : *</div>
  177.     <div class="rightpanel">
  178.         <input name="workshop_statut" type="radio" id="statut_P" value="P" <?php echo $mask_statut_P?> />
  179.         <label for="statut_P"><?php echo mb_ucfirst(_t('statut','public'))?></label>
  180.         <input name="workshop_statut" type="radio" id="statut_D" value="D" <?php echo $mask_statut_D?> />
  181.         <label for="statut_D"><?php echo mb_ucfirst(_t('statut','draft'))?></label>
  182.     </div>
  183.  
  184. <p>
  185.     <label for="workshop_comment"><?php echo mb_ucfirst(_t('workshop','comment'))?> : </label>
  186.     <textarea id="workshop_comment" name="workshop_comment" <?php echo AREA_SETTINGS?> class="largetextfield"><?php echo $form_comment?></textarea>
  187. </p>
  188.   <div>
  189.     <input name="rub" type="hidden" value="<?php echo $rub?>" id="rub" />
  190.     <input name="todo" type="hidden" value="<?php echo $todo?>" id="todo" />
  191.     <?php echo cancel_button($rub_link."&amp;todo=list")?>
  192.     <input name="valider" type="submit" value="<?php echo _t('btn','valid'?>" class="button" id="valider" />
  193.   </div>
  194. </form>
  195. </div>
  196. <?php include_once(override($dir.'/help.php'THEME_ADMIN_PATH))?></div>
  197. <?php
  198. // Récapitulatif
  199. else    {
  200.   $requete=SQL_getonethemeName($form_theme);
  201.   $result=$sql_object->DBSelect($requete);
  202.   if($result==|| count($result)!=1exit;
  203.   else $theme_denomination=formatText($result[0]['theme_name']'2HTML');
  204.  
  205.   if($form_level <> -1{
  206.     $requete=SQL_getonelevelName($form_level);
  207.     $result=$sql_object->DBSelect($requete);
  208.     if($result==|| count($result)!=1exit;
  209.     else $level_denomination=formatText($result[0]['level_name']'2HTML');
  210.   else $level_denomination=_t('divers','none');
  211.  
  212.  
  213.   $display_form_resume=empty_nc($form_resume);
  214.   $display_form_comment=empty_nc($form_comment);
  215.  
  216.   ?>
  217. <div class="contentcontainer">
  218. <?php
  219. include_once(override($dir.'/menurub.php'THEME_ADMIN_PATH));
  220. ?>
  221. <div id="content">
  222. <h2><?php echo _t('recap','title'?></h2>
  223. <?php
  224. echo "<dl class=\"summary\">\n";
  225. echo "<dt>".mb_ucfirst(_t('workshop','title'))." :</dt>\n";
  226. echo "<dd>"$form_denomination."</dd>\n";
  227. echo "<dt>".mb_ucfirst(_t('workshop','resume'))" :</dt>\n";
  228. echo "<dd>".$display_form_resume."</dd>\n";
  229. echo "<dt>".mb_ucfirst(_t('workshop','restricted'))" :</dt>\n";
  230. echo "<dd>".$display_form_restricted."</dd>\n";
  231. echo "<dt>".mb_ucfirst(_t('workshop','theme'))." :</dt>\n";
  232. echo "<dd>".$theme_denomination."</dd>\n";
  233. echo "<dt>".mb_ucfirst(_t('workshop','level'))." :</dt>\n";
  234. echo "<dd>".$level_denomination."</dd>\n";
  235. echo "<dt>".mb_ucfirst(_t('workshop','organizer'))." :</dt>\n";
  236. echo "<dd>".$form_organizer."</dd>\n";
  237. echo "<dt>".mb_ucfirst(_t('divers','statut')) ." :</dt>\n";
  238. echo "<dd>"display_statut($_POST['workshop_statut'])"</dd>\n";
  239. echo "<dt>".mb_ucfirst(_t('workshop','comment')) ." :</dt>\n";
  240. echo "<dd>"$display_form_comment"</dd>\n";
  241. echo "</dl>\n";
  242. ?>
  243. <form id="addworkshop" action="<?php echo $_SERVER['SCRIPT_NAME']?>" method="post">
  244.   <div>
  245.       <input name="rub" type="hidden" value="<?php echo $rub?>" id="rub" />
  246.       <input name="todo" type="hidden" value="<?php echo $todo?>" id="todo" />
  247.     <?php echo cancel_button($rub_link."&amp;todo=list")?>
  248.       <input name="data_table" type="hidden" value="<?php echo $table?>" id="data_table" />
  249.       <input name="retour" type="button" value="<?php echo _t('btn','preview'?>" class="button" id="retour" onclick="history.go(-1);" />
  250.       <input name="enregistrer" type="submit" value="<?php echo _t('btn','save'?>" class="button" id="valider" />
  251.   </div>
  252. </form>
  253. </div>
  254. <?php include_once(override($dir.'/help.php'THEME_ADMIN_PATH))?></div>
  255. <?php
  256. }
  257. ?>

Documentation generated on Thu, 20 Mar 2014 16:45:50 +0100 by phpDocumentor 1.4.1