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. <?php
  192. /** 
  193.  * @toodo remove <input type="hidden" /> below if  displaying
  194. <p>
  195.       <label for="sdi_detail_viz"><?php echo mb_ucfirst(_t('sdi','detail_viz')) ?> : *</label>
  196.       <?php echo $select_detail_viz; ?>
  197. </p>
  198. */
  199. ?>
  200. <input name="sdi_detail_viz" type="hidden" id="sdi_detail_viz" value="<?php echo $form_detail_viz?>" />
  201. <p>
  202.     <label for="sdi_theme"><?php echo mb_ucfirst(_t('sdi','theme')) ?> : *</label>
  203.     <?php echo $select_theme?>
  204. </p>
  205. <div class="label"><?php echo mb_ucfirst(_t('divers','statut'))?> : *</div>
  206. <div class="rightpanel">
  207.     <input name="sdi_statut" type="radio" id="statut_P" value="P" <?php echo $mask_statut_P?> />
  208.     <label for="statut_P"><?php echo mb_ucfirst(_t('statut','public'))?></label>
  209.     <input name="sdi_statut" type="radio" id="statut_D" value="D" <?php echo $mask_statut_D?> />
  210.     <label for="statut_D"><?php echo mb_ucfirst(_t('statut','draft'))?></label>
  211. </div>
  212.  
  213. <?php 
  214. /** <p>
  215. <label for="range" ><?php echo mb_ucfirst(_t('sdi','range')) ?> : *</label>
  216. <input name="range" type="text" class="textfield" id="range" maxlength="150" value="<?php echo $form_range;
  217. ?>" />
  218. </p> */ 
  219. ?>
  220. <p>
  221.     <label for="description"><?php echo mb_ucfirst(_t('sdi','description')) ?> : *</label>
  222.     <textarea id="description" name="description" <?php echo AREA_SETTINGS?> class="largetextfield"><?php echo $form_description?></textarea>
  223. </p>
  224. <p>
  225.     <label for="goal"><?php echo mb_ucfirst(_t('sdi','goal')) ?> :</label>
  226.     <textarea id="goal" name="goal" <?php echo AREA_SETTINGS?> class="largetextfield"><?php echo $form_goal?></textarea>
  227. </p>
  228. <p>
  229.     <label for="consulting"><?php echo mb_ucfirst(_t('sdi','consulting')) ?> :</label>
  230.     <textarea id="consulting" name="consulting" <?php echo AREA_SETTINGS?> class="largetextfield"><?php echo $form_consulting?></textarea>
  231. </p>
  232. <p>
  233.     <label for="attached_to_dashboard"><?php echo mb_ucfirst(_t('sdi','attached_to_dashboard')) ?> :</label>
  234.     <input type="checkbox" name="attached_to_dashboard" value="1" id="attached_to_dashboard" <?php echo $mask_dashboard?> />
  235. </p>
  236. <p>
  237.     <label for="comment"><?php echo mb_ucfirst(_t('sdi','comment')) ?> :</label>
  238.     <textarea id="comment" name="comment" <?php echo AREA_SETTINGS?> class="largetextfield"><?php echo $form_comment?></textarea>
  239. </p>
  240.  
  241. <h3 class="part"><?php echo mb_ucfirst(_t('sdi','info_mesure'))?></h3>
  242.  
  243. <p>
  244.     <label for="unit"><?php echo mb_ucfirst(_t('sdi','unit')) ?> : *</label>
  245.     <input name="unit" type="text" class="textfield" id="unit" maxlength="100" value="<?php echo $form_unit?>" />
  246. </p>
  247. <p>
  248.     <label for="max_value"><?php echo mb_ucfirst(_t('sdi','max_value')) ?> : </label>
  249.     <input name="max_value" type="text" class="textfield" id="max_value" maxlength="6" value="<?php echo $form_max_value?>" />
  250. </p>
  251. <p>
  252.     <label for="min_value"><?php echo mb_ucfirst(_t('sdi','min_value')) ?> : </label>
  253.     <input name="min_value" type="text" class="textfield" id="min_value" maxlength="100" value="<?php echo $form_min_value?>" />
  254. </p>
  255. <p>
  256.     <label for="threshold_value"><?php echo mb_ucfirst(_t('sdi','initial_threshold_value')) ?> : </label>
  257.     <input name="threshold_value" type="text" class="textfield" id="threshold_value" maxlength="100" value="<?php echo $form_threshold_value?>" />
  258. </p>
  259. <p>
  260.     <label for="frequency"><?php echo mb_ucfirst(_t('sdi','frequency')) ?> : *</label>
  261.     <input name="frequency" type="text" class="textfield" id="frequency" maxlength="11" value="<?php echo $form_frequency?>" />
  262. </p>
  263. <div class="label"><?php echo mb_ucfirst(_t('sdi','threshold_relative')) ?> : *</div>
  264. <div class="rightpanel">
  265.     <input type="checkbox" name="threshold_relative" id="threshold_relative" <?php echo $mask_threshold_relative?> />
  266.   <label for="threshold_relative"><?php echo _t('sdi','threshold_relative_comment'?></label>
  267. </div>
  268.  
  269. <div>
  270.   <input name="id" type="hidden" value="<?php echo $id?>" id="id" />
  271.   <?php echo cancel_button($rub_link."&amp;todo=det&amp;id=".$id)?>
  272.   <input name="rub" type="hidden" value="<?php echo $rub?>" id="rub" />
  273.   <input name="todo" type="hidden" value="<?php echo $todo?>" id="todo" />
  274.   <input name="valider1" type="submit" value="<?php echo _t('btn','valid'?>" class="button" id="valider" />
  275. </div>
  276. </form>
  277. </div>
  278. <?php include_once(override($dir.'/help.php'THEME_ADMIN_PATH))?>
  279. </div>
  280. <?php
  281.             // Récapitulatif
  282. else {
  283.   if (!isset($integrity5|| is_string($integrity5)) {
  284.  
  285.  
  286.     $table=unserialize(urldecode($table));
  287.  
  288.     $display_sdi_name formatText(empty_nc($table[0])'2HTML');
  289.     $display_sdi_description =formatText(empty_nc($table[1])'2HTML');
  290.     $display_sdi_comment =formatText(empty_nc($table[2])'2HTML');
  291.     //$display_sdi_range = empty_nc($table[4]);
  292.     $display_sdi_goal formatText(empty_nc($table[5])'2HTML');
  293.     $display_sdi_consulting formatText(empty_nc($table[6])'2HTML');
  294.     $display_sdi_unit formatText(empty_nc($table[7])'2HTML');
  295.     $display_sdi_max_value empty_nc($table[8]);
  296.     $display_sdi_min_value empty_nc($table[9]);
  297.     $display_sdi_threshold_value empty_nc($table[10]);
  298.     $display_sdi_frequency empty_nc($table[11]);
  299.     $display_sdi_statut empty_nc($table[12]);
  300.     $onetheme SQL_getOnesditheme($table[3]);
  301.     $onetheme $sql_object -> DBSelect($onetheme);
  302.     $display_sdi_theme formatText($onetheme[0]['theme_name']'2HTML');
  303.  
  304.     if ($table[13]=='Y'$display_sdi_threshold_relative _t('sdi','threshold_relative_Y');
  305.     else $display_sdi_threshold_relative _t('sdi','threshold_relative_N');
  306.     
  307.     if ($table[14]=='Y'$display_attached_to_dashboard _t('divers','yes');
  308.     else $display_attached_to_dashboard _t('divers','no');
  309.     
  310.     $display_sdi_type formatText($lang['sdi']['select_type'][$table[15]]'2HTML');
  311.     $display_sdi_dashboard_viz formatText($lang['sdi']['select_dashboard_viz'][$table[16]]'2HTML');
  312.     $display_sdi_detail_viz formatText($lang['sdi']['select_detail_viz'][$table[17]]'2HTML');
  313.         
  314.     $table urlencode(serialize($table));
  315.  
  316.     ?>
  317. <div class="contentcontainer"><?php
  318. include_once(override($dir.'/menurub.php'THEME_ADMIN_PATH));
  319.  
  320. ?>
  321. <div id="content">
  322. <h2><?php echo mb_ucfirst(_t('recap','title'))?></h2>
  323. <dl class="dl3">
  324.     <dt><?php echo mb_ucfirst(_t('sdi','name2'))?> :</dt>
  325.     <dd><?php echo $display_sdi_name?></dd>
  326.     <?php /*
  327.     <dt><?php echo mb_ucfirst(_t('sdi','type')) ?> : </dt>
  328.     <dd><?php echo mb_ucfirst($display_sdi_type);?></dd>
  329.     */ ?>
  330.     <dt><?php echo mb_ucfirst(_t('sdi','dashboard_viz')) ?> : </dt>
  331.     <dd><?php echo mb_ucfirst($display_sdi_dashboard_viz);?></dd>
  332.     <?php /*
  333.     <dt><?php echo mb_ucfirst(_t('sdi','detail_viz')) ?> : </dt>
  334.     <dd><?php echo mb_ucfirst($display_sdi_detail_viz);?></dd>
  335.     */ ?>
  336.     <dt><?php echo mb_ucfirst(_t('divers','statut'))?> :</dt>
  337.     <dd><?php echo display_statut($display_sdi_statut)?></dd>
  338.     <dt><?php echo mb_ucfirst(_t('sdi','theme'))?> :</dt>
  339.     <dd><?php echo $display_sdi_theme?></dd>
  340.     <?php 
  341.     /*<dt><?php echo mb_ucfirst(_t('sdi','range'));     ?> :</dt>
  342.     <dd><?php echo $display_sdi_range; ?><br /></dd> */ 
  343.     ?>
  344.     <dt><?php echo mb_ucfirst(_t('sdi','description'))?> :</dt>
  345.     <dd><?php echo $display_sdi_description?></dd>
  346.     <dt><?php echo mb_ucfirst(_t('sdi','goal'))?> :</dt>
  347.     <dd><?php echo $display_sdi_goal?></dd>
  348.     <dt><?php echo mb_ucfirst(_t('sdi','consulting'))?> :</dt>
  349.     <dd><?php echo $display_sdi_consulting?></dd>
  350.     <dt><?php echo mb_ucfirst(_t('sdi','attached_to_dashboard'));    ?> :</dt>
  351.     <dd><?php echo $display_attached_to_dashboard;    ?></dd>
  352.     <dt><?php echo mb_ucfirst(_t('sdi','comment'))?> :</dt>
  353.     <dd><?php echo $display_sdi_comment?></dd>
  354. </dl>
  355. <h3 class="part"><?php echo mb_ucfirst(_t('sdi','info_mesure'))?></h3>
  356. <dl class="dl3">
  357.     <dt><?php echo mb_ucfirst(_t('sdi','unit'))?> :</dt>
  358.     <dd><?php echo $display_sdi_unit?></dd>
  359.     <dt><?php echo mb_ucfirst(_t('sdi','max_value'))?> :</dt>
  360.     <dd><?php echo $display_sdi_max_value?></dd>
  361.     <dt><?php echo mb_ucfirst(_t('sdi','min_value'))?> :</dt>
  362.     <dd><?php echo $display_sdi_min_value;    ?></dd>
  363.     <dt><?php echo mb_ucfirst(_t('sdi','initial_threshold_value'));    ?> :</dt>
  364.     <dd><?php echo $display_sdi_threshold_value?></dd>
  365.     <dt><?php echo mb_ucfirst(_t('sdi','threshold_relative'));    ?> :</dt>
  366.     <dd><?php echo $display_sdi_threshold_relative;    ?></dd>
  367.     <dt><?php echo mb_ucfirst(_t('sdi','frequency'))?> :</dt>
  368.     <dd><?php echo $display_sdi_frequency;    ?></dd>
  369. </dl>
  370. <form id="addsdi5" action="<?php echo $_SERVER['SCRIPT_NAME']?>" method="post">
  371.   <div>
  372.     <input name="rub" type="hidden" value="<?php echo $rub?>" id="rub" />
  373.     <input name="todo" type="hidden" value="<?php echo $todo?>" id="todo" />
  374.     <input name="id" type="hidden" value="<?php echo $id?>" id="id" />
  375.     <?php echo cancel_button($rub_link."&amp;todo=det&amp;id=".$id)?>
  376.     <input name="data_table" type="hidden" value="<?php echo $table?>" id="data_table" />
  377.     <input name="retour" type="button" value="<?php echo _t('btn','preview'?>" class="button" id="retour" onclick="history.go(-1);" />
  378.     <input name="enregistrer" type="submit" value="<?php echo _t('btn','save'?>" class="button" id="valider" />
  379.   </div>
  380. </form>
  381. </div>
  382. <?php include_once(override($dir.'/help.php'THEME_ADMIN_PATH))?>
  383. </div>
  384. <?php
  385.   }
  386. }
  387. ?>

Documentation generated on Mon, 08 Apr 2013 18:15:38 +0200 by phpDocumentor 1.4.1