function remove_team_leader($team_id, $user_id) { if (!isAjax()) { return false; } if (!$this->tank_auth->is_team_leader($team_id) && !$this->tank_auth->is_allowed()) return false; $this->viewdata["function_title"] = "Removing team leader..."; $member = new Membership(); $member->remove_team_leader($team_id, $user_id); flash_notice('notice', _('You have removed the user from his team leader position.')); $team = new Team($team_id); echo json_encode(array('href' => site_url('/admin/members/teams/' . $team->stub))); }
function leave_leadership($team_stub) { $this->viewdata["navbar"] = ""; $team = new Team(); $team->where('stub', $team_stub)->get(); if ($team->result_count() != 1) { show_404(); } if (!$this->tank_auth->is_team_leader($team->id) && !$this->tank_auth->is_allowed()) { show_404(); } if ($this->input->post()) { $member = new Membership(); if (!$member->remove_team_leader($team->id)) { return show_404(); } redirect('/account/teams/'); } $this->viewdata["function_title"] = _("Leave team leadership"); $data["team_name"] = $team->name; $data["team_id"] = $team->id; $this->viewdata["main_content_view"] = $this->load->view('account/profile/leave_leadership', $data, TRUE); $this->load->view("account/default.php", $this->viewdata); }
function remove_team_leader($team_id, $user_id) { if (!isAjax()) { return false; } if (!$this->tank_auth->is_team_leader($team_id) && !$this->tank_auth->is_allowed()) { return false; } $this->viewdata["function_title"] = "Removing team leader..."; $member = new Membership(); $member->remove_team_leader($team_id, $user_id); $user = new User($user_id); flash_notice('notice', sprintf(_('You have stripped %s of their team leader position.'), $user->username)); $team = new Team($team_id); $this->output->set_output(json_encode(array('href' => site_url('/admin/members/teams/' . $team->stub)))); }