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 (!class_exists('auth')) {
  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 (!$l21auth->hasRight('publication')) ReloadIndex('admin');
  59.   if ($l21auth->GetSessionElement('id')!=$publi_owner && !$l21auth->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 (!$l21auth->hasRight('workshop')) ReloadIndex('admin');
  69.   if (!$l21auth->isWorkgroupOrganiser($l21auth->GetSessionElement('id')$sql_object$workshop_id&& !$l21auth->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></li>
  77.     <li><a href="<?php echo $rub_link?>" id="chemin_<?php echo $rub?>" class="chemin_rub"><?php echo _t('menu',$mod_inc)?></a></li>
  78.     <li><span><?php echo formatNavTitle(_t('contents',$mod_inc.'_type')." : "$current_title)?></span></li>
  79. </ul>
  80. </div>
  81. <!--end barre haute -->
  82. <?php
  83. include_once(THEME_ADMIN_PATH."quickicons.php");
  84. ?>
  85.  
  86. <?php
  87. if(!isset($integrity|| is_string($integrity)) {
  88.   ?>
  89. <div class="contentcontainer"><?php
  90. include_once(override($dir.'/menurub.php'THEME_ADMIN_PATH));
  91. ?>
  92. <div id="content">
  93. <?php
  94. if(isset($integrity&& is_string($integrity)) display_errors($integrity);
  95. ?>
  96. <h2><?php echo formatTitleh2(_t('contents',$mod_inc.'_type')." : "$current_title)?></h2>
  97. <form id="addpart" action="<?php echo $_SERVER['SCRIPT_NAME']?>" method="post">
  98.   <p>
  99.     <label for="part_title"><?php echo mb_ucfirst(_t('contents','title'))?> : *</label>
  100.     <input name="part_title" type="text" class="textfield" id="part_title" maxlength="200" value="<?php echo $form_title?>" />
  101.   </p>
  102.   <p>
  103.     <label for="part_body"><?php echo mb_ucfirst(_t('contents','body'))?> : *</label>
  104.     <textarea id="part_body" name="part_body" class="largetextfield" <?php echo AREA_SETTINGS?>><?php echo $form_body?></textarea>
  105.   </p>
  106.   <div>
  107.     <input name="rub" type="hidden" value="<?php echo $rub?>" id="rub" />
  108.     <input name="todo" type="hidden" value="<?php echo $todo?>" id="todo" />
  109.     <input name="type" type="hidden" value="<?php echo $type?>" id="type" />
  110.     <input name="parent" type="hidden" value="<?php echo $parent?>" id="parent" />
  111.     <?php echo cancel_button($cancel_link)?>
  112.     <input name="valider" type="submit" value="<?php echo _t('btn','valid'?>" class="button" id="valider" />
  113.   </div>
  114. </form>
  115. </div>
  116. <?php include_once(override($dir.'/help.php'THEME_ADMIN_PATH))?></div>
  117. <?php
  118. // Récapitulatif
  119. else    {
  120. ?>
  121. <div class="contentcontainer"><?php
  122. include_once(override($dir.'/menurub.php'THEME_ADMIN_PATH));
  123. ?>
  124. <div id="content">
  125. <h2><?php echo _t('recap','title'?></h2>
  126. <?php
  127. echo "<dl class=\"summary\">\n";
  128. echo "<dt>".mb_ucfirst(_t('contents','title'))." : </dt>\n";
  129. echo "<dd>".$form_title."</dd>\n";
  130. echo "<dt>".mb_ucfirst(_t('contents','body'))." :</dt>\n";
  131. echo "<dd>".linkin_content($form_body)."</dd>\n";
  132. echo "</dl>\n";
  133. ?>
  134. <form id="addscale" action="<?php echo $_SERVER['SCRIPT_NAME']?>" method="post">
  135.   <div>
  136.     <input name="rub" type="hidden" value="<?php echo $rub?>" id="rub" />
  137.     <input name="todo" type="hidden" value="<?php echo $todo?>" id="todo" />
  138.     <input name="type" type="hidden" value="<?php echo $type?>" id="type" />
  139.     <input name="parent" type="hidden" value="<?php echo $parent?>" id="parent" />
  140.     <input name="data_table" type="hidden" value="<?php echo $table?>" id="data_table" />
  141.     <input name="retour" type="button" value="<?php echo _t('btn','preview'?>" class="button" id="retour" onclick="history.go(-1);" />
  142.     <input name="enregistrer" type="submit" value="<?php echo _t('btn','save'?>" class="button" id="valider" />
  143.   </div>
  144. </form>
  145. </div>
  146. <?php include_once(override($dir.'/help.php'THEME_ADMIN_PATH))?></div>
  147. <?php
  148. }
  149. ?>

Documentation generated on Thu, 20 Mar 2014 16:45:45 +0100 by phpDocumentor 1.4.1