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

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