Skip to content
Snippets Groups Projects
Commit f6e18b4e authored by Jared Hancock's avatar Jared Hancock
Browse files

Add delete support for Teams

parent dc1e667a
Branches
Tags
No related merge requests found
...@@ -136,6 +136,23 @@ class Team { ...@@ -136,6 +136,23 @@ class Team {
return true; return true;
} }
function delete() {
global $thisstaff;
if(!$thisstaff || !($id=$this->getId()))
return false;
# Remove members of this team
db_query('DELETE FROM '.TEAM_MEMBER_TABLE
.' WHERE team_id='.db_input($id));
# Remove the team
$res = db_query(
'DELETE FROM '.TEAM_TABLE.' WHERE team_id='.db_input($id)
.' LIMIT 1');
return (db_affected_rows($res) == 1);
}
/* ----------- Static function ------------------*/ /* ----------- Static function ------------------*/
function lookup($id){ function lookup($id){
return ($id && is_numeric($id) && ($team= new Team($id)) && $team->getId()==$id)?$team:null; return ($id && is_numeric($id) && ($team= new Team($id)) && $team->getId()==$id)?$team:null;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment