public function update_password($input) { $v = new InputValidator($input); $v->stringEqual('password2')->validate('password', 'Senha'); // $this->validateToken($input['token'], $v); // $v->throwException(); // $f = new TableFilter($this->_table, $input); $f->crypted()->filter('password'); $f->null()->filter('password_change_date'); // $this->_dao->update($this->_table, array('id_admin = ?' => $input['token'])); }
public function restore($itens) { foreach ($itens as $item) { $entity = $this->_entities->getEntity($item['name']); $entity_id = $entity->getId(); $entity_title = $entity->getTitle(); $entity_tbl = $entity->getTbl(); $entity_sequence = $entity->getSequence(); $model = $entity->getModel(); $tableHistory = $model->getById($item['id']); // if ($parent_title = $this->hasParentOnTrash($entity, $tableHistory)) { throw new Exception('Favor restaurar o ítem ' . $parent_title . ' primeiro'); } // $table = new Table($entity_tbl); $f = new TableFilter($table, array('is_del' => '0')); if (count($entity_sequence)) { if (isset($entity_sequence['dependence'])) { if (is_array($entity_sequence['dependence'])) { foreach ($entity_sequence['dependence'] as $dp) { $table->{$dp} = $tableHistory[$dp]; } } else { $table->{$entity_sequence['dependence']} = $tableHistory[$entity_sequence['dependence']]; } } $f->sequence($this->_dao, $entity)->filter('sequence'); } $f->intval()->filter('is_del'); $f->null()->filter('del_date'); $this->_dao->update($table, array($entity_id . ' = ?' => $item['id'])); $this->log('R', $tableHistory[$entity_title], $table); } }