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

Source for file mod_multi.php

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

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