<?php 
 class Application_Model_Form_UserNew extends MyWeb_Form
{

    public function init()
    {
        $root = 'index.php';
        $request = Zend_Controller_Front::getInstance()->getRequest();
        $getValue = $request->getParams();
        $path = explode($root, $request->getRequestUri());
        $translate = Zend_Registry::get('Zend_Translate');
        
        // nastaví atributy formuláře
        $this->setAction("new");
        $this->setMethod("post");
        $this->setAttrib("id", "form_user_new");
        //nacteni config souboru s definovan7mi fomularovymi prvky
        $config = new Zend_Config_Ini(APPLICATION_PATH . "/forms/userNew.ini");
        $this->setConfig($config);
        
        
        //***************************************************************************
         $element = $this->getElement('user_name');
         $element->setLabel($translate->translate('Name'));
        //***************************************************************************
         $element = $this->getElement('user_userName');
         $element->setLabel($translate->translate('Username'));
        //***************************************************************************
         $element = $this->getElement('user_passwd');
         $element->setLabel($translate->translate('Password'));
         //***************************************************************************
        //!!! hidden pole jsou nutna ve formulari protoze getValue porovnava hodnoty s prvky formulare
        
        $State_id_state = new Zend_Form_Element_Hidden('State_id_state');
        $State_id_state->setValue(NULL);
        $user_registrationDateTime = new Zend_Form_Element_Hidden('user_registrationDateTime');
        $user_registrationDateTime->setValue(NULL);
        //***************************************************************************
        
        // vytvoří formulářový prvek odesílací tlačítko
        $submitInsert = new Zend_Form_Element_Submit("send", array("label" => $translate->translate('NewUserSend')));
        // přidá formulářové prvky do formuláře
        $this->addElements(array(	$State_id_state,
        							$user_registrationDateTime
        						));
        $this->addDisplayGroup(array(
        								'user_name',
        								'user_userName',
        								'user_registrationDateTime',
        								'user_passwd',
        								'State_id_state'
        							),'formRoleEdit',array('legend' => $translate->translate('NewUser')));
        $this->addElements(array($submitInsert));
    }


}
