protected function _getRoleField()
 {
     $acl = Kwf_Registry::get('acl');
     $userRole = Kwf_Registry::get('userModel')->getAuthedUserRole();
     $authedUser = Kwf_Registry::get('userModel')->getAuthedUser();
     // alle erlaubten haupt-rollen in variable
     $roles = array();
     foreach ($acl->getAllowedEditRolesByRole($userRole) as $role) {
         $roles[$role->getRoleId()] = Kwf_Trl::getInstance()->trlStaticExecute($role->getRoleName());
     }
     if (!$roles) {
         return null;
     }
     // ALLE additional roles in variable
     $addRoles = array();
     foreach ($acl->getAdditionalRoles() as $role) {
         $addRoles[$role->getParentRoleId()][$role->getRoleId()] = Kwf_Trl::getInstance()->trlStaticExecute($role->getRoleName());
     }
     // Wenns keine additionalRoles gibt, normales select verwenden
     if (!$addRoles) {
         $ret = new Kwf_Form_Field_Select('role', trlKwf('Rights'));
         $ret->setValues($roles)->setAllowBlank(false);
     } else {
         // eigene additionalRoles holen, nur die dürfen zugewiesen werden
         $allowedRoles = array_merge($authedUser->getAdditionalRoles(), $acl->getAllowedEditResourceRoleIdsByRole($userRole));
         // cards container erstellen und zu form hinzufügen
         $ret = new Kwf_Form_Container_Cards('role', trlKwf('Rights'));
         $ret->getCombobox()->setAllowBlank(false);
         foreach ($roles as $roleId => $roleName) {
             $card = $ret->add();
             $card->setTitle($roleName);
             $card->setName($roleId);
             if (isset($addRoles[$roleId])) {
                 foreach ($addRoles[$roleId] as $addRoleId => $addRoleName) {
                     if (!in_array($addRoleId, $allowedRoles)) {
                         unset($addRoles[$roleId][$addRoleId]);
                     }
                 }
                 $editor = new Kwf_Form_Field_MultiCheckboxLegacy('Kwf_User_AdditionalRoles', trlKwf('Additional rights'));
                 $editor->setColumnName('additional_role')->setValues($addRoles[$roleId])->setReferences(array('columns' => array('user_id'), 'refColumns' => array('id')));
                 $card->add($editor);
             }
         }
     }
     return $ret;
 }
Пример #2
0
 protected function _initFields()
 {
     parent::_initFields();
     $fs = new Kwf_Form_Container_FieldSet(trlKwf('Form Properties'));
     $fs->add(new Kwf_Form_Field_TextField('subject', trlKwf('E-Mail Subject')))->setWidth(400);
     $fs->add(new Kwf_Form_Field_TextField('submit_caption', trlKwf('Submit Caption')))->setWidth(400);
     $this->add($fs);
     $hiddenField = new Kwf_Form_Field_Hidden('send_confirm_mail');
     $hiddenField->setData(new Kwc_Form_Dynamic_Trl_Data());
     $cards = new Kwf_Form_Container_Cards();
     $cards->setCombobox($hiddenField);
     $card = $cards->add(new Kwf_Form_Container_Card());
     $card->setName('0');
     $card = $cards->add(new Kwf_Form_Container_Card());
     $card->setName('1');
     $fs = $card->add(new Kwf_Form_Container_FieldSet(trlKwf('Send copy to User')));
     $fs->add(new Kwf_Form_Field_TextField('confirm_subject', trlKwf('Subject')))->setWidth(300)->setAllowBlank(false);
     $this->add($cards);
 }
Пример #3
0
 public function __construct($name, $class, $id = null)
 {
     parent::__construct($name, $class, $id);
     $this->fields->add(new Kwf_Form_Field_Static(trlKwfStatic('Please insert the web address to your YouTube or Vimeo video.')))->setWidth(400);
     $this->fields->add(new Kwf_Form_Field_TextField('url', trlKwfStatic('URL')))->setWidth(400)->setVtype('url');
     $cards = new Kwf_Form_Container_Cards('size', trlKwfStatic('Size'));
     $cards->setDefaultValue('fullWidth');
     $cards->setAllowBlank(false);
     $card = $cards->add();
     $card->setTitle(trlKwfStatic('full width'));
     $card->setName('fullWidth');
     $card = $cards->add();
     $card->setTitle(trlKwfStatic('user-defined'));
     $card->setName('custom');
     $card->add(new Kwf_Form_Field_TextField('width', trlKwfStatic('Width')))->setAllowBlank(false);
     $card->add(new Kwf_Form_Field_TextField('height', trlKwfStatic('Height')))->setAllowBlank(false);
     $this->add($cards);
     $this->add(new Kwf_Form_Field_Select('ratio', trlKwfStatic('Ratio')))->setValues(array('16x9' => trlKwfStatic('16:9'), '4x3' => trlKwfStatic('4:3')))->setAllowBlank(false);
     $this->fields->add(new Kwf_Form_Field_Checkbox('show_similar_videos', trlKwfStatic('Show similar videos (YouTube only)')));
     $this->fields->add(new Kwf_Form_Field_Checkbox('autoplay', trlKwfStatic('Autoplay Video')));
 }
Пример #4
0
 protected function _initFields()
 {
     parent::_initFields();
     $validator = new Zend_Validate_Regex(array('pattern' => Kwc_Advanced_Youtube_Component::REGEX));
     $validator->setMessage(trlKwf('No valid youtube url'), Zend_Validate_Regex::NOT_MATCH);
     $this->add(new Kwf_Form_Field_UrlField('url', trlKwf('URL')))->addValidator($validator)->setAllowBlank(false)->setWidth(400);
     if (Kwc_Abstract::getSetting($this->getClass(), 'videoWidth') == Kwc_Advanced_Youtube_Component::USER_SELECT) {
         $cards = new Kwf_Form_Container_Cards('size', trlKwf('Size'));
         $cards->setDefaultValue('fullWidth');
         $cards->setAllowBlank(false);
         $card = $cards->add();
         $card->setTitle(trlKwfStatic('full width'));
         $card->setName('fullWidth');
         $card = $cards->add();
         $card->setTitle(trlKwfStatic('user-defined'));
         $card->setName('custom');
         $card->add(new Kwf_Form_Field_TextField('video_width', trlKwf('Width')))->setAllowBlank(false);
         $this->add($cards);
     }
     $this->add(new Kwf_Form_Field_Select('dimensions', trlKwf('Dimension')))->setDefaultValue('16x9')->setValues(array('16x9' => trlStatic('16:9'), '4x3' => trlStatic('4:3')));
     $this->add(new Kwf_Form_Field_Checkbox('autoplay', trlKwf('Autoplay')));
 }