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

Documentation generated on Mon, 08 Apr 2013 18:11:57 +0200 by phpDocumentor 1.4.1