当前位置: 首页>>代码示例>>PHP>>正文


PHP Zend_Form::getElement方法代码示例

本文整理汇总了PHP中Zend_Form::getElement方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Form::getElement方法的具体用法?PHP Zend_Form::getElement怎么用?PHP Zend_Form::getElement使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Zend_Form的用法示例。


在下文中一共展示了Zend_Form::getElement方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: addAction

 public function addAction()
 {
     $this->buildForm("admin/group/save");
     $this->gForm->getElement('tmp_id')->setValue(Util_Guid::generate());
     $this->gForm->getElement('url')->setValue('http://');
     $this->gForm->getElement('user_responsible')->setValue(UGD_Login_Manager::getInstance()->getActiveUser()->getId());
 }
开发者ID:rdohms,项目名称:ugDirectory,代码行数:7,代码来源:GroupController.php

示例2: createForm

 /**
  * Create the setting form and populate with the custom setting values
  * 
  * @param integer $groupid
  */
 public static function createForm($groupid)
 {
     $form = new Zend_Form(array('action' => '/admin/settings/index/groupid/' . $groupid, 'method' => 'post'));
     $form->addElementPrefixPath('Shineisp_Decorator', 'Shineisp/Decorator/', 'decorator');
     $records = Doctrine_Query::create()->from('SettingsParameters s')->where('group_id = ?', $groupid)->execute(array(), Doctrine_Core::HYDRATE_ARRAY);
     if (!empty($records)) {
         foreach ($records as $record) {
             // Custom style added to the textareas
             $style = $record['type'] == "textarea" ? array('rows' => 4) : array();
             $form->addElement($record['type'], $record['var'], $style + array('decorators' => array('Bootstrap'), 'filters' => array('StringTrim'), 'label' => $record['name'], 'description' => $record['description'], 'class' => 'form-control obj_' . $record['var']));
             if (!empty($record['config'])) {
                 $config = json_decode($record['config'], true);
                 if (!empty($config['class']) && class_exists($config['class']) && !empty($config['method']) && method_exists($config['class'], $config['method'])) {
                     $class = $config['class'];
                     $method = $config['method'];
                     $data = call_user_func(array($class, $method));
                     if (!empty($data)) {
                         if ($record['type'] == "select") {
                             $form->getElement($record['var'])->setMultiOptions($data);
                         } else {
                             $form->getElement($record['var'])->setValue($data);
                         }
                     }
                 }
             }
         }
     }
     $settings = self::getValues(Settings::find_by_GroupId($groupid));
     $form->populate($settings);
     return $form;
 }
开发者ID:kokkez,项目名称:shineisp,代码行数:36,代码来源:SettingsParameters.php

示例3: simpleAction

 public function simpleAction(\Zend_Form $form, \Application\Entity\Entity $model, $preventDefault = false)
 {
     $em = EntityManager::getInstance();
     $form->setAction($this->getRequest()->getRequestUri());
     if ($form->getElement("parent")) {
         $form->getElement("parent")->setValue($this->getRequest()->getParam("parent"));
     }
     if ($this->getRequest()->isPost() && $form->isValid($_POST)) {
         call_user_func(array($this->getActionController(), self::SET_MODEL_METHOD), $form, $model);
         $em->persist($model);
         if ($preventDefault == false) {
             $this->simpleEndAction();
         }
         return true;
     }
 }
开发者ID:sp1ke77,项目名称:MLM-1,代码行数:16,代码来源:FormAction.php

