Example #1
0
 /**
  * Constructor
  * 
  * @param   boolean $autoinit
  */
 public function __construct($id = NULL)
 {
     parent::__construct('users');
     if ($id) {
         cogear()->db->where('id', $id);
         $this->find();
     }
 }
Example #2
0
 /**
  * Найти все
  */
 public function findAll()
 {
     if ($result = parent::findAll()) {
         foreach ($result as $file) {
             $file->getInfo();
         }
     }
     return $result;
 }
Example #3
0
 /**
  * Delete
  *
  * @return boolean
  */
 public function delete()
 {
     if ($result = parent::delete()) {
         if ($childs = $this->getChilds()) {
             foreach ($childs as $child) {
                 $child->delete();
             }
         }
     }
     return $result;
 }
Example #4
0
 /**
  * Save page
  */
 public function save()
 {
     // Event call
     event('page.save.before', $this);
     parent::save();
     // Generate hierarchy path
     $this->genPath();
     // Update object data
     $this->update();
     // Event call
     event('page.save.after', $this);
 }
Example #5
0
 /**
  *
  */
 public function insert($data = NULL)
 {
     if ($result = parent::insert($data)) {
         event('user.insert', $this, $data, $result);
     }
     return $result;
 }
Example #6
0
 /**
  * Render post
  */
 public function render($template = NULL)
 {
     event('post.render', $this);
     if (!$this->teaser) {
         $this->views++;
         $this->cache(FALSE);
         $this->update(array('views' => $this->views));
     }
     return parent::render($template);
 }