/** * Constructor * Needs to be called by any extending form to add default decorators * * @param array $groups */ public function __construct(array $groups) { $group = new Zend_Form_Element_Select('group', array('required' => true, 'label' => 'Group:')); foreach ($groups as $g) { $group->addMultiOption($g->get('id'), $g->get('name')); } $this->addElements(array(new Zend_Form_Element_Text('name', array('required' => true, 'label' => 'Fullname:', 'attribs' => array('class' => 'text span-5'), 'filters' => array('StripTags', 'StringTrim'), 'validators' => array('notEmpty'))), new Zend_Form_Element_Text('username', array('required' => true, 'label' => 'Username:'******'attribs' => array('class' => 'text span-5'), 'filters' => array('StripTags', 'StringTrim'), 'validators' => array('notEmpty', array('Regex', false, array('/^[\\w\\.\\-]+$/i'))))), new Zend_Form_Element_Text('mail', array('required' => true, 'label' => 'E-Mailaddress:', 'attribs' => array('class' => 'text span-5'), 'filters' => array('StripTags', 'StringTrim'), 'validators' => array('notEmpty', 'EmailAddress'))), $group, new Zend_Form_Element_Checkbox('active', array('required' => true, 'label' => 'User enabled:', 'checked' => true)), new Zend_Form_Element_Submit('saveBtn', array('label' => 'Save')))); parent::__construct(); }
/** * Constrcuts the form * * @param Admin_Model_DbRow_Role $role * @param array $groups * @param array $users * @param array $inherits */ public function __construct(Admin_Model_DbRow_Role $role, array $groups, array $users, array $inherits) { // create the dynamic multi options $selectGroups = new Zend_Form_Element_Multiselect('groups', array('label' => 'Groups:')); $selectUsers = new Zend_Form_Element_Multiselect('users', array('label' => 'Users:')); $inheritRole = new Zend_Form_Element_Multiselect('inherit', array('label' => 'Roles:', 'multiOptions' => array(0 => 'none'))); foreach ($groups as $group) { $selectGroups->addMultiOption($group->get('id'), $group->get('name')); } foreach ($users as $user) { $selectUsers->addMultiOption($user->get('id'), $user->get('name')); } foreach ($inherits as $inRole) { $inheritRole->addMultiOption($inRole->get('id'), $inRole->get('name')); } $this->addElements(array(new Zend_Form_Element_Text('name', array('required' => true, 'label' => 'Name of the role:', 'attribs' => array('class' => 'text span-5'), 'filters' => array('StripTags', 'StringTrim'), 'validators' => array('notEmpty'), 'value' => $role->get('name', ''), 'order' => 1)), new Zend_Form_Element_Textarea('description', array('label' => 'Description:', 'filters' => array('StripTags'), 'value' => $role->get('description'), 'order' => 2)), $selectGroups, $selectUsers, $inheritRole, new Zend_Form_Element_Submit('saveBtn', array('label' => 'Save', 'order' => 10)))); $this->addDisplayGroups(array(array(array('name', 'description'), 'metadata', array('legend' => 'General Informations')), array(array('groups', 'users'), 'roleassignments', array('legend' => 'Apply groups and users to this role')), array(array('inherit'), 'roleinherit', array('legend' => 'Inherit the rights from the following roles')))); parent::__construct(); }
/** * * @param Admin_Model_DbRow_Controller $controller */ public function __construct(Admin_Model_DbRow_Controller $controller) { $this->addElements(array(new Zend_Form_Element_Text('module', array('ignore' => true, 'label' => 'Module:', 'attribs' => array('class' => 'text span-4', 'readonly' => 'true'), 'value' => $controller->get('moduleName'), 'order' => 1)), new Zend_Form_Element_Text('controller', array('ignore' => true, 'label' => 'Controller:', 'attribs' => array('class' => 'text span-4', 'readonly' => 'true'), 'value' => $controller->get('controllerName'), 'order' => 2)), new Zend_Form_Element_Text('action', array('ignore' => true, 'label' => 'Action:', 'attribs' => array('class' => 'text span-4', 'readonly' => 'true'), 'value' => '', 'order' => 3)), new Zend_Form_Element_Textarea('description', array('label' => 'Description:', 'filters' => array('StripTags'), 'attribs' => array('class' => 'text span-6'), 'order' => 4)), new Zend_Form_Element_Submit('saveBtn', array('label' => 'Save', 'order' => 10)))); parent::__construct(); }
/** * Constructor */ public function __construct() { $this->addElements(array(new Zend_Form_Element_Text('name', array('required' => true, 'label' => 'Groupname:', 'attribs' => array('class' => 'text span-5'), 'filters' => array('StripTags', 'StringTrim'), 'validators' => array('notEmpty'))), new Zend_Form_Element_Textarea('description', array('label' => 'Description:', 'attribs' => array('class' => 'span-5'), 'filters' => array('StripTags', 'StringTrim'), 'validators' => array(array('StringLength', false, array(0, 255))))), new Zend_Form_Element_Submit('saveBtn', array('label' => 'Save')))); parent::__construct(); }
/** * Create form, so that the admin can change the users password * * @param Admin_Model_DbRow_User $user */ public function __construct(Admin_Model_DbRow_User $user) { $this->addElements(array(new Zend_Form_Element_Password('pass1', array('required' => true, 'label' => 'Password:'******'attribs' => array('class' => 'text span-5'), 'validators' => array('notEmpty', array('StringLength', false, array(8, 64))))), new Zend_Form_Element_Password('pass2', array('required' => true, 'label' => 'Repeat Password:'******'attribs' => array('class' => 'text span-5'), 'validators' => array('notEmpty', array('StringLength', false, array(8, 64))))), new Zend_Form_Element_Hidden('id', array('required' => true, 'value' => $user->get('id'))), new Zend_Form_Element_Submit('changepass', array('label' => 'Save')))); parent::__construct(); }