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

Source for file mod.php

Documentation is available at mod.php

  1. <?php
  2. /**
  3.  * @package linea21.core
  4.  * @subpackage theme
  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. //////////// Check Inclusion de pages ////////////
  12. if (!class_exists('auth')){
  13.   include_once("../lib/lib_common.php");
  14.   ReloadIndex('admin');
  15. }
  16. ////////////
  17.  
  18. //////////// Check Droits utilisateur ////////////
  19. if (!$l21auth->isSuperAdmin()) ReloadIndex('admin');
  20. ////////////
  21.  
  22. if (isset($_GET['id']))    $id=$_GET['id'];
  23. if (isset($_POST['id'])) $id=$_POST['id'];
  24.  
  25. if(is_string($id[0]&& $id[0]=='s'{
  26.   $id=str_replace('s' ,''$id);
  27.   $query=SQL_getoneCompleteSDtheme($id);
  28.   $root true;
  29. else {
  30.   $query=SQL_getonetheme($id);
  31.   $root false;
  32. }
  33. $data=$sql_object->DBSelect($query);
  34. $display_title=formatText($data[0]['theme_name'],'2HTML');
  35. $display_id=$data[0]['theme_id'];
  36. if($root == false$current_sdthemeid=$data[0]['sdtheme_id'];
  37. if($root == false$form_sdtheme=$data[0]['sdtheme_id'];
  38. if($root == false$current_statut=$data[0]['theme_statut'];
  39.  
  40. $form_description_all='';
  41. $description_detail_form='';
  42.  
  43. $display_name=formatText($data[0]['theme_name'],'2FIELD');
  44.  
  45. if($root == true$form_description_all=formatText($data[0]['theme_description']'2FIELD');
  46. if($root == false$desc_project=formatText($data[0]['theme_desc_project']'2FIELD');
  47. if($root == false$desc_dashboard=formatText($data[0]['theme_desc_dashboard']'2FIELD');
  48. if($root == false$desc_publi=formatText($data[0]['theme_desc_publication']'2FIELD');
  49. if($root == false$desc_workshop=formatText($data[0]['theme_desc_workshop']'2FIELD');
  50. if($root == false$desc_news=formatText($data[0]['theme_desc_news']'2FIELD');
  51.  
  52. $theme_object new theme;
  53.  
  54. ?>
  55. <div id="chemin">
  56.   <ul>
  57.       <li><a href="index.php" class="chemin_home"><?php echo _t('way','home')?></a></li>
  58.       <li><a href="<?php echo $rub_link?>" id="chemin_<?php echo $rub?>" class="chemin_rub"><?php echo _t('menu','theme')?></a></li>
  59.       <li><span><?php echo formatnavTitle(_t('theme','mod')" : ".$display_title)?></span></li>
  60.   </ul>
  61. </div>
  62. <!--end barre haute -->
  63. <?php
  64.  
  65.  
  66.  
  67. if($root == false{
  68.   if($current_statut=='D')  {
  69.     $mask_statut_D="checked=\"checked\"";
  70.     $mask_statut_P='';
  71.  
  72.   }
  73.   elseif($current_statut=='P'{
  74.     $mask_statut_D='';
  75.     $mask_statut_P="checked=\"checked\"";
  76.   }
  77.   $mask_desc_ALL='';
  78.   $mask_desc_DET="checked=\"checked\"";
  79.   $layer_all_style"style=\"display:none;\"";
  80.   $layer_det_style"style=\"display:block;\"";
  81. else {
  82.   $mask_desc_ALL="checked=\"checked\"";
  83.   $mask_desc_DET='';
  84.   $layer_all_style"style=\"display:block;\"";
  85.   $layer_det_style"style=\"display:none;\"";
  86. }
  87.  
  88. if(isset($_POST['enregistrer'])) {
  89.   $data_table=unserialize(urldecode($_POST['data_table']));
  90.   $result=$theme_object->ModifyTheme($id$data_table$sql_object);
  91.   $link_confirm="confirm.php?rub=".$rub."&todo=".$todo;
  92.   if($resultheader("Location: ".$link_confirm);
  93.   else  system_error();
  94. }
  95.  
  96. if(isset($_POST['valider'])) {
  97.   if(isset($_POST['root'])) $root trueelse $root false;
  98.   $table[0]=$_POST['denomination'];
  99.   $table[1]=''// anciennement visuel associé
  100.   if(!$root$table[2]=$_POST['sdtheme']else $table[2]='';
  101.   if($_POST['description']=='ALL'{
  102.     $table[3]=$_POST['desc_for_all'];
  103.     $table[4]=$_POST['desc_for_all'];
  104.     $table[5]=$_POST['desc_for_all'];
  105.     $table[6]=$_POST['desc_for_all'];
  106.     $table[7]=$_POST['desc_for_all'];
  107.   }
  108.   if($_POST['description']=='DET'{
  109.     if(isset($_POST['desc_det_project'])) $table[3]=$_POST['desc_det_project']else $table[3]='';
  110.     if(isset($_POST['desc_det_dashboard'])) $table[4]=$_POST['desc_det_dashboard']else $table[4]='';
  111.     if(isset($_POST['desc_det_publication'])) $table[5]=$_POST['desc_det_publication']else $table[5]='';
  112.     if(isset($_POST['desc_det_news'])) $table[6]=$_POST['desc_det_news']else $table[6]='';
  113.     if(isset($_POST['desc_det_workshop'])) $table[7]=$_POST['desc_det_workshop']else $table[7]='';
  114.   }
  115.   $table[8]=$_POST['statut'];
  116.   $root == true $table[9]=$table[9]=0;
  117.  
  118.  
  119.   $theme_objectnew theme;
  120.   if($root == true$theme_object->SetRoot();
  121.   $integrity=$theme_object->CheckDataIntegrity($table);
  122.   if(is_string($integrity)) $format_text='2FIELD'else $format_text='2HTML';
  123.  
  124.   if($root == false$form_sdtheme=$_POST['sdtheme'];
  125.   if($_POST['description']=='ALL'{
  126.     $form_description_all=formatText($_POST['desc_for_all'],$format_text);
  127.     $layer_all_style"style=\"display:block;\"";
  128.     $layer_det_style"style=\"display:none;\"";
  129.     $mask_desc_ALL="checked=\"checked\"";
  130.     $mask_desc_DET='';
  131.   }
  132.   if($_POST['description']=='DET'{
  133.     if(isset($_POST['desc_det_project'])) $desc_project=formatText($_POST['desc_det_project']$format_text);
  134.     if(isset($_POST['desc_det_dashboard'])) $desc_dashboard=formatText($_POST['desc_det_dashboard']$format_text);
  135.     if(isset($_POST['desc_det_publication'])) $desc_publi=formatText($_POST['desc_det_publication']$format_text);
  136.     if(isset($_POST['desc_det_news'])) $desc_news=formatText($_POST['desc_det_news']$format_text);
  137.     if(isset($_POST['desc_det_workshop'])) $desc_workshop=formatText($_POST['desc_det_workshop']$format_text);
  138.     $layer_all_style"style=\"display:none;\"";
  139.     $layer_det_style"style=\"display:block;\"";
  140.     $mask_desc_ALL='';
  141.     $mask_desc_DET="checked=\"checked\"";
  142.   }
  143.   $display_name=$_POST['denomination'];
  144.   if($_POST['statut']=='D'$mask_statut_D="checked=\"checked\""else $mask_statut_D='';
  145.   if($_POST['statut']=='P'$mask_statut_P="checked=\"checked\""else $mask_statut_P='';
  146.   $table=urlencode(serialize($table));
  147. }
  148.  
  149. if(!$root{
  150.   // preparation affichage detaillé
  151.   if(defined('MOD_PROJECT')) {
  152.     $description_detail_form.= "<p>\n";
  153.     $description_detail_form.= "<label for=\"desc_det_project\" >".mb_ucfirst(_t('theme','desc_det_project'))." : *</label>\n";
  154.     $description_detail_form.= "<textarea id=\"desc_det_project\"  name=\"desc_det_project\" ".AREA_SETTINGS." class=\"largetextfield\" >".$desc_project."</textarea>\n";
  155.     $description_detail_form.= "</p>\n";
  156.   }
  157.   if(defined('MOD_SDI')) {
  158.     $description_detail_form.= "<p>\n";
  159.     $description_detail_form.= "<label for=\"desc_det_dashboard\" >".mb_ucfirst(_t('theme','desc_det_dashboard'))." : *</label>\n";
  160.     $description_detail_form.= "<textarea id=\"desc_det_dashboard\"  name=\"desc_det_dashboard\" ".AREA_SETTINGS." class=\"largetextfield\" >".$desc_dashboard."</textarea>\n";
  161.     $description_detail_form.= "</p>\n";
  162.   }
  163.   if(defined('MOD_PUBLICATION')) {
  164.     $description_detail_form.= "<p>\n";
  165.     $description_detail_form.= "<label for=\"desc_det_publication\" >".mb_ucfirst(_t('theme','desc_det_publication'))." : *</label>\n";
  166.     $description_detail_form.= "<textarea id=\"desc_det_publication\"  name=\"desc_det_publication\" ".AREA_SETTINGS." class=\"largetextfield\" >".$desc_publi."</textarea>\n";
  167.     $description_detail_form.= "</p>\n";
  168.   }
  169.   if(defined('MOD_NEWS')) {
  170.     $description_detail_form.= "<p>\n";
  171.     $description_detail_form.= "<label for=\"desc_det_news\" >".mb_ucfirst(_t('theme','desc_det_news'))." : *</label>\n";
  172.     $description_detail_form.= "<textarea id=\"desc_det_news\"  name=\"desc_det_news\" ".AREA_SETTINGS." class=\"largetextfield\">".$desc_news."</textarea>\n";
  173.     $description_detail_form.= "</p>\n";
  174.   }
  175.   if(defined('MOD_WORKSHOP')) {
  176.     $description_detail_form.= "<p>\n";
  177.     $description_detail_form.= "<label for=\"desc_det_workshop\" >".mb_ucfirst(_t('theme','desc_det_workshop'))." : *</label>\n";
  178.     $description_detail_form.= "<textarea id=\"desc_det_workshop\"  name=\"desc_det_workshop\" ".AREA_SETTINGS." class=\"largetextfield\">".$desc_workshop."</textarea>\n";
  179.     $description_detail_form.= "</p>\n";
  180.   }
  181. }
  182.  
  183.  
  184. include_once(THEME_ADMIN_PATH."quickicons.php");
  185. if(!$root{
  186.   $data=$sql_object->DBSelect($req_listsdtheme);
  187.   include_once("../lib/input_helpers.php");
  188.   // select-box des SD thèmes
  189.   $data=$sql_object->DBSelect($req_listsdtheme);
  190.   $select_sdtheme=SDThemeSelectBox($data"sdtheme"$form_sdtheme);
  191. }
  192. ?>
  193.  
  194. <?php
  195. if(!isset($integrity|| is_string($integrity)) {
  196.     
  197.     $js "$('#description_ALL').click(function() {
  198.                         $('#det').fadeOut();
  199.                         $('#all').fadeIn();
  200.                     });
  201.                     $('#description_DET').click(function() {
  202.                         $('#all').fadeOut();
  203.                         $('#det').fadeIn();
  204.                     });";
  205.     
  206.     footerAddInlineJS($js);
  207. ?>
  208. <div class="contentcontainer">
  209. <?php
  210. include_once(override($dir.'/menurub.php'THEME_ADMIN_PATH));
  211. ?>
  212. <div id="content">
  213. <?php
  214. if(isset($integrity&& is_string($integrity)) display_errors($integrity);
  215. ?>
  216. <h2><?php echo formatTitleh2($display_title)?></h2>
  217. <form id="modtheme" action="<?php echo $_SERVER['SCRIPT_NAME']?>" method="post">
  218. <p>
  219.     <label for="denomination"><?php echo mb_ucfirst(_t('theme','denomination'))?> : *</label>
  220.     <input name="denomination" type="text" class="textfield" id="denomination" maxlength="200" value="<?php echo $display_name?>" />
  221. </p>
  222. <input name="statut" type="hidden" id="statut" value="P" />
  223. <?php if($root == true?>
  224.   <input name="root" type="hidden" id="root" value="1" />
  225.   <input name="description" type="hidden" id="description" value="ALL" />
  226. <?php ?>
  227. <?php if(!$root?>
  228. <p>
  229.     <label for="sdtheme"><?php echo mb_ucfirst(_t('theme','sdtheme'))?> : *</label>
  230.     <?php echo $select_sdtheme?>
  231. </p>
  232.  
  233. <div class="label"><?php echo mb_ucfirst(_t('theme','description'))?> : *</div>
  234. <div class="rightpanel">
  235.     <input name="description" class="radioinline" type="radio" id="description_ALL" value="ALL" <?php echo $mask_desc_ALL?> />
  236.     <label for="description_ALL"><?php echo mb_ucfirst(_t('theme','description_all'))?></label>
  237.     <input name="description" class="radioinline" type="radio" id="description_DET" value="DET" <?php echo $mask_desc_DET?> />
  238.     <label for="description_DET"><?php echo mb_ucfirst(_t('theme','description_det'))?></label>
  239. </div>
  240.  
  241. <?php ?>
  242. <div>
  243.     <div id="all" <?php echo $layer_all_style?>>
  244.         <p>
  245.             <label for="desc_for_all"><?php echo _t('theme','desc_all')?> : *</label>
  246.             <textarea id="desc_for_all" name="desc_for_all" <?php echo AREA_SETTINGS?> class="largetextfield"><?php echo $form_description_all?></textarea>
  247.         </p>
  248.     </div>
  249.     <div id="det" <?php echo $layer_det_style?>><?php echo $description_detail_form?></div>
  250.     <input name="id" type="hidden" value="<?php echo $id?>" id="id" />
  251.     <input name="rub" type="hidden" value="<?php echo $rub?>" id="rub" />
  252.     <input name="todo" type="hidden" value="<?php echo $todo?>" id="todo" />
  253.     <?php echo cancel_button('javascript:history.go(-1);')?>
  254.     <input name="valider" type="submit" value="<?php echo _t('btn','valid'?>" class="button" id="valider" />
  255. </div>
  256. </form>
  257. </div>
  258. <?php include_once(override($dir.'/help.php'THEME_ADMIN_PATH))?></div>
  259. <?php
  260. // Récapitulatif
  261. else    {
  262.  
  263. if(!$root{
  264.   $query=SQL_getoneSDtheme($form_sdtheme);
  265.   $data=$sql_object->DBSelect($query);
  266.   $display_sdtheme_name=formatText($data[0]['sdtheme_name']'2HTML');
  267.   }
  268.  
  269. ?>
  270. <div class="contentcontainer">
  271. <?php
  272. include_once(override($dir.'/menurub.php'THEME_ADMIN_PATH));
  273. ?>
  274. <div id="content">
  275. <h2><?php echo _t('recap','title'?></h2>
  276. <?php
  277. echo "<dl class=\"summary\">";
  278. echo "<dt>".formatText(mb_ucfirst(_t('theme','denomination')),'2HTML')." :</dt>";
  279. echo "<dd>"formatText($_POST['denomination'],'2HTML');"</dd>";
  280. if(!$root{
  281.   echo "<dt>"formatText(mb_ucfirst(_t('theme','sdtheme')),'2HTML')" :</dt>";
  282.   echo "<dd>".$display_sdtheme_name."</dd>";
  283. }
  284. if($_POST['description']=='ALL'{
  285.   echo "<dt>".formatText(mb_ucfirst(_t('theme','desc_all')),'2HTML')." :</dt>";
  286.   echo "<dd>"formatText($form_description_all,'2HTML')."</dd>";
  287. }
  288. if($_POST['description']=='DET'{
  289.   if(defined('MOD_PROJECT')) {
  290.     echo "<dt>".formatText(mb_ucfirst(_t('theme','desc_det_project')),'2HTML')."</dt>";
  291.     echo "<dd>"$desc_project."</dd>";
  292.   }
  293.   if(defined('MOD_SDI')) {
  294.     echo "<dt>".formatText(mb_ucfirst(_t('theme','desc_det_dashboard')),'2HTML')."</dt>";
  295.     echo "<dd>"$desc_dashboard."</dd>";
  296.   }
  297.   if(defined('MOD_PUBLICATION')) {
  298.     echo "<dt>".formatText(mb_ucfirst(_t('theme','desc_det_publication')),'2HTML')."</dt>";
  299.     echo "<dd>"$desc_publi."</dd>";
  300.   }
  301.   if(defined('MOD_NEWS')) {
  302.     echo "<dt>".formatText(mb_ucfirst(_t('theme','desc_det_news')),'2HTML')."</dt>";
  303.     echo "<dd>"$desc_news."</dd>";
  304.   }
  305.   if(defined('MOD_WORKSHOP')) {
  306.     echo "<dt>".formatText(mb_ucfirst(_t('theme','desc_det_workshop')),'2HTML')."</dt>";
  307.     echo "<dd>"$desc_workshop."</dd>";
  308.   }
  309. }
  310. echo "</dl>";
  311. ?>
  312. <form id="addscale" action="<?php echo $_SERVER['SCRIPT_NAME']?>" method="post">
  313.   <div>
  314.     <input name="id" type="hidden" value="<?php echo $id?>" id="id" />
  315.     <input name="rub" type="hidden" value="<?php echo $rub?>" id="rub" />
  316.     <input name="todo" type="hidden" value="<?php echo $todo?>" id="todo" />
  317.     <input name="data_table" type="hidden" value="<?php echo $table?>" id="data_table" />
  318.     <?php echo cancel_button('?rub='.$rub.'&amp;todo=list')?>
  319.     <input name="retour" type="button" value="<?php echo _t('btn','preview'?>" class="button" id="retour" onclick="history.go(-1);" />
  320.     <input name="enregistrer" type="submit" value="<?php echo _t('btn','save'?>" class="button" id="valider" />
  321.   </div>
  322. </form>
  323. </div>
  324. <?php include_once(override($dir.'/help.php'THEME_ADMIN_PATH))?></div>
  325. <?php
  326. }
  327. ?>

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