/** * 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); }
/** * Class constructor */ public function __construct($clipId) { parent::__construct('videoEditForm'); $this->setAjax(true); $this->setAction(OW::getRouter()->urlFor('GVIDEOVIEWER_CTRL_Index', 'ajaxUpdateVideo')); $language = OW::getLanguage(); // clip id field $clipIdField = new HiddenField('id'); $clipIdField->setRequired(true); $this->addElement($clipIdField); // title Field $titleField = new TextField('title'); $titleField->addValidator(new StringValidator(1, 128)); $titleField->setRequired(true); $this->addElement($titleField->setLabel($language->text('video', 'title'))); // description Field $descField = new WysiwygTextarea('description'); $descField->setId("video-desc-area"); $this->addElement($descField->setLabel($language->text('video', 'description'))); $code = new Textarea('code'); $code->setRequired(true); $this->addElement($code->setLabel($language->text('video', 'code'))); $entityTags = BOL_TagService::getInstance()->findEntityTags($clipId, 'video'); 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('video', 'tags'))); $submit = new Submit('edit'); $submit->setValue($language->text('video', 'btn_edit')); $this->addElement($submit); }
public function __construct(Post $post, $tags = array()) { parent::__construct('save'); $this->service = PostService::getInstance(); $this->post = $post; $this->setMethod('post'); $titleTextField = new TextField('title'); $this->addElement($titleTextField->setLabel(OW::getLanguage()->text('blogs', 'save_form_lbl_title'))->setValue($post->getTitle())->setRequired(true)); $buttons = array(BOL_TextFormatService::WS_BTN_BOLD, BOL_TextFormatService::WS_BTN_ITALIC, BOL_TextFormatService::WS_BTN_UNDERLINE, BOL_TextFormatService::WS_BTN_IMAGE, BOL_TextFormatService::WS_BTN_LINK, BOL_TextFormatService::WS_BTN_ORDERED_LIST, BOL_TextFormatService::WS_BTN_UNORDERED_LIST, BOL_TextFormatService::WS_BTN_MORE, BOL_TextFormatService::WS_BTN_SWITCH_HTML, BOL_TextFormatService::WS_BTN_HTML, BOL_TextFormatService::WS_BTN_VIDEO); $postTextArea = new WysiwygTextarea('post', $buttons); $postTextArea->setSize(WysiwygTextarea::SIZE_L); $postTextArea->setLabel(OW::getLanguage()->text('blogs', 'save_form_lbl_post')); $postTextArea->setValue($post->getPost()); $postTextArea->setRequired(true); $this->addElement($postTextArea); $draftSubmit = new Submit('draft'); $draftSubmit->addAttribute('onclick', "\$('#save_post_command').attr('value', 'draft');"); if ($post->getId() != null && !$post->isDraft()) { $text = OW::getLanguage()->text('blogs', 'change_status_draft'); } else { $text = OW::getLanguage()->text('blogs', 'sava_draft'); } $this->addElement($draftSubmit->setValue($text)); if ($post->getId() != null && !$post->isDraft()) { $text = OW::getLanguage()->text('blogs', 'update'); } else { $text = OW::getLanguage()->text('blogs', 'save_publish'); } $publishSubmit = new Submit('publish'); $publishSubmit->addAttribute('onclick', "\$('#save_post_command').attr('value', 'publish');"); $this->addElement($publishSubmit->setValue($text)); $tagService = BOL_TagService::getInstance(); $tags = array(); if (intval($this->post->getId()) > 0) { $arr = $tagService->findEntityTags($this->post->getId(), 'blog-post'); foreach (!empty($arr) ? $arr : array() as $dto) { $tags[] = $dto->getLabel(); } } $tf = new TagsInputField('tf'); $tf->setLabel(OW::getLanguage()->text('blogs', 'tags_field_label')); $tf->setValue($tags); $this->addElement($tf); }
public function __construct($link) { parent::__construct('save'); $language = OW::getLanguage()->getInstance(); $this->link = $link; $urlField = new TextField('url'); $urlField->setHasInvitation(true)->setInvitation('http://www.example.com'); $this->addElement($urlField->setRequired(true)->addValidator(new UrlValidator())->setLabel($language->text('links', 'save_form_url_field_label'))->setValue($this->link->getUrl())); $titleField = new TextField('title'); $this->addElement($titleField->setRequired(true)->setLabel($language->text('links', 'save_form_title_field_label'))->setValue($this->link->getTitle())); $descriptionTextArea = new WysiwygTextarea('description'); $descriptionTextArea->setLabel($language->text('links', 'save_form_desc_field_label')); $descriptionTextArea->setValue($this->link->getDescription()); $descriptionTextArea->setRequired(true); $this->addElement($descriptionTextArea); $tagService = BOL_TagService::getInstance(); $tags = array(); if (intval($this->link->getId()) > 0) { $arr = $tagService->findEntityTags($this->link->getId(), 'link'); foreach (!empty($arr) ? $arr : array() as $dto) { $tags[] = $dto->getLabel(); } } $tagsField = new TagsInputField('tags'); $tagsField->setLabel($language->text('links', 'save_form_tags_field_label')); $tagsField->setValue($tags); $tagsField->setDelimiterChars(array('.')); $this->addElement($tagsField); // $tagsField = new TagsField('tags', $tags); // $this->addElement($tagsField->setLabel($language->text('links', 'save_form_tags_field_label'))); $submit = new Submit('submit'); $this->addElement($submit); }