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


PHP Roles::getRoles方法代码示例

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


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

示例1: __construct

 /** The constructor 
  * @access public
  * @param array $options
  * @return void
  */
 public function __construct(array $options = null)
 {
     parent::__construct($options);
     $roles = new Roles();
     $role_options = $roles->getRoles();
     $inst = new Institutions();
     $inst_options = $inst->getInsts();
     $projecttypes = new ProjectTypes();
     $projectype_list = $projecttypes->getTypes();
     $this->setName('emailsearch');
     ZendX_JQuery::enableForm($this);
     $message = new Zend_Form_Element_Textarea('messageToUser');
     $message->setLabel('Message to user: ')->setRequired(true)->addFilters(array('StringTrim', 'WordChars', 'BasicHtml', 'EmptyParagraph'))->setAttribs(array('rows' => 10))->addFilter('BasicHtml')->addErrorMessage('You must enter a message to your recipient.');
     $fullname = new Zend_Form_Element_Text('fullname');
     $fullname->setLabel('Send this to: ')->addFilters(array('StringTrim', 'StripTags', 'Purifier'))->setAttrib('size', 30);
     $email = $this->addElement('text', 'email', array('label' => 'Their email Address', 'size' => '30'))->email;
     $email->addValidator('EmailAddress')->addFilters(array('StringTrim', 'StripTags', 'StringToLower'))->setRequired(true)->addErrorMessage('Please enter a valid address!');
     //Submit button
     $submit = new Zend_Form_Element_Submit('submit');
     $hash = new Zend_Form_Element_Hash('csrf');
     $hash->setValue($this->_salt)->setTimeout(60);
     $this->addElement($hash);
     $this->addElements(array($fullname, $submit, $message));
     $this->addDisplayGroup(array('fullname', 'email', 'messageToUser'), 'details');
     $this->details->setLegend('Details: ');
     $this->addDisplayGroup(array('submit'), 'buttons');
     parent::init();
 }
开发者ID:lesleyauk,项目名称:findsorguk,代码行数:33,代码来源:EmailSearchForm.php

示例2: __construct

 public function __construct($options = null)
 {
     parent::__construct($options);
     $roles = new Roles();
     $role_options = $roles->getRoles();
     $inst = new Institutions();
     $inst_options = $inst->getInsts();
     $projecttypes = new ProjectTypes();
     $projectype_list = $projecttypes->getTypes();
     $this->setName('emailsearch');
     ZendX_JQuery::enableForm($this);
     $decorators = array(array('ViewHelper'), array('Description', array('placement' => 'append', 'class' => 'info')), array('Errors', array('placement' => 'append', 'class' => 'error', 'tag' => 'li')), array('Label'), array('HtmlTag', array('tag' => 'li')));
     $message = new Zend_Form_Element_Textarea('messageToUser');
     $message->setLabel('Message to user: ')->setRequired(true)->addFilters(array('StringTrim', 'WordChars', 'BasicHtml', 'EmptyParagraph'))->setAttribs(array('rows' => 10))->addFilter('BasicHtml')->addErrorMessage('You must enter a message to your recipient.');
     $fullname = new Zend_Form_Element_Text('fullname');
     $fullname->setLabel('Send this to: ')->addFilters(array('StringTrim', 'StripTags'))->addValidator('Alnum', false, array('allowWhiteSpace' => true))->setAttrib('size', 30)->setDecorators($decorators);
     $email = $this->addElement('text', 'email', array('label' => 'Their email Address', 'size' => '30'))->email;
     $email->addValidator('EmailAddress')->addFilters(array('StringTrim', 'StripTags', 'StringToLower'))->setRequired(true)->addErrorMessage('Please enter a valid address!');
     $email->setDecorators($decorators);
     //Submit button
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setAttrib('id', 'submit')->setAttrib('class', 'large')->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->setLabel('Send to a friend');
     $hash = new Zend_Form_Element_Hash('csrf');
     $hash->setValue($this->_config->form->salt)->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->removeDecorator('label')->setTimeout(60);
     $this->addElement($hash);
     $this->addElements(array($fullname, $submit, $message));
     $this->addDisplayGroup(array('fullname', 'email', 'messageToUser'), 'details')->removeDecorator('HtmlTag');
     $this->details->addDecorators(array('FormElements', array('HtmlTag', array('tag' => 'ul'))));
     $this->details->removeDecorator('DtDdWrapper');
     $this->details->removeDecorator('HtmlTag');
     $this->details->setLegend('Details: ');
     $this->addDisplayGroup(array('submit'), 'submit');
 }
开发者ID:rwebley,项目名称:Beowulf---PAS,代码行数:33,代码来源:EmailSearchForm.php

