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><a href="index.php" class="chemin_home"><?php echo _t('way','home'?></a>
  78.     </li>
  79.     <li><a href="<?php echo $rub_link?>" id="chemin_<?php echo $rub?>"
  80.         class="chemin_rub"><?php echo _t('menu','scale')?></a></li>
  81.     <li><span><?php echo _t('scale','mod'.' : '.formatNavTitle($current_title);?></span>
  82.     </li>
  83. </ul>
  84. </div>
  85. <!--end barre haute -->
  86. <?php
  87. include_once(THEME_ADMIN_PATH."quickicons.php");
  88. if($current_scale_dependencies!=0{
  89.   include_once("../lib/input_helpers.php");
  90.   // select-box des échelles
  91.   $table_exclu=$scale_object->getMaxDepth($scale_id$sql_object);
  92.   $req_mod=SQL_getMaxScalesDepth($table_exclu["depth"]$table_exclu["exclusion"]);
  93.   $data=$sql_object->DBSelect($req_mod);
  94.   $select_root=ScaleSelectBox($data"root_scale"$form_root_scale);
  95.  
  96.   // select box statut
  97.   $select_statut="<label for=\"statut_P\" >"._t('divers','statut'." : *</label>\n";
  98.   $select_statut.="<input type=\"radio\" name=\"statut_scale\" id=\"statut_P\" value=\"P\"".$mask_statut_P." /><span class=\"radio\">"._t('statut','public')."</span>\n";
  99.   $select_statut.="<input type=\"radio\" name=\"statut_scale\" id=\"statut_D\" value=\"D\"".$mask_statut_D." /><span class=\"radio\">"._t('statut','draft')."</span>\n";
  100. else {
  101.   $select_root  empty_none('');
  102.   $select_root .="<input type=\"hidden\" name=\"root_scale\" value=\"0\" id=\"root_scale\" />\n";
  103.   $select_statut="<input type=\"hidden\" name=\"statut_scale\" value=\"P\" id=\"statut_scale\" />\n";
  104. }
  105.  
  106.  
  107. ?>
  108.  
  109. <?php
  110. if(!isset($integrity|| is_string($integrity)) {
  111.   ?>
  112. <div class="contentcontainer"><?php
  113. include_once($dir."/menurub.php");
  114. ?>
  115. <div id="content"><?php
  116. if(isset($integrity&& is_string($integrity)) display_errors($integrity);
  117. ?>
  118. <h2><?php echo formatTitleh2($current_title)?></h2>
  119. <form id="modscale" action="<?php echo $_SERVER['SCRIPT_NAME']?>"
  120.     method="post">
  121. <p><label for="denomination"><?php echo _t('scale','denomination')?> :
  122. *</label> <input name="denomination" type="text" id="denomination"
  123.     maxlength="200" value="<?php echo $form_denomination?>"
  124.     class="textfield" /></p>
  125. <p><label for="surface"><?php echo _t('scale','surface')?> (<?php echo SURFACE_UNIT?>)
  126. :</label> <input name="surface" type="text" id="surface" maxlength="8"
  127.     value="<?php echo $form_surface?>" class="textfield" /></p>
  128. <p><label for="population"><?php echo _t('scale','population')?> :</label>
  129. <input name="population" type="text" id="population" maxlength="8"
  130.     value="<?php echo $form_population?>" class="textfield" /></p>
  131. <p><label for="root_scale"><?php echo _t('scale','root')?> : *</label>
  132. <?php echo $select_root?></p>
  133. <?php /*<p>
  134. <?php echo $select_statut; ?>
  135. </p>
  136. */?>
  137. <p><label for="com_scale"><?php echo _t('scale','comment')?> : </label>
  138. <textarea id="com_scale" name="com_scale" class="largetextfield"
  139. <?php echo AREA_SETTINGS?>><?php echo $form_comment?></textarea> <br />
  140. </p>
  141. <div><input name="statut_scale" type="hidden" value="P" id="statut_P" />
  142. <input name="id" type="hidden" value="<?php echo $scale_id?>"
  143.     id="scale_id" /> <input name="rub" type="hidden"
  144.     value="<?php echo $rub?>" id="rub" /> <input name="todo"
  145.     type="hidden" value="<?php echo $todo?>" id="todo" /> <?php echo cancel_button('javascript:history.go(-1);')?>
  146. <input name="valider" type="submit"
  147.     value="<?php echo _t('btn','valid'?>" class="button" id="valider" />
  148. </div>
  149. </form>
  150. </div>
  151. <?php include_once($dir."/help.php")?></div>
  152. <?php
  153. // Récapitulatif
  154. else    {
  155.   $display_form_surface=empty_nc($form_surface);
  156.   $display_form_population=empty_nc($form_population);
  157.   $display_form_comment=empty_none($form_comment);
  158.  
  159.   // sélection de l'échelle racine si elle en a une (!echelle root)
  160.   if($current_scale_dependencies!=0{
  161.     $requete=SQL_getonescale($_POST['root_scale']);
  162.     $data=$sql_object->DBSelect($requete);
  163.     $display_root_scale="<dt>"._t('scale','root')." : </dt>\n";
  164.     $display_root_scale.="<dd>".formatText($data[0]['scale_denomination']'2HTML')."<br /></dd>\n";
  165.   else $display_root_scale='';
  166.   $display_statut_scale=display_statut($form_statut_scale);
  167.   ?>
  168. <div class="contentcontainer"><?php
  169. include_once($dir."/menurub.php");
  170. ?>
  171. <div id="content">
  172. <h2><?php echo _t('recap','title')?></h2>
  173. <dl class="dl3">
  174.     <dt><?php echo _t('scale','denomination')?> :</dt>
  175.     <dd><?php echo $form_denomination?><br />
  176.     </dd>
  177.     <dt><?php echo _t('scale','surface')?> (<?php echo SURFACE_UNIT?>)
  178.     :</dt>
  179.     <dd><?php echo $display_form_surface?><br />
  180.     </dd>
  181.     <dt><?php echo _t('scale','population')?> :</dt>
  182.     <dd><?php echo $display_form_population?><br />
  183.     </dd>
  184.     <?php echo $display_root_scale?>
  185.     <?php /*<dt><?php echo _t('divers','statut'); ?>: </dt>
  186.     <dd><?php echo $display_statut_scale; ?><br /></dd> */ ?>
  187.     <dt><?php echo _t('scale','comment')?> :</dt>
  188.     <dd><?php echo formatText($display_form_comment'2HTML')?><br />
  189.     </dd>
  190. </dl>
  191. <form id="addscale" action="<?php echo $_SERVER['SCRIPT_NAME']?>"
  192.     method="post">
  193. <div><input name="id" type="hidden" value="<?php echo $scale_id?>"
  194.     id="scale_id" /> <input name="rub" type="hidden"
  195.     value="<?php echo $rub?>" id="rub" /> <input name="todo"
  196.     type="hidden" value="<?php echo $todo?>" id="todo" /> <input
  197.     name="data_table" type="hidden" value="<?php echo $table?>"
  198.     id="data_table" /> <?php echo cancel_button('?rub=scale&amp;todo=list')?>
  199. <input name="retour" type="button"
  200.     value="<?php echo _t('btn','preview'?>" class="button" id="retour"
  201.     onclick="history.go(-1);" /> <input name="enregistrer" type="submit"
  202.     value="<?php echo _t('btn','save'?>" class="button" id="valider" /></div>
  203. </form>
  204. </div>
  205.     <?php include_once($dir."/help.php")?></div>
  206.     <?php
  207. }
  208. ?>

Documentation generated on Thu, 03 May 2012 15:06:31 +0200 by phpDocumentor 1.4.1