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

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