示例3: init

 /** Initialise the form
  * @access public
  * @return void
  */
 public function init()
 {
     $roles = new Roles();
     $role_options = $roles->getRoles();
     $inst = new Institutions();
     $inst_options = $inst->getInsts();
     $username = $this->addElement('text', 'username', array('label' => 'Username: '))->username;
     $username->addFilters(array('StripTags', 'StringTrim'))->setRequired(true);
     $firstName = $this->addElement('text', 'first_name', array('label' => 'First Name', 'size' => '30'))->first_name;
     $firstName->setRequired(true)->addFilters(array('StripTags', 'StringTrim', 'Purifier'))->addErrorMessage('You must enter a firstname');
     $lastName = $this->addElement('text', 'last_name', array('label' => 'Last Name', 'size' => '30'))->last_name;
     $lastName->setRequired(true)->addFilters(array('StripTags', 'StringTrim', 'Purifier'))->addErrorMessage('You must enter a surname');
     $preferred_name = $this->addElement('text', 'preferred_name', array('label' => 'Preferred Name: ', 'size' => '30'))->preferred_name;
     $preferred_name->setRequired(true)->addFilters(array('StripTags', 'StringTrim', 'Purifier'))->addErrorMessage('You must enter your preferred name');
     $fullname = $this->addElement('text', 'fullname', array('label' => 'Full name: ', 'size' => '30'))->fullname;
     $fullname->setRequired(true)->addFilters(array('StripTags', 'StringTrim', 'Purifier'))->addErrorMessage('You must enter your preferred name');
     $email = $this->addElement('text', 'email', array('label' => 'Email Address', 'size' => '30'))->email;
     $email->addValidator('EmailAddress')->addFilters(array('StripTags', 'StringTrim', 'StringToLower'))->setRequired(true)->addErrorMessage('Please enter a valid address!');
     $password = $this->addElement('password', 'password', array('label' => 'Change password: ', 'size' => '30'))->password;
     $password->setRequired(false);
     $institution = $this->addElement('select', 'institution', array('label' => 'Recording institution: '))->institution;
     $institution->addMultiOptions(array(null => 'Choose institution', 'Available institutions' => $inst_options))->setAttrib('class', 'input-xlarge selectpicker show-menu-arrow');
     $canRecord = $this->addElement('checkbox', 'canRecord', array('label' => 'Allowed to record: '))->canRecord;
     $role = $this->addElement('select', 'role', array('label' => 'Site role: '))->role;
     $role->addMultiOptions(array(null => 'Choose a role', 'Available roles' => $role_options))->setAttrib('class', 'input-medium selectpicker show-menu-arrow');
     $person = $this->addElement('text', 'person', array('label' => 'Personal details attached: '))->person;
     $peopleID = $this->addElement('hidden', 'peopleID', array())->peopleID;
     $submit = new Zend_Form_Element_Submit('submit');
     $this->addElement($submit);
     $this->addDisplayGroup(array('username', 'first_name', 'last_name', 'fullname', 'preferred_name', 'email', 'institution', 'role', 'password', 'person', 'peopleID', 'canRecord'), 'userdetails');
     $this->addDisplayGroup(array('submit'), 'buttons');
     $this->setLegend('Edit account details: ');
     parent::init();
 }
开发者ID:lesleyauk,项目名称:findsorguk,代码行数:38,代码来源:EditAccountForm.php

示例4: init

 public function init()
 {
     $required = true;
     $roles = new Roles();
     $role_options = $roles->getRoles();
     $inst = new Institutions();
     $inst_options = $inst->getInsts();
     $this->setAction($this->_actionUrl)->setMethod('post')->setAttrib('id', 'accountform');
     $this->clearDecorators();
     $this->addElementPrefixPath('Pas_Validate', 'Pas/Validate/', 'validate');
     $this->addPrefixPath('Pas_Form_Element', 'Pas/Form/Element/', 'element');
     $decorators = array(array('ViewHelper'), array('Description', array('placement' => 'append', 'class' => 'info')), array('Errors', array('placement' => 'prepend', 'class' => 'error', 'tag' => 'li')), array('Label', array('separator' => ' ', 'requiredSuffix' => ' *', 'class' => 'leftalign')), array('HtmlTag', array('tag' => 'li')));
     $username = $this->addElement('text', 'username', array('label' => 'Username: '))->username;
     $username->setDecorators($decorators)->addFilters(array('StripTags', 'StringTrim'))->setRequired(true);
     $firstName = $this->addElement('text', 'first_name', array('label' => 'First Name', 'size' => '30'))->first_name;
     $firstName->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addValidator('Alnum', false, array('allowWhiteSpace' => true))->addErrorMessage('You must enter a firstname');
     $firstName->setDecorators($decorators);
     $lastName = $this->addElement('text', 'last_name', array('label' => 'Last Name', 'size' => '30'))->last_name;
     $lastName->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addValidator('Alnum', false, array('allowWhiteSpace' => true))->addErrorMessage('You must enter a surname');
     $lastName->setDecorators($decorators);
     $fullname = $this->addElement('text', 'fullname', array('label' => 'Preferred Name: ', 'size' => '30'))->fullname;
     $fullname->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addValidator('Alnum', false, array('allowWhiteSpace' => true))->addErrorMessage('You must enter your preferred name');
     $fullname->setDecorators($decorators);
     $email = $this->addElement('text', 'email', array('label' => 'Email Address', 'size' => '30'))->email;
     $email->addValidator('EmailAddress')->addFilters(array('StripTags', 'StringTrim', 'StringToLower'))->setRequired(true)->addErrorMessage('Please enter a valid address!');
     $email->setDecorators($decorators);
     $password = $this->addElement('password', 'password', array('label' => 'Change password: ', 'size' => '30'))->password;
     $password->setRequired(false);
     $password->setDecorators($decorators);
     $institution = $this->addElement('select', 'institution', array('label' => 'Recording institution: '))->institution;
     $institution->setDecorators($decorators);
     $institution->addMultiOptions(array(NULL => NULL, 'Choose institution' => $inst_options));
     $role = $this->addElement('select', 'role', array('label' => 'Site role: '))->role;
     $role->setDecorators($decorators);
     $role->addMultiOptions(array(NULL => NULL, 'Choose role' => $role_options));
     $person = $this->addElement('text', 'person', array('label' => 'Personal details attached: '))->person;
     $person->setDecorators($decorators);
     $peopleID = $this->addElement('hidden', 'peopleID', array())->peopleID;
     $peopleID->setDecorators($decorators);
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->clearDecorators();
     $submit->addDecorators(array(array('ViewHelper'), array('HtmlTag', array('tag' => 'div', 'class' => 'submit'))));
     $submit->setAttrib('class', 'large');
     $this->addElement($submit);
     $hash = new Zend_Form_Element_Hash('csrf');
     $hash->setValue($this->_config->form->salt)->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->removeDecorator('label')->setTimeout(60);
     $this->addElement($hash);
     $this->addDisplayGroup(array('username', 'first_name', 'last_name', 'fullname', 'email', 'institution', 'role', 'password', 'person', 'peopleID'), 'userdetails');
     $this->addDecorator('FormElements')->addDecorator(array('ListWrapper' => 'HtmlTag'), array('tag' => 'div'))->addDecorator('FieldSet')->addDecorator('Form');
     $this->userdetails->removeDecorator('DtDdWrapper');
     $this->userdetails->removeDecorator('FieldSet');
     $this->userdetails->addDecorator(array('DtDdWrapper' => 'HtmlTag'), array('tag' => 'ul'));
     $this->addDisplayGroup(array('submit'), 'submit');
     $this->setLegend('Edit account details: ');
 }
