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

Documentation generated on Thu, 20 Mar 2014 16:48:50 +0100 by phpDocumentor 1.4.1