Exemplo n.º 1
0
 /**
  * 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);
 }
Exemplo n.º 2
0
 /**
  * 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);
 }
Exemplo n.º 3
0
 /**
  * Class constructor
  *
  */
 public function __construct($required = false)
 {
     parent::__construct('AllmyvideosVideoInfoForm');
     $language = OW::getLanguage();
     // title Field
     $titleField = new TextField('title');
     $titleField->setRequired($required);
     $this->addElement($titleField->setLabel($language->text('video', 'title')));
     // description Field
     $descField = new WysiwygTextarea('description');
     $this->addElement($descField->setLabel($language->text('video', 'description')));
     $tagsField = new TagsInputField('tags');
     $this->addElement($tagsField->setLabel($language->text('video', 'tags')));
     $tokenField = new HiddenField('token');
     $this->addElement($tokenField);
     $filenameField = new HiddenField('filename');
     $this->addElement($filenameField);
     $protocolField = new HiddenField('protocol');
     $this->addElement($protocolField);
     $submit = new Submit('save');
     $submit->setValue($language->text('spvideo', 'btn_save'));
     $this->addElement($submit);
 }
Exemplo n.º 4
0
 public function onBeforeRender()
 {
     parent::onBeforeRender();
     $language = OW::getLanguage();
     $form = new Form('inite-friends');
     $emailList = new TagsInputField('emailList');
     $emailList->setRequired();
     $emailList->setDelimiterChars(array(',', ' '));
     $emailList->setInvitation($language->text('contactimporter', 'email_field_inv_message'));
     $emailList->setJsRegexp('/^(([^<>()[\\]\\.,;:\\s@\\"]+(\\.[^<>()[\\]\\.,;:\\s@\\"]+)*)|(\\".+\\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/');
     $form->addElement($emailList);
     $text = new Textarea('text');
     $text->setValue($language->text('contactimporter', 'email_invite_field_default_text'));
     $text->setHasInvitation(true);
     $form->addElement($text);
     $submit = new Submit('submit');
     $form->addElement($submit);
     $form->setAction(OW::getRouter()->urlFor('CONTACTIMPORTER_CTRL_Email', 'send'));
     $form->setAjax();
     $form->setAjaxResetOnSuccess(false);
     $form->bindJsFunction(Form::BIND_SUCCESS, "\n            function(data){                \n                if( data.success ){\n                    OW.info(data.message);\n                    owForms['inite-friends'].resetForm();\n                    window.ciMailFloatBox.close();\n                }\n                else{\n                    OW.error(data.message);\n                }\n              }");
     $this->addForm($form);
 }
Exemplo n.º 5
0
 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);
 }
Exemplo n.º 6
0
 /**
  * Class constructor
  *
  */
 public function __construct()
 {
     parent::__construct('videoAddForm');
     $language = OW::getLanguage();
     // title Field
     $titleField = new TextField('title');
     $titleField->setRequired(true);
     $this->addElement($titleField->setLabel($language->text('video', 'title')));
     // description Field
     $descField = new WysiwygTextarea('description');
     $this->addElement($descField->setLabel($language->text('video', 'description')));
     // code Field
     $codeField = new Textarea('code');
     $codeField->setRequired(true);
     $this->addElement($codeField->setLabel($language->text('video', 'code')));
     $tagsField = new TagsInputField('tags');
     $this->addElement($tagsField->setLabel($language->text('video', 'tags')));
     $submit = new Submit('add');
     $submit->setValue($language->text('video', 'btn_add'));
     $this->addElement($submit);
 }
Exemplo n.º 7
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);
 }
Exemplo n.º 8
0
 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);
 }
