C:\$Recycle.Bin\S-1-5-21-3967099092-2644009230-141905953-500\$R30CG93\tcpro\absencegroup.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
<?php
/**
 * absencegroup.php
 * 
 * Displays a dialog to assign absence types to groups
 * 
 * @package TeamCalPro
 * @version 3.3.001 
 * @author George Lewe
 * @copyright Copyright (c) 2004-2010 by George Lewe
 * @link http://www.lewe.com
 * @license http://www.lewe.com/tcpro/doc/license.txt Extended GNU Public License
 */

//echo "<script type=\"text/javascript\">alert(\"Debug: \");</script>";

/**
 * Set parent flag to control access to child scripts 
 */
define'_VALID_TCPRO');

/**
 * Includes 
 */
require ("config.tcpro.php");
require_once (
"includes/functions.tcpro.php");
getOptions();
if (
strlen($CONF['options']['lang'])) require ("includes/lang/" $CONF['options']['lang'] . ".tcpro.php");
else                                  require (
"includes/lang/english.tcpro.php");

require_once(
"includes/tcabsence.class.php");
require_once(
"includes/tcabsencegroup.class.php");
require_once(
"includes/tcgroup.class.php");
require_once(
"includes/tclog.class.php" );
require_once(
"includes/tclogin.class.php" );

$A = new tcAbsence;
$AG = new tcAbsenceGroup;
$G = new tcGroup;
$L = new tcLogin
$LOG = new tcLog

/**
 * Check if allowed 
 */
if (!checkAuth("admin")) {
   
// Not authorized. Get outta here
   
jsReload("index.php");
}

if (isset(
$_POST['btn_assign'])) {
   
   
/**
    * First unassign from all groups 
    */
   
$AG->unassignAbsence($_REQUEST['abs']);
   
   
/**
    * Now assign the new selection 
    */
   
$logthis=false
   foreach(
$_POST as $key=>$value) {
      if (
substr($key,0,2)=="a-") {
         
//echo "<script type=\"text/javascript\">alert(\"Debug: ".$key."\");</script>";
         
if (strlen($key) && !$AG->isAssigned($_REQUEST['abs'],substr($key,2))) {
            
$AG->assign($_REQUEST['abs'],substr($key,2));
            
$logthis=true;  
         }
      }
   }
      
   if (
$logthis) {
      
$LOG->log("logAbsence"$L->checkLogin(), "Absence to Group assignment changed for: " $_REQUEST['absname']);
      
sendNotification("absencechange"$_POST['abs_symbolhidden'], "");
   }

} elseif (isset(
$_POST['btn_assign_all'])) {

   
/**
    * First unassign from all groups 
    */
   
$AG->unassignAbsence($_REQUEST['abs']);
   
   
/**
    * Now assign to all groups 
    */
   
$Gquery  "SELECT groupname FROM `".$G->table."`;";
   
$Gresult $G->db->db_query($Gquery);
   while ( 
$Grow=$G->db->db_fetch_array($Gresult,MYSQL_ASSOC) ) {
      
$AG->assign($_REQUEST['abs'],$Grow['groupname']);
   }

} elseif (isset(
$_POST['btn_done'])) {

   
jsCloseAndReload("absences.php");

}

include (
$CONF['app_root'] . "includes/header.html.inc.php");
?>
<body>
   <div id="overDiv" style="position:absolute; visibility:hidden; z-index:1000;"></div>
   <form name="form1" method="post" action="<?=$_SERVER['PHP_SELF']?>?abs=<?=$_REQUEST['abs']?>&amp;absname=<?=$_REQUEST['absname']?>">
   <table class="dlg">
      <tr>
         <td class="dlg-header">
            <?php printDialogTop($LANG['abs_group_title'],"absence_assignment.html","ico_group.png"); ?>
         </td>
      </tr>
      <tr>
         <td class="dlg-body">
            <?php printDialogFrameTop($LANG['abs_group_frame_title'],"500"); ?>
               <table width="99%">
                  <tr class="dlg-body">
                     <td class="dlg-frame-body">
                        <?=$LANG['abs_group_hint']."<strong>".$_REQUEST['absname']?></strong>
                        <br />&nbsp;
                     </td>
                  </tr>
               </table>
               <table width="99%">
                  <?php
                     $Gquery  
"SELECT * FROM `".$G->table."` ORDER BY `groupname`;";
                     
$Gresult $G->db->db_query($Gquery);
                     
$rowstyle=1;
                     while ( 
$row=$G->db->db_fetch_array($Gresult,MYSQL_ASSOC) ) {
                        
$assigned="";
                        if (
$AG->isAssigned($_REQUEST['abs'],$row['groupname'])) {
                           
$assigned="CHECKED";
                        }
                        
$gname $row['groupname'];
                        echo 
'<tr class="row'.$rowstyle.'">
                           <td class="dlg-frame-body" width="24">
                              <input name="a-'
.$gname.'" value="a-'.$gname.'" type="checkbox" '.$assigned.'>'.'
                           </td>
                           <td class="dlg-frame-body" style="padding-left: 4px;">
                              '
.$gname.'
                           </td>
                        </tr>
                        '
;
                        if (
$rowstyle$rowstyle=0; else $rowstyle=1;
                     }
                  
?>
               </table>
               <br />
               <input name="btn_assign" type="submit" class="button" value="<?=$LANG['btn_assign']?>" onmouseover="this.className='button-over';" onmouseout="this.className='button';">
               <input name="btn_assign_all" type="submit" class="button" value="<?=$LANG['btn_assign_all']?>" onmouseover="this.className='button-over';" onmouseout="this.className='button';">
            <?php printDialogFrameBottom(); ?>
         </td>
      </tr>
      <tr>
         <td class="dlg-menu">
            <input name="btn_help" type="button" class="button" onclick="javascript:this.blur(); openPopup('help/<?=$CONF['options']['helplang']?>/html/index.html?absence_assignment.html','help','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,titlebar=0,resizable=0,dependent=1,width=740,height=500');" value="<?=$LANG['btn_help']?>" onmouseover="this.className='button-over';" onmouseout="this.className='button';">
            <input name="btn_close" type="button" class="button" onclick="javascript:window.close();" value="<?=$LANG['btn_close']?>" onmouseover="this.className='button-over';" onmouseout="this.className='button';">
            <input name="btn_done" type="submit" class="button" value="<?=$LANG['btn_done']?>" onmouseover="this.className='button-over';" onmouseout="this.className='button';">
         </td>
      </tr>
   </table>
   </form>
<?php
include_once ($CONF['app_root'] . "includes/footer.html.inc.php");
?>