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

Documentation generated on Fri, 01 Apr 2011 09:27:19 +0200 by phpDocumentor 1.4.1