PageRenderTime 90ms CodeModel.GetById 85ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/webapp/modules/pc/page/c_event_member_list.php

https://github.com/openpne/OpenPNE2
PHP | 60 lines | 40 code | 12 blank | 8 comment | 5 complexity | 4f99aec3c2c87a8a4e9e2ab95837e12a MD5 | raw file
 1<?php
 2/**
 3 * @copyright 2005-2008 OpenPNE Project
 4 * @license   http://www.php.net/license/3_01.txt PHP License 3.01
 5 */
 6
 7class pc_page_c_event_member_list extends OpenPNE_Action
 8{
 9    function execute($requests)
10    {
11        $u = $GLOBALS['AUTH']->uid();
12
13        // --- リクエスト変数
14        $c_commu_topic_id = $requests['target_c_commu_topic_id'];
15        $page = $requests['page'];
16        // ----------
17
18        $c_topic = db_commu_c_topic4c_commu_topic_id_2($c_commu_topic_id);
19        $c_commu_id = $c_topic['c_commu_id'];
20
21        //--- 権限チェック
22        if (!db_commu_is_c_commu_view4c_commu_idAc_member_id($c_commu_id, $u)) {
23            handle_kengen_error();
24        }
25        //---
26
27        $this->set('c_commu', db_commu_c_commu4c_commu_id($c_commu_id));
28        $this->set('c_topic', $c_topic);
29
30        $this->set('inc_navi', fetch_inc_navi('c', $c_commu_id));
31        $this->set('page', $page);
32        $page_size = 50;
33        $c_event_member_list = db_commu_c_event_member_list4c_commu_topic_id($c_commu_topic_id, $page, $page_size);
34        $total_c_event_member = db_commu_count_c_event_member_list4c_commu_topic_id($c_commu_topic_id);
35
36        $start_num = ($page-1) * $page_size + 1;
37        $end_num = $page * $page_size;
38        if ($end_num > $total_c_event_member) {
39            $end_num = $total_c_event_member;
40        }
41
42        $end_page = ceil($total_c_event_member / $page_size);
43        for ($i=1; $i <= $end_page; $i++) {
44            $page_num[] = $i;
45        }
46        $this->set("page_num", $page_num);
47
48        $this->set('c_event_member_list', $c_event_member_list);
49        $this->set('total_c_event_member', $total_c_event_member);
50
51        $this->set('is_prev', ($start_num != 1));
52        $this->set('is_next', ($end_num != $total_c_event_member));
53
54        $this->set('start_num', $start_num);
55        $this->set('end_num', $end_num);
56        return 'success';
57    }
58}
59
60?>