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

Documentation generated on Fri, 01 Apr 2011 09:33:11 +0200 by phpDocumentor 1.4.1