Exemple #1
0
 /**
  * Init function to set up form elements.
  *
  * @return void
  */
 public function init()
 {
     $this->setAttrib('id', 'create-new-client-form');
     $clientTypes = Repo_ClientType::getInstance()->getSelectArray();
     $clientTree = Repo_Client::getInstance()->getClientTree();
     // Build up the flat option array
     Functions_Common::$tempCache = array();
     Functions_Common::flattenOptionTree($clientTree, Functions_Common::$tempCache, 'id', 'name', 'children', '');
     $clientTreeOptions = array(' ' => ' ') + Functions_Common::$tempCache;
     // Name
     $this->addElement('text', 'client_name', array('decorators' => $this->_standardElementDecorator, 'class' => 'form-control', 'label' => 'Client Name', 'required' => true));
     // Parent
     $this->addElement('select', 'client_parent', array('decorators' => $this->_standardElementDecorator, 'class' => 'form-control', 'label' => 'Parent Client', 'required' => false));
     $this->getElement('client_parent')->addMultiOptions($clientTreeOptions);
     // Type
     $this->addElement('select', 'client_type', array('decorators' => $this->_standardElementDecorator, 'class' => 'form-control', 'label' => 'Type', 'required' => false));
     $this->getElement('client_type')->addMultiOptions($clientTypes);
     // ID
     $this->addElement('hidden', 'client_id', array('decorators' => $this->_buttonElementDecorator, 'required' => false));
 }