示例4: addElementBusunitId

 /**
  * Adds an element BusUnitId.<br/><br/>
  * Defaults:<br/>
  * name         = busunit_id<br/>
  * requires     = true<br/>
  * label        = Business unit<br/>
  * placeholder  = 'Choose a business unit'<br/>
  * dimension    = 6<br/>
  * modelfield   = busunit_id<br/>
  * firstvaluenull  = true
  * 
  * @param Zend_Form $form The Zend_Form object where the element will be added
  * @param array $options The options to pass in the element
  */
 public function addElementBusunitId($form, $options = array())
 {
     $elementName = isset($options['name']) ? $options['name'] : 'busunit_id';
     $modelField = isset($options['modelfield']) ? $options['modelfield'] : 'busunit_id';
     $form->addElement('select', $elementName, array('filters' => array('StringTrim'), 'label' => isset($options['label']) ? $options['label'] : 'Business unit', 'dimension' => isset($options['dimension']) ? $options['dimension'] : 6, 'placeholder' => 'Choose a business unit', 'required' => isset($options['required']) ? $options['required'] : true, 'value' => $this->_model ? $this->_model->{$modelField} : ''));
     $el = $form->getElement($elementName);
     $firstvaluenull = isset($options['firstvaluenull']) ? $options['firstvaluenull'] : true;
     if ($firstvaluenull) {
         $el->addMultiOption(null, null);
     }
     /////////////////////
     // Add Headquarters
     $bud = new Busunit_Domain_Headquarters();
     $bu = $bud->getByAppAccount(Zend_Auth::getInstance()->getIdentity()->appaccount_id);
     $el->addMultiOption($bu->getId(), $bu->getName());
     // Add Branchs
     $bud = new Busunit_Domain_Branch();
     $bu = $bud->getAll('name');
     foreach ($bu as $busunit) {
         $el->addMultiOption($busunit->getId(), $busunit->getName());
     }
     // set value
     if ($this->_model && $this->_model->{$modelField}) {
         $el->setValue($this->_model->{$modelField});
     } else {
         $el->setValue(null);
     }
 }
开发者ID:brunopbaffonso,项目名称:ongonline,代码行数:42,代码来源:Util.php

示例5: editformAction

 /**
  * editformAction
  * @author Thomas Schedler <tsh@massiveart.com>
  * @version 1.0
  */
 public function editformAction()
 {
     $this->core->logger->debug('users->controllers->UserController->editformAction()');
     try {
         $arrGroups = $this->getModelUsers()->getUserGroups($this->getRequest()->getParam('id'));
         if (count($arrGroups) > 0) {
             $this->arrGroups = array();
             foreach ($arrGroups as $objGroup) {
                 $this->arrGroups[] = $objGroup->idGroups;
             }
         }
         $this->initForm();
         $this->objForm->setAction('/zoolu/users/user/edit');
         $this->objUser = $this->getModelUsers()->getUserTable()->find($this->getRequest()->getParam('id'))->current();
         foreach ($this->objForm->getElements() as $objElement) {
             $name = $objElement->getName();
             if (isset($this->objUser->{$name})) {
                 $objElement->setValue($this->objUser->{$name});
             }
         }
         $this->objForm->getElement('language')->setValue($this->objUser->idLanguages);
         $this->view->form = $this->objForm;
         $this->view->formTitle = $this->core->translate->_('Edit_User');
         $this->renderScript('form.phtml');
     } catch (Exception $exc) {
         $this->core->logger->err($exc);
     }
 }
开发者ID:BGCX261,项目名称:zoolu-svn-to-git,代码行数:33,代码来源:UserController.php

示例6: getForm

 /**
  * @return Zend_Form
  */
 public function getForm()
 {
     static $form;
     if (null === $form) {
         $form = new Zend_Form();
         $form->addElement('text', 'name', array('label' => _('Name'), 'required' => true))->addElement('text', 'organisationUnit', array('label' => _('Organisation unit')))->addElement('text', 'website', array('label' => _('Website')))->addElement('text', 'email', array('label' => _('E-mail')))->addElement('text', 'streetAddress', array('label' => _('Street Address')))->addElement('text', 'locality', array('label' => _('Locality')))->addElement('text', 'postalCode', array('label' => _('Postal Code')))->addElement('text', 'countryName', array('label' => _('Country Name')))->addElement('submit', 'submit', array('label' => _('Submit')));
         $form->getElement('email')->addValidator(new Zend_Validate_EmailAddress());
         try {
             $form->getElement('postalCode')->addValidator(new Zend_Validate_PostCode());
         } catch (Zend_Validate_Exception $e) {
             //no valid locale found, so be it...
         }
         $form->setDefaults($this->toArray());
     }
     return $form;
 }
