function saveAgentName($agentnameid = NULL) { global $clientRoot; $result = ""; $am = new AgentManager(); if ($am->isAgentEditor()) { if (strlen($agentnameid) == 0) { $toSave = new agentnames(); $toSave = $am->getAndChangeAgentNameFromRequest($agentnameid); } else { $toSave = $am->getAndChangeAgentNameFromRequest($agentnameid); } if ($toSave != null) { $result = $am->saveNewAgentName($toSave); } else { $result = "Error in saving agent name record."; } } else { $result = "You aren't authorized to edit agent records."; } return $result; }