Beispiel #1
0
 public static function add($name, $description, array $options = array())
 {
     $id = array_key_exists('id', $options) ? $options['id'] : null;
     $active = array_key_exists('active', $options) ? $options['active'] : null;
     $data = array('name' => $name, 'description' => $description, 'active' => $active);
     if (!is_null($active)) {
         $data['id'] = $id;
     }
     $RoleObj = new RoleObj();
     if ($RoleObj->replace($data)) {
         Backend::addSuccess('Added role ' . $data['name']);
         $toret = true;
     } else {
         Backend::addError('Could not add role ' . $data['name']);
         $toret = false;
     }
     return $toret;
 }