开发者ID:rwebley,项目名称:Beowulf---PAS,代码行数:55,代码来源:EditAccountForm.php

示例5: __construct

 public function __construct($options = null)
 {
     parent::__construct($options);
     $roles = new Roles();
     $role_options = $roles->getRoles();
     $inst = new Institutions();
     $inst_options = $inst->getInsts();
     $projecttypes = new ProjectTypes();
     $projectype_list = $projecttypes->getTypes();
     $this->setName('acceptupgrades');
     ZendX_JQuery::enableForm($this);
     $decorators = array(array('ViewHelper'), array('Description', array('placement' => 'append', 'class' => 'info')), array('Errors', array('placement' => 'append', 'class' => 'error', 'tag' => 'li')), array('Label'), array('HtmlTag', array('tag' => 'li')));
     $level = new Zend_Form_Element_Select('level');
     $level->setLabel('Level of research: ')->setRequired(true)->addMultiOptions(array(NULL => NULL, 'Choose type of research' => $projectype_list))->setDecorators($decorators)->addFilter('StripTags')->addFilter('StringTrim')->addErrorMessage('You must set the level of research');
     $title = new Zend_Form_Element_Text('title');
     $title->setLabel('Project title: ')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->setAttrib('size', 60)->addErrorMessage('This project needs a title.')->setDecorators($decorators);
     $researchOutline = new Pas_Form_Element_RTE('researchOutline');
     $researchOutline->setLabel('Research outline: ')->setRequired(true)->setAttrib('rows', 10)->setAttrib('cols', 40)->setAttrib('Height', 400)->setAttrib('ToolbarSet', 'Finds')->addFilter('StringTrim')->addFilter('BasicHtml')->addFilter('EmptyParagraph')->addFilter('WordChars')->addErrorMessage('Outline must be present.');
     $reference = new Zend_Form_Element_Text('reference');
     $reference->setLabel('Referee\'s name: ')->setAttrib('size', 30)->addFilter('StringTrim')->addFilter('StripTags')->setDecorators($decorators);
     $referenceEmail = new Zend_Form_Element_Text('referenceEmail');
     $referenceEmail->setLabel('Referee\'s email address: ')->setAttrib('size', 30)->addValidator('EmailAddress')->addFilter('StringToLower')->addFilter('StringTrim')->addFilter('StripTags')->setDecorators($decorators);
     $message = new Pas_Form_Element_RTE('message');
     $message->setLabel('Message to user: ')->setRequired(true)->setAttrib('rows', 10)->setAttrib('cols', 40)->setAttrib('Height', 400)->setAttrib('ToolbarSet', 'Finds')->addFilter('StringTrim')->addFilter('BasicHtml')->addFilter('EmptyParagraph')->addFilter('WordChars')->addErrorMessage('You must enter a message for the user to know they have been approved.');
     $fullname = new Zend_Form_Element_Text('fullname');
     $fullname->setLabel('Fullname: ')->setAttrib('size', 30)->addFilter('StringTrim')->addFilter('StripTags')->setDecorators($decorators);
     $institution = $this->addElement('select', 'institution', array('label' => 'Recording institution: '))->institution;
     $institution->setDecorators($decorators)->addMultiOptions(array(NULL => NULL, 'Choose institution' => $inst_options));
     $role = $this->addElement('select', 'role', array('label' => 'Site role: '))->role;
     $role->setDecorators($decorators);
     $role->addMultiOptions(array(NULL => NULL, 'Choose role' => $role_options));
     $role->removeMultiOption('admin');
     $startDate = new ZendX_JQuery_Form_Element_DatePicker('startDate');
     $startDate->setLabel('Start date of project: ')->setAttrib('size', 12)->setJQueryParam('dateFormat', 'yy-mm-dd')->addFilter('StringTrim')->addFilter('StripTags')->addValidator('Date')->setRequired(false)->addErrorMessage('You must enter a valid start date for this project');
     $endDate = new ZendX_JQuery_Form_Element_DatePicker('endDate');
     $endDate->setLabel('End date of project: ')->addValidator('Date')->addFilter('StringTrim')->addFilter('StripTags')->setJQueryParam('dateFormat', 'yy-mm-dd')->setAttrib('size', 12)->setRequired(false)->addErrorMessage('You must enter a valid end date for this project');
     $email = $this->addElement('text', 'email', array('label' => 'Email Address', 'size' => '30'))->email;
     $email->addValidator('emailAddress')->setRequired(true)->addFilter('StringToLower')->addErrorMessage('Please enter a valid address!')->setDecorators($decorators);
     $already = new Zend_Form_Element_Radio('already');
     $already->setLabel('Is your topic already listed on our research register?: ')->addMultiOptions(array(1 => 'Yes it is', 0 => 'No it isn\'t'))->setRequired(true)->setOptions(array('separator' => ''))->setDecorators($decorators);
     $insert = new Zend_Form_Element_Checkbox('insert');
     $insert->setLabel('Insert details into research register: ')->setCheckedValue(1)->setDecorators($decorators);
     $valid = new Zend_Form_Element_Radio('higherLevel');
     $valid->setLabel('Approve?: ')->addMultiOptions(array(1 => 'Unauthorised', 0 => 'Authorised'))->setRequired(true)->setOptions(array('separator' => ''))->setDecorators($decorators);
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setAttrib('id', 'submit')->setAttrib('class', 'large')->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag');
     $this->addElements(array($reference, $referenceEmail, $researchOutline, $startDate, $endDate, $fullname, $valid, $level, $title, $submit, $already, $insert, $message));
     $this->addDisplayGroup(array('fullname', 'username', 'email', 'institution', 'level', 'role', 'reference', 'referenceEmail', 'message', 'researchOutline', 'title', 'startDate', 'endDate', 'already', 'higherLevel', 'insert'), 'details')->removeDecorator('HtmlTag');
     $this->details->addDecorators(array('FormElements', array('HtmlTag', array('tag' => 'ul'))));
     $this->details->removeDecorator('DtDdWrapper');
     $this->details->removeDecorator('HtmlTag');
     $this->details->setLegend('Details: ');
     $this->addDisplayGroup(array('submit'), 'submit');
 }
