コード例 #1
0
ファイル: Raidplan.php プロジェクト: ZerGabriel/Raidplanner
    /**
     * make raidplan object for display
     *
     */
    public function Get_Raidplan()
    {
        global $phpEx, $db;
        // populate properties
        $sql_array = array('SELECT' => ' rp.*, t.teams_id, t.team_name, t.team_size, u.username, u.user_colour ', 'FROM' => array(RP_RAIDS_TABLE => 'rp', RP_TEAMS => 't', USERS_TABLE => 'u'), 'WHERE' => ' t.teams_id = rp.raidteam
				AND rp.raidplan_id = ' . (int) $this->id . '
                AND rp.poster_id = u.user_id ');
        $sql = $db->sql_build_query('SELECT', $sql_array);
        //cache for 1 day
        $result = $db->sql_query($sql, 86400);
        $row = $db->sql_fetchrow($result);
        $db->sql_freeresult($result);
        if (!$row) {
            trigger_error('INVALID_RAIDPLAN');
        }
        $this->link = generate_board_url() . "/dkp.{$phpEx}?page=planner&view=raidplan&raidplanid=" . $this->id;
        $this->raid_id = $row['raid_id'];
        $this->accesslevel = $row['raidplan_access_level'];
        $this->poster = $row['poster_id'];
        $this->poster_url = get_username_string('full', $this->poster, $row['username'], $row['user_colour']);
        $this->group_id = $row['group_id'];
        $this->group_id_list = $row['group_id_list'];
        $this->event_type = $row['etype_id'];
        $this->invite_time = $row['raidplan_invite_time'];
        $this->start_time = $row['raidplan_start_time'];
        $this->end_time = $row['raidplan_end_time'];
        $this->all_day = $row['raidplan_all_day'];
        $this->day = $row['raidplan_day'];
        $this->subject = $row['raidplan_subject'];
        $this->body = $row['raidplan_body'];
        $this->bbcode['bitfield'] = $row['bbcode_bitfield'];
        $this->bbcode['uid'] = $row['bbcode_uid'];
        $this->signups_allowed = $row['track_signups'] == 0 ? false : true;
        $this->signups = array('yes' => (int) $row['signup_yes'], 'no' => (int) $row['signup_no'], 'maybe' => (int) $row['signup_maybe'], 'confirmed' => (int) $row['signup_confirmed']);
        $this->raidteam = $row['raidteam'];
        $this->raidteamname = $row['team_name'];
        $this->RaidTeamNeeded = (int) $row['team_size'];
        unset($row);
        $Points = new \bbdkp\controller\points\Points();
        $Member = new \bbdkp\controller\members\Members();
        $rpsignup = new RaidplanSignup($Points, $Member);
        $this->mychars = $rpsignup->getmychars($this->id);
        unset($rpsignup);
        // lock signup pane if you have no characters bound to your account
        $this->nochar = count($this->mychars) == 0 ? true : false;
        $this->locked = $this->nochar;
        // get array of raid roles
        $this->_get_raid_roles();
        // attach signoffs & signups to roles (available+confirmed)
        $this->_get_Signups($Points, $Member);
        $this->invite_list = $this->_set_InviteList($this->accesslevel, $this->group_id, $this->group_id_list);
    }