开发者ID:rubensworks,项目名称:OpenSKOS,代码行数:19,代码来源:Tenant.php

示例7: addElementJobFunctionId

 /**
  * Adds an element JobFunctionId.<br/><br/>
  * Defaults:<br/>
  * name         = job_function_id<br/>
  * requires     = true<br/>
  * label        = Business unit<br/>
  * placeholder  = 'Choose a job function'<br/>
  * dimension    = 6<br/>
  * modelfield   = job_function_id<br/>
  * firstvaluenull  = true
  * 
  * @param Zend_Form $form The Zend_Form object where the element will be added
  * @param array $options The options to pass in the element
  */
 public function addElementJobFunctionId($form, $options = array())
 {
     $elementName = isset($options['name']) ? $options['name'] : 'job_function_id';
     $modelField = isset($options['modelfield']) ? $options['modelfield'] : 'job_function_id';
     $form->addElement('select', $elementName, array('filters' => array('StringTrim'), 'label' => isset($options['label']) ? $options['label'] : 'Job function', 'dimension' => isset($options['dimension']) ? $options['dimension'] : 6, 'placeholder' => 'Choose a job function', 'required' => isset($options['required']) ? $options['required'] : true, 'value' => $this->_model ? $this->_model->{$modelField} : ''));
     $el = $form->getElement($elementName);
     $firstvaluenull = isset($options['firstvaluenull']) ? $options['firstvaluenull'] : true;
     if ($firstvaluenull) {
         $el->addMultiOption(null, null);
     }
     /**
      * Add job functions
      */
     $jfd = new Staff_Domain_Jobfunction();
     $jf = $jfd->getAll('name');
     foreach ($jf as $item) {
         $el->addMultiOption($item->getId(), $item->getName());
     }
     // set value
     if ($this->_model && $this->_model->{$modelField}) {
         $el->setValue($this->_model->{$modelField});
     } else {
         $el->setValue(null);
     }
 }
开发者ID:brunopbaffonso,项目名称:ongonline,代码行数:39,代码来源:Util.php

示例8: addOptionsToForm

 public static function addOptionsToForm(Zend_Form $form, $options, $fieldName, $attributeName)
 {
     $arr = array();
     foreach ($options as $option) {
         $arr[$option->id] = $option->{$attributeName};
     }
     $form->getElement($fieldName)->setMultiOptions($arr);
 }
开发者ID:DBezemer,项目名称:server,代码行数:8,代码来源:PackageHelper.php

示例9: SetValueToFormField

 public static function SetValueToFormField(Zend_Form $form, $fieldName, $value)
 {
     try {
         $field = $form->getElement($fieldName);
     } catch (Exception $e) {
         throw new C3op_Util_FormFieldValueSetterException("Cant find %s element", $fieldName);
     }
     $field->setValue($value);
 }
开发者ID:racporto,项目名称:c3op,代码行数:9,代码来源:FormFieldValueSetter.php

示例10: makeOptionCheckbox

 public function makeOptionCheckbox(Zend_Form $form, $elements, $label = 'Options', $displayGroupName = 'options')
 {
     foreach ($elements as $element) {
         $form->getElement($element)->setAttrib('noFormItem', true);
     }
     $form->addDisplayGroup($elements, $displayGroupName);
     $form->getDisplayGroup($displayGroupName)->setAttrib('class', 'form-checkbox')->setAttrib('formItem', 'true')->setLegend($label);
     return $form;
 }
开发者ID:netconstructor,项目名称:Centurion,代码行数:9,代码来源:GridForm.php

