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


PHP Zend_Form_Element_Select::setOrder方法代码示例

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


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

示例1: init

 public function init()
 {
     $this->form = new User_Form_Edit();
     $this->form->removeElement(User::COL_PASSWORD);
     $this->form->removeElement(User_Form_Edit::PASSWORD_CLONE);
     $roleElement = new Zend_Form_Element_Select(User::COL_ROLE);
     $roleElement->setRequired(true);
     $roleElement->setOrder(1);
     $roleElement->setMultiOptions(array('reader' => 'reader', 'datamanager' => 'datamanager', 'ws-manager' => 'ws-manager', 'admin' => 'admin'));
     $this->form->addElement($roleElement, null, array('pos' => 1));
     $this->view->form = $this->form;
 }
开发者ID:blackskaarj,项目名称:webgr,代码行数:12,代码来源:UserController.php

示例2: manageAction

 /**
  * Manage action for Permission controller
  * @throws Zend_Exception
  * @return NULL
  */
 public function manageAction()
 {
     try {
         $translate = Zend_Registry::get('Zend_Translate');
         $roleId = $this->getRequest()->getParam('role', 0);
         $mdlRole = new Acl_Model_Role();
         $role = $mdlRole->find($roleId)->current();
         if (!$role) {
             throw new Exception($translate->translate("LBL_ROW_NOT_FOUND"));
         }
         $select = $mdlRole->select()->order('priority DESC')->limit(1);
         $childRole = $role->findDependentRowset('Acl_Model_Role', null, $select)->current();
         $frmManageResource = new Acl_Form_ManageResources();
         $action = $this->_request->getBaseUrl() . "/acl/permission/update";
         $frmManageResource->setAction($action);
         $frmManageResource->getElement('id')->setValue($role->id);
         $mdlResource = new Acl_Model_Resource();
         $mdlPermission = new Acl_Model_Permission();
         $modules = $mdlResource->getModules();
         $zfelements = array();
         $resourceDataIds = array();
         $order = 1;
         foreach ($modules as $module) {
             $resources = $mdlResource->getByModule($module);
             if (!array_key_exists(strtolower($module->module), $zfelements)) {
                 $zfelements[strtolower($module->module)] = array();
             }
             foreach ($resources as $resource) {
                 $resourceDataIds[] = $resource->id;
                 $cbResource = new Zend_Form_Element_Select("cb_res_" . $resource->id);
                 $zfelements[strtolower($module->module)][] = "cb_res_" . $resource->id;
                 $lblResource = $resource->controller . ' / ' . $resource->actioncontroller;
                 $cbResource->setLabel($lblResource);
                 $childPrivilege = $childRole ? $mdlPermission->getByResource($resource, $childRole) : null;
                 $rolePrivilege = $mdlPermission->getByResource($resource, $role);
                 #var_dump($childPrivilege, $rolePrivilege, $lblResource);
                 /*if ( strcasecmp($resource->controller, 'tag') == 0 && strcasecmp($resource->actioncontroller, 'list') == 0 ){
                       Zend_Debug::dump( $childPrivilege, 'child privilege' );
                       Zend_Debug::dump( $rolePrivilege, 'role privilege' );
                   }*/
                 if ($childPrivilege == null && $rolePrivilege == null) {
                     $cbResource->addMultiOption('deny', $translate->translate("ACL_DENIED_DEFAULT"));
                     $cbResource->addMultiOption('allow', $translate->translate("ACL_ALLOW"));
                 } elseif (isset($rolePrivilege->privilege) && strcasecmp($rolePrivilege->privilege, 'allow') == 0) {
                     $cbResource->addMultiOption('allow', $translate->translate("ACL_ALLOW"));
                     $cbResource->addMultiOption('deny', $translate->translate("ACL_DENY"));
                 } elseif (isset($rolePrivilege->privilege) && strcasecmp($rolePrivilege->privilege, 'deny') == 0) {
                     $cbResource->addMultiOption('deny', $translate->translate("ACL_DENY"));
                     $cbResource->addMultiOption('allow', $translate->translate("ACL_ALLOW"));
                 } elseif ($childPrivilege && strcasecmp($childPrivilege->privilege, 'allow') == 0 && !$rolePrivilege) {
                     $cbResource->addMultiOption('allow', sprintf($translate->translate("ACL_ALLOWED_INHERITED_FROM"), $privilege->name));
                     $cbResource->addMultiOption('deny', $translate->translate("ACL_DENY"));
                 } elseif ($childPrivilege && strcasecmp($childPrivilege->privilege, 'deny') == 0 && !$rolePrivilege) {
                     $cbResource->addMultiOption('deny', sprintf($translate->translate("ACL_DENIED_INHERITED_FROM"), $privilege->name));
                     $cbResource->addMultiOption('allow', $translate->translate("ACL_ALLOW"));
                 }
                 $cbResource->setOrder($order);
                 $frmManageResource->addElement($cbResource);
                 $order++;
             }
         }
         #$frmManageResource->getMessages()
         $resourceDataIds = implode(',', $resourceDataIds);
         $hrs = new Zend_Session_Namespace('resourceDataIds');
         $hrs->hrs = $resourceDataIds;
         #$frmManageResource->getElement('hrs')->setValue( $resourceDataIds );
         $this->view->modules = $modules;
         $this->view->zfelements = $zfelements;
         $this->view->role = $role;
         $this->view->formResources = $frmManageResource;
         $fields = array();
         foreach ($frmManageResource->getElements() as $element) {
             $fields[] = $element->getName();
         }
         $frmManageResource->addDisplayGroup($fields, 'form', array('legend' => "ACL_UPDATE_ROLE"));
     } catch (Exception $e) {
         $this->_helper->flashMessenger->addMessage(array('type' => 'error', 'header' => '', 'message' => $e->getMessage()));
         $this->_helper->redirector("list", "role", "acl");
     }
     return null;
 }
开发者ID:rogercastaneda,项目名称:owlsys,代码行数:86,代码来源:PermissionController.php

示例3: _countryRender

 private function _countryRender($property)
 {
     $disp = $property . 'Display';
     $req = $property . 'Required';
     $seq = $property . 'Sequence';
     if ($this->{$disp}) {
         $countries = Cible_FunctionsGeneral::getCountries();
         if ($this->_addScript) {
             $this->jsLocationScript($countries);
         }
         $field = new Zend_Form_Element_Select($this->{$property});
         $field->setRequired($this->{$req})->setAttrib('class', 'stdSelect')->setValue($this->_countryDefaultVal)->setRegisterInArrayValidator(false)->setLabel($this->view->getCibleText('form_label' . $property));
         if ($this->{$seq}) {
             $field->setOrder($this->{$seq});
         }
         if ($this->{$req}) {
             $field->setAttrib('class', 'stdSelect ' . $req);
             $this->_addRequiredValidator($field);
         }
         foreach ($countries as $key => $country) {
             $field->addMultiOption($country['ID'], $country['name']);
         }
         $this->_form->addElement($field);
     }
 }
开发者ID:anunay,项目名称:stentors,代码行数:25,代码来源:FormAddress.php


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