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

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