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. $form_comment = $result_value[0]['sdiv_comment'];
  60. $form_statutc = $result_value[0]['sdiv_comment_display'];
  61. if($form_statut=='D') $mask_statut_D="checked=\"checked\""; else $mask_statut_D='';
  62. if($form_statut=='P') $mask_statut_P="checked=\"checked\""; else $mask_statut_P='';
  63. if($form_statutc=='Y') $mask_statutc_public="checked=\"checked\""; else $mask_statutc_public='';
  64.   if($form_statutc=='N') $mask_statutc_private="checked=\"checked\""; else $mask_statutc_private='';
  65.  
  66. if (isset($_POST['valider1'])) {
  67.  
  68.   $table[0] = $_POST['value'];
  69.   $table[1] = $_POST['id'];
  70.   $table[2] = $_POST['scale'];
  71.   $table[3] = $_POST['date'];
  72.   $table[4] = $_POST['statut'];
  73.   $table[5] = $_POST['comment'];
  74.   $table[6] = $_POST['statutc'];
  75.  
  76.   $sdi_object = new sdi;
  77.   $integrity = $sdi_object -> CheckDataIntegrity_value($table, $sql_object);
  78.  
  79.   $form_value = $_POST['value'];
  80.   $form_sdi_id = $_POST['id'];
  81.   $form_scale_id = $_POST['scale'];
  82.   $form_date = $_POST['date'];
  83.   $form_statut = $_POST['statut'];
  84.   $form_statutc = $_POST['statutc'];
  85.   if($form_statut=='D') $mask_statut_D="checked=\"checked\""; else $mask_statut_D='';
  86.   if($form_statut=='P') $mask_statut_P="checked=\"checked\""; else $mask_statut_P='';
  87.   if($form_statutc=='Y') $mask_statutc_public="checked=\"checked\""; else $mask_statutc_public='';
  88.   if($form_statutc=='N') $mask_statutc_private="checked=\"checked\""; else $mask_statutc_private='';
  89.   $table = urlencode(serialize($table));
  90. }
  91.  
  92. include_once(THEME_ADMIN_PATH."quickicons.php");
  93. $resultscale = $sql_object -> DBSelect($req_list_scale);
  94. $listing=ScaleSelectBox($resultscale, "scale" ,$form_scale_id);
  95.  
  96. $req_sdii=SQL_getInfoSdi($id);
  97. $result_sdii = $sql_object -> DBSelect($req_sdii);
  98.  
  99. $navtitle=_t('dashboard','mod')." : ".$result_sdii[0]['sdii_name'];
  100.  
  101. footerAddJS('../lib/js/jquery.datePicker.l10n/jquery.ui.datepicker-'.U_L.'.js');
  102. ?>
  103. <div id="chemin">
  104. <ul>
  105.     <li><a href="index.php" class="chemin_home"><?php echo _t('way','home'); ?></a></li>
  106.     <li><a href="<?php echo $rub_link; ?>" id="chemin_<?php echo $rub; ?>" class="chemin_rub"><?php echo _t('menu','dashboard'); ?></a></li>
  107.     <li><span><?php echo formatnavTitle($navtitle); ?></span></li>
  108. </ul>
  109. </div>
  110. <!--end barre haute -->
  111.  
  112.  
  113. <script type="text/javascript">    
  114.     $(function()
  115.     {
  116.         var dateFormat = "<?php echo DATE_FORMAT; ?>";
  117.         dateFormat = dateFormat.replace("yyyy", "yy");
  118.         
  119.         $(".date-pick").datepicker({
  120.             showOn: "button",
  121.             buttonImage: "../lib/js/calendar.png",
  122.             buttonImageOnly: true,
  123.             dateFormat: dateFormat,
  124.             dateMin: new Date(2000, 1 - 1, 1)
  125.         });
  126.         $( ".date-pick" ).datepicker( $.datepicker.regional[ "<?php echo U_L; ?>" ] );
  127.         
  128.     });
  129. </script>
  130.  
  131. <?php
  132. if (!isset($integrity) || is_string($integrity)) {
  133. ?>
  134. <div class="contentcontainer">
  135. <?php
  136. include_once($dir . "/menurub.php");
  137. ?>
  138. <div id="content"><?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 ; ?>"><?php echo _t('dashboard','det_sdi');?></a>
  144. </div>
  145. <br class="brendstep" />
  146.  
  147. <?php }?>
  148. <h2><?php echo formatTitleh2($result_sdii[0]['sdii_name']); ?></h2>
  149.  
  150. <form id="addvalue" action="<?php echo $_SERVER['SCRIPT_NAME']; ?>" method="post">
  151. <p>
  152.     <label for="value"><?php echo _t('dashboard','value') ?> * (<?php echo formatText($result_sdii[0]['sdii_unit'], '2HTML'); ?>) :</label>
  153.     <input name="value" type="text" id="value" maxlength="255" value="<?php echo $form_value; ?>" class="textfield" />
  154. </p>
  155. <p>
  156.     <label for="scale"><?php echo _t('dashboard','scale') ?> * : </label>
  157.     <?php echo $listing; ?>
  158. </p>
  159.  
  160. <div class="label"><?php echo _t('divers','statut'); ?> * : </div>
  161. <div class="rightpanel">
  162.     <input name="statut" type="radio" id="statut_P" value="P" <?php echo $mask_statut_P; ?> />
  163.     <label for="statut_P"><?php echo _t('statut','public'); ?></label>
  164.     <input name="statut" type="radio" id="statut_D" value="D" <?php echo $mask_statut_D; ?> />
  165.     <label for="statut_D"><?php echo _t('statut','draft'); ?></label>
  166. </div>
  167.  
  168. <p>
  169.     <label for="date"><?php echo _t('dashboard','date'); ?> : </label>
  170.     <input name="date" type="text" maxlength="10" id="date" class="date-pick shorttextfield" value="<?php echo $form_date; ?>" />
  171. </p>
  172. <p>
  173.     <label for="comment"><?php echo _t('dashboard','comment') ?> : </label> 
  174.     <textarea id="comment" name="comment" <?php echo AREA_SETTINGS; ?>    class="largetextfield"><?php echo $form_comment; ?></textarea>
  175. </p>
  176.  
  177. <div class="label"><?php echo _t('dashboard','comment_status'); ?> * : </div>
  178. <div class="rightpanel">
  179.     <input name="statutc" type="radio" id="statutc_P" value="Y" <?php echo $mask_statutc_public; ?> />
  180.     <label for="statutc_P"><?php echo _t('dashboard','public'); ?></label>
  181.     <input name="statutc" type="radio" id="statutc_D" value="N" <?php echo $mask_statutc_private; ?> />
  182.     <label for="statutc_D"><?php echo _t('dashboard','private'); ?></label>
  183. </div>
  184.  
  185.  
  186. <div class="sdi_det">
  187.     <a name="affeval" id="affeval" style="display: none;"></a> <a href="#affeval" onclick="$('#evaluation').slideToggle();"><?php echo _t('sdi','info_mesure'); ?></a>
  188. </div>
  189. <div id="evaluation" style="display: none;"><br class="brendstep" />
  190. <table cellspacing="0" cellpadding="3">
  191.     <thead>
  192.         <tr>
  193.         <?php
  194.         echo "<td>" . _t('sdi','unit') . "</td>\n";
  195.         echo "<td>" . _t('sdi','max_value') . "</td>\n";
  196.         echo "<td>" . _t('sdi','min_value') . "</td>\n";
  197.         echo "<td>" . _t('sdi','threshold_value') . "</td>\n";
  198.  
  199.         ?>
  200.         </tr>
  201.     </thead>
  202.     <tbody>
  203.     <?php echo "<tr>\n";
  204.     echo "<td>" . $result_sdii[0]['sdii_unit'] . "</td>\n";
  205.     echo "<td>" . $result_sdii[0]['sdii_max_value'] . "</td>\n";
  206.     echo "<td>" . $result_sdii[0]['sdii_min_value'] . "</td>\n";
  207.     echo "<td>" . $result_sdii[0]['sdii_threshold_value'] . "</td>\n";
  208.     echo "</tr>\n";
  209.  
  210.     ?>
  211.     </tbody>
  212. </table>
  213. </div>
  214. <div>
  215.     <input name="id" type="hidden" value="<?php echo $id; ?>" id="id" />
  216.     <input name="scale_id" type="hidden" value="<?php echo $scale_id; ?>" id="scale_id" />
  217.     <input name="value_id" type="hidden" value="<?php echo $value_id; ?>" id="value_id" />
  218.     <?php echo cancel_button($link_cancel); ?>
  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.     $table = unserialize(urldecode($table));
  233.     $req_scale = SQL_getonescale($table[2]);
  234.     $resultscale2 = $sql_object -> DBSelect($req_scale);
  235.  
  236.     $display_comment = formatText($_POST['comment'], '2HTML');
  237.         
  238.     ($form_statutc == 'Y') ? $display_comment_status = _t('dashboard', 'public') : $display_comment_status = _t('dashboard', 'private');
  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_statut = $table[4];
  245.     $table = urlencode(serialize($table));
  246.  
  247.     ?>
  248. <div class="contentcontainer">
  249. <?php
  250. include_once($dir . "/menurub.php");
  251. ?>
  252. <div id="content">
  253. <h2><?php echo _t('recap','title') ;?></h2>
  254. <dl class="dl3">
  255.     <dt><?php echo _t('dashboard','value');    ?> :</dt>
  256.     <dd><?php echo $display_sdi_value . " " . $result_sdii[0]['sdii_unit']; ?>
  257.     </dd>
  258.     <dt><?php echo _t('sdi','name2'); ?> :</dt>
  259.     <dd><?php echo formatText($result_sdii[0]['sdii_name'], '2HTML'); ?> </dd>
  260.     <dt><?php echo _t('divers','statut'); ?> :</dt>
  261.     <dd><?php echo display_statut($display_sdi_statut); ?></dd>
  262.     <dt><?php echo _t('dashboard','date');    ?> :</dt>
  263.     <dd><?php echo $display_sdi_date; ?></dd>
  264.     <dt><?php echo _t('dashboard','scale');    ?> :</dt>
  265.     <dd><?php echo $display_sdi_scale;    ?></dd>
  266.     <dt><?php echo _t('dashboard','comment'); ?> :</dt>
  267.     <dd><?php echo $display_comment ;?></dd>
  268.     <dt><?php echo _t('dashboard','comment_status'); ?> :</dt>
  269.     <dd><?php echo $display_comment_status ;?></dd>
  270. </dl>
  271. <form id="addvalue2" action="<?php echo $_SERVER['SCRIPT_NAME']; ?>" method="post">
  272.   <div>
  273.     <input name="rub" type="hidden" value="<?php echo $rub; ?>" id="rub" />
  274.     <input name="todo" type="hidden" value="<?php echo $todo; ?>" id="todo" />
  275.     <input name="id" type="hidden" value="<?php echo $id; ?>" id="id" />
  276.     <input name="scale_id" type="hidden" value="<?php echo $scale_id; ?>" id="scale_id" />
  277.     <input name="value_id" type="hidden" value="<?php echo $value_id; ?>" id="value_id" />
  278.     <input name="data_table" type="hidden" value="<?php echo $table; ?>" id="data_table" />
  279.     <?php echo cancel_button($link_cancel); ?>
  280.     <input    name="retour" type="button" value="<?php echo _t('btn','preview') ?>" class="button" id="retour" onclick="history.go(-1);" />
  281.     <input name="enregistrer" type="submit" value="<?php echo _t('btn','save') ?>" class="button" id="valider" />
  282.   </div>
  283. </form>
  284. </div>
  285. <?php 
  286. include_once($dir . "/help.php");
  287. ?>
  288. </div>
  289. <?php
  290.   }
  291. }
  292. ?>

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