示例11: addPackagesToForm

 public static function addPackagesToForm(Zend_Form $form, $packages)
 {
     $arr = array();
     $arr[-1] = "N/A";
     foreach ($packages as $package) {
         $arr[$package->id] = $package->name;
     }
     $form->getElement('partner_package')->setMultiOptions($arr);
 }
开发者ID:richhl,项目名称:kalturaCE,代码行数:9,代码来源:PackageHelper.php

示例12: getForm

 /**
  * @return Zend_Form
  */
 public function getForm()
 {
     static $form;
     if (null === $form) {
         $form = new Zend_Form();
         $form->addElement('text', 'name', array('label' => _('Name'), 'required' => true))->addElement('text', 'organisationUnit', array('label' => _('Organisation unit')))->addElement('text', 'website', array('label' => _('Website')))->addElement('text', 'email', array('label' => _('E-mail')))->addElement('text', 'streetAddress', array('label' => _('Street Address')))->addElement('text', 'locality', array('label' => _('Locality')))->addElement('text', 'postalCode', array('label' => _('Postal Code')))->addElement('text', 'countryName', array('label' => _('Country Name')))->addElement('checkbox', 'enableStatusesSystem', array('label' => _('Enable the statuses system for concepts. (check help below *)'), 'required' => false))->addElement('submit', 'submit', array('label' => _('Submit')));
         $form->getElement('email')->addValidator(new Zend_Validate_EmailAddress());
         $form->setDefaults($this->toArray());
     }
     return $form;
 }
开发者ID:olhsha,项目名称:OpenSKOS2tempMeertens,代码行数:14,代码来源:Tenant.php

示例13: addPackagesToForm

 public static function addPackagesToForm(Zend_Form $form, $packages, $fieldName, $addDefult = true, $defaultName = "N/A")
 {
     $arr = array();
     if ($addDefult) {
         $arr[''] = $defaultName;
     }
     foreach ($packages as $package) {
         $arr[$package->id] = $package->name;
     }
     $form->getElement($fieldName)->setMultiOptions($arr);
 }
开发者ID:DBezemer,项目名称:server,代码行数:11,代码来源:PackageHelper.php

示例14: saveAction

 public function saveAction()
 {
     $this->_helper->viewRenderer->setNoRender(true);
     $message = array("success" => 0, "message" => "Please Correct the Errors Below!");
     if ($this->_addForm->isValid($_POST)) {
         //As everything is ok, save it...
         $task = $this->_dataTable->createRow();
         $task->name = $this->_addForm->getElement("name")->getValue();
         $task->description = $this->_addForm->getElement("desc")->getValue();
         $time = $this->_addForm->getElement("end_date")->getValue();
         if (!empty($time)) {
             $task->end_date = date("Y-m-d", strtotime($time));
         }
         $task->status = Task::STATUS_OPEN;
         $task->save();
         $message["success"] = 1;
         $message["message"] = "Task is saved successfully! Wait For Redirection!";
     } else {
         $message["errors"] = $this->_addForm->getErrors();
     }
     echo json_encode($message);
 }
开发者ID:radalin,项目名称:pgday2012-task,代码行数:22,代码来源:IndexController.php

示例15: getElement

 /**
  * Wrap parent to provide a default Zend_View to
  * the element, if none is given
  *
  * @param string $elementName
  * @return NULL|Zend_Form_Element
  */
 public function getElement($elementName)
 {
     $element = parent::getElement($elementName);
     if (!isset($element) || FALSE == $element instanceof Zend_Form_Element) {
         return NULL;
     }
     if (NULL == $element->getView()) {
         if (NULL == $this->getView()) {
             $this->setView(new Zend_View());
         }
         $element->setView($this->getView());
     }
     return $element;
 }
开发者ID:jbrinley,项目名称:BuggyPress,代码行数:21,代码来源:BuggyPress_Form.php


注:本文中的Zend_Form::getElement方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。