Beispiel #1
0
 public function __construct()
 {
     parent::__construct('addPhotoForm');
     $language = OW::getLanguage();
     // album suggest Field
     $albumField = new SuggestField('album');
     $albumField->setRequired(true);
     $albumField->setMinChars(1);
     $userId = OW::getUser()->getId();
     $responderUrl = OW::getRouter()->urlFor('PHOTO_CTRL_Upload', 'suggestAlbum', array('userId' => $userId));
     $albumField->setResponderUrl($responderUrl);
     $albumField->setLabel($language->text('photo', 'album'));
     $albumField->setId('ynmediaimporter_album_suggest');
     $this->addElement($albumField);
     // json hidden field
     $dataField = new HiddenField('json_data');
     $dataField->setId("ynmediaimporter_json_data");
     $this->addElement($dataField);
     $submit = new Submit('submit');
     $submit->setValue("Continue");
     $this->addElement($submit);
     $this->setAction(OW::getRouter()->urlForRoute("ynmediaimporter.addphoto"));
 }
Beispiel #2
0
 /**
  * Generates add forum form
  * 
  * @param string $action
  * @return Form
  */
 private function generateAddForumForm($action)
 {
     $language = OW::getLanguage();
     $form = new Form('add-forum-form');
     $form->setAction($action);
     $groupName = new TextField('group-name');
     $groupName->setRequired(true);
     $sValidator = new StringValidator(1, 255);
     $sValidator->setErrorMessage($language->text('forum', 'chars_limit_exceeded', array('limit' => 255)));
     $groupName->addValidator($sValidator);
     $form->addElement($groupName);
     $sectionField = new SuggestField('section');
     $sectionField->setRequired(true);
     $sectionField->setMinChars(1);
     $responderUrl = OW::getRouter()->urlFor('FORUM_CTRL_Customize', 'suggestSection');
     $sectionField->setResponderUrl($responderUrl);
     $firstSection = FORUM_BOL_ForumService::getInstance()->getFirstSection();
     if ($firstSection) {
         $sectionField->setValue($firstSection->name);
     }
     $form->addElement($sectionField->setLabel($language->text('forum', 'section')));
     $description = new Textarea('description');
     $description->setRequired(true);
     $sValidator = new StringValidator(1, 50000);
     $sValidator->setErrorMessage($language->text('forum', 'chars_limit_exceeded', array('limit' => 50000)));
     $description->addValidator($sValidator);
     $form->addElement($description);
     $isPrivate = new CheckboxField('is-private');
     $form->addElement($isPrivate);
     $roles = new CheckboxGroup('roles');
     $authService = BOL_AuthorizationService::getInstance();
     $roleList = $authService->getRoleList();
     $options = array();
     foreach ($roleList as $role) {
         $options[$role->id] = $authService->getRoleLabel($role->name);
     }
     $roles->addOptions($options);
     $roles->setColumnCount(2);
     $form->addElement($roles);
     $submit = new Submit('add');
     $submit->setValue($language->text('forum', 'add_new_forum_submit'));
     $form->addElement($submit);
     $form->setAjax(true);
     return $form;
 }
Beispiel #3
0
 public function __construct($list, $entityType, $entityId, $albumSuggestRsp)
 {
     parent::__construct('photoSubmitForm');
     $language = OW::getLanguage();
     // album suggest Field
     $albumField = new SuggestField('album');
     $albumField->setRequired(true);
     $albumField->setMinChars(1);
     // description Field
     $descField = new Textarea('description');
     $this->addElement($descField->setLabel($language->text('photo', 'description')));
     if (count($list) == 1) {
         $tagsField = new TagsInputField('tags');
         $this->addElement($tagsField->setLabel($language->text('photo', 'tags')));
     }
     $userId = OW::getUser()->getId();
     // collect default album names
     $event = new BASE_CLASS_EventCollector(PHOTO_CLASS_EventHandler::EVENT_SUGGEST_DEFAULT_ALBUM, array('userId' => $userId, "entityType" => $entityType, "entityId" => $entityId));
     OW::getEventManager()->trigger($event);
     $data = $event->getData();
     if (!empty($data)) {
         $albumField->setValue($data[0]);
     }
     $albumField->setResponderUrl($albumSuggestRsp);
     $albumField->setLabel($language->text('photo', 'album'));
     $this->addElement($albumField);
     $submit = new Submit('submit');
     $this->addElement($submit);
 }