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 content
  5.  * @author linea21 <info@linea21.com>
  6.  * @version $id SVN
  7.  * @access public
  8.  * @license http://opensource.org/licenses/gpl-3.0.html
  9.  *  'Content' module is used by 'Publication' and 'Workshop' modules
  10.  */
  11.  
  12. //////////// Check Inclusion de pages ////////////
  13. if (!class_exists('auth')) {
  14.   include_once("../lib/lib_common.php");
  15.   ReloadIndex('admin');
  16. }
  17. ////////////
  18.  
  19. if(isset($_POST['id']))    $id=$_POST['id'];
  20. if(isset($_GET['id']))    $id=$_GET['id'];
  21. $complete_type=strtoupper($mod_inc);
  22.  
  23. $contents_object new contents;
  24.  
  25.  
  26. if($type=='P'{
  27.   $requeteSQL_getOnePublicationParts($id);
  28.   $result=$sql_object->DBSelect($requete);
  29.   $form_title=formatText($result[0]['publicon_title'],'2FIELD');
  30.   $form_body=formatText($result[0]['publicon_body'],'2FIELD');
  31. }
  32. if($type=='W'{
  33.   $requeteSQL_getOneWorkshopParts($id);
  34.   $result=$sql_object->DBSelect($requete);
  35.   $form_title=formatText($result[0]['workrepcon_title']'2FIELD');
  36.   $form_body=formatText($result[0]['workrepcon_body']'2FIELD');
  37. }
  38.  
  39.  
  40.  
  41. if(isset($_POST['enregistrer'])) {
  42.  
  43.   $data_table=unserialize(urldecode($_POST['data_table']));
  44.   $result=$contents_object->ModifyContents($id$data_table$complete_type$sql_object);
  45.  
  46.   $link_confirm="confirm.php?rub=".$rub."&todo=".$todo."&type=".$type."&id=".$parent;
  47.   if($resultheader("Location: ".$link_confirm);
  48.   else  system_error();
  49. }
  50.  
  51. if(isset($_POST['valider'])) {
  52.   $table[0]=$_POST['part_title'];
  53.   $table[1]=$_POST['part_body'];
  54.  
  55.   $integrity=$contents_object->CheckDataIntegrity($table,$type);
  56.  
  57.  
  58.   if(is_string($integrity)) {
  59.     $text_format='2FIELD';
  60.   else {
  61.     $text_format='2HTML';
  62.   }
  63.   
  64.   $form_title=formatText($_POST['part_title']$text_format);
  65.   $form_body=formatText($_POST['part_body']$text_format);
  66.  
  67.   $table=urlencode(serialize($table));
  68. }
  69.  
  70. if($type=='P'{
  71.   $requeteSQL_getPublicationTitle($parent);
  72.   $result=$sql_object->DBSelect($requete);
  73.   $current_title=FormatText($result[0]['publi_title']'2HTML');
  74.   $current_owner=$result[0]['publi_posted_by'];
  75.  
  76.   //////////// Check Droits utilisateur ////////////
  77.   if ($l21auth->GetSessionElement('id')!=$current_owner && !$l21auth->isSuperAdmin()) ReloadIndex('admin');
  78.   ///////////
  79.  
  80. }
  81. if($type=='W'{
  82.   $requeteSQL_getWorkshopRepTitleAndGroup($parent);
  83.   $result=$sql_object->DBSelect($requete);
  84.   $current_title=FormatText($result[0]['workrep_title'].' ('.$result[0]['workshop_denomination'].').''2HTML');
  85.   $current_workshop_id=$result[0]['workrep_workshop_id'];
  86.  
  87.   //////////// Check Droits utilisateur ////////////
  88.   if (!$l21auth->isWorkgroupOrganiser($l21auth->GetSessionElement('id')$sql_object$current_workshop_id&& !$l21auth->isSuperAdmin()) ReloadIndex('admin');
  89.   ///////////
  90.  
  91. }
  92. ?>
  93. <div id="chemin">
  94. <ul>
  95.     <li><a href="index.php" class="chemin_home"><?php echo _t('way','home')?></a></li>
  96.     <li><a href="<?php echo $rub_link?>" id="chemin_<?php echo $rub?>" class="chemin_rub"><?php echo _t('menu',$mod_inc)?></a></li>
  97.     <li><span><?php echo formatNavTitle(_t('contents',$mod_inc.'_type')." : "$current_title)?></span></li>
  98. </ul>
  99. </div>
  100. <!--end barre haute -->
  101. <?php
  102. include_once(THEME_ADMIN_PATH."quickicons.php");
  103. ?>
  104.  
  105. <?php
  106. if(!isset($integrity|| is_string($integrity)) {
  107.   ?>
  108. <div class="contentcontainer"><?php
  109. include_once(override($dir.'/menurub.php'THEME_ADMIN_PATH));
  110. ?>
  111. <div id="content">
  112.  
  113. <?php
  114. if(isset($integrity&& is_string($integrity)) display_errors($integrity);
  115. ?>
  116.  
  117. <h2><?php echo formatTitleh2($current_title)?></h2>
  118. <form id="modpart" action="<?php echo $_SERVER['SCRIPT_NAME']?>" method="post">
  119.   <p>
  120.     <label for="part_title"><?php echo mb_ucfirst(_t('contents','title'))?> : *</label>
  121.     <input name="part_title" type="text" class="textfield" id="part_title" maxlength="200" value="<?php echo $form_title?>" />
  122.   </p>
  123.   <p>
  124.     <label for="part_body"><?php echo mb_ucfirst(_t('contents','body'))?> : *</label>
  125.     <textarea id="part_body" name="part_body" class="largetextfield" <?php echo AREA_SETTINGS?>><?php echo $form_body?></textarea>
  126.   </p>
  127.   
  128.   <div>
  129.     <input name="id" type="hidden" value="<?php echo $id?>" id="id" />
  130.     <input name="rub" type="hidden" value="<?php echo $rub?>" id="rub" />
  131.     <input name="todo" type="hidden" value="<?php echo $todo?>" id="todo" />
  132.     <input name="type" type="hidden" value="<?php echo $type?>" id="type" />
  133.     <input name="parent" type="hidden" value="<?php echo $parent?>" id="parent" />
  134.     <?php echo cancel_button($cancel_link)?>
  135.     <input name="valider" type="submit" value="<?php echo _t('btn','valid'?>" class="button" id="valider" />
  136.   </div>
  137. </form>
  138. </div>
  139. <?php include_once(override($dir.'/help.php'THEME_ADMIN_PATH))?></div>
  140. <?php
  141. // Récapitulatif
  142. else    {
  143. ?>
  144. <div class="contentcontainer">
  145. <?php
  146. include_once(override($dir.'/menurub.php'THEME_ADMIN_PATH));
  147. ?>
  148.   <div id="content">
  149.   <h2><?php echo formatTitleh2(_t('recap','title'))?></h2>
  150.   <?php
  151.   echo "<dl class=\"summary\">\n";
  152.   echo "<dt>".mb_ucfirst(_t('contents','title'))." :</dt>\n";
  153.   echo "<dd>".$form_title."</dd>\n";
  154.   echo "<dt>".mb_ucfirst(_t('contents','body'))." :</dt>\n";
  155.   echo "<dd>".linkin_content($form_body)."</dd>\n";
  156.   echo "</dl>\n";
  157.   ?>
  158.   <form id="modpart" action="<?php echo $_SERVER['SCRIPT_NAME']?>" method="post">
  159.     <div>
  160.       <input name="id" type="hidden" value="<?php echo $id?>" id="id" />
  161.       <input name="rub" type="hidden" value="<?php echo $rub?>" id="rub" />
  162.       <input name="todo" type="hidden" value="<?php echo $todo?>" id="todo" />
  163.       <input name="type" type="hidden" value="<?php echo $type?>" id="type" />
  164.       <input name="parent" type="hidden" value="<?php echo $parent?>" id="parent" />
  165.       <input name="data_table" type="hidden" value="<?php echo $table?>" id="data_table" />
  166.       <?php echo cancel_button($cancel_link)?>
  167.       <input name="retour" type="button" value="<?php echo _t('btn','preview'?>" class="button" id="retour" onclick="history.go(-1);" />
  168.       <input name="enregistrer" type="submit" value="<?php echo _t('btn','save'?>" class="button" id="valider" />
  169.     </div>
  170.   </form>
  171.   </div>
  172. <?php include_once(override($dir.'/help.php'THEME_ADMIN_PATH))?>
  173. </div>
  174. <?php
  175. }
  176. ?>

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