本文整理汇总了PHP中User_Model::__construct方法的典型用法代码示例。如果您正苦于以下问题:PHP User_Model::__construct方法的具体用法?PHP User_Model::__construct怎么用?PHP User_Model::__construct使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类User_Model
的用法示例。
在下文中一共展示了User_Model::__construct方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct($action, $title, $id = FALSE)
{
// Load the user
parent::__construct($id);
// Create the form
$this->form = new Forge($action, $title);
$this->form->input('username')->label(TRUE)->rules('required|length[5,32]')->value($this->object->username);
$this->form->input('email')->label(TRUE)->rules('required|length[5,127]|valid_email')->value($this->object->email);
$this->form->password('password')->label(TRUE)->rules('length[5,64]');
$this->form->password('confirm')->label(TRUE)->matches($this->form->password);
// Make sure that the username does not already exist
$this->form->username->callback(array($this, 'is_existing_user'));
if ($this->object->id == 0) {
// Password fields are required for new users
$this->form->password->rules('+required');
}
// // Find all roles
// $roles = new Role_Model;
// $roles = $roles->find(ALL);
//
// $options = array();
// foreach ($roles as $role)
// {
// // Add each role to the options
// $options[$role->name] = isset($this->roles[$role->id]);
// }
//
// // Create a checklist of roles
// $this->form->checklist('roles')->options($options)->label(TRUE);
// Add the save button
$this->form->submit('Save');
}
示例2:
function __construct($data = null)
{
parent::__construct($data);
$this->table_name = 'guides';
$this->primary_key = 'guides.guideId';
if ($data != null) {
$this->id = $data->guideId;
$this->userId = $data->userId;
}
}
示例3:
function __construct()
{
// Call the Model constructor
parent::__construct();
$this->load->model($this->models, '', TRUE);
}
示例4: __construct
public function __construct()
{
// load database library into $this->db (can be omitted if not required)
parent::__construct();
}