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

Source for file add.php

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

Documentation generated on Thu, 20 Mar 2014 16:45:53 +0100 by phpDocumentor 1.4.1