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

Source for file add_multi.php

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

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