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 dashboard
  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['value_id']) && !isset($_POST['value_id'])) {
  20.     $value_id = 1;
  21. } else {
  22.     if (isset($_POST['value_id'])) $value_id = $_POST['value_id'];
  23.     if (isset($_GET['value_id'])) $value_id = $_GET['value_id'];
  24. } 
  25. if (!isset($_GET['id']) && !isset($_POST['id'])) {
  26.     $id = 1;
  27. } else {
  28.     if (isset($_POST['id'])) $id = $_POST['id'];
  29.     if (isset($_GET['id'])) $id = $_GET['id'];
  30. } 
  31. if (!isset($_GET['scale_id']) && !isset($_POST['scale_id'])) {
  32.     $scale_id = 1;
  33. } else {
  34.     if (isset($_POST['scale_id'])) $scale_id = $_POST['scale_id'];
  35.     if (isset($_GET['id'])) $scale_id = $_GET['scale_id'];
  36. } 
  37.  
  38. $sdi_object = new sdi;
  39. $req_sdiov=SQL_getOneValue($value_id);    
  40. $result_value = $sql_object -> DBSelect($req_sdiov);
  41. //$result_value = $sdi_object -> GetOneValue($value_id, $sql_object);
  42.  
  43. $link_mod_sdi = "index.php?&amp;rub=sdi&amp;todo=det&amp;id=";
  44. $link_cancel=$rub_link."&amp;todo=det&amp;id=".$id."&amp;scale_id=".$scale_id;
  45.  
  46. if (isset($_POST['enregistrer'])) {
  47.     $data_table = unserialize(urldecode($_POST['data_table']));
  48.     $sdi_object = new sdi;
  49.     $result = $sdi_object -> ModifyValue($value_id, $data_table, $sql_object);
  50.     $link_confirm="confirm.php?rub=".$rub."&todo=".$todo."&id=".$id."&scale_id=".$scale_id;
  51.     if (isset($result)) header("Location: " . $link_confirm);
  52.     else system_error();
  53. } 
  54. $form_value = $result_value[0]['sdiv_value'];
  55. $form_sdi_id = $id;
  56. $form_scale_id = $scale_id;
  57. $form_date = $result_value[0]['date_p'];
  58. $form_statut = $result_value[0]['sdiv_statut'];
  59. if($form_statut=='D') $mask_statut_D="checked=\"checked\""; else $mask_statut_D='';
  60. if($form_statut=='P') $mask_statut_P="checked=\"checked\""; else $mask_statut_P='';
  61.  
  62. if (isset($_POST['valider1'])) {
  63.  
  64.     $table[0] = $_POST['value'];
  65.     $table[1] = $_POST['id'];
  66.     $table[2] = $_POST['scale'];
  67.     $table[3] = $_POST['date'];
  68.     $table[4] = $_POST['statut'];
  69.  
  70.     $sdi_object = new sdi;
  71.     $integrity = $sdi_object -> CheckDataIntegrity_value($table, $sql_object);
  72.  
  73.     $form_value = $_POST['value'];
  74.     $form_sdi_id = $_POST['id'];
  75.     $form_scale_id = $_POST['scale'];
  76.     $form_date = $_POST['date'];
  77.     $form_statut = $_POST['statut'];
  78.     if($form_statut=='D') $mask_statut_D="checked=\"checked\""; else $mask_statut_D='';
  79.     if($form_statut=='P') $mask_statut_P="checked=\"checked\""; else $mask_statut_P='';
  80.     $table = urlencode(serialize($table));
  81. } 
  82.  
  83. include_once("quickicons.php");
  84. $resultscale = $sql_object -> DBSelect($req_list_scale);
  85. $listing=ScaleSelectBox($resultscale, "scale" ,$form_scale_id);    
  86.  
  87. $req_sdii=SQL_getInfoSdi($id);
  88. $result_sdii = $sql_object -> DBSelect($req_sdii);
  89.  
  90. $navtitle=$GLOBALS['lang']['dashboard']['mod']." : ".$result_sdii[0]['sdii_name'];    
  91. ?>
  92. <div id="chemin">
  93.     <ul>
  94.         <li>
  95.             <a href="index.php"><?php echo $GLOBALS['lang']['way']['home']; ?></a>
  96.         </li>
  97.         <li>
  98.             <a href="<?php echo $rub_link;
  99.  
  100. ?>"><?php echo $GLOBALS['lang']['menu']['dashboard']; ?></a>
  101.         </li>
  102.         <li>
  103.             <span><?php echo formatnavTitle($navtitle); ?></span>
  104.         </li>
  105.     </ul>
  106. </div>
  107. <!--end barre haute -->
  108.  
  109.  
  110. <script type="text/javascript" charset="utf-8">
  111.     Date.format = '<?php echo DATE_FORMAT ?>';
  112.     
  113.     $.dpText = {
  114.     TEXT_PREV_YEAR        :    '<?php echo $GLOBALS['lang']['datePicker']['TEXT_PREV_YEAR']; ?>',
  115.     TEXT_PREV_MONTH        :    '<?php echo $GLOBALS['lang']['datePicker']['TEXT_PREV_MONTH']; ?>',
  116.     TEXT_NEXT_YEAR        :    '<?php echo $GLOBALS['lang']['datePicker']['TEXT_NEXT_YEAR']; ?>',
  117.     TEXT_NEXT_MONTH        :    '<?php echo $GLOBALS['lang']['datePicker']['TEXT_NEXT_MONTH']; ?>',
  118.     TEXT_CLOSE            :    '<?php echo $GLOBALS['lang']['datePicker']['TEXT_CLOSE']; ?>',
  119.     TEXT_CHOOSE_DATE    :    '<?php echo $GLOBALS['lang']['datePicker']['TEXT_CHOOSE_DATE']; ?>'
  120.     }
  121.     
  122.     $(function()
  123.     {
  124.         $('.date-pick').datePicker({startDate:'01/01/1990'});
  125.     });
  126. </script>
  127.  
  128. <?php
  129. if (!isset($integrity) || is_string($integrity)) {
  130.  
  131.     ?>
  132. <div class="contentcontainer">
  133.         <?php
  134.     include_once($dir . "/menurub.php");
  135.  
  136.     ?>
  137.         <div id="content">
  138.             <?php
  139.     if (isset($integrity) && is_string($integrity)) display_errors($integrity);
  140.  
  141.        if (IsSuperAdmin()){?>
  142.     <div class="mod_link">
  143.     <a href="<?php echo $link_mod_sdi . $id ;
  144.     ?>"><?php echo $GLOBALS['lang']['dashboard']['det_sdi'];
  145.     ?></a>
  146.     </div>
  147.             <br class="brendstep" />
  148.             
  149.     <?php }?>
  150.     <h2><?php echo formatTitleh2($result_sdii[0]['sdii_name']);
  151.     ?></h2>
  152.             
  153.             <form id="addvalue" action="<?php echo $_SERVER['SCRIPT_NAME'];
  154.  
  155.     ?>" method="post">
  156.                 <p>
  157.                 <label for="value" ><?php echo $GLOBALS['lang']['dashboard']['value'] ?> * (<?php echo formatText($result_sdii[0]['sdii_unit'], '2HTML');
  158.     ?>) :</label>
  159.                 <input name="value" type="text" id="value" maxlength="255" value="<?php echo $form_value;
  160.  
  161.     ?>" class="textfield" />
  162.                 </p>
  163.                 <p>
  164.                 <label for="scale" ><?php echo $GLOBALS['lang']['dashboard']['scale'] ?> * : </label>
  165.                 <?php echo $listing;
  166.     ?>
  167.                 </p>
  168.                 <p>
  169.                 <label for="statut_P"><? echo $GLOBALS['lang']['divers']['statut']; ?> * : </label>
  170.                 <input name="statut" type="radio" id="statut_P" value="P" <?php echo $mask_statut_P; ?> /><span class="radio"><?php echo $GLOBALS['lang']['statut']['public']; ?></span>
  171.                 <input name="statut" type="radio" id="statut_D" value="D" <?php echo $mask_statut_D; ?> /><span class="radio"><?php echo $GLOBALS['lang']['statut']['draft']; ?></span>
  172.                 <br />
  173.                 </p>
  174.                 <p><label for="date"><? echo $GLOBALS['lang']['dashboard']['date']; ?> :
  175. </label> <input name="date" type="text" maxlength="10" id="date"
  176.     class="date-pick shorttextfield date-text"
  177.     value="<?php echo $form_date; ?>" /></p>
  178.                 <br class="brendstep" />
  179.                 <br class="brendstep" />
  180.                 <div class="sdi_det">
  181.         <a name="affeval" id="affeval" style="display:none;"></a>
  182.         <a href="#affeval" onclick="$('#evaluation').slideToggle();"><?php echo $GLOBALS['lang']['sdi']['info_mesure'];
  183.     ?></a>
  184.         </div>
  185.         <div id="evaluation" style="display:none;" >
  186.     <br class="brendstep" />
  187.         <table cellspacing="0" cellpadding="3">
  188.         <thead>
  189.         <tr>
  190.         <?php
  191.     echo "<td>" . $GLOBALS['lang']['sdi']['unit'] . "</td>\n";
  192.     echo "<td>" . $GLOBALS['lang']['sdi']['max_value'] . "</td>\n";
  193.     echo "<td>" . $GLOBALS['lang']['sdi']['min_value'] . "</td>\n";
  194.     echo "<td>" . $GLOBALS['lang']['sdi']['threshold_value'] . "</td>\n";
  195.  
  196.     ?>
  197.         </tr>
  198.         </thead>
  199.         <tbody>
  200.         <?php echo "<tr>\n";
  201.     echo "<td>" . $result_sdii[0]['sdii_unit'] . "</td>\n";
  202.     echo "<td>" . $result_sdii[0]['sdii_max_value'] . "</td>\n";
  203.     echo "<td>" . $result_sdii[0]['sdii_min_value'] . "</td>\n";
  204.     echo "<td>" . $result_sdii[0]['sdii_threshold_value'] . "</td>\n";
  205.     echo "</tr>\n";
  206.  
  207.     ?>
  208.         </tbody>
  209.         </table>
  210.         </div>
  211.                 <div>
  212.                 
  213.                 <input name="id" type="hidden" value="<?php echo $id;
  214.     ?>" id="id" />
  215.     <input name="scale_id" type="hidden" value="<?php echo $scale_id; ?>" id="scale_id" />
  216.                 
  217.     <input name="value_id" type="hidden" value="<?php echo $value_id;
  218.     ?>" id="value_id" />
  219.     <? echo cancel_button($link_cancel); ?>
  220.                 <input name="rub" type="hidden" value="<?php echo $rub;
  221.     ?>" id="rub" />
  222.                 <input name="todo" type="hidden" value="<?php echo $todo;
  223.     ?>" id="todo" />
  224.                 <input name="valider1" type="submit" value="<?php echo $GLOBALS['lang']['btn']['valid'] ?>" class="button" id="valider" />
  225.                 </div>
  226.             </form>
  227.         </div>
  228. <?php include_once($dir . "/help.php");
  229.  
  230.     ?>
  231. </div>
  232. <?php 
  233.     // Récapitulatif
  234. } else {
  235.     if (!isset($integrity5) || is_string($integrity5)) {
  236.         $table = unserialize(urldecode($table));
  237.         $req_scale = SQL_getonescale($table[2]);
  238.         $resultscale2 = $sql_object -> DBSelect($req_scale);
  239.  
  240.         $display_sdi_value = $table[0]; 
  241.         // afficher nom de scale
  242.         $display_sdi_scale = formatText($resultscale2[0]['scale_denomination'], '2HTML');
  243.         $display_sdi_date = $table[3];
  244.         $display_sdi_date2=explode ("-", $display_sdi_date);
  245.         $display_sdi_date=$display_sdi_date2[2]."-".$display_sdi_date2[1]."-".$display_sdi_date2[0];
  246.         $display_sdi_statut = $table[4];
  247.         $table = urlencode(serialize($table));
  248.  
  249.         ?>
  250. <div class="contentcontainer">
  251. <?php
  252.         include_once($dir . "/menurub.php");
  253.  
  254.         ?>
  255. <div id="content">
  256.             <h2><?php echo $GLOBALS['lang']['recap']['title'] ;
  257.  
  258.         ?></h2>
  259.             <dl class="dl3">
  260.                             <dt><?php echo $GLOBALS['lang']['dashboard']['value'];
  261.  
  262.         ?> : </dt>
  263.                 <dd><?php echo $display_sdi_value . " " . $result_sdii[0]['sdii_unit'] ;
  264.  
  265.         ?><br /></dd>
  266.                 <dt><?php echo $GLOBALS['lang']['sdi']['name2'] ;
  267.  
  268.         ?> : </dt>
  269.                 <dd><?php echo formatText($result_sdii[0]['sdii_name'], '2HTML');
  270.  
  271.         ?><br /></dd>
  272.                 <dt><?php echo $GLOBALS['lang']['divers']['statut'] ;
  273.  
  274.         ?> :</dt>
  275.                 <dd><?php echo display_statut($display_sdi_statut) ;
  276.  
  277.         ?><br /></dd>
  278.                 <dt><?php echo $GLOBALS['lang']['dashboard']['date'] ;
  279.  
  280.         ?> :</dt>
  281.                 <dd><?php echo $display_sdi_date ;
  282.  
  283.         ?><br /></dd>
  284.                 <dt><?php echo $GLOBALS['lang']['dashboard']['scale'] ;
  285.  
  286.         ?> :</dt>
  287.                 <dd><?php echo $display_sdi_scale ;
  288.  
  289.         ?><br /></dd>
  290.             </dl>
  291.             <form id="addvalue2" action="<?php echo $_SERVER['SCRIPT_NAME'];
  292.  
  293.         ?>" method="post">
  294.                 <div>
  295.                 <input name="rub" type="hidden" value="<?php echo $rub;
  296.  
  297.         ?>" id="rub" />
  298.                 <input name="todo" type="hidden" value="<?php echo $todo;
  299.  
  300.         ?>" id="todo" />
  301.                     <input name="id" type="hidden" value="<?php echo $id;
  302.  
  303.         ?>" id="id" />
  304.         <input name="scale_id" type="hidden" value="<?php echo $scale_id; ?>" id="scale_id" />
  305.                 
  306.             <input name="value_id" type="hidden" value="<?php echo $value_id;
  307.     ?>" id="value_id" />
  308.     
  309.                 <input name="data_table" type="hidden" value="<?php echo $table;
  310.  
  311.         ?>" id="data_table" />
  312.         <? echo cancel_button($link_cancel); ?>
  313.                 <input name="retour" type="button" value="<?php echo $GLOBALS['lang']['btn']['preview'] ?>" class="button" id="retour" onclick="history.go(-1);" />
  314.                 <input name="enregistrer" type="submit" value="<?php echo $GLOBALS['lang']['btn']['save'] ?>" class="button" id="valider" />
  315.                 </div>
  316.             </form>
  317.         </div>
  318.     <?php include_once($dir . "/help.php");
  319.  
  320.         ?>
  321. </div>
  322. <?php
  323.     } 
  324. } 
  325.  
  326. ?>

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