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

Source for file add.php

Documentation is available at add.php

  1. <?php
  2. /**
  3.  * @package linea21.core
  4.  * @subpackage scale
  5.  * @author linea21 <info@linea21.com>
  6.  * @version $id SVN
  7.  * @access public
  8.  * @license http://opensource.org/licenses/gpl-3.0.html
  9.  */
  10.  
  11. //////////// Check Inclusion de pages //////////// 
  12. if (!function_exists('AuthenthificationProcess')){ 
  13. include_once("../lib/lib_common.php");
  14. ReloadIndex('admin');
  15. }
  16. ////////////
  17. ?><div id="chemin">
  18.     <ul>
  19.         <li>
  20.             <a href="index.php" class="chemin_home"><? echo _t('way','home'); ?></a>
  21.         </li>
  22.         <li>
  23.                <a href="<?php echo $rub_link; ?>" id="chemin_<? echo $rub; ?>" class="chemin_rub"><? echo _t('menu','scale'); ?></a>
  24.         </li>
  25.         <li>
  26.             <span><? echo formatnavTitle(_t('scale','add')); ?></span>
  27.         </li>
  28.     </ul>
  29. </div>
  30. <!--end barre haute -->
  31. <?php
  32. if(isset($_POST['enregistrer'])) {
  33.     $data_table=unserialize(urldecode($_POST['data_table']));
  34.     $scale_object= new scale;
  35.     $result=$scale_object->AddScale($data_table, $sql_object);
  36.     $link_confirm="confirm.php?rub=".$rub."&todo=".$todo;
  37.     if(is_numeric($result)) header("Location: ".$link_confirm);
  38.     else  system_error();
  39. }
  40.  
  41. $form_denomination='';
  42. $form_comment='';
  43. $form_surface='';
  44. $form_population='';
  45. $form_root_scale=-1;
  46. if(isset($_POST['valider'])) {
  47.     $table[0]=$_POST['denomination'];
  48.     $table[1]=$_POST['surface'];
  49.     $table[2]=$_POST['population'];
  50.     $table[3]=$_POST['root_scale'];
  51.     $table[4]=$_POST['com_scale'];
  52.     $table[5]='P'; // statut
  53.     $scale_object= new scale;
  54.     $integrity=$scale_object->CheckDataIntegrity($table);
  55.     if(is_string($integrity)) $format_text='2FIELD';
  56.     else $format_text='2HTML';
  57.     $form_denomination=formatText($_POST['denomination'], $format_text);
  58.     $form_surface=$_POST['surface'];
  59.     $form_population=$_POST['population'];
  60.     $form_comment=formatText($_POST['com_scale'], $format_text);
  61.     $form_root_scale=$_POST['root_scale'];
  62.     $table=urlencode(serialize($table));
  63. }
  64. include_once(THEME_ADMIN_PATH."quickicons.php");
  65.  
  66. include_once("../lib/input_helpers.php");
  67. // select-box des échelles
  68. $data=$sql_object->DBSelect($req_add);
  69. $select_root=ScaleSelectBox($data, "root_scale", $form_root_scale);
  70. ?>
  71.  
  72. <?php
  73. if(!isset($integrity) || is_string($integrity)) {
  74. ?>
  75. <div class="contentcontainer">
  76.         <?php
  77.         include_once($dir."/menurub.php");
  78.         ?>
  79.         <div id="content">
  80.             <?php
  81.             if(isset($integrity) && is_string($integrity)) display_errors($integrity);
  82.             ?>
  83.             <h2><? echo formatTitleh2(_t('scale','add_title')); ?></h2>
  84.             <form id="addscale" action="<?php echo $_SERVER['SCRIPT_NAME']; ?>" method="post">
  85.                 <p>
  86.                 <label for="denomination" ><? echo _t('scale','denomination') ?> : *</label>
  87.                 <input name="denomination" type="text" id="denomination" maxlength="200" value="<?php echo $form_denomination; ?>" class="textfield"/>
  88.                 </p>
  89.                 <p>
  90.                 <label for="surface" ><? echo _t('scale','surface') ?> (<?php echo SURFACE_UNIT; ?>) :</label>
  91.                 <input name="surface" type="text" id="surface" maxlength="8" value="<?php echo $form_surface; ?>" class="textfield" />
  92.                 </p>
  93.                 <p>
  94.                 <label for="population" ><? echo _t('scale','population') ?> :</label>
  95.                 <input name="population" type="text" id="population" maxlength="8" value="<?php echo $form_population; ?>" class="textfield" />
  96.                 </p>
  97.                 <p>
  98.                 <label for="root_scale" ><? echo _t('scale','root') ?> : *</label>
  99.                 <?php echo $select_root; ?>
  100.                 </p>
  101.                 <p>
  102.                 <label for="com_scale" ><? echo _t('scale','comment') ?> : </label>
  103.                 <textarea id="com_scale" name="com_scale" class="largetextfield" <?php echo AREA_SETTINGS; ?> ><?php echo $form_comment; ?></textarea>
  104.                 <br />
  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.                 <?php echo cancel_button('javascript:history.go(-1);'); ?>
  110.                 <input name="valider" type="submit" value="<? echo _t('btn','valid') ?>" class="button" id="valider" />
  111.                 </div>
  112.             </form>
  113.         </div>
  114. <?php include_once($dir."/help.php"); ?>
  115. </div>
  116. <?php
  117. // Récapitulatif
  118. } else    {
  119. $display_form_comment=empty_none($form_comment);
  120. $display_form_surface=empty_nc($form_surface);
  121. $display_form_population=empty_nc($form_population);
  122.  
  123. $requete=SQL_getonescale($_POST['root_scale']);
  124. $data=$sql_object->DBSelect($requete);
  125. $display_root_scale=formatText($data[0]['scale_denomination'], '2HTML');
  126.  
  127. ?>
  128. <div class="contentcontainer">
  129. <?php
  130. include_once($dir."/menurub.php");
  131. ?>
  132. <div id="content">
  133.             <h2><? echo formatTitleh2(_t('recap','title')); ?></h2>
  134.             <dl class="dl3">
  135.                 <dt><? echo _t('scale','denomination'); ?> : </dt>
  136.                 <dd><?php echo $form_denomination; ?><br /></dd>
  137.                 <dt><? echo _t('scale','surface'); ?> (<?php echo SURFACE_UNIT; ?>) :</dt>
  138.                 <dd><?php echo $display_form_surface; ?><br /></dd>
  139.                 <dt><? echo _t('scale','population'); ?> :</dt>
  140.                 <dd><?php echo $display_form_population; ?><br /></dd>
  141.                 <dt><? echo _t('scale','root'); ?> : </dt>
  142.                 <dd><?php echo $display_root_scale; ?><br /></dd>
  143.                 <dt><? echo _t('scale','comment'); ?> : </dt>
  144.                 <dd><?php echo $display_form_comment; ?><br /></dd>
  145.             </dl>
  146.             <form id="addscale" action="<?php echo $_SERVER['SCRIPT_NAME']; ?>" method="post">
  147.                 <div>
  148.                 <input name="rub" type="hidden" value="<?php echo $rub; ?>" id="rub" />
  149.                 <input name="todo" type="hidden" value="<?php echo $todo; ?>" id="todo" />
  150.                 <input name="data_table" type="hidden" value="<?php echo $table; ?>" id="data_table" />
  151.                 <?php echo cancel_button('?rub='.$rub.'&amp;todo=list'); ?>
  152.                 <input name="retour" type="button" value="<? echo _t('btn','preview') ?>" class="button" id="retour" onclick="history.go(-1);" />
  153.                 <input name="enregistrer" type="submit" value="<? echo _t('btn','save') ?>" class="button" id="valider" />
  154.                 </div>
  155.             </form>
  156.         </div>
  157.     <?php include_once($dir."/help.php"); ?>
  158. </div>
  159. <?php
  160. }
  161. ?>

Documentation generated on Fri, 16 Oct 2009 09:27:34 +0200 by phpDocumentor 1.4.1