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_object= new 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_object= new 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[4] = 0;
  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>
  123.             <a href="index.php" class="chemin_home"><?php echo _t('way','home') ?></a>
  124.         </li>
  125.         <li>
  126.             <a href="<?php echo $rub_link;
  127. ?>"  id="chemin_<? echo $rub; ?>" class="chemin_rub"><?php echo _t('menu','sdi')?></a>
  128.         </li>
  129.         <li>
  130.             <span><?php echo formatnavTitle($navtitle) ?></span>
  131.         </li>
  132.     </ul>
  133. </div>
  134. <?php
  135. if (!isset($integrity) || is_string($integrity)) {
  136.  
  137.     ?>
  138. <div class="contentcontainer">
  139.         <?php
  140.     include_once($dir . "/menurub.php");
  141.  
  142.     ?>
  143.         <div id="content">
  144.             <?php
  145.     if (isset($integrity) && is_string($integrity)) display_errors($integrity);
  146.  
  147.     ?>
  148.     <div class="mod_link">
  149.     <a href="<? echo $link_mod_e.$id ;?>"><?echo _t('sdi','modify_sdi_e');?></a> | 
  150.     <a href="<? echo $link_mod_p.$id ;?>"><?echo _t('sdi','modify_sdi_p');?></a> | 
  151.     <a href="<? echo $link_mod_r.$id ;?>"><?echo _t('sdi','modify_sdi_r');?></a>
  152.     </div>
  153.             <br class="brendstep" /><h2><?php echo formatTitleh2($data_sdi_name[0]['sdii_name']); ?></h2>
  154.             
  155.             <form id="addsdi" action="<?php echo $_SERVER['SCRIPT_NAME'];
  156.     ?>" method="post">
  157.                 <p>
  158.                 <label for="sdi_name" ><?php echo _t('sdi','name2') ?> * :</label>
  159.                 <input name="sdi_name" type="text" class="textfield" id="sdi_name" maxlength="255" value="<?php echo $form_name;
  160.     ?>" />
  161.                 </p>
  162.                 <p>
  163.                 <label for="sdi_theme" ><?php echo _t('sdi','theme') ?> * : </label>
  164.                 <?php echo $select_theme;
  165.     ?>
  166.                 </p>
  167.                 <p>
  168.                 <label for="statut_P"><? echo _t('divers','statut'); ?> * : </label>
  169.                 <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>
  170.                 <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>
  171.                 <br />
  172.                 </p>
  173.                 <?php /* <p>
  174.                 <label for="range" ><?php echo _t('sdi','range') ?> * :</label>
  175.                 <input name="range" type="text" class="textfield" id="range" maxlength="150" value="<?php echo $form_range;
  176.     ?>" />
  177.                 </p> */ ?>
  178.                 <p>
  179.                 <label for="description" ><?php echo _t('sdi','description') ?> * :</label>
  180.                 <textarea id="description" name="description" <?php echo AREA_SETTINGS; ?> class="largetextfield" ><?php echo $form_description;
  181.     ?></textarea>
  182.                 </p>
  183.                 <p>
  184.                 <label for="comment" ><?php echo _t('sdi','comment') ?>  :</label>
  185.                 <textarea id="comment" name="comment" <?php echo AREA_SETTINGS; ?> class="largetextfield" ><?php echo $form_comment;
  186.     ?></textarea>
  187.                 </p>
  188.                 <p>
  189.                 <label for="goal" ><?php echo _t('sdi','goal') ?>  :</label>
  190.                 <textarea id="goal" name="goal" <?php echo AREA_SETTINGS; ?> class="largetextfield" ><?php echo $form_goal;
  191.     ?></textarea>
  192.                 </p>
  193.                 <p>
  194.                 <label for="consulting" ><?php echo _t('sdi','consulting') ?>  :</label>
  195.                 <textarea id="consulting" name="consulting" <?php echo AREA_SETTINGS; ?> class="largetextfield" ><?php echo $form_consulting;
  196.     ?></textarea>
  197.                 </p>
  198.  
  199.                 
  200.                 <p>
  201.                 <? echo _t('sdi','info_mesure'); ?>
  202.                 </p>
  203.  
  204.                 <p>
  205.                 <label for="unit" ><?php echo _t('sdi','unit') ?> * :</label>
  206.                 <input name="unit" type="text" class="textfield" id="unit" maxlength="100" value="<?php echo $form_unit;
  207.     ?>" />
  208.                 </p>
  209.                 <p>
  210.                 <label for="max_value" ><?php echo _t('sdi','max_value') ?> * :</label>
  211.                 <input name="max_value" type="text" class="textfield" id="max_value" maxlength="6" value="<?php echo $form_max_value;
  212.     ?>" />
  213.                 </p>
  214.                 <p>
  215.                 <label for="min_value" ><?php echo _t('sdi','min_value') ?> * :</label>
  216.                 <input name="min_value" type="text" class="textfield" id="min_value" maxlength="100" value="<?php echo $form_min_value;
  217.     ?>" />
  218.                 </p>
  219.                 <p>
  220.                 <label for="threshold_value" ><?php echo _t('sdi','threshold_value') ?> * :</label>
  221.                 <input name="threshold_value" type="text" class="textfield" id="threshold_value" maxlength="100" value="<?php echo $form_threshold_value;
  222.     ?>" />
  223.                 </p>
  224.                 <p>
  225.                 <label for="frequency" ><?php echo _t('sdi','frequency') ?> * :</label>
  226.                 <input name="frequency" type="text" class="textfield" id="frequency" maxlength="11" value="<?php echo $form_frequency;
  227.     ?>" />
  228.                 </p>
  229.                 <p>
  230.                 <label for="threshold_relative" ><?php echo _t('sdi','threshold_relative') ?> * :</label>
  231.                 <input type="checkbox" name="threshold_relative" id="threshold_relative"<? if ($form_threshold_relative=='Y') echo " checked=\"checked\"" ?> />
  232.                 </p>
  233.                 <div class="chekbox"><?php echo _t('sdi','threshold_relative_comment') ?></div>
  234.                 <div>
  235.                 <br />
  236.                 <input name="id" type="hidden" value="<?php echo $id;
  237.             ?>" id="id" />
  238.             <br />
  239.                 <? echo cancel_button($rub_link."&amp;todo=det&amp;id=".$id); ?>
  240.                 <input name="rub" type="hidden" value="<?php echo $rub; ?>" id="rub" />
  241.                 <input name="todo" type="hidden" value="<?php echo $todo; ?>" id="todo" />
  242.                 <input name="valider1" type="submit" value="<?php echo _t('btn','valid') ?>" class="button" id="valider" />
  243.                 </div>
  244.             </form>
  245.         </div>
  246. <?php include_once($dir . "/help.php");
  247.     ?>
  248. </div>
  249. <?php 
  250.     // Récapitulatif
  251. } else {
  252.                 if (!isset($integrity5) || is_string($integrity5)) {
  253.                 
  254.                 
  255.                     $table=unserialize(urldecode($table));
  256.                     
  257.                     $display_sdi_name = formatText(empty_nc($table[0]), '2HTML');
  258.                     $display_sdi_description =formatText(empty_nc($table[1]), '2HTML');
  259.                     $display_sdi_comment =formatText(empty_nc($table[2]), '2HTML');
  260.                     //$display_sdi_range = empty_nc($table[4]);               
  261.                     $display_sdi_goal = formatText(empty_nc($table[5]), '2HTML');
  262.                     $display_sdi_consulting = formatText(empty_nc($table[6]), '2HTML');
  263.                     $display_sdi_unit = formatText(empty_nc($table[7]), '2HTML');
  264.                     $display_sdi_max_value = empty_nc($table[8]);
  265.                     $display_sdi_min_value = empty_nc($table[9]);
  266.                     $display_sdi_threshold_value = empty_nc($table[10]);
  267.                     $display_sdi_frequency = empty_nc($table[11]);
  268.                     $display_sdi_statut = empty_nc($table[12]);
  269.                     $onetheme = SQL_getOnesditheme($table[3]);
  270.                     $onetheme = $sql_object -> DBSelect($onetheme);
  271.                     $display_sdi_theme = formatText($onetheme[0]['theme_name'], '2HTML');
  272.  
  273.                     if ($table[13]=='Y') $display_sdi_threshold_relative = _t('sdi','threshold_relative_Y');
  274.                     else $display_sdi_threshold_relative = _t('sdi','threshold_relative_N');
  275.                     
  276.                     $table = urlencode(serialize($table));
  277.  
  278.                     ?>
  279. <div class="contentcontainer">
  280. <?php
  281.                     include_once($dir . "/menurub.php");
  282.  
  283.                     ?>
  284. <div id="content">
  285.             <h2><?php echo _t('recap','title') ;
  286.                     ?></h2>
  287.             <dl class="dl3">
  288.                 <dt><?php echo _t('sdi','name2') ;
  289.                     ?> : </dt>
  290.                 <dd><?php echo $display_sdi_name ;
  291.                     ?><br /></dd>
  292.                 <dt><?php echo _t('divers','statut') ;
  293.                     ?> :</dt>
  294.                 <dd><?php echo display_statut($display_sdi_statut) ;
  295.                     ?><br /></dd>
  296.                 <dt><?php echo _t('sdi','theme') ;
  297.                     ?> :</dt>
  298.                 <dd><?php echo $display_sdi_theme ;
  299.                     ?><br /></dd>
  300.                 <?php /*<dt><?php echo _t('sdi','range') ;
  301.                     ?> :</dt>
  302.                 <dd><?php echo $display_sdi_range ;
  303.                     ?><br /></dd> */ ?>
  304.                 <dt><?php echo _t('sdi','description') ;
  305.                     ?> : </dt>
  306.                 <dd><?php echo $display_sdi_description ;
  307.                     ?><br /></dd>
  308.                 <dt><?php echo _t('sdi','comment') ;
  309.                     ?> : </dt>
  310.                 <dd><?php echo $display_sdi_comment ;
  311.                     ?><br /></dd>
  312.                 <dt><?php echo _t('sdi','goal') ;
  313.                     ?> : </dt>
  314.                 <dd><?php echo $display_sdi_goal ;
  315.                     ?><br /></dd>
  316.                 <dt><?php echo _t('sdi','consulting') ;
  317.                     ?> : </dt>
  318.                 <dd><?php echo $display_sdi_consulting ;
  319.                     ?><br /></dd>
  320.                 <dt><?php echo _t('sdi','unit') ;
  321.                     ?> : </dt>
  322.                 <dd><?php echo $display_sdi_unit ;
  323.                     ?><br /></dd>
  324.                 <dt><?php echo _t('sdi','max_value') ;
  325.                     ?> : </dt>
  326.                 <dd><?php echo $display_sdi_max_value ;
  327.                     ?><br /></dd>
  328.                 <dt><?php echo _t('sdi','min_value') ;
  329.                     ?> : </dt>
  330.                 <dd><?php echo $display_sdi_min_value ;
  331.                     ?><br /></dd>
  332.                 <dt><?php echo _t('sdi','threshold_value') ;
  333.                     ?> : </dt>
  334.                 <dd><?php echo $display_sdi_threshold_value ;
  335.                     ?><br /></dd>
  336.                 <dt><?php echo _t('sdi','threshold_relative') ;
  337.                     ?> : </dt>
  338.                 <dd><?php echo $display_sdi_threshold_relative ;
  339.                     ?><br /></dd>    
  340.                 <dt><?php echo _t('sdi','frequency') ;
  341.                     ?> : </dt>
  342.                 <dd><?php echo $display_sdi_frequency ;
  343.                     ?><br /></dd>
  344.             </dl>
  345.             <form id="addsdi5" action="<?php echo $_SERVER['SCRIPT_NAME'];
  346.                     ?>" method="post">
  347.                 <div>
  348.                 <input name="rub" type="hidden" value="<?php echo $rub;
  349.                     ?>" id="rub" />
  350.                 <input name="todo" type="hidden" value="<?php echo $todo;
  351.                     ?>" id="todo" />
  352.                     <input name="id" type="hidden" value="<?php echo $id;
  353.             ?>" id="id" />
  354.             <br />
  355.                 <? echo cancel_button($rub_link."&amp;todo=det&amp;id=".$id); ?>
  356.                 
  357.                 <input name="data_table" type="hidden" value="<?php echo $table;
  358.                     ?>" id="data_table" />
  359.                 <input name="retour" type="button" value="<?php echo _t('btn','preview') ?>" class="button" id="retour" onclick="history.go(-1);" />
  360.                 <input name="enregistrer" type="submit" value="<?php echo _t('btn','save') ?>" class="button" id="valider" />
  361.                 </div>
  362.             </form>
  363.         </div>
  364.     <?php include_once($dir . "/help.php");
  365.                     ?>
  366. </div>
  367. <?php
  368.                 } 
  369.             }
  370. ?>

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