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

Documentation generated on Thu, 20 Mar 2014 16:48:53 +0100 by phpDocumentor 1.4.1