开发者ID:rwebley,项目名称:Beowulf---PAS,代码行数:54,代码来源:AcceptUpgradeForm.php

示例6: __construct

 public function __construct($options = null)
 {
     parent::__construct($options);
     $roles = new Roles();
     $role_options = $roles->getRoles();
     $inst = new Institutions();
     $inst_options = $inst->getInsts();
     $projecttypes = new ProjectTypes();
     $projectype_list = $projecttypes->getTypes();
     $this->setName('acceptupgrades');
     ZendX_JQuery::enableForm($this);
     $decorators = array(array('ViewHelper'), array('Description', array('placement' => 'append', 'class' => 'info')), array('Errors', array('placement' => 'append', 'class' => 'error', 'tag' => 'li')), array('Label'), array('HtmlTag', array('tag' => 'li')));
     $researchOutline = new Zend_Form_Element_Textarea('researchOutline');
     $researchOutline->setLabel('Research outline: ')->setRequired(true)->addFilters(array('StringTrim', 'BasicHtml'))->setAttribs(array('rows' => 10))->addErrorMessage('Outline must be present.');
     $message = new Zend_Form_Element_Textarea('messageToUser');
     $message->setLabel('Message to user: ')->setRequired(true)->addFilters(array('StringTrim', 'BasicHtml', 'EmptyParagraph'))->setAttribs(array('rows' => 10))->addErrorMessage('You must enter a message for the user to know they have been approved.');
     $reference = new Zend_Form_Element_Text('reference');
     $reference->setLabel('Referee\'s name: ')->setAttrib('size', 30)->addFilters(array('StringTrim', 'StripTags'))->addValidator('Alnum', false, array('allowWhiteSpace' => true))->setDecorators($decorators);
     $referenceEmail = new Zend_Form_Element_Text('referenceEmail');
     $referenceEmail->setLabel('Referee\'s email address: ')->setAttrib('size', 30)->addFilters(array('StringTrim', 'StripTags', 'StringToLower'))->addValidator('EmailAddress', false, array('mx' => true))->setDecorators($decorators);
     $fullname = new Zend_Form_Element_Text('fullname');
     $fullname->setLabel('Fullname: ')->setAttrib('size', 30)->addFilters(array('StringTrim', 'StripTags'))->addValidator('Alnum', false, array('allowWhiteSpace' => true))->setDecorators($decorators);
     $email = $this->addElement('text', 'email', array('label' => 'Email Address', 'size' => '30'))->email;
     $email->setRequired(true)->addFilters(array('StringTrim', 'StripTags', 'StringToLower'))->addValidator('EmailAddress', false, array('mx' => true))->addErrorMessage('Please enter a valid address!');
     $email->setDecorators($decorators);
     $already = new Zend_Form_Element_Radio('already');
     $already->setLabel('Is your topic already listed on our research register?: ')->addMultiOptions(array(1 => 'Yes it is', 0 => 'No it isn\'t'))->setRequired(true)->setOptions(array('separator' => ''))->setDecorators($decorators);
     //Submit button
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setAttrib('id', 'submit')->setAttrib('class', 'large')->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->setLabel('Reject application');
     $this->addElements(array($researchOutline, $fullname, $reference, $referenceEmail, $submit, $message));
     $hash = new Zend_Form_Element_Hash('csrf');
     $hash->setValue($this->_config->form->salt)->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->removeDecorator('label')->setTimeout(4800);
     $this->addElement($hash);
     $this->addDisplayGroup(array('fullname', 'email', 'messageToUser', 'reference', 'referenceEmail', 'researchOutline'), 'details')->removeDecorator('HtmlTag');
     $this->details->addDecorators(array('FormElements', array('HtmlTag', array('tag' => 'ul'))));
     $this->details->removeDecorator('DtDdWrapper');
     $this->details->removeDecorator('HtmlTag');
     $this->details->setLegend('Details: ');
     $this->addDisplayGroup(array('submit'), 'submit');
 }
