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

Source for file mod.php

Documentation is available at mod.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. if (isset($_GET['id']))    $scale_id=$_GET['id'];
  19. if (isset($_POST['id'])) $scale_id=$_POST['id'];
  20.  
  21. $scale_objectnew scale;
  22.  
  23. $requete=SQL_getonescale($scale_id);
  24. $data=$sql_object->DBSelect($requete'OBJECT');
  25. $current_title=formatText($data[0]->scale_denomination'2HTML');
  26. $current_scale_dependencies=$data[0]->scale_dependencies;
  27. $current_root=$data[0]->scale_root;
  28.  
  29. $mask_statut_P='';
  30. $mask_statut_D='';
  31.  
  32. if(isset($_POST['valider'])) {
  33.     $table[0]=$_POST['denomination'];
  34.     $table[1]=$_POST['surface'];
  35.     $table[2]=$_POST['population'];
  36.     $table[3]=$_POST['root_scale'];
  37.     $table[4]=$_POST['com_scale'];
  38.     $table[5]=$_POST['statut_scale'];
  39.     $table[6]=$current_root;
  40.     $integrity=$scale_object->CheckDataIntegrity($table);
  41.     
  42.     if(is_string($integrity)) $format_text='2FIELD';
  43.     else $format_text='2HTML';
  44.     $form_denomination=formatText($_POST['denomination']$format_text);
  45.     $form_surface=$_POST['surface'];
  46.     $form_population=$_POST['population'];
  47.     $form_comment=$_POST['com_scale'];
  48.     $form_root_scale=$_POST['root_scale'];
  49.     $form_statut_scale=$_POST['statut_scale'];
  50.     $table=urlencode(serialize($table));
  51. }
  52.  
  53. if(isset($_POST['enregistrer'])) {
  54.     $data_table=unserialize(urldecode($_POST['data_table']));
  55.     $result=$scale_object->ModifyScale($scale_id$data_table$sql_object);
  56.     $link_confirm="confirm.php?rub=".$rub."&todo=".$todo."&id=".$scale_id;
  57.     if($resultheader("Location: ".$link_confirm);
  58.     else  system_error();
  59. }
  60.  
  61. if(!isset($integrity)) {
  62.     $requete=SQL_getonescale($scale_id);
  63.     $data=$sql_object->DBSelect($requete'OBJECT');
  64.     $form_denomination=formatText($data[0]->scale_denomination'2FIELD');
  65.     $form_surface=$data[0]->scale_surface;
  66.     $form_population=$data[0]->scale_inhabitantsnumber;
  67.     $form_root_scale=$data[0]->scale_root;
  68.     $form_statut_scale=$data[0]->scale_statut;
  69.     $form_comment=formatText($data[0]->scale_comment'2FIELD');
  70. }
  71.  
  72. if($form_statut_scale=='P'$mask_statut_P=' checked="checked"';
  73. if($form_statut_scale=='D'$mask_statut_D=' checked="checked"';
  74. ?>
  75. <div id="chemin">
  76.     <ul>
  77.         <li>
  78.             <a href="index.php"><? echo $GLOBALS['lang']['way']['home'?></a>
  79.         </li>
  80.         <li>
  81.             <a href="<?php echo $rub_link?>"><? echo $GLOBALS['lang']['menu']['scale']?></a>
  82.         </li>
  83.         <li>
  84.             <span><? echo $GLOBALS['lang']['scale']['mod'.' : '.formatNavTitle($current_title);?></span>
  85.         </li>
  86.     </ul>
  87. </div>
  88. <!--end barre haute -->
  89. <?php
  90. include_once("quickicons.php");
  91. if($current_scale_dependencies!=0{
  92.     include_once("../lib/input_helpers.php");
  93.     // select-box des échelles
  94.     $table_exclu=$scale_object->getMaxDepth($scale_id$sql_object);
  95.     $req_mod=SQL_getMaxScalesDepth($table_exclu["depth"]$table_exclu["exclusion"]);
  96.     $data=$sql_object->DBSelect($req_mod);
  97.     $select_root=ScaleSelectBox($data"root_scale"$form_root_scale);
  98.                 
  99.     // select box statut
  100.     $select_statut="<label for=\"statut_P\" >".$GLOBALS['lang']['divers']['statut'." : *</label>\n";
  101.     $select_statut.="<input type=\"radio\" name=\"statut_scale\" id=\"statut_P\" value=\"P\"".$mask_statut_P." /><span class=\"radio\">".$GLOBALS['lang']['statut']['public']."</span>\n";
  102.     $select_statut.="<input type=\"radio\" name=\"statut_scale\" id=\"statut_D\" value=\"D\"".$mask_statut_D." /><span class=\"radio\">".$GLOBALS['lang']['statut']['draft']."</span>\n";
  103. else {
  104.     $select_root  empty_none('');
  105.     $select_root .="<input type=\"hidden\" name=\"root_scale\" value=\"0\" id=\"root_scale\" />\n";
  106.     $select_statut="<input type=\"hidden\" name=\"statut_scale\" value=\"P\" id=\"statut_scale\" />\n";
  107. }
  108.  
  109.  
  110. ?>
  111.  
  112. <?php
  113. if(!isset($integrity|| is_string($integrity)) {
  114. ?>
  115. <div class="contentcontainer">
  116. <?php
  117. include_once($dir."/menurub.php");
  118. ?>
  119.         <div id="content">
  120.             <?php
  121.             if(isset($integrity&& is_string($integrity)) display_errors($integrity);
  122.             ?>
  123.             <h2><? echo formatTitleh2($current_title)?></h2>
  124.             <form id="modscale" action="<?php echo $_SERVER['SCRIPT_NAME']?>" method="post">
  125.                 <p>
  126.                 <label for="denomination"><? echo $GLOBALS['lang']['scale']['denomination']?> : *</label>
  127.                 <input name="denomination" type="text"  id="denomination" maxlength="200" value="<?php echo $form_denomination?>" class="textfield"/>
  128.                 </p>
  129.                 <p>
  130.                 <label for="surface"><? echo $GLOBALS['lang']['scale']['surface']?> (<?php echo SURFACE_UNIT?>) :</label>
  131.                 <input name="surface" type="text"  id="surface" maxlength="8" value="<?php echo $form_surface?>" class="textfield" />
  132.                 </p>
  133.                 <p>
  134.                 <label for="population"><? echo $GLOBALS['lang']['scale']['population']?> :</label>
  135.                 <input name="population" type="text" id="population" maxlength="8" value="<?php echo $form_population?>" class="textfield" />
  136.                 </p>
  137.                 <p>
  138.                 <label for="root_scale"><?php echo $GLOBALS['lang']['scale']['root']?> : *</label>
  139.                 <?php echo $select_root?>
  140.                 </p>
  141.                 <?php /*<p>
  142.                 <?php echo $select_statut; ?>
  143.                 </p>
  144.                 */?>
  145.                 <p>
  146.                 <label for="com_scale"><? echo $GLOBALS['lang']['scale']['comment']?> : </label>
  147.                 <textarea id="com_scale" name="com_scale" class="largetextfield" <?php echo AREA_SETTINGS?> ><?php echo $form_comment?></textarea>
  148.                 <br />
  149.                 </p>
  150.                 <div>
  151.                 <input name="statut_scale" type="hidden" value="P" id="statut_P" />
  152.                 <input name="id" type="hidden" value="<?php echo $scale_id?>" id="scale_id" />
  153.                 <input name="rub" type="hidden" value="<?php echo $rub?>" id="rub" />
  154.                 <input name="todo" type="hidden" value="<?php echo $todo?>" id="todo" />
  155.                 <?php echo cancel_button('javascript:history.go(-1);')?>
  156.                 <input name="valider" type="submit" value="<? echo $GLOBALS['lang']['btn']['valid'?>" class="button" id="valider" />
  157.                 </div>
  158.             </form>
  159.         </div>
  160.         <?php include_once($dir."/help.php")?>
  161. </div>
  162. <?php
  163. // Récapitulatif
  164. else    {
  165. $display_form_surface=empty_nc($form_surface);
  166. $display_form_population=empty_nc($form_population);
  167. $display_form_comment=empty_none($form_comment);
  168.  
  169. // sélection de l'échelle racine si elle en a une (!echelle root)
  170. if($current_scale_dependencies!=0{
  171.     $requete=SQL_getonescale($_POST['root_scale']);
  172.     $data=$sql_object->DBSelect($requete);
  173.     $display_root_scale="<dt>".$GLOBALS['lang']['scale']['root']." : </dt>\n";
  174.     $display_root_scale.="<dd>".formatText($data[0]['scale_denomination']'2HTML')."<br /></dd>\n";
  175. else $display_root_scale='';
  176. $display_statut_scale=display_statut($form_statut_scale);
  177. ?>
  178. <div class="contentcontainer">
  179.         <?php
  180.         include_once($dir."/menurub.php");
  181.         ?>
  182.         <div id="content">
  183.             <h2><? echo $GLOBALS['lang']['recap']['title']?></h2>
  184.             <dl class="dl3">
  185.                 <dt><? echo $GLOBALS['lang']['scale']['denomination']?> : </dt>
  186.                 <dd><?php echo $form_denomination?><br /></dd>
  187.                 <dt><? echo $GLOBALS['lang']['scale']['surface']?> (<?php echo SURFACE_UNIT?>) :</dt>
  188.                 <dd><?php echo $display_form_surface?><br /></dd>
  189.                 <dt><? echo $GLOBALS['lang']['scale']['population']?> :</dt>
  190.                 <dd><?php echo $display_form_population?><br /></dd>
  191.                 <?php echo $display_root_scale?>
  192.                 <? /*<dt><? echo $GLOBALS['lang']['divers']['statut']; ?>: </dt>
  193.                 <dd><?php echo $display_statut_scale; ?><br /></dd> */ ?>
  194.                 <dt><? echo $GLOBALS['lang']['scale']['comment']?> : </dt>
  195.                 <dd><?php echo formatText($display_form_comment'2HTML')?><br /></dd>
  196.             </dl>
  197.             <form id="addscale" action="<?php echo $_SERVER['SCRIPT_NAME']?>" method="post">
  198.                 <div>
  199.                 <input name="id" type="hidden" value="<?php echo $scale_id?>" id="scale_id" />
  200.                 <input name="rub" type="hidden" value="<?php echo $rub?>" id="rub" />
  201.                 <input name="todo" type="hidden" value="<?php echo $todo?>" id="todo" />
  202.                 <input name="data_table" type="hidden" value="<?php echo $table?>" id="data_table" />
  203.                 <?php echo cancel_button('?rub=scale&amp;todo=list')?>
  204.                 <input name="retour" type="button" value="<? echo $GLOBALS['lang']['btn']['preview'?>" class="button" id="retour" onclick="history.go(-1);" />
  205.                 <input name="enregistrer" type="submit" value="<? echo $GLOBALS['lang']['btn']['save'?>" class="button" id="valider" />
  206.                 </div>
  207.             </form>
  208.         </div>
  209.         <?php include_once($dir."/help.php")?>
  210. </div>
  211. <?php
  212. }
  213. ?>

Documentation generated on Sat, 08 Nov 2008 14:53:30 +0100 by phpDocumentor 1.4.1