예제 #1
0
파일: edit_form.php 프로젝트: vazahat/dudex
 /**
  * Class constructor
  */
 public function __construct($photoId)
 {
     parent::__construct('photo-edit-form');
     $this->setAjax(true);
     $this->setAction(OW::getRouter()->urlFor('PHOTO_CTRL_Photo', 'ajaxUpdatePhoto'));
     $language = OW::getLanguage();
     $photo = PHOTO_BOL_PhotoService::getInstance()->findPhotoById($photoId);
     $album = PHOTO_BOL_PhotoAlbumService::getInstance()->findAlbumById($photo->albumId);
     $userId = OW::getUser()->getId();
     // photo id field
     $photoIdField = new HiddenField('id');
     $photoIdField->setRequired(true);
     $this->addElement($photoIdField);
     // photo album Field
     $albumField = new SuggestField('album');
     $responderUrl = OW::getRouter()->urlFor('PHOTO_CTRL_Upload', 'suggestAlbum', array('userId' => $userId));
     $albumField->setResponderUrl($responderUrl);
     if ($album) {
         $albumField->setValue($album->name);
     }
     $albumField->setRequired(true);
     $albumField->setLabel($language->text('photo', 'album'));
     $this->addElement($albumField);
     // description Field
     $descField = new WysiwygTextarea('description', null, false);
     $descField->setId("photo-desc-area");
     $this->addElement($descField->setLabel($language->text('photo', 'description')));
     $tags = array();
     $entityTags = BOL_TagService::getInstance()->findEntityTags($photo->id, 'photo');
     if ($entityTags) {
         $tags = array();
         foreach ($entityTags as $entityTag) {
             $tags[] = $entityTag->label;
         }
         $tagsField = new TagsInputField('tags');
         $tagsField->setValue($tags);
     } else {
         $tagsField = new TagsInputField('tags');
     }
     $this->addElement($tagsField->setLabel($language->text('photo', 'tags')));
     $submit = new Submit('edit');
     $submit->setValue($language->text('photo', 'btn_edit'));
     $this->addElement($submit);
 }
예제 #2
0
파일: add_photo.php 프로젝트: vazahat/dudex
 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"));
 }
예제 #3
0
파일: customize.php 프로젝트: vazahat/dudex
 /**
  * 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;
 }
예제 #4
0
파일: upload.php 프로젝트: vazahat/dudex
 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);
 }