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

Source for file add.php

Documentation is available at add.php

  1. <?php
  2. /**
  3.  * @package linea21.modules
  4.  * @subpackage publication
  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. <div id="chemin">
  23. <ul>
  24.     <li><a href="index.php" class="chemin_home"><?php echo _t('way','home')?></a></li>
  25.     <li><a href="<?php echo $rub_link?>" id="chemin_<?php echo $rub?>" class="chemin_rub"><?php echo _t('menu','publication'); ;?></a></li>
  26.     <li><span><?php echo formatNavTitle(_t('publication','add'))?></span></li>
  27. </ul>
  28. </div>
  29. <!--end barre haute -->
  30. <?php
  31. $form_title='';
  32. $form_theme=-1;
  33. $form_scale=-1;
  34. $form_level=-1;
  35. $form_resume='';
  36. $form_comment='';
  37. $form_author=$l21auth->GetSessionElement('login');
  38. $mask_statut_P='';
  39. $mask_statut_D="checked=\"checked\"";
  40.  
  41.  
  42. $publication_objectnew publication;
  43.  
  44. if(isset($_POST['enregistrer'])) {
  45.   $data_table=unserialize(urldecode($_POST['data_table']));
  46.   $result=$publication_object->AddPublication($data_table$sql_object);
  47.   $link_confirm="confirm.php?rub=".$rub."&todo=".$todo;
  48.   if(is_numeric($result)) header("Location: ".$link_confirm);
  49.   else  system_error();
  50. }
  51.  
  52. if(isset($_POST['valider'])) {
  53.   $table[0]=$_POST['publi_title'];
  54.   $table[1]=$_POST['publi_resume'];
  55.   $table[2]=$_POST['publi_theme'];
  56.   $table[3]=$_POST['publi_scale'];
  57.   $table[4]=$_POST['publi_level'];
  58.   $table[5]=$_POST['publi_author'];
  59.   $table[6]=$_POST['publi_comment'];
  60.   $table[7]=$_POST['publi_statut'];
  61.  
  62.   $integrity=$publication_object->CheckDataIntegrity($table$sql_object);
  63.  
  64.   if(is_string($integrity)) {
  65.     $text_format='2FIELD';
  66.   else {
  67.     $text_format='2HTML';
  68.     $table[5]=$integrity['user_id'];
  69.   }
  70.   $form_title=formatText($_POST['publi_title']$text_format);
  71.   $form_resume=formatText($_POST['publi_resume']$text_format);
  72.   $form_theme=$_POST['publi_theme'];
  73.   $form_scale=$_POST['publi_scale'];
  74.   $form_level=$_POST['publi_level'];
  75.   $form_author=formatText($_POST['publi_author']$text_format);
  76.   $form_comment=formatText($_POST['publi_comment']$text_format);
  77.  
  78.   if($_POST['publi_statut']=='D'$mask_statut_D="checked=\"checked\""else $mask_statut_D='';
  79.   if($_POST['publi_statut']=='P'$mask_statut_P="checked=\"checked\""else $mask_statut_P='';
  80.   $table=urlencode(serialize($table));
  81. }
  82.  
  83.  
  84. if(!isset($integrity|| is_string($integrity)) {
  85.   include_once("../lib/input_helpers.php");
  86.  
  87.   // select-box de thèmes
  88.   $data=$sql_object->DBSelect($req_list_theme);
  89.   $select_theme=ThemeSelectBox($data"publi_theme"$form_theme);
  90.  
  91.   // select-box des échelles
  92.   $data=$sql_object->DBSelect($req_list_scale);
  93.   $select_scale=ScaleSelectBox($data"publi_scale"$form_scale);
  94.  
  95.   // select-box des niveaux
  96.   $data=$sql_object->DBSelect($req_list_level);
  97.   $select_level=LevelSelectBox($data"publi_level"$form_level);
  98.  
  99.  
  100. }
  101.  
  102. include_once(THEME_ADMIN_PATH."quickicons.php");
  103.  
  104. ?>
  105.  
  106. <?php
  107. if(!isset($integrity|| is_string($integrity)) {
  108.   ?>
  109. <div class="contentcontainer">
  110. <?php
  111. include_once(override($dir.'/menurub.php'THEME_ADMIN_PATH));
  112. ?>
  113. <div id="content">
  114. <?php
  115. if(isset($integrity&& is_string($integrity)) display_errors($integrity);
  116. ?>
  117. <h2><?php echo formatTitleh2(_t('publication','add_title'))?></h2>
  118. <form id="addpublication" action="<?php echo $_SERVER['SCRIPT_NAME']?>" method="post">
  119. <p>
  120.     <label for="publi_title"><?php echo mb_ucfirst(_t('publication','title'))?> : *</label>
  121.     <input name="publi_title" type="text" class="textfield" id="publi_title" maxlength="150" value="<?php echo $form_title?>" />
  122. </p>
  123. <p>
  124.     <label for="publi_resume"><?php echo mb_ucfirst(_t('publication','resume'))?> : *</label>
  125.     <textarea id="publi_resume" name="publi_resume" class="largetextfield" <?php echo AREA_SETTINGS?>><?php echo $form_resume?></textarea>
  126. </p>
  127. <p>
  128.     <label for="publi_theme"><?php echo mb_ucfirst(_t('publication','theme'))?> : *</label>
  129.     <?php echo $select_theme?>
  130. </p>
  131. <p>
  132.     <label for="publi_scale"><?php echo mb_ucfirst(_t('publication','scale'))?> : *</label>
  133.     <?php echo $select_scale?>
  134. </p>
  135. <p>
  136.     <label for="publi_level"><?php echo mb_ucfirst(_t('publication','level'))?> : </label>
  137.     <?php echo $select_level?>
  138. </p>
  139. <p>
  140.     <label for="publi_author"><?php echo mb_ucfirst(_t('publication','author'))?> : *</label>
  141.     <input name="publi_author" type="text" class="textfield" id="publi_author" maxlength="150" value="<?php echo $form_author?>" />
  142. </p>
  143. <div class="label"><?php echo mb_ucfirst(_t('publication','statut'))?> : *</div>
  144. <div class="rightpanel">
  145.   <input name="publi_statut" type="radio" id="statut_P" value="P" <?php echo $mask_statut_P?> />
  146.   <label for="statut_P"><?php echo mb_ucfirst(_t('statut','public'))?></label>
  147.   <input name="publi_statut" type="radio" id="statut_D" value="D" <?php echo $mask_statut_D?> />
  148.   <label for="statut_D"><?php echo mb_ucfirst(_t('statut','draft'))?></label>
  149. </div>
  150. <p>
  151.     <label for="publi_comment"><?php echo mb_ucfirst(_t('publication','comment'))?> : </label>
  152.     <textarea id="publi_comment" name="publi_comment" class="largetextfield" <?php echo AREA_SETTINGS?>><?php echo $form_comment?></textarea>
  153. </p>
  154. <div>
  155.   <input name="rub" type="hidden" value="<?php echo $rub?>" id="rub" />
  156.   <input name="todo" type="hidden" value="<?php echo $todo?>" id="todo" />
  157.   <?php echo cancel_button('javascript:history.go(-1);')?>
  158.   <input name="valider" type="submit" value="<?php echo _t('btn','valid'?>" class="button" id="valider" />
  159. </div>
  160. </form>
  161. </div>
  162. <?php include_once(override($dir.'/help.php'THEME_ADMIN_PATH))?></div>
  163. <?php
  164. // Récapitulatif
  165. else    {
  166.  
  167.   $requete=SQL_getonethemeName($form_theme);
  168.   $result=$sql_object->DBSelect($requete);
  169.   if($result==|| count($result)!=1exit;
  170.   else $theme_denomination=formatText($result[0]['theme_name']'2HTML');
  171.  
  172.   $requete=SQL_getonescaleDenomination($form_scale);
  173.   $result=$sql_object->DBSelect($requete);
  174.   if($result==|| count($result)!=1exit;
  175.   else $scale_denomination=formatText($result[0]['scale_denomination']'2HTML');
  176.  
  177.   if($form_level <> -1{
  178.     $requete=SQL_getonelevelName($form_level);
  179.     $result=$sql_object->DBSelect($requete);
  180.     if($result==|| count($result)!=1exit;
  181.     else $level_denomination=formatText($result[0]['level_name']'2HTML');
  182.   }
  183.   else $level_denomination=_t('divers','none');
  184.  
  185.   $display_form_resume=empty_nc($form_resume);
  186.   $display_form_comment=empty_nc($form_comment);
  187.   ?>
  188. <div class="contentcontainer"><?php
  189. include_once(override($dir.'/menurub.php'THEME_ADMIN_PATH));
  190. ?>
  191. <div id="content">
  192. <h2><?php echo _t('recap','title'?></h2>
  193. <?php
  194. echo "<dl class=\"summary\">\n";
  195. echo "<dt>".mb_ucfirst(_t('publication','title'))." :</dt>\n";
  196. echo "<dd>"$form_title."</dd>\n";
  197. echo "<dt>"mb_ucfirst(_t('publication','resume'))" :</dt>\n";
  198. echo "<dd>".$display_form_resume."</dd>\n";
  199. echo "<dt>".mb_ucfirst(_t('publication','theme'))." :</dt>\n";
  200. echo "<dd>".$theme_denomination."</dd>\n";
  201. echo "<dt>".mb_ucfirst(_t('publication','scale'))." :</dt>\n";
  202. echo "<dd>".$scale_denomination."</dd>\n";
  203. echo "<dt>".mb_ucfirst(_t('publication','level'))." :</dt>\n";
  204. echo "<dd>".$level_denomination."</dd>\n";
  205. echo "<dt>".mb_ucfirst(_t('publication','author'))." :</dt>\n";
  206. echo "<dd>".$form_author."</dd>\n";
  207. echo "<dt>".mb_ucfirst(_t('divers','statut')) ." :</dt>\n";
  208. echo "<dd>"display_statut($_POST['publi_statut'])"</dd>\n";
  209. echo "<dt>".mb_ucfirst(_t('publication','comment')) ." :</dt>\n";
  210. echo "<dd>"$display_form_comment"</dd>\n";
  211. echo "</dl>\n";
  212. ?>
  213. <form id="addpublication" action="<?php echo $_SERVER['SCRIPT_NAME']?>" method="post">
  214.   <div>
  215.     <input name="rub" type="hidden" value="<?php echo $rub?>" id="rub" />
  216.     <input name="todo" type="hidden" value="<?php echo $todo?>" id="todo" />
  217.     <input name="data_table" type="hidden" value="<?php echo $table?>" id="data_table" />
  218.     <?php echo cancel_button('?rub=publication&amp;todo=list')?>
  219.     <input name="retour" type="button" value="<?php echo _t('btn','preview')?>" class="button" id="retour" onclick="history.go(-1);" />
  220.     <input name="enregistrer" type="submit" value="<?php echo _t('btn','save')?>" class="button" id="valider" />
  221.   </div>
  222. </form>
  223. </div>
  224. <?php include_once(override($dir.'/help.php'THEME_ADMIN_PATH))?></div>
  225. <?php
  226. }
  227. ?>

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