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

Documentation generated on Fri, 16 Oct 2009 09:36:54 +0200 by phpDocumentor 1.4.1