开发者ID:rwebley,项目名称:Beowulf---PAS,代码行数:41,代码来源:RejectUpgradeForm.php

示例7: deleteRole

 public static function deleteRole($id)
 {
     $roles = new Roles();
     $links = Roles::getRoles($id);
     if (count($links) > 0) {
         $links = $links['role'];
         if ($links['from_users'] > 0) {
             return array('class' => 'alert-warning', 'text' => "<p>Запись <b> " . $links['name'] . " не</b> может быть <b>удалена</b>, так как связана с одной или несколькими записями. Необходимо <b>переопределить</b> или <b>удалить</b> эти связи, после чего повторите попытку.</p>");
         } else {
             $query = "\n                    DELETE FROM role_right AS rl_rt\n                    WHERE rl_rt.role_id IN (\n                            SELECT rls.id\n                            FROM roles AS rls\n                            WHERE (rls.id = " . $links['id'] . ")\n                    ); ";
             $res = new Phalcon\Mvc\Model\Resultset\Simple(null, $roles, $roles->getReadConnection()->query($query));
             $query = "DELETE FROM roles WHERE (id = " . $links['id'] . ");";
             $res = new Phalcon\Mvc\Model\Resultset\Simple(null, $roles, $roles->getReadConnection()->query($query));
             return array('class' => 'alert-success', 'text' => "<p>Удаление записи <b>" . $links['name'] . "</b> произошло успешно.</p>");
         }
     }
     return array('class' => 'alert-danger', 'text' => "<p>Запись не найдена.</p>");
 }
开发者ID:StepanPilchyck,项目名称:DeliveryService,代码行数:18,代码来源:Roles.php

示例8: checkRight

 /**
  * 检测权限
  * 
  * @access public
  * @param mixed $actionId
  * @return mixed
  */
 public function checkRight($actionId)
 {
     $this->autoActionRight = false;
     $notcheckRight = array('login', 'logout', 'checkRight', 'check', 'captcha', 'noRight');
     if (in_array($actionId, $notcheckRight)) {
         return true;
     }
     //判定系统是否需要验证
     $isCheckRight = false;
     if (isset($this->needRightActions['*']) && $this->needRightActions['*'] == true) {
         $isCheckRight = true;
     }
     if (isset($this->needRightActions[$actionId])) {
         if ($this->needRightActions[$actionId]) {
             $isCheckRight = true;
         } else {
             $isCheckRight = false;
         }
     }
     if ($isCheckRight) {
         //要验证的权限码
         $code = strtolower($this->id) . '@' . $actionId;
         //取得用户信息
         $this->safebox = Safebox::getInstance();
         $manager = $this->safebox->get('manager');
         if (isset($manager['roles'])) {
             //如果是超级管理员角色 直接通过
             if ($manager['roles'] == 'administrator') {
                 $this->autoActionRight = true;
                 return true;
             }
             //其它角色则需要通过验证
             //$model = new Model('roles');
             //$result=$model->where("id=".$manager['roles'])->find();
             $roles = new Roles($manager['roles']);
             $result = $roles->getRoles();
             //var_dump($result);exit();
             if (isset($result['rights'])) {
                 $rights = $result['rights'];
             } else {
                 $rights = '';
             }
             if (stripos($rights, $code) !== false) {
                 $this->autoActionRight = true;
                 return true;
             } else {
                 return false;
             }
         } else {
             $this->redirect("login");
             return false;
         }
     }
     return true;
 }
开发者ID:sammychan1981,项目名称:quanpin,代码行数:62,代码来源:controller_class.php

