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

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