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

Source for file add_link.php

Documentation is available at add_link.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_url='http://';
  60. $form_url_mask='';
  61.  
  62. $resources_object= new resources;
  63.  
  64. if(isset($_POST['enregistrer'])) {
  65.     $data_table=unserialize(urldecode($_POST['data_table']));
  66.     $result=$resources_object->AddLinkRes($parent, $data_table, $complete_type, $sql_object);
  67.     $link_confirm="confirm.php?rub=".$rub."&todo=".$todo."&type=".$type."&id=".$parent;
  68.     if($result===true) header("Location: ".$link_confirm);
  69.     else  system_error();
  70. }
  71.  
  72. if(isset($_POST['valider'])) {
  73.     $table[0]=$_POST['link_url'];
  74.     $table[1]=$_POST['link_url_mask'];
  75.     $table[2]=0;
  76.  
  77.     $integrity=$resources_object->CheckDataIntegrity($table,'LINK');
  78.  
  79.     if(is_string($integrity)) {
  80.         $text_format='2FIELD';
  81.     } else {
  82.         $text_format='2HTML';
  83.     }
  84.     $form_url=formatText($_POST['link_url'], $text_format);
  85.     $form_url_mask=formatText($_POST['link_url_mask'], $text_format);
  86.  
  87.     $table=urlencode(serialize($table));
  88. }
  89.  
  90.  
  91. include_once(THEME_ADMIN_PATH."quickicons.php");
  92.  
  93. ?>
  94.  
  95. <?php
  96. if(!isset($integrity) || is_string($integrity)) {
  97. ?>
  98. <div class="contentcontainer">
  99.         <?php
  100.         include_once($dir."/menurub.php");
  101.         ?>
  102.         <div id="content">
  103.             <?php
  104.             if(isset($integrity) && is_string($integrity)) display_errors($integrity);
  105.             ?>
  106.             <h2><? echo formatTitleh2($current_title); ?></h2>
  107.             <form id="addlink" action="<?php echo $_SERVER['SCRIPT_NAME']; ?>" method="post">
  108.                 <p>
  109.                 <label for="link_url"><? echo _t('resources','url'); ?> : *</label>
  110.                 <input name="link_url" type="text" class="textfield" id="link_url" maxlength="1000" value="<?php echo $form_url; ?>" />
  111.                 </p>
  112.                 <p>
  113.                 <label for="link_url_mask"><? echo _t('resources','url_mask'); ?> : </label>
  114.                 <input name="link_url_mask" type="text" class="textfield" id="link_url_mask" maxlength="200" value="<?php echo $form_url_mask; ?>" />
  115.                 </p>
  116.                 <div>
  117.                 <input name="rub" type="hidden" value="<?php echo $rub; ?>" id="rub" />
  118.                 <input name="todo" type="hidden" value="<?php echo $todo; ?>" id="todo" />
  119.                 <input name="type" type="hidden" value="<?php echo $type; ?>" id="type" />
  120.                 <input name="parent" type="hidden" value="<?php echo $parent; ?>" id="parent" />
  121.                 <?php echo cancel_button($cancel_link); ?>
  122.                 <input name="valider" type="submit" value="<? echo _t('btn','valid') ?>" class="button" id="valider" />
  123.                 </div>
  124.             </form>
  125.         </div>
  126. <?php include_once($dir."/help.php"); ?>
  127. </div>
  128. <?php
  129. // Récapitulatif
  130. } else    {
  131.  
  132. if(trim($form_url_mask)=='') {
  133.     $form_url_mask=_t('divers','none');
  134.     $display_visual_test="<a href=\"".$form_url."\" class=\"out\">".$form_url."</a>";
  135. } else {
  136.     $display_visual_test="<a href=\"".$form_url."\" class=\"out\">".$form_url_mask."</a>";
  137. }
  138.  
  139. ?>
  140. <div class="contentcontainer">
  141. <?php
  142. include_once($dir."/menurub.php");
  143. ?>
  144. <div id="content">
  145.             <h2><? echo  formatTitleh2(_t('recap','title')); ?></h2>
  146.             <?php
  147.             echo "<dl class=\"dl3\">\n";
  148.             echo "<dt>"._t('resources','url')."</dt>\n";
  149.             echo "<dd>".$form_url."</dd>\n";
  150.             echo "<dt>"._t('resources','url_mask')."</dt>\n";
  151.             echo "<dd>".$form_url_mask."</dd>\n";
  152.             echo "<dt>"._t('resources','url_visual_test')."</dt>\n";
  153.             echo "<dd>".$display_visual_test."</dd>\n";
  154.             echo "</dl>\n";
  155.             ?>
  156.             <form id="addlink" action="<?php echo $_SERVER['SCRIPT_NAME']; ?>" method="post">
  157.                 <div>
  158.                 <input name="rub" type="hidden" value="<?php echo $rub; ?>" id="rub" />
  159.                 <input name="todo" type="hidden" value="<?php echo $todo; ?>" id="todo" />
  160.                 <input name="type" type="hidden" value="<?php echo $type; ?>" id="type" />
  161.                 <input name="parent" type="hidden" value="<?php echo $parent; ?>" id="parent" />
  162.                 <input name="data_table" type="hidden" value="<?php echo $table; ?>" id="data_table" />
  163.                 <?php echo cancel_button($cancel_link); ?>
  164.                 <input name="retour" type="button" value="<? echo _t('btn','preview') ?>" class="button" id="retour" onclick="history.go(-1);" />
  165.                 <input name="enregistrer" type="submit" value="<? echo _t('btn','save') ?>" class="button" id="valider" />
  166.                 </div>
  167.             </form>
  168.         </div>
  169.     <?php include_once($dir."/help.php"); ?>
  170. </div>
  171. <?php
  172. }
  173. ?>

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