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

Source for file mod.php

Documentation is available at mod.php

  1. <?php
  2. /**
  3.  * @package linea21.modules
  4.  * @subpackage news
  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 (!hasRight('news')) ReloadIndex('admin');
  20. ////////////
  21.  
  22.  
  23. if (isset($_GET['id']))    $id=$_GET['id'];
  24. if (isset($_POST['id'])) $id=$_POST['id'];
  25.  
  26. $news_object new news;
  27. $mask_statut_P='';
  28. $mask_statut_D='';
  29. $mask_archive_P='';
  30. $mask_archive_D='';
  31. $mask_archive_AA='';
  32. $mask_archive_PA='';
  33.  
  34. if(isset($_POST['enregistrer'])) {
  35.   $data_table=unserialize(urldecode($_POST['data_table']));
  36.   $result=$news_object->ModifyNews($id$data_table$sql_object);
  37.  
  38.   $link_confirm="confirm.php?rub=".$rub."&todo=".$todo;
  39.   if($resultheader("Location: ".$link_confirm);
  40.   else  system_error();
  41. }
  42.  
  43. // Titre de l'actu en cours de modification
  44. $requete=SQL_getNewsTitle($id);
  45. $result=$sql_object->DBSelect($requete);
  46. if($result==|| count($result)!=1exit;
  47. else $news_current_title=formatText($result[0]['news_title'],'2HTML');
  48.  
  49.  
  50. // Obtention des données  de la BDD
  51. $req_detSQL_getoneCompleteNews($id);
  52. $result=$sql_object->DBSelect($req_det);
  53. if($result==|| count($result)!=1exit;
  54.  
  55. $form_title=formatText($result[0]['news_title']'2FIELD');
  56. $form_header=formatText($result[0]['news_header']'2FIELD');
  57. $form_body=formatText($result[0]['news_body']'2FIELD');
  58. $form_theme=$result[0]['news_theme'];
  59. $form_scale=$result[0]['news_scale'];
  60. $form_level=$result[0]['news_level'];
  61. $form_statut=$result[0]['news_statut'];
  62. $current_statut=$result[0]['news_statut'];
  63. $news_owner $result[0]['news_posted_by'];
  64.  
  65. //////////// Check Droits utilisateur ////////////
  66. if (!hasRight('news')) ReloadIndex('admin');
  67. if (GetSessionElement('id')!=$news_owner && !IsSuperAdmin()) ReloadIndex('admin');
  68. ////////////
  69.  
  70.  
  71.  
  72. if(isset($_POST['valider'])) {
  73.   $table[0]=$_POST['news_title'];
  74.   $table[1]=$_POST['news_header'];
  75.   $table[2]=$_POST['news_body'];
  76.   $table[3]=$_POST['news_theme'];
  77.   $table[4]=$_POST['news_scale'];
  78.   $table[5]=$_POST['news_level'];
  79.   $table[6]=$_POST['news_statut'];
  80.  
  81.   $news_objectnew news;
  82.   $integrity=$news_object->CheckDataIntegrity($table);
  83.  
  84.  
  85.   if(is_string($integrity)) $text_format='2FIELD';
  86.   else $text_format='2HTML';
  87.   $form_title=formatText($_POST['news_title'],$text_format);
  88.   $form_header=formatText($_POST['news_header']$text_format);
  89.   $form_body=formatText($_POST['news_body']$text_format);
  90.   $form_theme=$_POST['news_theme'];
  91.   $form_scale=$_POST['news_scale'];
  92.   $form_level=$_POST['news_level'];
  93.   $form_statut=$_POST['news_statut'];
  94.  
  95.  
  96.   if($_POST['news_statut']=='D'$mask_statut_D="checked=\"checked\""else $mask_statut_D='';
  97.   if($_POST['news_statut']=='P'$mask_statut_P="checked=\"checked\""else $mask_statut_P='';
  98.   $table=urlencode(serialize($table));
  99. }
  100.  
  101.  
  102. include_once("../lib/input_helpers.php");
  103.  
  104. // select-box de thèmes
  105. $data=$sql_object->DBSelect($req_list_theme);
  106. $select_theme=ThemeSelectBox($data"news_theme"$form_theme);
  107.  
  108. // select-box des échelles
  109. $data=$sql_object->DBSelect($req_list_scale);
  110. $select_scale=ScaleSelectBox($data"news_scale"$form_scale);
  111.  
  112. // select-box des niveaux
  113. $data=$sql_object->DBSelect($req_list_level);
  114. $select_level=LevelSelectBox($data"news_level"$form_level);
  115.  
  116. // select-box statut
  117. if($form_statut=='P'$mask_archive_P=' selected="selected"';
  118. if($form_statut=='D'$mask_archive_D=' selected="selected"';
  119. if($form_statut=='AA'$mask_archive_AA=' selected="selected"';
  120. if($form_statut=='PA'$mask_archive_PA=' selected="selected"';
  121. $select_statut="<select name=\"news_statut\" id=\"news_statut\">\n";
  122. $select_statut.="<option value=\"P\"".$mask_archive_P.">".display_statut('P')."</option>\n";
  123. $select_statut.="<option value=\"D\"".$mask_archive_D.">".display_statut('D')."</option>\n";
  124. $select_statut.="<option value=\"AA\"".$mask_archive_AA.">".display_statut('AA')."</option>\n";
  125. $select_statut.="<option value=\"PA\"".$mask_archive_PA.">".display_statut('PA')."</option>\n";
  126. $select_statut.="</select>\n";
  127. ?>
  128.  
  129.  
  130. <div id="chemin">
  131. <ul>
  132.     <li><a href="index.php" class="chemin_home"><?php echo _t('way','home')?></a>
  133.     </li>
  134.     <li><a href="<?php echo $rub_link?>" id="chemin_<?php echo $rub?>"
  135.         class="chemin_rub"><?php echo _t('menu','news');?></a></li>
  136.     <li><span><?php echo formatNavTitle(_t('news','mod')' : '.$news_current_title)?></span>
  137.     </li>
  138. </ul>
  139. </div>
  140. <!--end barre haute -->
  141. <?php
  142. include_once(THEME_ADMIN_PATH."quickicons.php");
  143. ?>
  144.  
  145. <?php
  146. if(!isset($integrity|| is_string($integrity)) {
  147.   ?>
  148. <div class="contentcontainer">
  149. <?php
  150. include_once($dir."/menurub.php");
  151. ?>
  152. <div id="content">
  153. <?php
  154. if(isset($integrity&& is_string($integrity)) display_errors($integrity);
  155. ?>
  156. <h2><?php echo formatTitleh2($news_current_title)?></h2>
  157. <form id="modnews" action="<?php echo $_SERVER['SCRIPT_NAME']?>" method="post">
  158. <p>
  159.   <label for="news_title"><?php echo _t('news','title')?> : *</label>
  160.   <input name="news_title" type="text" class="textfield" maxlength="200" id="news_title" value="<?php echo $form_title?>" />
  161. </p>
  162. <p>
  163.   <label for="news_header"><?php echo _t('news','header')?> : *</label>
  164.   <textarea id="news_header" name="news_header" class="largetextfield" <?php echo AREA_SETTINGS?>><?php echo $form_header?></textarea>
  165. </p>
  166. <p>
  167.   <label for="news_body"><?php echo _t('news','body')?> : *</label>
  168.   <textarea id="news_body" name="news_body" class="largetextfield" <?php echo AREA_SETTINGS?>><?php echo $form_body?></textarea>
  169. </p>
  170. <p>
  171.   <label for="news_theme"><?php echo _t('news','theme')?> : *</label>
  172.   <?php echo $select_theme?>
  173. </p>
  174. <p>
  175.   <label for="news_scale"><?php echo _t('news','scale')?> : *</label>
  176.   <?php echo $select_scale?>
  177. </p>
  178. <p>
  179.   <label for="news_level"><?php echo _t('news','level')?> : </label>
  180.   <?php echo $select_level?>
  181. </p>
  182. <p>
  183.   <label for="news_statut"><?php echo _t('news','statut')?> :  </label>
  184.   <?php echo $select_statut?>
  185. </p>
  186. <div>
  187.   <input name="id" type="hidden" value="<?php echo $id?>" id="id" />
  188.   <input name="rub" type="hidden" value="<?php echo $rub?>" id="rub" />
  189.   <input name="todo" type="hidden" value="<?php echo $todo?>" id="todo" />
  190.   <?php echo cancel_button('javascript:history.go(-1);')?>
  191.   <input name="valider" type="submit" value="<?php echo _t('btn','valid')?>" class="button" id="valider" />
  192. </div>
  193. </form>
  194. </div>
  195.     <?php include_once($dir."/help.php")?></div>
  196.     <?php
  197.     // Récapitulatif
  198. else    {
  199.  
  200.   $requete=SQL_getonethemeName($form_theme);
  201.   $result=$sql_object->DBSelect($requete);
  202.   if($result==|| count($result)!=1exit;
  203.   else $theme_denomination=formatText($result[0]['theme_name']);
  204.  
  205.   $requete=SQL_getonescaleDenomination($form_scale);
  206.   $result=$sql_object->DBSelect($requete);
  207.   if($result==|| count($result)!=1exit;
  208.   else $scale_denomination=formatText($result[0]['scale_denomination']);
  209.  
  210.   if($form_level <> -1{
  211.     $requete=SQL_getonelevelName($form_level);
  212.     $result=$sql_object->DBSelect($requete);
  213.     if($result==|| count($result)!=1exit;
  214.     else $level_denomination=formatText($result[0]['level_name']);
  215.   else $level_denomination=_t('divers','none');
  216.  
  217.   $display_form_header=formatText(empty_nc($form_header));
  218.  
  219.   ?>
  220. <div class="contentcontainer"><?php
  221. include_once($dir."/menurub.php");
  222. ?>
  223. <div id="content">
  224. <h2><?php echo formatTitleh2(_t('recap','title'))?></h2>
  225. <?php
  226. echo "<dl class=\"dl3\">\n";
  227. echo "<dt>"._t('news','title')."</dt>\n";
  228. echo "<dd>".$form_title."</dd>\n";
  229. echo "<dt>"._t('news','header')"</dt>\n";
  230. echo "<dd>".linkin_content($display_form_header)."</dd>\n";
  231. echo "<dt>"._t('news','body')." :</dt>\n";
  232. echo "<dd>".linkin_content($form_body)."</dd>\n";
  233. echo "<dt>"._t('news','theme')." :</dt>\n";
  234. echo "<dd>".$theme_denomination."</dd>\n";
  235. echo "<dt>"._t('news','scale')." :</dt>\n";
  236. echo "<dd>".$scale_denomination."</dd>\n";
  237. echo "<dt>"._t('news','level')." :</dt>\n";
  238. echo "<dd>".$level_denomination."</dd>\n";
  239. echo "<dt>"._t('divers','statut'."</dt>\n";
  240. echo "<dd>"display_statut($_POST['news_statut'])"</dd>\n";
  241. echo "</dl>\n";
  242. ?>
  243. <form id="modscale" action="<?php echo $_SERVER['SCRIPT_NAME']?>"    method="post">
  244. <div>
  245.   <input name="id" type="hidden" value="<?php echo $id?>" id="id" />
  246.   <input name="rub" type="hidden" value="<?php echo $rub?>" id="rub" />
  247.   <input name="todo" type="hidden" value="<?php echo $todo?>" id="todo" />
  248.   <input name="data_table" type="hidden" value="<?php echo $table?>" id="data_table" />
  249.   <?php echo cancel_button('?rub=news&amp;todo=list')?>
  250.   <input name="retour" type="button" value="<?php echo _t('btn','preview')?>" class="button" id="retour" onclick="history.go(-1);" />
  251.   <input name="enregistrer" type="submit" value="<?php echo _t('btn','save')?>" class="button" id="valider" />
  252. </div>
  253. </form>
  254. </div>
  255. <?php include_once($dir."/help.php")?></div>
  256. <?php
  257. }
  258. ?>

Documentation generated on Thu, 03 May 2012 15:06:25 +0200 by phpDocumentor 1.4.1