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');
 }
 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;
     }
 }
Exemple #3
0
 function __construct()
 {
     // Call the Model constructor
     parent::__construct();
     $this->load->model($this->models, '', TRUE);
 }
 public function __construct()
 {
     // load database library into $this->db (can be omitted if not required)
     parent::__construct();
 }