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

Source for file mod.php

Documentation is available at mod.php

  1. <?php
  2. /**
  3.  * @package linea21.modules
  4.  * @subpackage sdi
  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. include_once("../lib/input_helpers.php");
  19. if(!isset($_GET['id']&& !isset($_POST['id'])) {
  20.   $id="1";
  21. else {
  22.   if(isset($_POST['id']))    $id=$_POST['id'];
  23.   if(isset($_GET['id']))    $id=$_GET['id'];
  24. }
  25.  
  26. $link_mod_e=$rub_link."&amp;todo=mod_e&amp;id=";
  27. $link_mod_r=$rub_link."&amp;todo=mod_r&amp;id=";
  28. $link_mod_p=$rub_link."&amp;todo=mod_p&amp;id=";
  29.  
  30.  
  31. if (isset($_POST['enregistrer'])) {
  32.   $data_table unserialize(urldecode($_POST['data_table']));
  33.   $j=0;
  34.   for ($i=0;$i<14;$i++){
  35.     $data_table_sdi[$j]=$data_table[$i];
  36.     $j++;
  37.   }
  38.   $sdi_objectnew sdi;
  39.   $result=$sdi_object->ModifySdi($ID=$id$data_table_sdi$sql_object);
  40.   $link_confirm="confirm.php?rub=".$rub."&todo=".$todo."&id=".$id;
  41.   if(isset($result)) header("Location: ".$link_confirm);
  42.   else  system_error();
  43. }
  44.  
  45. $sdi_objectnew sdi;
  46. $req_sdii=SQL_getInfoSdi($id);
  47. $data_form_sdi $sql_object -> DBSelect($req_sdii);
  48. //$data_form_sdi=$sdi_object->GetInfoSdi($id, $sql_object);
  49. $form_name formatText($data_form_sdi[0]['sdii_name']'2FIELD');
  50. $form_theme =  $data_form_sdi[0]['sdii_theme'];
  51. //$form_range =  $data_form_sdi[0]['sdii_range'];
  52. $form_description =  formatText($data_form_sdi[0]['sdii_description']'2FIELD');
  53. $form_comment =  formatText($data_form_sdi[0]['sdii_comment']'2FIELD');
  54. $form_goal =  formatText($data_form_sdi[0]['sdii_goal']'2FIELD');
  55. $form_consulting formatText($data_form_sdi[0]['sdii_consulting']'2FIELD');
  56. $form_unit =  formatText($data_form_sdi[0]['sdii_unit']'2FIELD');
  57. $form_max_value =  $data_form_sdi[0]['sdii_max_value'];
  58. $form_min_value =  $data_form_sdi[0]['sdii_min_value'];
  59. $form_threshold_value $data_form_sdi[0]['sdii_threshold_value'];
  60. $form_frequency $data_form_sdi[0]['sdii_frequency'];
  61. $form_threshold_relative=$data_form_sdi[0]['sdii_threshold_relative'];
  62. if($data_form_sdi[0]['sdii_statut']=='D'$mask_statut_D="checked=\"checked\""else $mask_statut_D='';
  63. if($data_form_sdi[0]['sdii_statut']=='P'$mask_statut_P="checked=\"checked\""else $mask_statut_P='';
  64.  
  65.  
  66. if (isset($_POST['valider1'])) {
  67.  
  68.   $table[0$_POST['sdi_name'];
  69.   $table[1$_POST['description'];
  70.   $table[2$_POST['comment'];
  71.   $table[3$_POST['sdi_theme'];
  72.   //$table[4] = $_POST['range'];
  73.   $table[40;
  74.   $table[5$_POST['goal'];
  75.   $table[6$_POST['consulting'];
  76.   $table[7$_POST['unit'];
  77.   $table[8$_POST['max_value'];
  78.   $table[9$_POST['min_value'];
  79.   $table[10]$_POST['threshold_value'];
  80.   $table[11]$_POST['frequency'];
  81.   $table[12]$_POST['sdi_statut'];
  82.  
  83.   if (isset($_POST['threshold_relative'])) {
  84.     $table[13]="Y";
  85.   }
  86.   else $table[13]="N";
  87.  
  88.   $sdi_object new sdi;
  89.   $integrity $sdi_object -> CheckDataIntegrity_info($table);
  90.  
  91.   $form_name formatText($_POST['sdi_name']'2FIELD');
  92.   $form_theme $_POST['sdi_theme'];
  93.   $form_statut =$_POST['sdi_statut'];
  94.   //$form_range = $_POST['range'];
  95.   $form_description formatText($_POST['description']'2FIELD');
  96.   $form_comment formatText($_POST['comment']'2FIELD');
  97.   $form_goal formatText($_POST['goal']'2FIELD');
  98.   $form_consulting formatText($_POST['consulting']'2FIELD');
  99.   $form_unit formatText($_POST['unit']'2FIELD');
  100.   $form_max_value $_POST['max_value'];
  101.   $form_min_value $_POST['min_value'];
  102.   $form_threshold_value $_POST['threshold_value'];
  103.   $form_threshold_relative=$table[13];
  104.   $form_frequency $_POST['frequency'];
  105.   $table urlencode(serialize($table));
  106.   if($form_statut=='D'$mask_statut_D="checked=\"checked\""else $mask_statut_D='';
  107.   if($form_statut=='P'$mask_statut_P="checked=\"checked\""else $mask_statut_P='';
  108.  
  109. }
  110.  
  111. include_once(THEME_ADMIN_PATH."quickicons.php");
  112.  
  113. $data $sql_object -> DBSelect($req_list_theme);
  114. $select_theme=ThemeSelectBox($data"sdi_theme"$form_theme);
  115.  
  116. $req_list_sdiname=SQL_getOnesdiname($id);
  117. $data_sdi_name $sql_object -> DBSelect($req_list_sdiname);
  118. $navtitle=_t('sdi','mod_e')." : ".$data_sdi_name[0]['sdii_name'];
  119. ?>
  120. <div id="chemin">
  121.   <ul>
  122.       <li><a href="index.php" class="chemin_home"><?php echo _t('way','home'?></a></li>
  123.       <li><a href="<?php echo $rub_link?>" id="chemin_<?php echo $rub?>" class="chemin_rub"><?php echo _t('menu','sdi')?></a></li>
  124.       <li><span><?php echo formatnavTitle($navtitle?></span></li>
  125.   </ul>
  126. </div>
  127. <?php
  128. if (!isset($integrity|| is_string($integrity)) {
  129. ?>
  130. <div class="contentcontainer">
  131. <?php
  132. include_once($dir "/menurub.php");
  133. ?>
  134. <div id="content">
  135. <?php
  136. if (isset($integrity&& is_string($integrity)) display_errors($integrity);
  137. ?>
  138. <div class="mod_link">
  139. <a href="<?php echo $link_mod_e.$id ;?>"><?echo _t('sdi','modify_sdi_e');?></a>
  140. | <a href="<?php echo $link_mod_p.$id ;?>"><?echo _t('sdi','modify_sdi_p');?></a>
  141. | <a href="<?php echo $link_mod_r.$id ;?>"><?echo _t('sdi','modify_sdi_r');?></a>
  142. </div>
  143. <br class="brendstep" />
  144. <h2><?php echo formatTitleh2($data_sdi_name[0]['sdii_name'])?></h2>
  145.  
  146. <form id="addsdi" action="<?php echo $_SERVER['SCRIPT_NAME']?>" method="post">
  147. <p>
  148.     <label for="sdi_name"><?php echo _t('sdi','name2'?> * :</label>
  149.     <input name="sdi_name" type="text" class="textfield" id="sdi_name" maxlength="255" value="<?php echo $form_name?>" />
  150. </p>
  151. <p>
  152.     <label for="sdi_theme"><?php echo _t('sdi','theme'?> * : </label>
  153.     <?php echo $select_theme?>
  154. </p>
  155. <div class="label"><?php echo _t('divers','statut')?> * : </div>
  156. <div class="rightpanel">
  157.     <input name="sdi_statut" type="radio" id="statut_P" value="P" <?php echo $mask_statut_P?> />
  158.     <label for="statut_P"><?php echo _t('statut','public')?></label>
  159.     <input name="sdi_statut" type="radio" id="statut_D" value="D" <?php echo $mask_statut_D?> />
  160.     <label for="statut_D"><?php echo _t('statut','draft')?></label>
  161. </div>
  162.  
  163. <?php 
  164. /** <p>
  165. <label for="range" ><?php echo _t('sdi','range') ?> * :</label>
  166. <input name="range" type="text" class="textfield" id="range" maxlength="150" value="<?php echo $form_range;
  167. ?>" />
  168. </p> */ 
  169. ?>
  170. <p>
  171.     <label for="description"><?php echo _t('sdi','description'?> * :</label>
  172.     <textarea id="description" name="description" <?php echo AREA_SETTINGS?> class="largetextfield"><?php echo $form_description?></textarea>
  173. </p>
  174. <p>
  175.     <label for="comment"><?php echo _t('sdi','comment'?> :</label>
  176.     <textarea id="comment" name="comment" <?php echo AREA_SETTINGS?> class="largetextfield"><?php echo $form_comment?></textarea>
  177. </p>
  178. <p>
  179.     <label for="goal"><?php echo _t('sdi','goal'?> :</label>
  180.     <textarea id="goal" name="goal" <?php echo AREA_SETTINGS?> class="largetextfield"><?php echo $form_goal?></textarea>
  181. </p>
  182. <p>
  183.     <label for="consulting"><?php echo _t('sdi','consulting'?> :</label>
  184.     <textarea id="consulting" name="consulting" <?php echo AREA_SETTINGS?> class="largetextfield"><?php echo $form_consulting?></textarea>
  185. </p>
  186.  
  187.  
  188. <h3 class="part"><?php echo _t('sdi','info_mesure')?></h3>
  189.  
  190. <p>
  191.     <label for="unit"><?php echo _t('sdi','unit'?> * :</label>
  192.     <input name="unit" type="text" class="textfield" id="unit" maxlength="100" value="<?php echo $form_unit?>" />
  193. </p>
  194. <p>
  195.     <label for="max_value"><?php echo _t('sdi','max_value'?> * :</label>
  196.     <input name="max_value" type="text" class="textfield" id="max_value" maxlength="6" value="<?php echo $form_max_value?>" />
  197. </p>
  198. <p>
  199.     <label for="min_value"><?php echo _t('sdi','min_value'?> * :</label>
  200.     <input name="min_value" type="text" class="textfield" id="min_value" maxlength="100" value="<?php echo $form_min_value?>" />
  201. </p>
  202. <p>
  203.     <label for="threshold_value"><?php echo _t('sdi','threshold_value'?> * :</label>
  204.     <input name="threshold_value" type="text" class="textfield" id="threshold_value" maxlength="100" value="<?php echo $form_threshold_value?>" />
  205. </p>
  206. <p>
  207.     <label for="frequency"><?php echo _t('sdi','frequency'?> * :</label>
  208.     <input name="frequency" type="text" class="textfield" id="frequency" maxlength="11" value="<?php echo $form_frequency?>" />
  209. </p>
  210. <div class="label"><?php echo _t('sdi','threshold_relative'?> * :</div>
  211. <div class="rightpanel">
  212.     <input type="checkbox" name="threshold_relative" id="threshold_relative" <?php if ($form_threshold_relative=='Y'echo " checked=\"checked\"" ?> />
  213.   <label for="threshold_relative"><?php echo _t('sdi','threshold_relative_comment'?></label>
  214. </div>
  215.  
  216. <div>
  217.   <input name="id" type="hidden" value="<?php echo $id?>" id="id" />
  218.   <?php echo cancel_button($rub_link."&amp;todo=det&amp;id=".$id)?>
  219.   <input name="rub" type="hidden" value="<?php echo $rub?>" id="rub" />
  220.   <input name="todo" type="hidden" value="<?php echo $todo?>" id="todo" />
  221.   <input name="valider1" type="submit" value="<?php echo _t('btn','valid'?>" class="button" id="valider" />
  222. </div>
  223. </form>
  224. </div>
  225. <?php include_once($dir "/help.php");
  226. ?>
  227. </div>
  228. <?php
  229.             // Récapitulatif
  230. else {
  231.   if (!isset($integrity5|| is_string($integrity5)) {
  232.  
  233.  
  234.     $table=unserialize(urldecode($table));
  235.  
  236.     $display_sdi_name formatText(empty_nc($table[0])'2HTML');
  237.     $display_sdi_description =formatText(empty_nc($table[1])'2HTML');
  238.     $display_sdi_comment =formatText(empty_nc($table[2])'2HTML');
  239.     //$display_sdi_range = empty_nc($table[4]);
  240.     $display_sdi_goal formatText(empty_nc($table[5])'2HTML');
  241.     $display_sdi_consulting formatText(empty_nc($table[6])'2HTML');
  242.     $display_sdi_unit formatText(empty_nc($table[7])'2HTML');
  243.     $display_sdi_max_value empty_nc($table[8]);
  244.     $display_sdi_min_value empty_nc($table[9]);
  245.     $display_sdi_threshold_value empty_nc($table[10]);
  246.     $display_sdi_frequency empty_nc($table[11]);
  247.     $display_sdi_statut empty_nc($table[12]);
  248.     $onetheme SQL_getOnesditheme($table[3]);
  249.     $onetheme $sql_object -> DBSelect($onetheme);
  250.     $display_sdi_theme formatText($onetheme[0]['theme_name']'2HTML');
  251.  
  252.     if ($table[13]=='Y'$display_sdi_threshold_relative _t('sdi','threshold_relative_Y');
  253.     else $display_sdi_threshold_relative _t('sdi','threshold_relative_N');
  254.         
  255.     $table urlencode(serialize($table));
  256.  
  257.     ?>
  258. <div class="contentcontainer"><?php
  259. include_once($dir "/menurub.php");
  260.  
  261. ?>
  262. <div id="content">
  263. <h2><?php echo _t('recap','title')?></h2>
  264. <dl class="dl3">
  265.     <dt><?php echo _t('sdi','name2')?> :</dt>
  266.     <dd><?php echo $display_sdi_name?></dd>
  267.     <dt><?php echo _t('divers','statut')?> :</dt>
  268.     <dd><?php echo display_statut($display_sdi_statut)?></dd>
  269.     <dt><?php echo _t('sdi','theme')?> :</dt>
  270.     <dd><?php echo $display_sdi_theme?></dd>
  271.     <?php /*<dt><?php echo _t('sdi','range');     ?> :</dt>
  272.     <dd><?php echo $display_sdi_range; ?><br /></dd> */ ?>
  273.     <dt><?php echo _t('sdi','description')?> :</dt>
  274.     <dd><?php echo $display_sdi_description?></dd>
  275.     <dt><?php echo _t('sdi','comment')?> :</dt>
  276.     <dd><?php echo $display_sdi_comment?></dd>
  277.     <dt><?php echo _t('sdi','goal')?> :</dt>
  278.     <dd><?php echo $display_sdi_goal?></dd>
  279.     <dt><?php echo _t('sdi','consulting')?> :</dt>
  280.     <dd><?php echo $display_sdi_consulting?></dd>
  281. </dl>
  282. <h3 class="part"><?php echo _t('sdi','info_mesure')?></h3>
  283. <dl class="dl3">
  284.     <dt><?php echo _t('sdi','unit')?> :</dt>
  285.     <dd><?php echo $display_sdi_unit?></dd>
  286.     <dt><?php echo _t('sdi','max_value')?> :</dt>
  287.     <dd><?php echo $display_sdi_max_value?></dd>
  288.     <dt><?php echo _t('sdi','min_value')?> :</dt>
  289.     <dd><?php echo $display_sdi_min_value;    ?></dd>
  290.     <dt><?php echo _t('sdi','threshold_value');    ?> :</dt>
  291.     <dd><?php echo $display_sdi_threshold_value?></dd>
  292.     <dt><?php echo _t('sdi','threshold_relative');    ?> :</dt>
  293.     <dd><?php echo $display_sdi_threshold_relative;    ?></dd>
  294.     <dt><?php echo _t('sdi','frequency')?> :</dt>
  295.     <dd><?php echo $display_sdi_frequency;    ?></dd>
  296. </dl>
  297. <form id="addsdi5" action="<?php echo $_SERVER['SCRIPT_NAME']?>" method="post">
  298.   <div>
  299.     <input name="rub" type="hidden" value="<?php echo $rub?>" id="rub" />
  300.     <input name="todo" type="hidden" value="<?php echo $todo?>" id="todo" />
  301.     <input name="id" type="hidden" value="<?php echo $id?>" id="id" />
  302.     <?php echo cancel_button($rub_link."&amp;todo=det&amp;id=".$id)?>
  303.     <input name="data_table" type="hidden" value="<?php echo $table?>" id="data_table" />
  304.     <input name="retour" type="button" value="<?php echo _t('btn','preview'?>" class="button" id="retour" onclick="history.go(-1);" />
  305.     <input name="enregistrer" type="submit" value="<?php echo _t('btn','save'?>" class="button" id="valider" />
  306.   </div>
  307. </form>
  308. </div>
  309. <?php include_once($dir "/help.php");
  310. ?>
  311. </div>
  312. <?php
  313.   }
  314. }
  315. ?>

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