2 // +-----------------------------------------------------------------------------+
3 // Copyright (C) 2011 Z&H Consultancy Services Private Limited <sam@zhservices.com>
6 // This program is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU General Public License
8 // as published by the Free Software Foundation; either version 2
9 // of the License, or (at your option) any later version.
12 // This program is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License for more details.
18 // A copy of the GNU General Public License is included along with this program:
19 // openemr/interface/login/GnuGPL.html
20 // For more information write to the Free Software
21 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23 // Author: Eldho Chacko <eldho@zhservices.com>
24 // Jacob T Paul <jacob@zhservices.com>
26 // +------------------------------------------------------------------------------+
28 //SANITIZE ALL ESCAPES
29 $sanitize_all_escapes=true;
32 //STOP FAKE REGISTER GLOBALS
33 $fake_register_globals=false;
36 require_once("../../interface/globals.php");
37 if((isset($_POST['form_save']) && $_POST['form_save']=='Save') ||
(isset($_POST['form_delete']) && $_POST['form_delete']=='Delete')){
38 $count = $_POST['count'];
40 $sta = $_POST['start'];
42 for($cnt=$sta;$cnt<=$end;$cnt++
){
43 if($_POST['hidid'.$cnt]){
44 if(trim(formData('inshort'.$cnt))=='' && trim(formdata('designation'.$cnt))==''){
45 sqlStatement("UPDATE customlists SET cl_deleted=1 WHERE cl_list_slno=?",array($_POST['hidid'.$cnt]));
46 sqlStatement("DELETE FROM template_users WHERE tu_template_id=? AND tu_user_id=?",array($_POST['hidid'.$cnt],$_SESSION['authId']));
49 $sql = "UPDATE customlists SET cl_list_item_short=?,cl_list_item_long=?,cl_order=? WHERE cl_list_slno=?";
50 sqlStatement($sql,array($_POST['inshort'.$cnt],$_POST['designation'.$cnt],$_POST['level'.$cnt],$_POST['hidid'.$cnt]));
54 if(trim(formData('inshort'.$cnt))!='' ||
trim(formdata('designation'.$cnt))!=''){
55 $rowID=sqlQuery("SELECT MAX(cl_list_item_id)+1 as maxID FROM customlists WHERE cl_list_type=6");
56 $itemID = $rowID['maxID'] ?
$rowID['maxID'] : 1;
57 $sql = "INSERT INTO customlists (cl_list_item_id,cl_list_type,cl_list_item_short,cl_list_item_long,cl_order) VALUES(?,?,?,?,?)";
58 $newid = sqlInsert($sql,array($itemID,6,$_POST['inshort'.$cnt],$_POST['designation'.$cnt],$_POST['level'.$cnt]));
59 sqlStatement("INSERT INTO template_users (tu_user_id,tu_template_id) VALUES (?,?)",array($_SESSION['authId'],$newid));
62 if($_POST['form_delete']=='Delete'){
63 if($_POST['chk'.$cnt]){
64 sqlStatement("UPDATE customlists SET cl_deleted=1 WHERE cl_list_slno=?",array($_POST['chk'.$cnt]));
65 sqlStatement("DELETE FROM template_users WHERE tu_template_id=? AND tu_user_id=?",array($_POST['chk'.$cnt],$_SESSION['authId']));
69 unset($_POST['form_save']);
70 unset($_POST['form_delete']);
75 <link rel
="stylesheet" href
="<?php echo $css_header;?>" type
="text/css">
77 .bottom
{border
-bottom
:1px solid black
;}
78 .top
{border
-top
:1px solid black
;}
79 .left
{border
-left
:1px solid black
;}
80 .right
{border
-right
:1px solid black
;}
81 .class1
{background
-color
:#7dc1db}
82 .class2
{background
-color
:#ef2983}
85 <body
class="body_top">
86 <form name
="designation_managment" action
="" method
="post" onsubmit
="top.restoreSession();">
87 <table cellpadding
='2' cellspacing
='0' border
="0" align
="center">
90 <td
class='title_bar' colspan
="4" align
="center"><u
><?php
echo htmlspecialchars(xl('Add Custom Button'),ENT_QUOTES
);?
></u
></td
>
94 <td align
="center" class="title_bar_top ">#</td>
95 <td align
="center" class="title_bar_top "><?php
echo htmlspecialchars(xl('Value'),ENT_QUOTES
);?
></td
>
96 <td align
="center" class="title_bar_top "><?php
echo htmlspecialchars(xl('Display Name'),ENT_QUOTES
);?
></td
>
97 <td align
="center" class="title_bar_top "><?php
echo htmlspecialchars(xl('Order'),ENT_QUOTES
);?
></td
>
98 <td align
="center" class="title_bar_top "> 
;</td
>
102 $res = sqlStatement("SELECT * FROM template_users AS tu LEFT OUTER JOIN customlists AS cl ON cl.cl_list_slno=tu.tu_template_id
103 WHERE tu.tu_user_id=? AND cl.cl_list_type=6 AND cl.cl_deleted=0 ORDER BY cl.cl_order",array($_SESSION['authId']));
106 while($row = sqlFetchArray($res)){
108 $start = $row['cl_list_slno'];
110 $i = $row['cl_list_slno'];
113 <tr
class='<?php echo htmlspecialchars($class,ENT_QUOTES);?>' ><input type
='hidden' name
='<?php echo htmlspecialchars("hidid".$i,ENT_QUOTES);?>' value
='<?php echo htmlspecialchars($row['cl_list_slno
'],ENT_QUOTES);?>'>
114 <td align
='center'><input type
='text' name
="<?php echo htmlspecialchars("sl
".$i,ENT_QUOTES);?>" value
="<?php echo htmlspecialchars($sl,ENT_QUOTES);?>" readonly
="" style
="width:25px; background-color:#C9C9C9"/></td
>
115 <td align
='center'><input type
='text' name
="<?php echo htmlspecialchars("inshort
".$i,ENT_QUOTES);?>" size
="10" value
="<?php echo htmlspecialchars($row['cl_list_item_short'],ENT_QUOTES);?>" /></td
>
116 <td align
='center'><input type
='text' name
="<?php echo htmlspecialchars("designation
".$i,ENT_QUOTES);?>" value
="<?php echo htmlspecialchars($row['cl_list_item_long'],ENT_QUOTES);?>" /></td
>
117 <td align
='center'><input type
='text' name
='<?php echo htmlspecialchars("level".$i,ENT_QUOTES);?>' value
="<?php echo htmlspecialchars($row['cl_order'],ENT_QUOTES);?>" size
=1></td
>
118 <td align
='center'><input type
='checkbox' name
='<?php echo htmlspecialchars("chk".$i,ENT_QUOTES);?>' value
='<?php echo htmlspecialchars($row['cl_list_slno
'],ENT_QUOTES);?>'></td
>
126 <td align
='center'><input type
='text' name
="<?php echo htmlspecialchars('sl'.$i,ENT_QUOTES);?>" value
="<?php echo htmlspecialchars($sl,ENT_QUOTES);?>" readonly
="" style
="width:25px; background-color:#C9C9C9"/></td
>
127 <td align
='center'><input type
='text' name
="<?php echo htmlspecialchars('inshort'.$i,ENT_QUOTES);?>" size
="10" value
="" /></td
>
128 <td align
='center'><input type
='text' name
="<?php echo htmlspecialchars('designation'.$i,ENT_QUOTES);?>" value
=""/></td
>
129 <td align
='center'><input type
='text' name
='<?php echo htmlspecialchars("level".$i,ENT_QUOTES);?>' size
=1 ></td
>
132 <td align
='center'><input type
='text' name
="<?php echo htmlspecialchars('sl'.$i+1,ENT_QUOTES);?>" value
="<?php echo htmlspecialchars($sl+1,ENT_QUOTES);?>" readonly
="" style
="width:25px; background-color:#C9C9C9"/></td
>
133 <td align
='center'><input type
='text' name
="<?php echo htmlspecialchars('inshort'.$i+1,ENT_QUOTES);?>" size
="10" value
="" /></td
>
134 <td align
='center'><input type
='text' name
="<?php echo htmlspecialchars('designation'.$i+1,ENT_QUOTES);?>" value
=""/></td
>
135 <td align
='center'><input type
='text' name
="<?php echo htmlspecialchars('level'.$i+1,ENT_QUOTES);?>" size
=1 ></td
>
138 <td align
='center'><input type
='text' name
="<?php echo htmlspecialchars('sl'.$i+2,ENT_QUOTES);?>" value
="<?php echo htmlspecialchars($sl+2,ENT_QUOTES);?>" readonly
="" style
="width:25px; background-color:#C9C9C9"/></td
>
139 <td align
='center'><input type
='text' name
="<?php echo htmlspecialchars('inshort'.$i+2,ENT_QUOTES);?>" size
="10" value
="" /></td
>
140 <td align
='center'><input type
='text' name
="<?php echo htmlspecialchars('designation'.$i+2,ENT_QUOTES);?>" value
=""/></td
>
141 <td align
='center'><input type
='text' name
="<?php echo htmlspecialchars('level'.$i+2,ENT_QUOTES);?>" size
=1 ></td
>
143 <input type
="hidden" name
="count" value
="<?php echo htmlspecialchars($i+2,ENT_QUOTES);?>">
145 <td colspan
="5" align
="center">
146 <input type
='submit' name
='form_save' id
='form_save' value
="<?php echo htmlspecialchars(xl('Save'),ENT_QUOTES);?>" />
147 <input type
='submit' name
='form_delete' id
='form_delete' value
="<?php echo htmlspecialchars(xl('Delete'),ENT_QUOTES);?>" title
='<?php echo htmlspecialchars(xl('Select corresponding checkboxes to delete
'),ENT_QUOTES);?>'/>