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. <div class="contentcontainer">
  198. <?php
  199. include_once(override($dir.'/menurub.php'THEME_ADMIN_PATH));
  200. ?>
  201. <div id="content">
  202. <?php
  203. if(isset($integrity&& is_string($integrity)) display_errors($integrity);
  204. ?>
  205. <h2><?php echo formatTitleh2($display_title)?></h2>
  206. <form id="modtheme" action="<?php echo $_SERVER['SCRIPT_NAME']?>" method="post">
  207. <p>
  208.     <label for="denomination"><?php echo mb_ucfirst(_t('theme','denomination'))?> : *</label>
  209.     <input name="denomination" type="text" class="textfield" id="denomination" maxlength="200" value="<?php echo $display_name?>" />
  210. </p>
  211. <input name="statut" type="hidden" id="statut" value="P" />
  212. <?php if($root == true?>
  213.   <input name="root" type="hidden" id="root" value="1" />
  214.   <input name="description" type="hidden" id="description" value="ALL" />
  215. <?php ?>
  216. <?php if(!$root?>
  217. <p>
  218.     <label for="sdtheme"><?php echo mb_ucfirst(_t('theme','sdtheme'))?> : *</label>
  219.     <?php echo $select_sdtheme?>
  220. </p>
  221.  
  222. <div class="label"><?php echo mb_ucfirst(_t('theme','description'))?> : *</div>
  223. <div class="rightpanel">
  224.     <input name="description" class="radioinline" type="radio" id="description_ALL" value="ALL" onclick="ShowthemeDesc('all');" <?php echo $mask_desc_ALL?> />
  225.     <label for="description_ALL"><?php echo mb_ucfirst(_t('theme','description_all'))?></label>
  226.     <input name="description" class="radioinline" type="radio" id="description_DET" value="DET" onclick="ShowthemeDesc('det');" <?php echo $mask_desc_DET?> />
  227.     <label for="description_DET"><?php echo mb_ucfirst(_t('theme','description_det'))?></label>
  228. </div>
  229.  
  230. <?php ?>
  231. <div>
  232.     <div id="all" <?php echo $layer_all_style?>>
  233.         <p>
  234.             <label for="desc_for_all"><?php echo _t('theme','desc_all')?> : *</label>
  235.             <textarea id="desc_for_all" name="desc_for_all" <?php echo AREA_SETTINGS?> class="largetextfield"><?php echo $form_description_all?></textarea>
  236.         </p>
  237.     </div>
  238.     <div id="det" <?php echo $layer_det_style?>><?php echo $description_detail_form?></div>
  239.     <input name="id" type="hidden" value="<?php echo $id?>" id="id" />
  240.     <input name="rub" type="hidden" value="<?php echo $rub?>" id="rub" />
  241.     <input name="todo" type="hidden" value="<?php echo $todo?>" id="todo" />
  242.     <?php echo cancel_button('javascript:history.go(-1);')?>
  243.     <input name="valider" type="submit" value="<?php echo _t('btn','valid'?>" class="button" id="valider" />
  244. </div>
  245. </form>
  246. </div>
  247. <?php include_once(override($dir.'/help.php'THEME_ADMIN_PATH))?></div>
  248. <?php
  249. // Récapitulatif
  250. else    {
  251.  
  252.   $query=SQL_getoneSDtheme($form_sdtheme);
  253.   $data=$sql_object->DBSelect($query);
  254.   $display_sdtheme_name=formatText($data[0]['sdtheme_name']'2HTML');
  255.   ?>
  256. <div class="contentcontainer">
  257. <?php
  258. include_once(override($dir.'/menurub.php'THEME_ADMIN_PATH));
  259. ?>
  260. <div id="content">
  261. <h2><?php echo _t('recap','title'?></h2>
  262. <?php
  263. echo "<dl class=\"dl3\">";
  264. echo "<dt>".formatText(mb_ucfirst(_t('theme','denomination')),'2HTML')." :</dt>";
  265. echo "<dd>"formatText($_POST['denomination'],'2HTML');"</dd>";
  266. if(!$root{
  267.   echo "<dt>"formatText(mb_ucfirst(_t('theme','sdtheme')),'2HTML')" :</dt>";
  268.   echo "<dd>".$display_sdtheme_name."</dd>";
  269. }
  270. if($_POST['description']=='ALL'{
  271.   echo "<dt>".formatText(mb_ucfirst(_t('theme','desc_all')),'2HTML')." :</dt>";
  272.   echo "<dd>"formatText($form_description_all,'2HTML')."</dd>";
  273. }
  274. if($_POST['description']=='DET'{
  275.   if(defined('MOD_PROJECT')) {
  276.     echo "<dt>".formatText(mb_ucfirst(_t('theme','desc_det_project')),'2HTML')."</dt>";
  277.     echo "<dd>"$desc_project."</dd>";
  278.   }
  279.   if(defined('MOD_SDI')) {
  280.     echo "<dt>".formatText(mb_ucfirst(_t('theme','desc_det_dashboard')),'2HTML')."</dt>";
  281.     echo "<dd>"$desc_dashboard."</dd>";
  282.   }
  283.   if(defined('MOD_PUBLICATION')) {
  284.     echo "<dt>".formatText(mb_ucfirst(_t('theme','desc_det_publication')),'2HTML')."</dt>";
  285.     echo "<dd>"$desc_publi."</dd>";
  286.   }
  287.   if(defined('MOD_NEWS')) {
  288.     echo "<dt>".formatText(mb_ucfirst(_t('theme','desc_det_news')),'2HTML')."</dt>";
  289.     echo "<dd>"$desc_news."</dd>";
  290.   }
  291.   if(defined('MOD_WORKSHOP')) {
  292.     echo "<dt>".formatText(mb_ucfirst(_t('theme','desc_det_workshop')),'2HTML')."</dt>";
  293.     echo "<dd>"$desc_workshop."</dd>";
  294.   }
  295. }
  296. echo "</dl>";
  297. ?>
  298. <form id="addscale" action="<?php echo $_SERVER['SCRIPT_NAME']?>" method="post">
  299.   <div>
  300.     <input name="id" type="hidden" value="<?php echo $id?>" id="id" />
  301.     <input name="rub" type="hidden" value="<?php echo $rub?>" id="rub" />
  302.     <input name="todo" type="hidden" value="<?php echo $todo?>" id="todo" />
  303.     <input name="data_table" type="hidden" value="<?php echo $table?>" id="data_table" />
  304.     <?php echo cancel_button('?rub='.$rub.'&amp;todo=list')?>
  305.     <input name="retour" type="button" value="<?php echo _t('btn','preview'?>" class="button" id="retour" onclick="history.go(-1);" />
  306.     <input name="enregistrer" type="submit" value="<?php echo _t('btn','save'?>" class="button" id="valider" />
  307.   </div>
  308. </form>
  309. </div>
  310. <?php include_once(override($dir.'/help.php'THEME_ADMIN_PATH))?></div>
  311. <?php
  312. }
  313. ?>

Documentation generated on Mon, 08 Apr 2013 18:15:34 +0200 by phpDocumentor 1.4.1