示例9: personAction

 public function personAction($reception = null, $item_id = null)
 {
     $this->view->setVar("TopMenuSelected", 'work');
     $this->view->setVar("MenuSelected", 'persons');
     $this->view->setVar("MenuItemActive", $reception);
     $messages = array();
     if (!empty($reception)) {
         $view = $reception;
         switch ($reception) {
             case 'add':
                 $this->view->setVar("CountriesAll", References::getCountries());
                 break;
             case 'preview-cache-station':
                 if ($this->request->isPost()) {
                     if ((bool) $this->request->getPost('add')) {
                         View::addMessages($this, [References::addPersonNew($this->request->getPost('full_name'), $this->request->getPost('address'), $this->request->getPost('country_id'), 3, $this->request->getPost('code'), 1, $this->request->getPost('phone'), Users::getStationId($this))]);
                     }
                 }
                 View::addMessages($this, [array('class' => 'alert-info', 'text' => "<p>Перечень записей Адресной книги кэшированных только для этой станции.</p>")]);
                 $this->view->setVar("PersonsCacheAll", References::getPersonsCache(Users::getStationId($this)));
                 break;
             case 'preview-cache':
                 if ($this->request->isPost()) {
                 }
                 View::addMessages($this, [array('class' => 'alert-info', 'text' => "<p>Перечень часто использующихся записей Адресной книги всех станций.</p>")]);
                 $this->view->setVar("PersonsCacheAll", References::getPersonsHot());
                 break;
             case 'preview':
                 if ($this->request->isPost()) {
                     //$messages[] = Users::addUser($this->request->getPost());
                     //$messages[] = Users::deleteUser($this->request->getPost('id'));
                 }
                 View::addMessages($this, [array('class' => 'alert-info', 'text' => "<p>Полный перечень записей Адресной книги всех станций.</p>")]);
                 $this->view->setVar("PersonsCacheAll", References::getPersonsAll());
                 break;
             case 'edit':
                 if (empty($item_id)) {
                     if ($this->request->isPost()) {
                         $this->response->redirect('/administration/user/edit/' . $this->request->getPost('user_id'), '/');
                     }
                     $messages[] = array('class' => 'alert-info', 'text' => "<p><b>Выберите</b> из выпадающего списка <b>профиль пользователя</b>, который нужно изменить.</p>");
                     $this->view->setVar("UsersAll", Users::getUsers());
                 } else {
                     if ($this->request->isPost()) {
                         $messages[] = Users::setUser($this->request->getPost());
                     }
                     $this->view->setVar("User", Users::getUsers($item_id));
                     $this->view->setVar("StationsAll", Stations::getStations());
                     $this->view->setVar("RolesAll", Roles::getRoles());
                     $this->view->setVar("LanguagesAll", References::getLanguages());
                     $this->view->setVar("CurrencyAll", References::getCurrency());
                     $this->view->setVar("Units1", References::getUnits(NULL, array(1))['units']);
                     $this->view->setVar("Units2", References::getUnits(NULL, array(3))['units']);
                     $this->view->setVar("Units3", References::getUnits(NULL, array(4))['units']);
                 }
                 break;
             case 'settings':
                 if ($this->request->isPost()) {
                     $messages[] = Users::addUser($this->request->getPost());
                     //$messages[] = Users::deleteUser($this->request->getPost('id'));
                 }
                 $this->view->setVar("UsersAll", Users::getUsers());
                 break;
         }
         $this->view->pick('/administration/' . "person_" . $view);
     }
     //$this->view->setVar("messages", $messages);
 }
开发者ID:StepanPilchyck,项目名称:DeliveryService,代码行数:68,代码来源:AdministrationController.php

