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

Documentation generated on Fri, 16 Oct 2009 09:28:00 +0200 by phpDocumentor 1.4.1