コード例 #1
0
ファイル: member.php プロジェクト: BackupTheBerlios/k4bb
 public function Execute(Template $template, Session $session, $request)
 {
     $ug = new Usergroup($session);
     /* Get the usergroup */
     $group = $ug->getVisibleUsergroup(intval($request['gid']), $template);
     /* Create the ancestors bar */
     if (!$group instanceof Error) {
         $template = CreateAncestors($template, $group['name']);
     } else {
         return $group;
     }
     /* Set the template */
     $template->content = array('file' => 'lookup_group.html');
     /* Set the template variables to the group's info */
     $template['group_name'] = $group['name'];
     $template['group_id'] = $group['id'];
     $template['mod_name'] = $group['mod_name'];
     $template['mod_id'] = $group['mod_id'];
     $template['group_description'] = $group['description'];
     $limit = isset($_GET['limit']) ? intval($_GET['limit']) : 15;
     $start = isset($_GET['start']) ? intval($_GET['start']) : NULL;
     $extra = !is_null($limit) && !is_null($start) ? "LIMIT " . $start . ", " . $limit : "LIMIT 15";
     /* Get the users in this group */
     $users = DBA::Open()->Query("SELECT * FROM " . USER_IN_GROUP . " WHERE group_id = " . $group['id'] . " AND name != '" . $group['mod_name'] . "' {$extra}");
     /* Set the users to a list item */
     $template->users_in_usergroup = $users;
     /* Tell the template how many users there are in that group */
     $template['num_group_users'] = $users->NumRows();
     /* If we're not the user group's moderator, hide some of the mod functions */
     if ($session['user']['name'] != $group['mod_name']) {
         $template->add_user = array('hide' => TRUE);
         $template->delete_user = array('hide' => TRUE);
     }
     /* Set the number of queries */
     $template['num_queries'] = $session->dba->num_queries;
     return TRUE;
 }