Created
June 24, 2011 19:59
-
-
Save eminetto/1045552 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class UsersController extends Zend_Controller_Scaffolding { | |
public function init() { | |
parent::init(); | |
//configuração dos campos a serem mostrados | |
$fields = array ( | |
'name' => array ( | |
'title' => 'Nome', | |
'required' => true, | |
'filters' => array('StripTags'), | |
'skip' => false, | |
'searchable' => true, | |
'sortable' => true, | |
'sortBy' => 'asc', | |
), | |
'email' => array ( | |
'title' => 'E-mail', | |
'required' => true, | |
'filters' => array('StripTags'), | |
'validators' => array('emailAddress'), | |
'skip' => false, | |
'sortable' => true, | |
'sortBy' => 'desc', | |
'searchable' => true | |
), | |
'password' => array ( | |
'title' => 'Senha', | |
'required' => true, | |
'type' => 'password', | |
'filters' => array('StripTags'), | |
'skip' => 'list', | |
'sortBy' => 'desc', | |
//antes de salvar o campo ele vai executar esse método | |
'saveModifier' => 'Admin_UsersController::password', | |
), | |
'status' => array( | |
'title' => 'Situação', | |
'type' => 'select', | |
'skip' => false, | |
'sortable' => true, | |
'searchable' => true | |
), | |
'role' => array( | |
'title' => 'Permissões', | |
'type' => 'select', | |
'skip' => 'list' | |
), | |
); | |
$options = array( | |
'entityTitle' => 'Usuários', | |
'pagination' => true, | |
'csrfProtected' => false, | |
); | |
//cria o scaffolding passando o Model e as configurações | |
$this->initScaffolding(new Users(), $fields, $options); | |
} | |
/** | |
* gera o hash da senha | |
* | |
* @return void | |
* @author Elton Minetto | |
**/ | |
static public function password($val) { | |
return md5($val); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment