linea21-modules
[ class tree: linea21-modules ] [ index: linea21-modules ] [ all elements ]

Source for file mod.php

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

Documentation generated on Thu, 03 May 2012 15:06:26 +0200 by phpDocumentor 1.4.1