shibboleth authentication module #4554: add admin model
parent
8d0407e3ec
commit
4f0b753fa7
@ -0,0 +1,42 @@ |
||||
<?php |
||||
|
||||
require_once dirname(__FILE__) . '/scaffold/admin.class.php'; |
||||
|
||||
/** |
||||
* A Chamilo admin. Model for the Admin table. |
||||
* |
||||
* Should be moved to the core. It only exists because it is not available through |
||||
* the API. |
||||
* |
||||
* The _Admin objet is generated by the scaffolder. Admin inherits from it to allow |
||||
* modifications without touching the generated file. Don't modify _Admin as |
||||
* it may change in the future. Instead add modifications to this class. |
||||
* |
||||
* @license see /license.txt |
||||
* @author Laurent Opprecht <laurent@opprecht.info>, Nicolas Rod for the University of Geneva |
||||
*/ |
||||
class Admin extends _Admin |
||||
{ |
||||
|
||||
} |
||||
|
||||
/** |
||||
* Store for Admin objects. Interact with the database. Allows to save and retrieve |
||||
* admin objects. |
||||
* |
||||
* Should be moved to the core. It only exists because it is not available through |
||||
* the API. |
||||
* |
||||
* The _AdminStore objet is generated by the scaffolder. This class inherits from it to allow |
||||
* modifications without touching the generated file. Don't modify the _ object as |
||||
* it may change in the future. Instead add modifications to this class. |
||||
* |
||||
* @copyright (c) 2012 University of Geneva |
||||
* @license GNU General Public License - http://www.gnu.org/copyleft/gpl.html |
||||
* @author Laurent Opprecht <laurent@opprecht.info> |
||||
*/ |
||||
class AdminStore extends _AdminStore |
||||
{ |
||||
|
||||
|
||||
} |
@ -0,0 +1,131 @@ |
||||
<?php |
||||
/** |
||||
* This file is autogenerated. Do not modifiy it. |
||||
*/ |
||||
|
||||
/** |
||||
* |
||||
* Model for table admin |
||||
* |
||||
* @license see /license.txt |
||||
* @author Laurent Opprecht <laurent@opprecht.info>, Nicolas Rod for the University of Geneva |
||||
*/ |
||||
class _Admin |
||||
{ |
||||
|
||||
/** |
||||
* Store for Admin objects. Interact with the database. |
||||
* |
||||
* @return AdminStore |
||||
*/ |
||||
public static function store() |
||||
{ |
||||
static $result = false; |
||||
if (empty($result)) |
||||
{ |
||||
$result = new AdminStore(); |
||||
} |
||||
return $result; |
||||
} |
||||
|
||||
/** |
||||
* |
||||
* @return Admin |
||||
*/ |
||||
public static function create($data = null) |
||||
{ |
||||
return self::store()->create_object($data); |
||||
} |
||||
|
||||
public $user_id = null; |
||||
|
||||
|
||||
/** |
||||
* |
||||
* @return bool |
||||
*/ |
||||
public function save() |
||||
{ |
||||
return self::store()->save($this); |
||||
} |
||||
|
||||
} |
||||
|
||||
/** |
||||
* Store for Admin objects. Interact with the database. |
||||
* |
||||
* @copyright (c) 2012 University of Geneva |
||||
* @license GNU General Public License - http://www.gnu.org/copyleft/gpl.html |
||||
* @author Laurent Opprecht <laurent@opprecht.info> |
||||
*/ |
||||
class _AdminStore extends Store |
||||
{ |
||||
|
||||
/** |
||||
* |
||||
* @return AdminStore |
||||
*/ |
||||
public static function instance() |
||||
{ |
||||
static $result = false; |
||||
if (empty($result)) |
||||
{ |
||||
$result = new self(); |
||||
} |
||||
return $result; |
||||
} |
||||
|
||||
public function __construct() |
||||
{ |
||||
parent::__construct('admin', 'Admin', 'user_id'); |
||||
} |
||||
|
||||
/** |
||||
* |
||||
* @return Admin |
||||
*/ |
||||
public function get($w) |
||||
{ |
||||
$args = func_get_args(); |
||||
$f = array('parent', 'get'); |
||||
return call_user_func_array($f, $args); |
||||
} |
||||
|
||||
/** |
||||
* |
||||
* @return Admin |
||||
*/ |
||||
public function create_object($data) |
||||
{ |
||||
return parent::create_object($data); |
||||
} |
||||
|
||||
/** |
||||
* |
||||
* @return Admin |
||||
*/ |
||||
public function get_by_user_id($value) |
||||
{ |
||||
return $this->get(array('user_id' => $value)); |
||||
} |
||||
|
||||
/** |
||||
* |
||||
* @return bool |
||||
*/ |
||||
public function user_id_exists($value) |
||||
{ |
||||
return $this->exist(array('user_id' => $value)); |
||||
} |
||||
|
||||
/** |
||||
* |
||||
* @return bool |
||||
*/ |
||||
public function delete_by_user_id($value) |
||||
{ |
||||
return $this->delete(array('user_id' => $value)); |
||||
} |
||||
|
||||
|
||||
} |
Loading…
Reference in new issue