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 (!function_exists('AuthenthificationProcess')) {
  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 (GetSessionElement('id')!=$current_owner && !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 (!AuthUser4Workshop($current_workshop_id$sql_object&& !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>
  96.     </li>
  97.     <li><a href="<?php echo $rub_link?>" id="chemin_<?php echo $rub?>"
  98.         class="chemin_rub"><?php echo _t('menu',$mod_inc)?></a></li>
  99.     <li><span><?php echo formatNavTitle(_t('contents',$mod_inc.'_type')." : "$current_title)?></span>
  100.     </li>
  101. </ul>
  102. </div>
  103. <!--end barre haute -->
  104. <?php
  105. include_once(THEME_ADMIN_PATH."quickicons.php");
  106. ?>
  107.  
  108. <?php
  109. if(!isset($integrity|| is_string($integrity)) {
  110.   ?>
  111. <div class="contentcontainer"><?php
  112. include_once($dir."/menurub.php");
  113. ?>
  114. <div id="content">
  115.  
  116. <?php
  117. if(isset($integrity&& is_string($integrity)) display_errors($integrity);
  118. ?>
  119.  
  120. <h2><?php echo formatTitleh2($current_title)?></h2>
  121. <form id="modpart" action="<?php echo $_SERVER['SCRIPT_NAME']?>" method="post">
  122.   <p>
  123.     <label for="part_title"><?php echo _t('contents','title')?> : *</label>
  124.     <input name="part_title" type="text" class="textfield" id="part_title" maxlength="200" value="<?php echo $form_title?>" />
  125.   </p>
  126.   <p>
  127.     <label for="part_body"><?php echo _t('contents','body')?> : *</label>
  128.     <textarea id="part_body" name="part_body" class="largetextfield" <?php echo AREA_SETTINGS?>><?php echo $form_body?></textarea>
  129.   </p>
  130.   
  131.   <div>
  132.     <input name="id" type="hidden" value="<?php echo $id?>" id="id" />
  133.     <input name="rub" type="hidden" value="<?php echo $rub?>" id="rub" />
  134.     <input name="todo" type="hidden" value="<?php echo $todo?>" id="todo" />
  135.     <input name="type" type="hidden" value="<?php echo $type?>" id="type" />
  136.     <input name="parent" type="hidden" value="<?php echo $parent?>" id="parent" />
  137.     <?php echo cancel_button($cancel_link)?>
  138.     <input name="valider" type="submit" value="<?php echo _t('btn','valid'?>" class="button" id="valider" />
  139.   </div>
  140. </form>
  141. </div>
  142. <?php include_once($dir."/help.php")?></div>
  143. <?php
  144. // Récapitulatif
  145. else    {
  146. ?>
  147. <div class="contentcontainer">
  148. <?php
  149. include_once($dir."/menurub.php");
  150. ?>
  151.   <div id="content">
  152.   <h2><?php echo formatTitleh2(_t('recap','title'))?></h2>
  153.   <?php
  154.   echo "<dl class=\"dl3\">\n";
  155.   echo "<dt>"._t('contents','title')."</dt>\n";
  156.   echo "<dd>".$form_title."</dd>\n";
  157.   echo "<dt>"._t('contents','body')."</dt>\n";
  158.   echo "<dd>".linkin_content($form_body)."</dd>\n";
  159.   echo "</dl>\n";
  160.   ?>
  161.   <form id="modpart" action="<?php echo $_SERVER['SCRIPT_NAME']?>" method="post">
  162.     <div>
  163.       <input name="id" type="hidden" value="<?php echo $id?>" id="id" />
  164.       <input name="rub" type="hidden" value="<?php echo $rub?>" id="rub" />
  165.       <input name="todo" type="hidden" value="<?php echo $todo?>" id="todo" />
  166.       <input name="type" type="hidden" value="<?php echo $type?>" id="type" />
  167.       <input name="parent" type="hidden" value="<?php echo $parent?>" id="parent" />
  168.       <input name="data_table" type="hidden" value="<?php echo $table?>" id="data_table" />
  169.       <?php echo cancel_button($cancel_link)?>
  170.       <input name="retour" type="button" value="<?php echo _t('btn','preview'?>" class="button" id="retour" onclick="history.go(-1);" />
  171.       <input name="enregistrer" type="submit" value="<?php echo _t('btn','save'?>" class="button" id="valider" />
  172.     </div>
  173.   </form>
  174.   </div>
  175. <?php include_once($dir."/help.php")?>
  176. </div>
  177. <?php
  178. }
  179. ?>

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