示例10: __construct

 public function __construct()
 {
     $nodes = array('/admin/index' => array('name' => '管理首页', 'parent' => 'config'), '/admin/theme_list' => array('name' => '主题设置', 'parent' => 'config'), '/admin/config_globals' => array('name' => '站点设置', 'parent' => 'config'), '/admin/config_other' => array('name' => '其它配置', 'parent' => 'config'), '/admin/config_email' => array('name' => '邮箱配置', 'parent' => 'config'), '/admin/msg_template_list' => array('name' => '信息模板', 'parent' => 'config'), '/admin/msg_template_edit' => array('name' => '信息模板编辑', 'parent' => 'config'), '/admin/oauth_list' => array('name' => '开放登录', 'parent' => 'config'), '/admin/oauth_edit' => array('name' => '开放登录编辑', 'parent' => 'config'), '/admin/payment_list' => array('name' => '支付方式', 'parent' => 'delivery'), '/admin/payment_edit' => array('name' => '编辑支付方式', 'parent' => 'delivery'), '/admin/zoning_list' => array('name' => '区域划分', 'parent' => 'delivery'), '/admin/ext_params_list' => array('name' => '海关对接', 'parent' => 'delivery'), '/admin/area_list' => array('name' => '地区管理', 'parent' => 'delivery'), '/admin/fare_list' => array('name' => '运费模板', 'parent' => 'delivery'), '/admin/fare_edit' => array('name' => '运费模板编辑', 'parent' => 'delivery'), '/admin/express_company_list' => array('name' => '快递公司', 'parent' => 'delivery'), '/admin/express_company_edit' => array('name' => '快递公司编辑', 'parent' => 'delivery'), '/admin/manager_list' => array('name' => '管理员', 'parent' => 'safe'), '/admin/manager_edit' => array('name' => '编辑管理员', 'parent' => 'safe'), '/admin/roles_list' => array('name' => '角色管理', 'parent' => 'safe'), '/admin/roles_edit' => array('name' => '角色编辑', 'parent' => 'safe'), '/admin/resources_list' => array('name' => '权限列表', 'parent' => 'safe'), '/admin/resources_edit' => array('name' => '编辑权限资源', 'parent' => 'safe'), '/admin/log_operation_list' => array('name' => '操作日志', 'parent' => 'safe'), '/admin/update' => array('name' => '版本升级', 'parent' => 'safe'), '/admin/clear' => array('name' => '清除缓存', 'parent' => 'safe'), '/content/article_list' => array('name' => '全部文章', 'parent' => 'article'), '/content/article_edit' => array('name' => '文章编辑', 'parent' => 'article'), '/content/category_list' => array('name' => '分类管理', 'parent' => 'article'), '/content/category_edit' => array('name' => '编辑分类', 'parent' => 'article'), '/content/help_list' => array('name' => '全部帮助', 'parent' => 'help'), '/content/help_edit' => array('name' => '帮助编辑', 'parent' => 'help'), '/content/help_category_list' => array('name' => '帮助分类管理', 'parent' => 'help'), '/content/help_category_edit' => array('name' => '编辑帮助分类', 'parent' => 'help'), '/content/ad_list' => array('name' => '广告管理', 'parent' => 'banner'), '/content/wel_list' => array('name' => '欢迎页面', 'parent' => 'banner'), '/content/ad_edit' => array('name' => '编辑广告', 'parent' => 'banner'), '/content/wel_edit' => array('name' => '编辑欢迎页面', 'parent' => 'banner'), '/content/tags_list' => array('name' => '标签管理', 'parent' => 'banner'), '/content/nav_list' => array('name' => '导航管理', 'parent' => 'banner'), '/content/nav_edit' => array('name' => '导航管理', 'parent' => 'banner'), '/admin/tables_list' => array('name' => '数据库备份', 'parent' => 'database'), '/admin/back_list' => array('name' => '数据库还原', 'parent' => 'database'), '/goods/goods_category_list' => array('name' => '分类管理', 'parent' => 'goods_config'), '/goods/goods_category_edit' => array('name' => '编辑分类', 'parent' => 'goods_config'), '/goods/goods_type_list' => array('name' => '类型管理', 'parent' => 'goods_config'), '/goods/goods_type_edit' => array('name' => '类型编辑', 'parent' => 'goods_config'), '/goods/tax_type_list' => array('name' => '税种管理', 'parent' => 'goods_config'), '/goods/tax_type_edit' => array('name' => '税种编辑', 'parent' => 'goods_config'), '/goods/theme_list' => array('name' => '主题管理', 'parent' => 'goods_config'), '/goods/theme_edit' => array('name' => '主题编辑', 'parent' => 'goods_config'), '/goods/tax_country_list' => array('name' => '国别管理', 'parent' => 'goods_config'), '/goods/tax_country_edit' => array('name' => '国别编辑', 'parent' => 'goods_config'), '/goods/goods_spec_list' => array('name' => '规格管理', 'parent' => 'goods_config'), '/goods/goods_spec_edit' => array('name' => '规格编辑', 'parent' => 'goods_config'), '/goods/brand_list' => array('name' => '品牌管理', 'parent' => 'goods_config'), '/goods/brand_edit' => array('name' => '品牌编辑', 'parent' => 'goods_config'), '/goods/series_list' => array('name' => '系列管理', 'parent' => 'goods_config'), '/goods/series_edit' => array('name' => '系列编辑', 'parent' => 'goods_config'), '/goods/goods_list' => array('name' => '商品管理', 'parent' => 'goods'), '/goods/goods_edit' => array('name' => '商品编辑', 'parent' => 'goods'), '/customer/customer_list' => array('name' => '会员管理', 'parent' => 'customer'), '/customer/customer_edit' => array('name' => '添加会员', 'parent' => 'customer'), '/customer/grade_list' => array('name' => '会员等级管理', 'parent' => 'customer'), '/customer/grade_edit' => array('name' => '添加会员等级', 'parent' => 'customer'), '/customer/withdraw_list' => array('name' => '提现申请', 'parent' => 'balance'), '/customer/balance_list' => array('name' => '资金日志', 'parent' => 'balance'), '/customer/review_list' => array('name' => '商品评价', 'parent' => 'ask_reviews'), '/customer/ask_list' => array('name' => '商品咨询', 'parent' => 'ask_reviews'), '/customer/ask_edit' => array('name' => '咨询回复', 'parent' => 'ask_reviews'), '/customer/message_list' => array('name' => '信息管理', 'parent' => 'ask_reviews'), '/customer/message_edit' => array('name' => '信息发送', 'parent' => 'ask_reviews'), '/customer/notify_list' => array('name' => '到货通知', 'parent' => 'ask_reviews'), '/customer/company_list' => array('name' => '商户管理', 'parent' => 'company'), '/customer/company_edit' => array('name' => '添加商户', 'parent' => 'company'), '/order/order_list' => array('name' => '商品订单', 'parent' => 'order'), '/order/email_message_list' => array('name' => '订单通知', 'parent' => 'order'), '/order/result_list' => array('name' => '回执信息', 'parent' => 'order'), '/order/examine_list' => array('name' => '审批结果', 'parent' => 'order'), '/order/email_message_edit' => array('name' => '订单通知编辑', 'parent' => 'order'), '/order/express_template_list' => array('name' => '快递单模板', 'parent' => 'express'), '/order/express_template_edit' => array('name' => '快递单模板编辑', 'parent' => 'express'), '/order/ship_list' => array('name' => '发货点管理', 'parent' => 'express'), '/order/ship_edit' => array('name' => '发货点编辑', 'parent' => 'express'), '/order/doc_receiving_list' => array('name' => '收款单', 'parent' => 'receipt'), '/order/doc_invoice_list' => array('name' => '发货单', 'parent' => 'receipt'), '/order/doc_refund_list' => array('name' => '退款单', 'parent' => 'receipt'), '/count/index' => array('name' => '订单统计', 'parent' => 'count'), '/count/hot' => array('name' => '热销统计', 'parent' => 'count'), '/count/area_buy' => array('name' => '地区统计', 'parent' => 'count'), '/count/user_reg' => array('name' => '会员分布统计', 'parent' => 'customer_count'), '/marketing/voucher_template_list' => array('name' => '代金券模板', 'parent' => 'voucher'), '/marketing/voucher_template_edit' => array('name' => '代金券模板编辑', 'parent' => 'voucher'), '/marketing/voucher_list' => array('name' => '代金券管理', 'parent' => 'voucher'), '/marketing/voucher_edit' => array('name' => '代金券编辑', 'parent' => 'voucher'), '/marketing/prom_goods_list' => array('name' => '商品促销', 'parent' => 'promotions'), '/marketing/prom_goods_edit' => array('name' => '编辑商品促销', 'parent' => 'promotions'), '/marketing/prom_order_list' => array('name' => '订单促销', 'parent' => 'promotions'), '/marketing/prom_order_edit' => array('name' => '编辑订单促销', 'parent' => 'promotions'), '/marketing/prom_series_list' => array('name' => '系列促销', 'parent' => 'promotions'), '/marketing/prom_series_edit' => array('name' => '编辑系列促销', 'parent' => 'promotions'), '/marketing/bundling_list' => array('name' => '捆绑促销', 'parent' => 'promotions'), '/marketing/bundling_edit' => array('name' => '编辑捆绑促销', 'parent' => 'promotions'), '/marketing/groupbuy_list' => array('name' => '团购', 'parent' => 'promotions'), '/marketing/groupbuy_edit' => array('name' => '团购', 'parent' => 'promotions'), '/marketing/flash_sale_list' => array('name' => '限时抢购', 'parent' => 'promotions'), '/marketing/flash_sale_edit' => array('name' => '编辑限时抢购', 'parent' => 'promotions'));
     //分组菜单
     $subMenu = array('config' => array('name' => '参数设定', 'parent' => 'system'), 'delivery' => array('name' => '支付与配送', 'parent' => 'system'), 'safe' => array('name' => '安全管理', 'parent' => 'system'), 'database' => array('name' => '数据库管理', 'parent' => 'system'), 'article' => array('name' => '文章管理', 'parent' => 'content'), 'help' => array('name' => '帮助中心', 'parent' => 'content'), 'banner' => array('name' => '内容管理', 'parent' => 'content'), 'goods' => array('name' => '产品管理', 'parent' => 'goods'), 'goods_config' => array('name' => '商品配置', 'parent' => 'goods'), 'company' => array('name' => '商户管理', 'parent' => 'customer'), 'customer' => array('name' => '会员管理', 'parent' => 'customer'), 'balance' => array('name' => '会员资金', 'parent' => 'customer'), 'ask_reviews' => array('name' => '咨询与评价', 'parent' => 'customer'), 'order' => array('name' => '订单管理', 'parent' => 'order'), 'receipt' => array('name' => '单据管理', 'parent' => 'order'), 'express' => array('name' => '快递单配置', 'parent' => 'order'), 'count' => array('name' => '销售统计', 'parent' => 'count'), 'customer_count' => array('name' => '客户统计', 'parent' => 'count'), 'promotions' => array('name' => '促销活动', 'parent' => 'marketing'), 'voucher' => array('name' => '代金券管理', 'parent' => 'marketing'));
     //主菜单
     $menu = array('goods' => array('link' => '/goods/goods_list', 'name' => '商品中心'), 'order' => array('link' => '/order/order_list', 'name' => '订单中心'), 'customer' => array('link' => '/customer/company_list', 'name' => '客户中心'), 'marketing' => array('link' => '/marketing/prom_goods_list', 'name' => '营销推广'), 'count' => array('link' => '/count/index', 'name' => '统计报表'), 'content' => array('link' => '/content/article_list', 'name' => '内容管理'), 'system' => array('link' => '/admin/index', 'name' => '系统设置'));
     $safebox = Safebox::getInstance();
     $manager = $safebox->get('manager');
     if (isset($manager['roles']) && $manager['roles'] != 'administrator') {
         $roles = new Roles($manager['roles']);
         $result = $roles->getRoles();
         if (isset($result['rights'])) {
             $rights = $result['rights'];
         } else {
             $rights = '';
         }
         if (is_array($nodes)) {
             $subMenuKey = array();
             foreach ($nodes as $key => $value) {
                 $_key = trim(strtr($key, '/', '@'), '@');
                 if (stripos($rights, $_key) === false) {
                     unset($nodes[$key]);
                 } else {
                     if (!isset($subMenuKey[$value['parent']])) {
                         $subMenuKey[$value['parent']] = $key;
                     } else {
                         if (stristr($key, '_list')) {
                             $subMenuKey[$value['parent']] = $key;
                         }
                     }
                 }
             }
             $menuKey = array();
             foreach ($subMenu as $key => $value) {
                 if (isset($subMenuKey[$key])) {
                     $menuKey[$value['parent']] = $key;
                 } else {
                     unset($subMenu[$key]);
                 }
             }
             foreach ($menu as $key => $value) {
                 if (!isset($menuKey[$key])) {
                     unset($menu[$key]);
                 } else {
                     $menu[$key]['link'] = $subMenuKey[$menuKey[$key]];
                 }
             }
         }
     }
     //var_dump($subMenuKey,$menuKey,$menu);exit;
     if (is_array($nodes)) {
         $this->nodes = $nodes;
     } else {
         $this->nodes = array();
     }
     if (is_array($subMenu)) {
         $this->subMenu = $subMenu;
     } else {
         $this->subMenu = array();
     }
     if (is_array($menu)) {
         $this->menu = $menu;
     } else {
         $this->menu = array();
     }
     foreach ($this->nodes as $key => $nodes) {
         $this->_subMenu[$nodes['parent']][] = array('link' => $key, 'name' => $nodes['name'], 'display' => isset($nodes['name']) ? $nodes['name'] : true);
     }
     foreach ($this->subMenu as $key => $subMenu) {
         $this->_menu[$subMenu['parent']][] = array('link' => $key, 'name' => $subMenu['name']);
     }
     $this->link_key = '/' . (Req::get('con') == null ? strtolower(Tiny::app()->defaultController) : Req::get('con')) . '/' . (Req::get('act') == null ? Tiny::app()->getController()->defaultAction : Req::get('act'));
 }
开发者ID:sammychan1981,项目名称:quanpin,代码行数:74,代码来源:Menu.php


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