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

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