Exemplo n.º 9
0
 public function __construct($name)
 {
     parent::__construct($name);
     $militaryTime = Ow::getConfig()->getValue('base', 'military_time');
     $language = OW::getLanguage();
     $currentYear = date('Y', time());
     $title = new TextField('title');
     $title->setRequired();
     $title->setLabel($language->text('eventx', 'add_form_title_label'));
     $event = new OW_Event(self::EVENTX_NAME, array('name' => 'title'), $title);
     OW::getEventManager()->trigger($event);
     $title = $event->getData();
     $this->addElement($title);
     $startDate = new DateField('start_date');
     $startDate->setMinYear($currentYear);
     $startDate->setMaxYear($currentYear + 5);
     $startDate->setRequired();
     $event = new OW_Event(self::EVENTX_NAME, array('name' => 'start_date'), $startDate);
     OW::getEventManager()->trigger($event);
     $startDate = $event->getData();
     $this->addElement($startDate);
     $startTime = new EventTimeField('start_time');
     $startTime->setMilitaryTime($militaryTime);
     if (!empty($_POST['endDateFlag'])) {
         $startTime->setRequired();
     }
     $event = new OW_Event(self::EVENTX_NAME, array('name' => 'start_time'), $startTime);
     OW::getEventManager()->trigger($event);
     $startTime = $event->getData();
     $this->addElement($startTime);
     $endDate = new DateField('end_date');
     $endDate->setMinYear($currentYear);
     $endDate->setMaxYear($currentYear + 5);
     $event = new OW_Event(self::EVENTX_NAME, array('name' => 'end_date'), $endDate);
     OW::getEventManager()->trigger($event);
     $endDate = $event->getData();
     $this->addElement($endDate);
     $endTime = new EventTimeField('end_time');
     $endTime->setMilitaryTime($militaryTime);
     $event = new OW_Event(self::EVENTX_NAME, array('name' => 'end_time'), $endTime);
     OW::getEventManager()->trigger($event);
     $endTime = $event->getData();
     $this->addElement($endTime);
     if (OW::getConfig()->getValue('eventx', 'enableCategoryList') == '1') {
         if (OW::getConfig()->getValue('eventx', 'enableMultiCategories') == 1) {
             $element = new CheckboxGroup('event_category');
             $element->setColumnCount(3);
         } else {
             $element = new SelectBox('event_category');
         }
         $element->setRequired(true);
         $element->setLabel($language->text('eventx', 'event_category_label'));
         foreach (EVENTX_BOL_EventService::getInstance()->getCategoriesList() as $category) {
             $element->addOption($category->id, $category->name);
         }
         $this->addElement($element);
     }
     $maxInvites = new TextField('max_invites');
     $maxInvites->setRequired();
     $validator = new IntValidator(0);
     $validator->setErrorMessage($language->text('eventx', 'invalid_integer_value'));
     $maxInvites->addValidator($validator);
     $maxInvites->setLabel($language->text('eventx', 'add_form_maxinvites_label'));
     $this->addElement($maxInvites);
     $location = new TextField('location');
     $location->setRequired();
     $location->setId('location');
     $location->setLabel($language->text('eventx', 'add_form_location_label'));
     $event = new OW_Event(self::EVENTX_NAME, array('name' => 'location'), $location);
     OW::getEventManager()->trigger($event);
     $location = $event->getData();
     $this->addElement($location);
     $whoCanView = new RadioField('who_can_view');
     $whoCanView->setRequired();
     $whoCanView->addOptions(array('1' => $language->text('eventx', 'add_form_who_can_view_option_anybody'), '2' => $language->text('eventx', 'add_form_who_can_view_option_invit_only')));
     $whoCanView->setLabel($language->text('eventx', 'add_form_who_can_view_label'));
     $event = new OW_Event(self::EVENTX_NAME, array('name' => 'who_can_view'), $whoCanView);
     OW::getEventManager()->trigger($event);
     $whoCanView = $event->getData();
     $this->addElement($whoCanView);
     $whoCanInvite = new RadioField('who_can_invite');
     $whoCanInvite->setRequired();
     $whoCanInvite->addOptions(array(EVENTX_BOL_EventService::CAN_INVITE_PARTICIPANT => $language->text('eventx', 'add_form_who_can_invite_option_participants'), EVENTX_BOL_EventService::CAN_INVITE_CREATOR => $language->text('eventx', 'add_form_who_can_invite_option_creator')));
     $whoCanInvite->setLabel($language->text('eventx', 'add_form_who_can_invite_label'));
     $event = new OW_Event(self::EVENTX_NAME, array('name' => 'who_can_invite'), $whoCanInvite);
     OW::getEventManager()->trigger($event);
     $whoCanInvite = $event->getData();
     $this->addElement($whoCanInvite);
     $desc = new WysiwygTextarea('desc');
     $desc->setLabel($language->text('eventx', 'add_form_desc_label'));
     $desc->setRequired();
     $event = new OW_Event(self::EVENTX_NAME, array('name' => 'desc'), $desc);
     OW::getEventManager()->trigger($event);
     $desc = $event->getData();
     $this->addElement($desc);
     $imageField = new FileField('image');
     $imageField->setLabel($language->text('eventx', 'add_form_image_label'));
     $this->addElement($imageField);
     if (OW::getConfig()->getValue('eventx', 'enableTagsList') == '1') {
         $tags = new TagsInputField('tags');
         $tags->setId('tags');
         $tags->setLabel($language->text('base', 'tags_cloud_cap_label'));
         $this->addElement($tags);
     }
     $submit = new Submit('submit');
     $submit->setValue($language->text('eventx', 'add_form_submit_label'));
     $this->addElement($submit);
     $event = new OW_Event(self::EVENTX_NAME, array('name' => 'image'), $imageField);
     OW::getEventManager()->trigger($event);
     $imageField = $event->getData();
     $this->setEnctype(Form::ENCTYPE_MULTYPART_FORMDATA);
 }