Example #1
0
 function group()
 {
     $this->authorize('administrator', 'manager');
     if ($_GET['group'] <= 0) {
         $_GET['group'] = $_SESSION['group'];
     }
     $data = $this->fetchAll("SELECT userid, realname FROM " . DB_PREFIX . "user WHERE user_group = " . intval($_GET['group']) . " ORDER BY user_order,id");
     $hash['user'] = array();
     if (is_array($data) && count($data) > 0) {
         foreach ($data as $row) {
             $hash['user'][$row['userid']] = $row['realname'];
         }
         $user = implode("','", array_keys($hash['user']));
         $field = implode(',', $this->schematize());
         $query = sprintf("SELECT %s FROM %s WHERE (timecard_year = %d) AND (timecard_month = %d) AND (owner IN ('%s')) ORDER BY timecard_date", $field, $this->table, $_GET['year'], $_GET['month'], $user);
         $hash['list'] = $this->fetchAll($query);
     }
     $hash['group'] = $this->findGroup();
     $config = new Config($this->handler);
     $hash['config'] = $config->configure('timecard');
     return $hash;
 }