function teams() { if ($this->input->post('action')) { if ($this->input->post('action') == 'apply_with_team_name') { if (($error = $this->_apply()) !== TRUE) { $data["errors"]['team_name'] = $error; } } } // this is a datamapper object $teams = $this->tank_auth->is_team(); $data["teams"] = $teams ? $teams->all_to_array(array('name', 'stub')) : array(); $teams_leaded = $this->tank_auth->is_team_leader(); $data["teams_leaded"] = $teams_leaded ? $teams_leaded->all_to_array(array('name', 'stub')) : array(); $members = new Membership(); $members->get_applicants(); $data["requests"] = $members; $members = new Membership(); $members->get_applications(); $data["applications"] = $members; $data["user_id"] = $this->tank_auth->get_user_id(); $this->viewdata["function_title"] = _("Your teams"); $this->viewdata["main_content_view"] = $this->load->view('account/profile/teams', $data, TRUE); $this->load->view("account/default.php", $this->viewdata); }
function _get_memberships() { $application = array(); $members = new Membership(); if ($members->get_applications()) { foreach ($members->all as $key => $applicant) { $application[] = array( $applicant->user->username, $applicant->team->name, $applicant->user->email, array( 'display' => 'buttoner', 'href' => site_url('/admin/members/accept_application/' . $applicant->team->id . '/' . $applicant->user->id), 'text' => _('Accept'), 'plug' => _('Do you really want to accept this applicant?') ), array( 'display' => 'buttoner', 'href' => site_url('/admin/members/reject_application/' . $applicant->team->id . '/' . $applicant->user->id), 'text' => _('Reject'), 'plug' => _('Do you really want to reject this applicant?') ) ); } $list = tabler($application, TRUE, FALSE); $data = array('application' => $list, 'section' => _('Pending applicants')); $this->viewdata['main_content_view'] .= $this->load->view("admin/dashboard/applicants", $data, TRUE); } }