Пример #1
0
 public function configure()
 {
     $choices = array("" => "");
     foreach (sfGuardUserGroupPeer::retrieveForUserWithoutCurrentRole($this->getOption('actual_user')->getLoginRole(), $this->getOption('actual_user')->getGuardUser()->getId()) as $user_role) {
         $choices[$user_role->getId()] = $user_role;
     }
     $this->setWidget('roles', new sfWidgetFormChoice(array('choices' => $choices)));
     $this->validatorSchema['roles'] = new sfValidatorChoice(array('choices' => array_keys($choices)));
     $this->widgetSchema['roles']->setLabel('Change role: ');
     $this->getWidgetSchema()->setNameFormat('user_role[%s]');
     $this->getValidatorSchema()->setOption('allow_extra_fields', true);
 }