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(THEME_ADMIN_PATH."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=_t('dashboard','mod')." : ".$result_sdii[0]['sdii_name'];
  91. ?>
  92. <div id="chemin">
  93. <ul>
  94.     <li><a href="index.php" class="chemin_home"><?php echo _t('way','home'); ?></a>
  95.     </li>
  96.     <li><a href="<?php echo $rub_link;
  97.  
  98. ?>" id="chemin_<?php echo $rub; ?>"
  99.         class="chemin_rub"><?php echo _t('menu','dashboard'); ?></a></li>
  100.     <li><span><?php echo formatnavTitle($navtitle); ?></span></li>
  101. </ul>
  102. </div>
  103. <!--end barre haute -->
  104.  
  105.  
  106. <script type="text/javascript" charset="utf-8">
  107.     Date.format = '<?php echo DATE_FORMAT ?>';
  108.     
  109.     $.dpText = {
  110.     TEXT_PREV_YEAR        :    '<?php echo _t('datePicker','TEXT_PREV_YEAR'); ?>',
  111.     TEXT_PREV_MONTH        :    '<?php echo _t('datePicker','TEXT_PREV_MONTH'); ?>',
  112.     TEXT_NEXT_YEAR        :    '<?php echo _t('datePicker','TEXT_NEXT_YEAR'); ?>',
  113.     TEXT_NEXT_MONTH        :    '<?php echo _t('datePicker','TEXT_NEXT_MONTH'); ?>',
  114.     TEXT_CLOSE            :    '<?php echo _t('datePicker','TEXT_CLOSE'); ?>',
  115.     TEXT_CHOOSE_DATE    :    '<?php echo _t('datePicker','TEXT_CHOOSE_DATE'); ?>'
  116.     }
  117.     
  118.     $(function()
  119.     {
  120.         $('.date-pick').datePicker({startDate:'01/01/1990'});
  121.     });
  122. </script>
  123.  
  124. <?php
  125. if (!isset($integrity) || is_string($integrity)) {
  126.  
  127.   ?>
  128. <div class="contentcontainer"><?php
  129. include_once($dir . "/menurub.php");
  130.  
  131. ?>
  132. <div id="content"><?php
  133. if (isset($integrity) && is_string($integrity)) display_errors($integrity);
  134.  
  135. if (IsSuperAdmin()){?>
  136. <div class="mod_link"><a href="<?php echo $link_mod_sdi . $id ;
  137. ?>"><?php echo _t('dashboard','det_sdi');
  138. ?></a></div>
  139. <br class="brendstep" />
  140.  
  141. <?php }?>
  142. <h2><?php echo formatTitleh2($result_sdii[0]['sdii_name']);
  143. ?></h2>
  144.  
  145. <form id="addvalue" action="<?php echo $_SERVER['SCRIPT_NAME'];
  146.  
  147.     ?>"
  148.     method="post">
  149. <p><label for="value"><?php echo _t('dashboard','value') ?> * (<?php echo formatText($result_sdii[0]['sdii_unit'], '2HTML');
  150. ?>) :</label> <input name="value" type="text" id="value" maxlength="255"
  151.     value="<?php echo $form_value;
  152.  
  153.     ?>" class="textfield" /></p>
  154. <p><label for="scale"><?php echo _t('dashboard','scale') ?> * : </label>
  155.     <?php echo $listing;
  156.     ?></p>
  157. <p><label for="statut_P"><?php echo _t('divers','statut'); ?> * : </label>
  158. <input name="statut" type="radio" id="statut_P" value="P"
  159.     <?php echo $mask_statut_P; ?> /><span class="radio"><?php echo _t('statut','public'); ?></span>
  160. <input name="statut" type="radio" id="statut_D" value="D"
  161.     <?php echo $mask_statut_D; ?> /><span class="radio"><?php echo _t('statut','draft'); ?></span>
  162. <br />
  163. </p>
  164. <p><label for="date"><?php echo _t('dashboard','date'); ?> : </label> <input
  165.     name="date" type="text" maxlength="10" id="date"
  166.     class="date-pick shorttextfield date-text"
  167.     value="<?php echo $form_date; ?>" /></p>
  168. <br class="brendstep" />
  169. <br class="brendstep" />
  170. <div class="sdi_det"><a name="affeval" id="affeval"
  171.     style="display: none;"></a> <a href="#affeval"
  172.     onclick="$('#evaluation').slideToggle();"><?php echo _t('sdi','info_mesure');
  173.     ?></a></div>
  174. <div id="evaluation" style="display: none;"><br class="brendstep" />
  175. <table cellspacing="0" cellpadding="3">
  176.     <thead>
  177.         <tr>
  178.         <?php
  179.         echo "<td>" . _t('sdi','unit') . "</td>\n";
  180.         echo "<td>" . _t('sdi','max_value') . "</td>\n";
  181.         echo "<td>" . _t('sdi','min_value') . "</td>\n";
  182.         echo "<td>" . _t('sdi','threshold_value') . "</td>\n";
  183.  
  184.         ?>
  185.         </tr>
  186.     </thead>
  187.     <tbody>
  188.     <?php echo "<tr>\n";
  189.     echo "<td>" . $result_sdii[0]['sdii_unit'] . "</td>\n";
  190.     echo "<td>" . $result_sdii[0]['sdii_max_value'] . "</td>\n";
  191.     echo "<td>" . $result_sdii[0]['sdii_min_value'] . "</td>\n";
  192.     echo "<td>" . $result_sdii[0]['sdii_threshold_value'] . "</td>\n";
  193.     echo "</tr>\n";
  194.  
  195.     ?>
  196.     </tbody>
  197. </table>
  198. </div>
  199. <div><input name="id" type="hidden" value="<?php echo $id;
  200.     ?>"
  201.     id="id" /> <input name="scale_id" type="hidden"
  202.     value="<?php echo $scale_id; ?>" id="scale_id" /> <input
  203.     name="value_id" type="hidden" value="<?php echo $value_id;
  204.     ?>"
  205.     id="value_id" /> <?php echo cancel_button($link_cancel); ?> <input
  206.     name="rub" type="hidden" value="<?php echo $rub;
  207.     ?>" id="rub" /> <input name="todo" type="hidden"
  208.     value="<?php echo $todo;
  209.     ?>" id="todo" /> <input name="valider1" type="submit"
  210.     value="<?php echo _t('btn','valid') ?>" class="button" id="valider" />
  211. </div>
  212. </form>
  213. </div>
  214.     <?php include_once($dir . "/help.php");
  215.  
  216.     ?></div>
  217.     <?php
  218.     // Récapitulatif
  219. } else {
  220.   if (!isset($integrity5) || is_string($integrity5)) {
  221.     $table = unserialize(urldecode($table));
  222.     $req_scale = SQL_getonescale($table[2]);
  223.     $resultscale2 = $sql_object -> DBSelect($req_scale);
  224.  
  225.     $display_sdi_value = $table[0];
  226.     // afficher nom de scale
  227.     $display_sdi_scale = formatText($resultscale2[0]['scale_denomination'], '2HTML');
  228.     $display_sdi_date = $table[3];
  229.     $display_sdi_statut = $table[4];
  230.     $table = urlencode(serialize($table));
  231.  
  232.     ?>
  233. <div class="contentcontainer"><?php
  234. include_once($dir . "/menurub.php");
  235.  
  236. ?>
  237. <div id="content">
  238. <h2><?php echo _t('recap','title') ;
  239.  
  240. ?></h2>
  241. <dl class="dl3">
  242.     <dt><?php echo _t('dashboard','value');
  243.  
  244.     ?> :</dt>
  245.     <dd><?php echo $display_sdi_value . " " . $result_sdii[0]['sdii_unit'] ;
  246.  
  247.     ?><br />
  248.     </dd>
  249.     <dt><?php echo _t('sdi','name2') ;
  250.  
  251.     ?> :</dt>
  252.     <dd><?php echo formatText($result_sdii[0]['sdii_name'], '2HTML');
  253.  
  254.     ?><br />
  255.     </dd>
  256.     <dt><?php echo _t('divers','statut') ;
  257.  
  258.     ?> :</dt>
  259.     <dd><?php echo display_statut($display_sdi_statut) ;
  260.  
  261.     ?><br />
  262.     </dd>
  263.     <dt><?php echo _t('dashboard','date') ;
  264.  
  265.     ?> :</dt>
  266.     <dd><?php echo $display_sdi_date ;
  267.  
  268.     ?><br />
  269.     </dd>
  270.     <dt><?php echo _t('dashboard','scale') ;
  271.  
  272.     ?> :</dt>
  273.     <dd><?php echo $display_sdi_scale ;
  274.  
  275.     ?><br />
  276.     </dd>
  277. </dl>
  278. <form id="addvalue2"
  279.     action="<?php echo $_SERVER['SCRIPT_NAME'];
  280.  
  281.         ?>" method="post">
  282. <div><input name="rub" type="hidden"
  283.     value="<?php echo $rub;
  284.  
  285.         ?>" id="rub" /> <input name="todo" type="hidden"
  286.     value="<?php echo $todo;
  287.  
  288.         ?>" id="todo" /> <input name="id" type="hidden"
  289.     value="<?php echo $id;
  290.  
  291.         ?>" id="id" /> <input name="scale_id" type="hidden"
  292.     value="<?php echo $scale_id; ?>" id="scale_id" /> <input
  293.     name="value_id" type="hidden" value="<?php echo $value_id;
  294.     ?>"
  295.     id="value_id" /> <input name="data_table" type="hidden"
  296.     value="<?php echo $table;
  297.  
  298.     ?>" id="data_table" /> <?php echo cancel_button($link_cancel); ?> <input
  299.     name="retour" type="button" value="<?php echo _t('btn','preview') ?>"
  300.     class="button" id="retour" onclick="history.go(-1);" /> <input
  301.     name="enregistrer" type="submit" value="<?php echo _t('btn','save') ?>"
  302.     class="button" id="valider" /></div>
  303. </form>
  304. </div>
  305.     <?php include_once($dir . "/help.php");
  306.  
  307.     ?></div>
  308.     <?php
  309.   }
  310. }
  311. ?>

Documentation generated on Fri, 01 Apr 2011 09:33:06 +0200 by phpDocumentor 1.4.1