function saveAgentTeams($agentteamid = NULL) { global $clientRoot; $result = ""; $am = new AgentManager(); if ($am->isAgentEditor()) { if (strlen($agentteamid) == 0) { $toSave = new agentteams(); $toSave = $am->getAndChangeAgentTeamsFromRequest($agentteamid); } else { $toSave = $am->getAndChangeAgentTeamsFromRequest($agentteamid); } if ($toSave != null) { $result = $am->saveNewAgentTeams($toSave); } else { $result = "Error in saving agent team record."; } } else { $result = "You aren't authorized to edit agent records."; } return $result; }