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

Source for file add.php

Documentation is available at add.php

  1. <?php
  2. /**
  3.  * @package linea21.modules
  4.  * @subpackage content
  5.  * @author linea21 <info@linea21.com>
  6.  * @version $id SVN
  7.  * @access public
  8.  * @license http://opensource.org/licenses/gpl-3.0.html
  9.  *  'Content' 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. $contents_object new contents;
  20. $complete_type=strtoupper($mod_inc);
  21. $form_title='';
  22. $form_body='';
  23.  
  24. if(isset($_POST['enregistrer'])) {
  25.   $data_table=unserialize(urldecode($_POST['data_table']));
  26.   $result=$contents_object->AddContents($parent$data_table$complete_type$sql_object);
  27.   $link_confirm="confirm.php?rub=".$rub."&todo=".$todo."&type=".$type."&id=".$parent;
  28.  
  29.   if($result===trueheader("Location: ".$link_confirm);
  30.   else  system_error();
  31. }
  32.  
  33. if(isset($_POST['valider'])) {
  34.   $table[0]=$_POST['part_title'];
  35.   $table[1]=$_POST['part_body'];
  36.  
  37.  
  38.   $integrity=$contents_object->CheckDataIntegrity($table,$type);
  39.  
  40.   if(is_string($integrity)) {
  41.     $text_format='2FIELD';
  42.   else {
  43.     $text_format='2HTML';
  44.   }
  45.   
  46.   $form_title=formatText($_POST['part_title']$text_format);
  47.   $form_body=formatText($_POST['part_body']$text_format);
  48.  
  49.   $table=urlencode(serialize($table));
  50. }
  51.  
  52. if($type=='P'{
  53.   $requeteSQL_getPublicationTitle($parent);
  54.   $result=$sql_object->DBSelect($requete);
  55.   $current_title=FormatText($result[0]['publi_title']);
  56.   $publi_owner=$result[0]['publi_posted_by'];
  57.   //////////// Check Droits utilisateur ////////////
  58.   if (!hasRight('publication')) ReloadIndex('admin');
  59.   if (GetSessionElement('id')!=$publi_owner && !IsSuperAdmin()) ReloadIndex('admin');
  60. }
  61.  
  62. if($type=='W'{
  63.   $requeteSQL_getWorkshopRepTitleAndGroup($parent);
  64.   $result=$sql_object->DBSelect($requete);
  65.   $current_title=FormatText($result[0]['workrep_title']).' ('.FormatText($result[0]['workshop_denomination']).')';
  66.   $workshop_id=$result[0]['workrep_workshop_id'];
  67.   //////////// Check Droits utilisateur ////////////
  68.   if (!hasRight('workshop')) ReloadIndex('admin');
  69.   if (!AuthUser4Workshop($workshop_id$sql_object&& !IsSuperAdmin()) ReloadIndex('admin');
  70. }
  71.  
  72. ?>
  73.  
  74. <div id="chemin">
  75. <ul>
  76.     <li><a href="index.php" class="chemin_home"><?php echo _t('way','home'?></a>
  77.     </li>
  78.     <li><a href="<?php echo $rub_link?>" id="chemin_<?php echo $rub?>"
  79.         class="chemin_rub"><?php echo _t('menu',$mod_inc)?></a></li>
  80.     <li><span><?php echo formatNavTitle(_t('contents',$mod_inc.'_type')." : "$current_title)?></span>
  81.     </li>
  82. </ul>
  83. </div>
  84. <!--end barre haute -->
  85. <?php
  86. include_once(THEME_ADMIN_PATH."quickicons.php");
  87. ?>
  88.  
  89. <?php
  90. if(!isset($integrity|| is_string($integrity)) {
  91.   ?>
  92. <div class="contentcontainer"><?php
  93. include_once($dir."/menurub.php");
  94. ?>
  95. <div id="content">
  96. <?php
  97. if(isset($integrity&& is_string($integrity)) display_errors($integrity);
  98. ?>
  99. <h2><?php echo formatTitleh2(_t('contents',$mod_inc.'_type')." : "$current_title)?></h2>
  100. <form id="addpart" action="<?php echo $_SERVER['SCRIPT_NAME']?>" method="post">
  101.   <p>
  102.     <label for="part_title"><?php echo _t('contents','title')?> : *</label>
  103.     <input name="part_title" type="text" class="textfield" id="part_title" maxlength="200" value="<?php echo $form_title?>" />
  104.   </p>
  105.   <p>
  106.     <label for="part_body"><?php echo _t('contents','body')?> : *</label>
  107.     <textarea id="part_body" name="part_body" class="largetextfield" <?php echo AREA_SETTINGS?>><?php echo $form_body?></textarea>
  108.   </p>
  109.   <div>
  110.     <input name="rub" type="hidden" value="<?php echo $rub?>" id="rub" />
  111.     <input name="todo" type="hidden" value="<?php echo $todo?>" id="todo" />
  112.     <input name="type" type="hidden" value="<?php echo $type?>" id="type" />
  113.     <input name="parent" type="hidden" value="<?php echo $parent?>" id="parent" />
  114.     <?php echo cancel_button($cancel_link)?>
  115.     <input name="valider" type="submit" value="<?php echo _t('btn','valid'?>" class="button" id="valider" />
  116.   </div>
  117. </form>
  118. </div>
  119. <?php include_once($dir."/help.php")?></div>
  120. <?php
  121. // Récapitulatif
  122. else    {
  123. ?>
  124. <div class="contentcontainer"><?php
  125. include_once($dir."/menurub.php");
  126. ?>
  127. <div id="content">
  128. <h2><?php echo _t('recap','title'?></h2>
  129. <?php
  130. echo "<dl class=\"dl3\">\n";
  131. echo "<dt>"._t('contents','title')."</dt>\n";
  132. echo "<dd>".$form_title."</dd>\n";
  133. echo "<dt>"._t('contents','body')."</dt>\n";
  134. echo "<dd>".linkin_content($form_body)."</dd>\n";
  135. echo "</dl>\n";
  136. ?>
  137. <form id="addscale" action="<?php echo $_SERVER['SCRIPT_NAME']?>" method="post">
  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.     <input name="data_table" type="hidden" value="<?php echo $table?>" id="data_table" />
  144.     <input name="retour" type="button" value="<?php echo _t('btn','preview'?>" class="button" id="retour" onclick="history.go(-1);" />
  145.     <input name="enregistrer" type="submit" value="<?php echo _t('btn','save'?>" class="button" id="valider" />
  146.   </div>
  147. </form>
  148. </div>
  149. <?php include_once($dir."/help.php")?></div>
  150. <?php
  151. }
  152. ?>

Documentation generated on Thu, 03 May 2012 15:01:52 +0200 by phpDocumentor 1.4.1