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

Source for file mod_biblio.php

Documentation is available at mod_biblio.php

  1. <?php
  2. /**
  3.  * @package linea21.modules
  4.  * @subpackage resources
  5.  * @author linea21 <info@linea21.com>
  6.  * @version $id SVN
  7.  * @access public
  8.  * @license http://opensource.org/licenses/gpl-3.0.html
  9.  *  'Resource' 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.  
  22. if($type=='P') {
  23.     $requete= SQL_getPublicationTitle($parent);
  24.     $result=$sql_object->DBSelect($requete);
  25.     $current_title=FormatText($result[0]['publi_title'], '2HTML');
  26.     $publi_owner=$result[0]['publi_posted_by'];
  27.     
  28.     //////////// Check Droits utilisateur ////////////
  29.     if (!HaveRight('publication')) ReloadIndex('admin');
  30.     if (GetSessionElement('id')!=$publi_owner && !IsSuperAdmin()) ReloadIndex('admin');
  31.     ///////////
  32. }
  33. if($type=='W') {
  34.     $requete= SQL_getWorkshopRepTitleAndGroup($parent);
  35.     $result=$sql_object->DBSelect($requete);
  36.     $current_title=FormatText($result[0]['workrep_title'].' ('.$result[0]['workshop_denomination'].')', '2HTML');
  37.     $workshop_id=$result[0]['workrep_workshop_id'];
  38.     
  39.     //////////// Check Droits utilisateur ////////////
  40.     if (!HaveRight('workshop')) ReloadIndex('admin');
  41.     if (!AuthUser4Workshop($workshop_id, $sql_object) && !IsSuperAdmin()) ReloadIndex('admin');
  42.     ///////////
  43.     
  44. }
  45. ?>
  46.  
  47. <div id="chemin">
  48.     <ul>
  49.         <li>
  50.             <a href="index.php" class="chemin_home"><? echo _t('way','home'); ?></a>
  51.         </li>
  52.         <li>
  53.                <a href="<?php echo $rub_link; ?>" id="chemin_<? echo $rub; ?>" class="chemin_rub"><? echo _t('menu',$mod_inc); ?></a>
  54.         </li>
  55.         <li>
  56.             <span><? echo formatNavTitle(_t('resources',$mod_inc.'_type')." : ". $current_title); ?></span>
  57.         </li>
  58.     </ul>
  59. </div>
  60. <!--end barre haute -->
  61. <?php
  62.  
  63. if(!isset($_POST['valider'])) {
  64.     $requete= SQL_getBiblioInfo($id);
  65.     $result=$sql_object->DBSelect($requete);
  66.     $form_author=formatText($result[0]['bibliores_author'], '2FIELD');
  67.     $form_title=formatText($result[0]['bibliores_title'], '2FIELD');
  68.     $form_sub_title=formatText($result[0]['bibliores_sub_title'], '2FIELD');
  69.     $form_editor=formatText($result[0]['bibliores_editor'], '2FIELD');
  70.     $form_published_date=formatText($result[0]['bibliores_date'], '2FIELD');
  71. }
  72.  
  73. $resources_object= new resources;
  74.  
  75. if(isset($_POST['enregistrer'])) {
  76.     $data_table=unserialize(urldecode($_POST['data_table']));
  77.     $result=$resources_object->ModifyBiblioRes($id, $data_table, $sql_object);
  78.     $link_confirm="confirm.php?rub=".$rub."&todo=".$todo."&type=".$type."&id=".$parent;
  79.     if($result) header("Location: ".$link_confirm);
  80.     else  system_error();
  81. }
  82.  
  83. if(isset($_POST['valider'])) {
  84.     $table[0]=$_POST['biblio_author'];
  85.     $table[1]=$_POST['biblio_title'];
  86.     $table[2]=$_POST['biblio_sub_title'];
  87.     $table[3]=$_POST['biblio_editor'];
  88.     $table[4]=$_POST['biblio_published_date'];
  89.     $table[5]=0; // range
  90.  
  91.     $integrity=$resources_object->CheckDataIntegrity($table,'BIBLIO');
  92.  
  93.     if(is_string($integrity)) {
  94.         $text_format='2FIELD';
  95.     } else {
  96.         $text_format='2HTML';
  97.     }
  98.     $form_author=formatText($_POST['biblio_author'], $text_format);
  99.     $form_title=formatText($_POST['biblio_title'], $text_format);
  100.     $form_sub_title=formatText($_POST['biblio_sub_title'], $text_format);
  101.     $form_editor=formatText($_POST['biblio_editor'], $text_format);
  102.     $form_published_date=formatText($_POST['biblio_published_date'], $text_format);
  103.  
  104.     $table=urlencode(serialize($table));
  105. }
  106.  
  107.  
  108. include_once(THEME_ADMIN_PATH."quickicons.php");
  109.  
  110. ?>
  111.  
  112. <?php
  113. if(!isset($integrity) || is_string($integrity)) {
  114. ?>
  115. <div class="contentcontainer">
  116.         <?php
  117.         include_once($dir."/menurub.php");
  118.         ?>
  119.         <div id="content">
  120.             <?php
  121.             if(isset($integrity) && is_string($integrity)) display_errors($integrity);
  122.             ?>
  123.             <h2><? echo formatTitleh2($current_title); ?></h2>
  124.             <form id="modbiblio" action="<?php echo $_SERVER['SCRIPT_NAME']; ?>" method="post">
  125.                 <p>
  126.                 <label for="biblio_author"><? echo _t('resources','biblio_author'); ?> : *</label>
  127.                 <input name="biblio_author" type="text" class="textfield" id="biblio_author" maxlength="200" value="<?php echo $form_author; ?>" />
  128.                 </p>
  129.                 <p>
  130.                 <label for="biblio_title"><? echo _t('resources','biblio_title'); ?> : *</label>
  131.                 <input name="biblio_title" type="text" class="textfield" id="biblio_title" maxlength="255" value="<?php echo $form_title; ?>" />
  132.                 </p>
  133.                 <p>
  134.                 <label for="biblio_sub_title"><? echo _t('resources','biblio_sub_title'); ?> : </label>
  135.                 <input name="biblio_sub_title" type="text" class="textfield" id="biblio_sub_title" maxlength="255" value="<?php echo $form_sub_title; ?>" />
  136.                 </p>
  137.                 <p>
  138.                 <label for="biblio_editor"><? echo _t('resources','biblio_editor'); ?> : </label>
  139.                 <input name="biblio_editor" type="text" class="textfield" id="biblio_editor" maxlength="255" value="<?php echo $form_editor; ?>" />
  140.                 </p>
  141.                 <p>
  142.                 <label for="biblio_published_date"><? echo _t('resources','biblio_published_date'); ?> : </label>
  143.                 <input name="biblio_published_date" type="text" class="textfield" id="biblio_published_date" maxlength="100" value="<?php echo $form_published_date; ?>" />
  144.                 </p>
  145.                 <div>
  146.                 <input name="id" type="hidden" value="<?php echo $id; ?>" id="id" />
  147.                 <input name="rub" type="hidden" value="<?php echo $rub; ?>" id="rub" />
  148.                 <input name="todo" type="hidden" value="<?php echo $todo; ?>" id="todo" />
  149.                 <input name="type" type="hidden" value="<?php echo $type; ?>" id="type" />
  150.                 <input name="parent" type="hidden" value="<?php echo $parent; ?>" id="parent" />
  151.                 <?php echo cancel_button($cancel_link); ?>
  152.                 <input name="valider" type="submit" value="<? echo _t('btn','valid') ?>" class="button" id="valider" />
  153.                 </div>
  154.             </form>
  155.         </div>
  156. <?php include_once($dir."/help.php"); ?>
  157. </div>
  158. <?php
  159. // Récapitulatif
  160. } else    {
  161.  
  162. $display_sub_title=empty_none($form_sub_title);
  163. $display_editor=empty_none($form_editor);
  164. $display_published_date=empty_none($form_published_date);
  165.  
  166.  
  167. ?>
  168. <div class="contentcontainer">
  169. <?php
  170. include_once($dir."/menurub.php");
  171. ?>
  172. <div id="content">
  173.             <h2><? echo formatTitleh2(_t('recap','title')); ?></h2>
  174.             <?php
  175.             echo "<dl class=\"dl3\">\n";
  176.             echo "<dt>"._t('resources','biblio_author')."</dt>\n";
  177.             echo "<dd>".$form_author."</dd>\n";
  178.             echo "<dt>"._t('resources','biblio_title')."</dt>\n";
  179.             echo "<dd>".$form_title."</dd>\n";
  180.             echo "<dt>"._t('resources','biblio_sub_title')."</dt>\n";
  181.             echo "<dd>".$display_sub_title."</dd>\n";
  182.             echo "<dt>"._t('resources','biblio_editor')."</dt>\n";
  183.             echo "<dd>".$display_editor."</dd>\n";
  184.             echo "<dt>"._t('resources','biblio_published_date')."</dt>\n";
  185.             echo "<dd>".$display_published_date."</dd>\n";
  186.             echo "</dl>\n";
  187.             ?>
  188.             <form id="modbiblio" action="<?php echo $_SERVER['SCRIPT_NAME']; ?>" method="post">
  189.                 <div>
  190.                 <input name="id" type="hidden" value="<?php echo $id; ?>" id="id" />
  191.                 <input name="rub" type="hidden" value="<?php echo $rub; ?>" id="rub" />
  192.                 <input name="todo" type="hidden" value="<?php echo $todo; ?>" id="todo" />
  193.                 <input name="type" type="hidden" value="<?php echo $type; ?>" id="type" />
  194.                 <input name="parent" type="hidden" value="<?php echo $parent; ?>" id="parent" />
  195.                 <input name="data_table" type="hidden" value="<?php echo $table; ?>" id="data_table" />
  196.                 <?php echo cancel_button($cancel_link); ?>
  197.                 <input name="retour" type="button" value="<? echo _t('btn','preview') ?>" class="button" id="retour" onclick="history.go(-1);" />
  198.                 <input name="enregistrer" type="submit" value="<? echo _t('btn','save') ?>" class="button" id="valider" />
  199.                 </div>
  200.             </form>
  201.         </div>
  202.     <?php include_once($dir."/help.php"); ?>
  203. </div>
  204. <?php
  205. }
  206. ?>

Documentation generated on Fri, 16 Oct 2009 09:37:17 +0200 by phpDocumentor 1.4.1