Exemple #1
0
 public function insert($input)
 {
     $input['file'] = array($input['file']);
     $v = new InputValidator($input);
     $has_file = $v->upload()->validate('file', 'Foto');
     $v->throwException();
     //
     $f = new TableFilter($this->_table, $input);
     $f->labelCredit()->filter('file');
     $f->newId()->filter($this->_id_photo_item);
     $f->string()->filter($this->_id_photo);
     $f->string()->filter('sequence');
     //
     $mf = new MoveFiles();
     $f->uploaded("/system/uploads/{$this->_photo}/{$input[$this->_id_photo]}/{$this->_photo_item}/{$this->getId()}/file", $has_file, $mf)->filter('file');
     //
     $mf->move();
     $this->_dao->insert($this->_table);
 }
Exemple #2
0
 public function update($input)
 {
     $v = new InputValidator($input);
     $v->string()->validate('name', 'Nome');
     $v->stringEmail()->validate('email', 'E-mail');
     $has_avatar = $v->upload()->validate('avatar', 'Avatar');
     $v->throwException();
     //
     $f = new TableFilter($this->_table, $input);
     $f->string()->filter('name');
     $f->string()->filter('email');
     $f->crypted()->filter('password');
     //
     $mf = new MoveFiles();
     $f->uploaded("/system/uploads/admin/{$this->getId()}/avatar", $has_avatar, $mf)->filter('avatar');
     //
     $mf->move();
     //
     $this->dao_update();
     $this->relogin();
 }