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

Source for file add_biblio.php

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

Documentation generated on Fri, 16 Oct 2009 09:28:15 +0200 by phpDocumentor 1.4.1