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

Documentation generated on Thu, 20 Mar 2014 16:48:52 +0100 by phpDocumentor 1.4.1