public function render() { $defaultAvatarUrl = BOL_AvatarService::getInstance()->getDefaultAvatarUrl(); $this->assign('defaultAvatarUrl', $defaultAvatarUrl); $js = "OW.Mailbox.conversationController = new MAILBOX_ConversationView();"; OW::getDocument()->addOnloadScript($js, 3006); //TODO check this config $enableAttachments = OW::getConfig()->getValue('mailbox', 'enable_attachments'); $this->assign('enableAttachments', $enableAttachments); $replyToMessageActionPromotedText = ''; $isAuthorizedReplyToMessage = OW::getUser()->isAuthorized('mailbox', 'reply_to_message'); $isAuthorizedReplyToMessage = $isAuthorizedReplyToMessage || OW::getUser()->isAuthorized('mailbox', 'send_chat_message'); if (!$isAuthorizedReplyToMessage) { $status = BOL_AuthorizationService::getInstance()->getActionStatus('mailbox', 'reply_to_message'); if ($status['status'] == BOL_AuthorizationService::STATUS_PROMOTED) { $replyToMessageActionPromotedText = $status['msg']; } } $this->assign('isAuthorizedReplyToMessage', $isAuthorizedReplyToMessage); $isAuthorizedReplyToChatMessage = OW::getUser()->isAuthorized('mailbox', 'reply_to_chat_message'); if (!$isAuthorizedReplyToChatMessage) { $status = BOL_AuthorizationService::getInstance()->getActionStatus('mailbox', 'reply_to_chat_message'); if ($status['status'] == BOL_AuthorizationService::STATUS_PROMOTED) { $replyToMessageActionPromotedText = $status['msg']; } } $this->assign('isAuthorizedReplyToChatMessage', $isAuthorizedReplyToChatMessage); $this->assign('replyToMessageActionPromotedText', $replyToMessageActionPromotedText); if ($isAuthorizedReplyToMessage) { $text = new WysiwygTextarea('mailbox_message'); $text->setId('conversationTextarea'); $this->assign('mailbox_message', $text->renderInput()); } return parent::render(); }
/** * Class constructor */ public function __construct() { parent::__construct('update-question-form'); $this->setAction(OW::getRouter()->urlFor('OCSFAQ_CTRL_Admin', 'editQuestion')); $lang = OW::getLanguage(); $questionId = new HiddenField('questionId'); $questionId->setRequired(true); $this->addElement($questionId); $question = new TextField('question'); $question->setRequired(true); $question->setLabel($lang->text('ocsfaq', 'question')); $this->addElement($question); $btnSet = array(BOL_TextFormatService::WS_BTN_IMAGE, BOL_TextFormatService::WS_BTN_VIDEO, BOL_TextFormatService::WS_BTN_HTML); $answer = new WysiwygTextarea('answer', $btnSet); $answer->setRequired(true); $answer->setLabel($lang->text('ocsfaq', 'answer')); $this->addElement($answer); $isFeatured = new CheckboxField('isFeatured'); $isFeatured->setLabel($lang->text('ocsfaq', 'is_featured')); $this->addElement($isFeatured); $categories = OCSFAQ_BOL_FaqService::getInstance()->getCategories(); if ($categories) { $category = new Selectbox('category'); foreach ($categories as $cat) { $category->addOption($cat->id, $cat->name); } $category->setLabel($lang->text('ocsfaq', 'category')); $this->addElement($category); } // submit $submit = new Submit('update'); $submit->setValue($lang->text('ocsfaq', 'btn_save')); $this->addElement($submit); }
/** * Class constructor */ public function __construct() { parent::__construct('edit-goal-form'); $this->setAction(OW::getRouter()->urlFor('OCSFUNDRAISING_CTRL_Admin', 'editGoal')); $this->setEnctype(Form::ENCTYPE_MULTYPART_FORMDATA); $lang = OW::getLanguage(); $id = new HiddenField('goalId'); $this->addElement($id); $name = new TextField('name'); $name->setRequired(true); $name->setLabel($lang->text('ocsfundraising', 'name')); $this->addElement($name); $btnSet = array(BOL_TextFormatService::WS_BTN_IMAGE, BOL_TextFormatService::WS_BTN_VIDEO, BOL_TextFormatService::WS_BTN_HTML); $desc = new WysiwygTextarea('description', $btnSet); $desc->setRequired(true); $sValidator = new StringValidator(1, 50000); $desc->addValidator($sValidator); $desc->setLabel($lang->text('ocsfundraising', 'description')); $this->addElement($desc); $category = new Selectbox('category'); $category->setLabel($lang->text('ocsfundraising', 'category')); $list = OCSFUNDRAISING_BOL_Service::getInstance()->getCategoryList(); if ($list) { foreach ($list as $cat) { $category->addOption($cat->id, $lang->text('ocsfundraising', 'category_' . $cat->id)); } } $this->addElement($category); $target = new TextField('target'); $target->setRequired(true); $target->setLabel($lang->text('ocsfundraising', 'target_amount')); $this->addElement($target); $current = new TextField('current'); $current->setRequired(true); $current->setLabel($lang->text('ocsfundraising', 'current_amount')); $this->addElement($current); $min = new TextField('min'); $min->setLabel($lang->text('ocsfundraising', 'min_amount')); $this->addElement($min); $end = new DateField('end'); $end->setMinYear(date('Y')); $end->setMaxYear(date('Y') + 2); $end->setLabel($lang->text('ocsfundraising', 'end_date')); $this->addElement($end); $imageField = new FileField('image'); $imageField->setLabel($lang->text('ocsfundraising', 'image_label')); $this->addElement($imageField); $submit = new Submit('update'); $submit->setLabel($lang->text('base', 'save')); $this->addElement($submit); }
public function __construct() { parent::__construct('hint-form'); $this->setAjax(TRUE); $this->setAction(OW::getRouter()->urlForRoute('profileprogressbar.admin_hint')); $this->setAjaxResetOnSuccess(FALSE); $this->bindJsFunction('success', 'function(data) { $("#profile-progressbar").tipTip({content: data.content}); OW.info("Settings successfully saved"); }'); $checkBox = new CheckboxField('show-hint'); if ((bool) OW::getConfig()->getValue('profileprogressbar', 'show_hint')) { $checkBox->addAttribute('checked', 'checked'); } $checkBox->setLabel(OW::getLanguage()->text('profileprogressbar', 'show_hint_label')); $checkBox->setDescription(OW::getLanguage()->text('profileprogressbar', 'show_hint_desc')); $this->addElement($checkBox); $hintText = new WysiwygTextarea('hint-text'); $hintText->setRequired(); $hintText->setSize(WysiwygTextarea::SIZE_L); $hintText->setValue(OW::getLanguage()->text('profileprogressbar', 'hint_text')); $hintText->setLabel(OW::getLanguage()->text('profileprogressbar', 'hint_label')); $hintText->setDescription(OW::getLanguage()->text('profileprogressbar', 'hint_desc')); $this->addElement($hintText); $submit = new Submit('save'); $submit->setValue('Save'); $this->addElement($submit); }
/** * 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); }
public function __construct($userId) { parent::__construct(); $form = new Form("send_message_form"); $form->setAjax(true); $form->setAjaxResetOnSuccess(true); $form->setAction(OW::getRouter()->urlFor('BASE_CTRL_AjaxSendMessageToEmail', 'sendMessage')); $user = new HiddenField("userId"); $user->setValue($userId); $form->addElement($user); $subject = new TextField('subject'); $subject->setInvitation(OW::getLanguage()->text('base', 'subject')); $subject->setRequired(true); $form->addElement($subject); $textarea = new WysiwygTextarea("message"); $textarea->setInvitation(OW::getLanguage()->text('base', 'message_invitation')); $requiredValidator = new WyswygRequiredValidator(); $requiredValidator->setErrorMessage(OW::getLanguage()->text('base', 'message_empty')); $textarea->addValidator($requiredValidator); $form->addElement($textarea); $submit = new Submit('send'); $submit->setLabel(OW::getLanguage()->text('base', 'send')); $form->addElement($submit); $form->bindJsFunction(Form::BIND_SUCCESS, ' function ( data ) { if ( data.result ) { OW.info(data.message); } else { OW.error(data.message); } if ( OW.getActiveFloatBox() ) { OW.getActiveFloatBox().close(); } } '); $this->addForm($form); }
/** * 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); }
/** * 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); }
public function __construct($interlocutorId) { $language = OW::getLanguage(); parent::__construct('mailbox-create-conversation-form'); $this->setAction(OW::getRouter()->urlFor('MAILBOX_CTRL_Mailbox', 'sendMessageAjaxResponder', array('userId' => $interlocutorId))); $this->setId('mailbox-create-conversation-form'); $this->setEnctype('multipart/form-data'); $this->setAjax(); $this->setAjaxResetOnSuccess(false); $hidden = new HiddenField('userId'); $hidden->setValue($interlocutorId); $this->addElement($hidden); //thickbox $validatorSubject = new StringValidator(0, 2048); $validatorSubject->setErrorMessage($language->text('mailbox', 'message_too_long_error', array('maxLength' => 2048))); $subject = new TextField('subject'); $subject->setLabel($language->text('mailbox', 'subject'))->addAttribute('class', 'ow_text'); $subject->addValidator($validatorSubject); $subject->setRequired(true); $this->addElement($subject); $validatorTextarea = new StringValidator(0, 24000); $validatorTextarea->setErrorMessage($language->text('mailbox', 'message_too_long_error', array('maxLength' => 24000))); $message = new WysiwygTextarea('message', array(BOL_TextFormatService::WS_BTN_IMAGE, BOL_TextFormatService::WS_BTN_VIDEO), false); $message->setLabel($language->text('mailbox', 'text'))->addAttribute('class', 'ow_text'); $message->addAttribute('rows', '10'); $message->addValidator($validatorTextarea); $message->setRequired(true); $this->addElement($message); if (OW::getConfig()->getValue('mailbox', 'enable_attachments')) { $multiUpload = new MAILBOX_CLASS_AjaxFileUpload('attachments'); $multiUpload->setId('attachments'); $this->addElement($multiUpload); } $captcha = new MailboxCaptchaField('captcha'); $captcha->addValidator(new MailboxCaptchaValidator($captcha->getId())); $LastSendStamp = BOL_PreferenceService::getInstance()->getPreferenceValue('mailbox_create_conversation_stamp', OW::getUser()->getId()); $this->displayCapcha = BOL_PreferenceService::getInstance()->getPreferenceValue('mailbox_create_conversation_display_capcha', OW::getUser()->getId()); if (!$this->displayCapcha && $LastSendStamp + self::DISPLAY_CAPTCHA_TIMEOUT > time()) { BOL_PreferenceService::getInstance()->savePreferenceValue('mailbox_create_conversation_display_capcha', true, OW::getUser()->getId()); $this->displayCapcha = true; } $captcha->addAttribute('disabled', 'disabled'); $this->addElement($captcha); $submit = new Submit('send'); $submit->setValue($language->text('mailbox', 'send_button')); $submit->addAttribute('class', 'ow_button ow_ic_mail'); $this->addElement($submit); if (!OW::getRequest()->isAjax()) { $messageError = $language->text('mailbox', 'create_conversation_fail_message'); $messageSuccess = $language->text('mailbox', 'create_conversation_message'); $js = " owForms['mailbox-create-conversation-form'].bind( 'success',\n function( json )\n {\n var from = \$('#mailbox-create-conversation-form');\n var captcha = from.find('input[name=captcha]');\n\n if ( json.result == 'permission_denied' )\n {\n if ( json.message != undefined )\n {\n OW.error(json.message);\n }\n else\n {\n OW.error(" . json_encode(OW::getLanguage()->text('mailbox', 'write_permission_denied')) . ");\n }\n }\n else if ( json.result == 'display_captcha' )\n \t{\n window." . $captcha->jsObjectName . ".refresh();\n\n if ( captcha.attr('disabled') != 'disabled' )\n {\n owForms['mailbox-create-conversation-form'].getElement('captcha').showError(" . json_encode(OW::getLanguage()->text('base', 'form_validator_captcha_error_message')) . ");\n }\n else\n {\n captcha.removeAttr('disabled');\n }\n\n from.find('tr.captcha').show();\n from.find('tr.mailbox_conversation').hide();\n }\n else if ( json.result == true )\n \t{\n \t window.mailbox_send_message_floatbox.close();\n \$('#attach_file_inputs').hide();\n\n captcha.attr('disabled','disabled');\n from.find('tr.captcha').hide();\n owForms['mailbox-create-conversation-form'].resetForm();\n window." . $captcha->jsObjectName . ".refresh();\n\n \t OW.info('{$messageSuccess}');\n from.find('tr.captcha').hide();\n from.find('tr.mailbox_conversation').show();\n }\n else\n {\n OW.error('{$messageError}');\n }\n\n \$('#mailbox-create-conversation-form input[name=userId]').val(" . $interlocutorId . ");\n\n \t} ); "; OW::getDocument()->addOnloadScript($js); } }
public function __construct($name, $senderId, $context = MCOMPOSE_BOL_Service::CONTEXT_USER, $initJs = true, $inPopup = true) { parent::__construct($name); $language = OW::getLanguage(); $this->userId = $senderId; $this->context = $context; $this->setAction(OW::getRouter()->urlFor('MCOMPOSE_CTRL_Compose', 'send', array('userId' => $senderId, 'formName' => $this->getName()))); $this->setMethod(self::METHOD_POST); $this->setId($this->getName()); $this->setEnctype('multipart/form-data'); $this->setAjax(); $this->setAjaxResetOnSuccess(false); $to = new MCOMPOSE_CLASS_UserSelectField('recipients', OW::getLanguage()->text('mcompose', 'selector_invitation_label')); $to->setRequired(); $this->addElement($to); //thickbox $validatorSubject = new StringValidator(0, 2048); $validatorSubject->setErrorMessage($language->text('mailbox', 'message_too_long_error', array('maxLength' => 2048))); $subject = new TextField('subject'); $subject->setInvitation('Subject'); $subject->setHasInvitation(true); $subject->setLabel($language->text('mailbox', 'subject'))->addAttribute('class', 'ow_text'); $subject->addValidator($validatorSubject); $subject->setRequired(true); $this->addElement($subject); $validatorTextarea = new StringValidator(0, 24000); $validatorTextarea->setErrorMessage($language->text('mailbox', 'message_too_long_error', array('maxLength' => 24000))); $message = new WysiwygTextarea('message', array(BOL_TextFormatService::WS_BTN_IMAGE, BOL_TextFormatService::WS_BTN_VIDEO), true); $message->setLabel($language->text('mailbox', 'text'))->addAttribute('class', 'ow_text'); $message->setSize(300); $message->addValidator($validatorTextarea); $message->setRequired(true); $this->addElement($message); if (OW::getConfig()->getValue('mailbox', 'enable_attachments')) { $multiUpload = new MAILBOX_CLASS_AjaxFileUpload('attachments'); //$multiUpload->setId('attachments'); $this->addElement($multiUpload); } // Captcha $captcha = new MailboxCaptchaField('captcha'); $captcha->addValidator(new MailboxCaptchaValidator($captcha->getId())); $captcha->addAttribute('disabled', 'disabled'); $this->addElement($captcha); $submit = new Submit('send'); $submit->setValue($language->text('mailbox', 'send_button')); $submit->addAttribute('class', 'ow_button ow_ic_mail'); $this->addElement($submit); if ($initJs) { $js = "owForms['" . $this->getName() . "'].bind( 'success',\n function( json )\n {\n var _complete = function(){ \n if ( _scope.floatBox ) _scope.floatBox.close();\n };\n\n var form = \$('#" . $this->getName() . "');\n var captcha = form.find('input[name=captcha]');\n\n if ( json.result == 'permission_denied' )\n {\n if ( json.message )\n {\n OW.error(json.message);\n }\n else\n {\n OW.error(" . json_encode(OW::getLanguage()->text('mailbox', 'write_permission_denied')) . ");\n }\n \n _complete();\n }\n else if ( json.result == 'display_captcha' )\n \t{\n window." . $captcha->jsObjectName . ".refresh();\n\n if ( captcha.attr('disabled') != 'disabled' )\n {\n owForms['" . $this->getName() . "'].getElement('captcha').showError(" . json_encode(OW::getLanguage()->text('base', 'form_validator_captcha_error_message')) . ");\n }\n else\n {\n captcha.removeAttr('disabled');\n }\n\n form.find('tr.captcha').show();\n form.find('tr.mailbox_conversation').hide();\n }\n else if ( json.result == true )\n \t{\n captcha.attr('disabled','disabled');\n form.find('tr.captcha').hide();\n window." . $captcha->jsObjectName . ".refresh();\n\n form.find('tr.captcha').hide();\n form.find('tr.mailbox_conversation').show();\n\n owForms['" . $this->getName() . "'].resetForm();\n form.find('textarea[name=message]').get(0).htmlareaRefresh();\n\n if ( json.error )\n OW.error(json.error);\n\n if ( json.warning )\n OW.warning(json.warning);\n\n if ( json.message )\n OW.info(json.message);\n \n _complete();\n }\n else if ( json.error )\n {\n OW.error(json.error);\n \n _complete();\n }\n\n }); "; OW::getDocument()->addOnloadScript($js); } }
/** * Class constructor * */ public function __construct() { $language = OW::getLanguage(); parent::__construct('mailbox-add-message-form'); $this->setId('mailbox-add-message-form'); $this->setEnctype('multipart/form-data'); $validator = new StringValidator(0, 24000); $validator->setErrorMessage($language->text('mailbox', 'message_too_long_error', array('maxLength' => 24000))); $textarea = new WysiwygTextarea('message', array(BOL_TextFormatService::WS_BTN_IMAGE, BOL_TextFormatService::WS_BTN_VIDEO), false); $textarea->addValidator($validator); $textarea->setHasInvitation(true); $textarea->setInvitation($language->text('mailbox', 'write_here')); $textarea->setRequired(true); $this->addElement($textarea); OW::getDocument()->addOnloadScript("\$('#{$textarea->getId()}').focus(function(){this.htmlarea();this.htmlareaFocus();});"); $configs = OW::getConfig()->getValues('mailbox'); if (!empty($configs['enable_attachments'])) { $multiUpload = new MultiFileField('attachments', 5); $this->addElement($multiUpload); } $submit = new Submit("add"); $submit->setValue($language->text('mailbox', 'add_button')); $this->addElement($submit); }
/** * Generates add post form. * * @param int $topicId * @param string $uid * @return Form */ private function generateAddPostForm($topicId, $uid) { $form = new Form('add-post-form'); $form->setEnctype('multipart/form-data'); $lang = OW::getLanguage(); $addPostUrl = OW::getRouter()->urlForRoute('add-post', array('topicId' => $topicId, 'uid' => $uid)); $form->setAction($addPostUrl); $topicIdField = new HiddenField('topic'); $topicIdField->setValue($topicId); $form->addElement($topicIdField); $attachmentUid = new HiddenField('attachmentUid'); $attachmentUid->setValue($uid); $attachmentUid->setRequired(true); $form->addElement($attachmentUid); $btnSet = array(BOL_TextFormatService::WS_BTN_IMAGE, BOL_TextFormatService::WS_BTN_VIDEO, BOL_TextFormatService::WS_BTN_HTML); $postText = new WysiwygTextarea('text', $btnSet); $postText->setRequired(true); $sValidator = new StringValidator(1, 50000); $sValidator->setErrorMessage($lang->text('forum', 'chars_limit_exceeded', array('limit' => 50000))); $postText->addValidator($sValidator); $form->addElement($postText); $submit = new Submit('submit'); $submit->setValue($lang->text('forum', 'add_post_btn')); $form->addElement($submit); return $form; }
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($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); }
/** * Generates Add Topic Form. * * @param array $groupSelect * @param int $groupId * @return Form */ private function generateForm($groupSelect, $groupId, $isHidden) { $form = new Form('add-topic-form'); $form->setEnctype("multipart/form-data"); $lang = OW::getLanguage(); $title = new TextField('title'); $title->setRequired(true); $sValidator = new StringValidator(1, 255); $sValidator->setErrorMessage($lang->text('forum', 'chars_limit_exceeded', array('limit' => 255))); $title->addValidator($sValidator); $form->addElement($title); if ($isHidden) { $group = new HiddenField('group'); $group->setValue($groupId); } else { $group = new ForumSelectBox('group'); $group->setOptions($groupSelect); if ($groupId) { $group->setValue($groupId); } $group->setRequired(true); $group->addValidator(new IntValidator()); } $form->addElement($group); $btnSet = array(BOL_TextFormatService::WS_BTN_IMAGE, BOL_TextFormatService::WS_BTN_VIDEO, BOL_TextFormatService::WS_BTN_HTML); $text = new WysiwygTextarea('text', $btnSet); $text->setRequired(true); $sValidator = new StringValidator(1, 50000); $sValidator->setErrorMessage($lang->text('forum', 'chars_limit_exceeded', array('limit' => 50000))); $text->addValidator($sValidator); $form->addElement($text); $subscribe = new CheckboxField('subscribe'); $subscribe->setLabel($lang->text('forum', 'subscribe')); $subscribe->setValue(true); $form->addElement($subscribe); $post = new Submit('post'); $post->setValue($lang->text('forum', 'add_post_btn')); $form->addElement($post); $attachmentField = new MultiFileField('attachments', 5); $form->addElement($attachmentField); $this->addForm($form); return $form; }
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); }
public function __construct($formName) { parent::__construct($formName); $this->setEnctype(Form::ENCTYPE_MULTYPART_FORMDATA); $language = OW::getLanguage(); $field = new TextField('title'); $field->setRequired(true); $field->setLabel($language->text('groups', 'create_field_title_label')); $this->addElement($field); $field = new WysiwygTextarea('description'); $field->setLabel($language->text('groups', 'create_field_description_label')); $field->setRequired(true); $this->addElement($field); $field = new GROUPS_Image('image'); $field->setLabel($language->text('groups', 'create_field_image_label')); $field->addValidator(new GROUPS_ImageValidator()); $this->addElement($field); $whoCanView = new RadioField('whoCanView'); $whoCanView->setRequired(); $whoCanView->addOptions(array(GROUPS_BOL_Service::WCV_ANYONE => $language->text('groups', 'form_who_can_view_anybody'), GROUPS_BOL_Service::WCV_INVITE => $language->text('groups', 'form_who_can_view_invite'))); $whoCanView->setLabel($language->text('groups', 'form_who_can_view_label')); $this->addElement($whoCanView); $whoCanInvite = new RadioField('whoCanInvite'); $whoCanInvite->setRequired(); $whoCanInvite->addOptions(array(GROUPS_BOL_Service::WCI_PARTICIPANT => $language->text('groups', 'form_who_can_invite_participants'), GROUPS_BOL_Service::WCI_CREATOR => $language->text('groups', 'form_who_can_invite_creator'))); $whoCanInvite->setLabel($language->text('groups', 'form_who_can_invite_label')); $this->addElement($whoCanInvite); }
public function index($params = array()) { $userService = BOL_UserService::getInstance(); $language = OW::getLanguage(); $this->setPageHeading($language->text('admin', 'massmailing')); $this->setPageHeadingIconClass('ow_ic_script'); $massMailingForm = new Form('massMailingForm'); $massMailingForm->setId('massMailingForm'); $rolesList = BOL_AuthorizationService::getInstance()->getRoleList(); $userRoles = new CheckboxGroup('userRoles'); $userRoles->setLabel($language->text('admin', 'massmailing_user_roles_label')); foreach ($rolesList as $role) { if ($role->name != 'guest') { $userRoles->addOption($role->name, $language->text('base', 'authorization_role_' . $role->name)); } } $massMailingForm->addElement($userRoles); $emailFormat = new Selectbox('emailFormat'); $emailFormat->setLabel($language->text('admin', 'massmailing_email_format_label')); $emailFormat->setOptions(array(self::EMAIL_FORMAT_TEXT => $language->text('admin', 'massmailing_email_format_text'), self::EMAIL_FORMAT_HTML => $language->text('admin', 'massmailing_email_format_html'))); $emailFormat->setValue(self::EMAIL_FORMAT_TEXT); $emailFormat->setHasInvitation(false); if (!empty($_POST['emailFormat'])) { $emailFormat->setValue($_POST['emailFormat']); } $massMailingForm->addElement($emailFormat); $subject = new TextField('subject'); $subject->addAttribute('class', 'ow_text'); $subject->addAttribute('style', 'width: auto;'); $subject->setRequired(); $subject->setLabel($language->text('admin', 'massmailing_subject_label')); if (!empty($_POST['subject'])) { $subject->setValue($_POST['subject']); } $massMailingForm->addElement($subject); $body = new Textarea('body'); if ($emailFormat->getValue() == self::EMAIL_FORMAT_HTML) { $body = new WysiwygTextarea('body'); $body->forceAddButtons(array(BOL_TextFormatService::WS_BTN_IMAGE, BOL_TextFormatService::WS_BTN_HTML)); } $body->addAttribute('class', 'ow_text'); $body->addAttribute('style', 'width: auto;'); $body->setRequired(); $body->setLabel($language->text('admin', 'massmailing_body_label')); if (!empty($_POST['body'])) { $body->setValue($_POST['body']); } $massMailingForm->addElement($body); $submit = new Submit('startMailing'); $submit->addAttribute('class', 'ow_button'); $submit->setValue($language->text('admin', 'massmailing_start_mailing_button')); $massMailingForm->addElement($submit); $this->addForm($massMailingForm); $ignoreUnsubscribe = false; $isActive = true; if (defined('OW_PLUGIN_XP')) { $massMailingTimestamp = OW::getConfig()->getValue('admin', 'mass_mailing_timestamp'); $timeout = $massMailingTimestamp + 60 * 60 * 24 - time(); if ($timeout > 0) { $isActive = false; $this->assign('expireText', $language->text('admin', 'massmailing_expire_text', array('hours' => (int) ceil($timeout / (60 * 60))))); } } $this->assign('isActive', $isActive); $total = $userService->findMassMailingUserCount($ignoreUnsubscribe); if (OW::getRequest()->isPost() && $isActive && isset($_POST['startMailing'])) { if ($massMailingForm->isValid($_POST)) { $data = $massMailingForm->getValues(); $start = 0; $count = self::MAILS_ARRAY_MAX_RECORDS; $mailCount = 0; $total = $userService->findMassMailingUserCount($ignoreUnsubscribe, $data['userRoles']); while ($start < $total) { $result = $this->userService->findMassMailingUsers($start, $count, $ignoreUnsubscribe, $data['userRoles']); $mails = array(); $userIdList = array(); foreach ($result as $user) { $userIdList[] = $user->id; } $displayNameList = $this->userService->getDisplayNamesForList($userIdList); $event = new BASE_CLASS_EventCollector('base.add_global_lang_keys'); OW::getEventManager()->trigger($event); $vars = call_user_func_array('array_merge', $event->getData()); foreach ($result as $key => $user) { $vars['user_email'] = $user->email; $mail = OW::getMailer()->createMail(); $mail->addRecipientEmail($user->email); $vars['user_name'] = $displayNameList[$user->id]; $code = md5($user->username . $user->password); $link = OW::getRouter()->urlForRoute('base_massmailing_unsubscribe', array('id' => $user->id, 'code' => $code)); $subjectText = UTIL_String::replaceVars($data['subject'], $vars); $mail->setSubject($subjectText); if ($data['emailFormat'] === self::EMAIL_FORMAT_HTML) { $htmlContent = UTIL_String::replaceVars($data['body'], $vars); $htmlContent .= $language->text('admin', 'massmailing_unsubscribe_link_html', array('link' => $link)); $mail->setHtmlContent($htmlContent); $textContent = preg_replace("/\\<br\\s*[\\/]?\\s*\\>/", "\n", $htmlContent); $textContent = strip_tags($textContent); $mail->setTextContent($textContent); } else { $textContent = UTIL_String::replaceVars($data['body'], $vars); $textContent .= "\n\n" . $language->text('admin', 'massmailing_unsubscribe_link_text', array('link' => $link)); $mail->setTextContent($textContent); } $mails[] = $mail; $mailCount++; } $start += $count; //printVar($mails); OW::getMailer()->addListToQueue($mails); } OW::getFeedback()->info($language->text('admin', 'massmailing_send_mails_message', array('count' => $mailCount))); if (defined('OW_PLUGIN_XP')) { OW::getConfig()->saveConfig('admin', 'mass_mailing_timestamp', time()); } $this->redirect(); } } $this->assign('userCount', $total); $language->addKeyForJs('admin', 'questions_empty_lang_value'); $language->addKeyForJs('admin', 'massmailing_total_members'); $script = ' window.massMailing = new MassMailing(\'' . $this->ajaxResponderUrl . '\'); '; OW::getDocument()->addOnloadScript($script); $jsDir = OW::getPluginManager()->getPlugin("admin")->getStaticJsUrl(); OW::getDocument()->addScript($jsDir . "mass_mailing.js"); }
/** * 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); }
public function __construct($videoId) { parent::__construct('videoEditForm'); $language = OW::getLanguage(); $videoIdField = new HiddenField('id'); $videoIdField->setRequired(true); $this->addElement($videoIdField); $titleField = new TextField('name'); $titleField->addValidator(new StringValidator(1, 128)); $titleField->setRequired(true); $this->addElement($titleField->setLabel($language->text('ivideo', 'upload_video_name'))); $descField = new WysiwygTextarea('description'); $this->addElement($descField->setLabel($language->text('ivideo', 'upload_video_desc'))); $element = new Selectbox('category'); $element->setRequired(true); $element->setLabel($language->text('ivideo', 'admin_video_category')); foreach (IVIDEO_BOL_CategoryDao::getInstance()->findAll() as $category) { $element->addOption($category->id, $category->name); } $this->addElement($element); $entityTags = BOL_TagService::getInstance()->findEntityTags($videoId, 'ivideo-video'); if ($entityTags) { $tags = array(); foreach ($entityTags as $entityTag) { $tags[] = $entityTag->label; } $tagsField = new TagsField('tags', $tags); } else { $tagsField = new TagsField('tags'); } $this->addElement($tagsField->setLabel($language->text('ivideo', 'tags_field_label'))); $submit = new Submit('edit'); $submit->setValue($language->text('ivideo', 'button_edit_label')); $this->addElement($submit); }
/** * Generates edit topic form. * * @param $topicDto * @param $postDto * @param $uid * @return Form */ private function generateEditTopicForm($topicDto, $postDto, $uid) { $form = new Form('edit-topic-form'); $form->setEnctype('multipart/form-data'); $lang = OW::getLanguage(); $topicIdField = new HiddenField('topic-id'); $topicIdField->setValue($topicDto->id); $form->addElement($topicIdField); $postIdField = new HiddenField('post-id'); $postIdField->setValue($postDto->id); $form->addElement($postIdField); $attachmentUid = new HiddenField('attachmentUid'); $attachmentUid->setValue($uid); $attachmentUid->setRequired(true); $form->addElement($attachmentUid); $topicTitleField = new TextField('title'); $topicTitleField->setValue($topicDto->title); $topicTitleField->setRequired(true); $sValidator = new StringValidator(1, 255); $sValidator->setErrorMessage($lang->text('forum', 'chars_limit_exceeded', array('limit' => 255))); $topicTitleField->addValidator($sValidator); $form->addElement($topicTitleField); $btnSet = array(BOL_TextFormatService::WS_BTN_IMAGE, BOL_TextFormatService::WS_BTN_VIDEO, BOL_TextFormatService::WS_BTN_HTML); $postText = new WysiwygTextarea('text', $btnSet); $postText->setValue($postDto->text); $postText->setRequired(true); $sValidator = new StringValidator(1, 50000); $sValidator->setErrorMessage($lang->text('forum', 'chars_limit_exceeded', array('limit' => 50000))); $postText->addValidator($sValidator); $form->addElement($postText); $submit = new Submit('save'); $submit->setValue($lang->text('base', 'edit_button')); $form->addElement($submit); return $form; }
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('event', 'add_form_title_label')); $event = new OW_Event(self::EVENT_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::EVENT_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::EVENT_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::EVENT_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::EVENT_NAME, array('name' => 'end_time'), $endTime); OW::getEventManager()->trigger($event); $endTime = $event->getData(); $this->addElement($endTime); $location = new TextField('location'); $location->setRequired(); $location->setLabel($language->text('event', 'add_form_location_label')); $event = new OW_Event(self::EVENT_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('event', 'add_form_who_can_view_option_anybody'), '2' => $language->text('event', 'add_form_who_can_view_option_invit_only'))); $whoCanView->setLabel($language->text('event', 'add_form_who_can_view_label')); $event = new OW_Event(self::EVENT_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(EVENT_BOL_EventService::CAN_INVITE_PARTICIPANT => $language->text('event', 'add_form_who_can_invite_option_participants'), EVENT_BOL_EventService::CAN_INVITE_CREATOR => $language->text('event', 'add_form_who_can_invite_option_creator'))); $whoCanInvite->setLabel($language->text('event', 'add_form_who_can_invite_label')); $event = new OW_Event(self::EVENT_NAME, array('name' => 'who_can_invite'), $whoCanInvite); OW::getEventManager()->trigger($event); $whoCanInvite = $event->getData(); $this->addElement($whoCanInvite); $submit = new Submit('submit'); $submit->setValue($language->text('event', 'add_form_submit_label')); $this->addElement($submit); $desc = new WysiwygTextarea('desc'); $desc->setLabel($language->text('event', 'add_form_desc_label')); $desc->setRequired(); $event = new OW_Event(self::EVENT_NAME, array('name' => 'desc'), $desc); OW::getEventManager()->trigger($event); $desc = $event->getData(); $this->addElement($desc); $imageField = new FileField('image'); $imageField->setLabel($language->text('event', 'add_form_image_label')); $this->addElement($imageField); $event = new OW_Event(self::EVENT_NAME, array('name' => 'image'), $imageField); OW::getEventManager()->trigger($event); $imageField = $event->getData(); $this->setEnctype(Form::ENCTYPE_MULTYPART_FORMDATA); }