Ejemplo n.º 1
0
 /**
  * @see FormElement::renderInput()
  *
  * @param array $params
  * @return string
  */
 public function renderInput($params = null)
 {
     parent::renderInput($params);
     if ($this->options === null || empty($this->options)) {
         return '';
     }
     $columnWidth = floor(100 / $this->columnsCount);
     $renderedString = '<ul class="ow_checkbox_group clearfix">';
     $noValue = true;
     foreach ($this->options as $key => $value) {
         if ($this->value !== null && is_array($this->value) && in_array($key, $this->value)) {
             $this->addAttribute(FormElement::ATTR_CHECKED, 'checked');
             $noValue = false;
         }
         $this->setId(UTIL_HtmlTag::generateAutoId('input'));
         $this->addAttribute('value', $key);
         $renderedString .= '<li style="width:' . $columnWidth . '%">' . UTIL_HtmlTag::generateTag('input', $this->attributes) . '&nbsp;<label for="' . $this->getId() . '">' . $value . '</label></li>';
         $this->removeAttribute(FormElement::ATTR_CHECKED);
     }
     $language = OW::getLanguage();
     $attributes = $this->attributes;
     $attributes['id'] = $this->getName() . '_unimportant';
     $attributes['name'] = $this->getName() . '_unimportant';
     if ($noValue) {
         $attributes[FormElement::ATTR_CHECKED] = 'checked';
     }
     $renderedString .= '<li class="matchmaking_unimportant_checkbox" style="display:block;border-top: 1px solid #bbb; margin-top: 12px;padding-top:6px; width:100%">' . UTIL_HtmlTag::generateTag('input', $attributes) . '&nbsp;<label for="' . $this->getId() . '">' . $language->text('matchmaking', 'this_is_unimportant') . '</label></li>';
     return $renderedString . '</ul>';
 }
Ejemplo n.º 2
0
 public function __construct($opponentId)
 {
     parent::__construct('composeMessageForm');
     $this->setEnctype(Form::ENCTYPE_MULTYPART_FORMDATA);
     $field = new HiddenField('uid');
     $field->setValue(UTIL_HtmlTag::generateAutoId('mailbox_new_message_' . $opponentId));
     $this->addElement($field);
     $field = new HiddenField('opponentId');
     $field->setValue($opponentId);
     $this->addElement($field);
     $field = new TextField('subject');
     $field->setInvitation(OW::getLanguage()->text('mailbox', 'subject'));
     $field->setHasInvitation(true);
     $field->setRequired();
     $this->addElement($field);
     $field = new Textarea('message');
     $field->setInvitation(OW::getLanguage()->text('mailbox', 'text_message_invitation'));
     $field->setHasInvitation(true);
     $field->setRequired();
     $this->addElement($field);
     $field = new HiddenField('attachment');
     $this->addElement($field);
     $submit = new Submit('sendBtn');
     $submit->setId('sendBtn');
     $submit->setValue(OW::getLanguage()->text('mailbox', 'add_button'));
     $this->addElement($submit);
     if (!OW::getRequest()->isAjax()) {
         $js = UTIL_JsGenerator::composeJsString('
         owForms["composeMessageForm"].bind( "submit", function( r )
         {
             $("#newmessage-mail-send-btn").addClass("owm_preloader_circle");
         });');
         OW::getDocument()->addOnloadScript($js);
     }
 }
Ejemplo n.º 3
0
 public function __construct(BASE_CLASS_WidgetParameter $params)
 {
     parent::__construct();
     $this->setTemplate(OW::getPluginManager()->getPlugin('base')->getCmpViewDir() . 'users_widget.html');
     $randId = UTIL_HtmlTag::generateAutoId('base_users_widget');
     $this->assign('widgetId', $randId);
     $data = $this->getData($params);
     $menuItems = array();
     $dataToAssign = array();
     if (!empty($data)) {
         foreach ($data as $key => $item) {
             $contId = "{$randId}_users_widget_{$key}";
             $toolbarId = !empty($item['toolbar']) ? "{$randId}_toolbar_{$key}" : false;
             $menuItems[$key] = array('label' => $item['menu-label'], 'id' => "{$randId}_users_widget_menu_{$key}", 'contId' => $contId, 'active' => !empty($item['menu_active']), 'toolbarId' => $toolbarId);
             $usersCmp = $this->getUsersCmp($item['userIds']);
             $dataToAssign[$key] = array('users' => $usersCmp->render(), 'active' => !empty($item['menu_active']), 'toolbar' => !empty($item['toolbar']) ? $item['toolbar'] : array(), 'toolbarId' => $toolbarId, 'contId' => $contId);
         }
     }
     $this->assign('data', $dataToAssign);
     $displayMenu = true;
     if (count($data) == 1 && !$this->forceDisplayMenu) {
         $displayMenu = false;
     }
     if (!$params->customizeMode && (count($data) != 1 || $this->forceDisplayMenu)) {
         $menu = $this->getMenuCmp($menuItems);
         if (!empty($menu)) {
             $this->addComponent('menu', $menu);
         }
     }
 }
Ejemplo n.º 4
0
 public function __construct($conversationId, $opponentId)
 {
     parent::__construct('newMailMessageForm');
     $this->setEnctype(Form::ENCTYPE_MULTYPART_FORMDATA);
     $field = new TextField('newMessageText');
     $field->setValue(OW::getLanguage()->text('mailbox', 'text_message_invitation'));
     $field->setId('newMessageText');
     $this->addElement($field);
     $field = new HiddenField('attachment');
     $this->addElement($field);
     $field = new HiddenField('conversationId');
     $field->setValue($conversationId);
     $this->addElement($field);
     $field = new HiddenField('opponentId');
     $field->setValue($opponentId);
     $this->addElement($field);
     $field = new HiddenField('uid');
     $field->setValue(UTIL_HtmlTag::generateAutoId('mailbox_conversation_' . $conversationId . '_' . $opponentId));
     $this->addElement($field);
     $submit = new Submit('newMessageSendBtn');
     $submit->setId('newMessageSendBtn');
     $submit->setName('newMessageSendBtn');
     $submit->setValue(OW::getLanguage()->text('mailbox', 'add_button'));
     $this->addElement($submit);
     if (!OW::getRequest()->isAjax()) {
         $js = UTIL_JsGenerator::composeJsString('
         owForms["newMailMessageForm"].bind( "submit", function( r )
         {
             $("#newmessage-mail-send-btn").addClass("owm_preloader_circle");
         });');
         OW::getDocument()->addOnloadScript($js);
     }
     $this->setAction(OW::getRouter()->urlFor('MAILBOX_MCTRL_Messages', 'newmessage'));
 }
Ejemplo n.º 5
0
 /**
  * User list
  * 
  * @param array $params
  *      integer count
  *      string boxType
  */
 function __construct(array $params = array())
 {
     parent::__construct();
     $this->countUsers = !empty($params['count']) ? (int) $params['count'] : self::DEFAULT_USERS_COUNT;
     $boxType = !empty($params['boxType']) ? $params['boxType'] : "";
     // init users short list
     $randId = UTIL_HtmlTag::generateAutoId('base_users_cmp');
     $data = $this->getData($this->countUsers);
     $menuItems = array();
     $dataToAssign = array();
     foreach ($data as $key => $item) {
         $contId = "{$randId}_users_cmp_{$key}";
         $toolbarId = !empty($item['toolbar']) ? "{$randId}_toolbar_{$key}" : false;
         $menuItems[$key] = array('label' => $item['menu-label'], 'id' => "{$randId}_users_cmp_menu_{$key}", 'contId' => $contId, 'active' => !empty($item['menu_active']), 'toolbarId' => $toolbarId, 'display' => 1);
         $usersCmp = $this->getUsersCmp($item['userIds']);
         $dataToAssign[$key] = array('users' => $usersCmp->render(), 'active' => !empty($item['menu_active']), 'toolbar' => !empty($item['toolbar']) ? $item['toolbar'] : array(), 'toolbarId' => $toolbarId, 'contId' => $contId);
     }
     $menu = $this->getMenuCmp($menuItems);
     if (!empty($menu)) {
         $this->addComponent('menu', $menu);
     }
     // assign view variables
     $this->assign('widgetId', $randId);
     $this->assign('data', $dataToAssign);
     $this->assign('boxType', $boxType);
 }
Ejemplo n.º 6
0
 /**
  * @see FormElement::renderInput()
  *
  * @param array $params
  * @return string
  */
 public function renderInput($params = null)
 {
     parent::renderInput($params);
     if (isset($params['checked'])) {
         $this->addAttribute(FormElement::ATTR_CHECKED, 'checked');
     }
     $label = isset($params['label']) ? $params['label'] : '';
     $this->addAttribute('value', $params['value']);
     $this->setId(UTIL_HtmlTag::generateAutoId('input'));
     $renderedString = '<label>' . UTIL_HtmlTag::generateTag('input', $this->attributes) . $label . '</label>';
     $this->removeAttribute(FormElement::ATTR_CHECKED);
     return $renderedString;
 }
Ejemplo n.º 7
0
 public function __construct($conversationId, $opponentId)
 {
     parent::__construct('newMessageForm');
     $this->setEnctype(Form::ENCTYPE_MULTYPART_FORMDATA);
     $field = new HiddenField('attachment');
     $this->addElement($field);
     $field = new HiddenField('conversationId');
     $field->setValue($conversationId);
     $this->addElement($field);
     $field = new HiddenField('opponentId');
     $field->setValue($opponentId);
     $this->addElement($field);
     $field = new HiddenField('uid');
     $field->setValue(UTIL_HtmlTag::generateAutoId('mailbox_conversation_' . $conversationId . '_' . $opponentId));
     $this->addElement($field);
     $this->setAction(OW::getRouter()->urlFor('MAILBOX_MCTRL_Messages', 'attachment'));
 }
Ejemplo n.º 8
0
 private function addUserList(EVENTX_BOL_Event $event, $status)
 {
     $configs = $this->eventService->getConfigs();
     $language = OW::getLanguage();
     $listTypes = $this->eventService->getUserListsArray();
     $serviceConfigs = $this->eventService->getConfigs();
     $userList = $this->eventService->findEventUsers($event->getId(), $status, null, $configs[EVENTX_BOL_EventService::CONF_EVENTX_USERS_COUNT]);
     $usersCount = $this->eventService->findEventUsersCount($event->getId(), $status);
     $idList = array();
     foreach ($userList as $eventUser) {
         $idList[] = $eventUser->getUserId();
     }
     $usersCmp = new BASE_CMP_AvatarUserList($idList);
     $linkId = UTIL_HtmlTag::generateAutoId('link');
     $contId = UTIL_HtmlTag::generateAutoId('cont');
     $this->userLists[] = array('contId' => $contId, 'cmp' => $usersCmp->render(), 'bottomLinkEnable' => $usersCount > $serviceConfigs[EVENTX_BOL_EventService::CONF_EVENTX_USERS_COUNT], 'toolbarArray' => array(array('label' => $language->text('eventx', 'avatar_user_list_bottom_link_label', array('count' => $usersCount)), 'href' => OW::getRouter()->urlForRoute('eventx.user_list', array('eventId' => $event->getId(), 'list' => $listTypes[(int) $status])))));
     $this->userListMenu[] = array('label' => $language->text('eventx', 'avatar_user_list_link_label_' . $status), 'id' => $linkId, 'contId' => $contId, 'active' => sizeof($this->userListMenu) < 1 ? true : false);
 }
Ejemplo n.º 9
0
 /**
  * 
  * @param string $menu
  * @param int $order
  * @return BOL_MenuItem
  */
 public function createEmptyItem($menu, $order)
 {
     $menuItem = new BOL_MenuItem();
     $documentKey = UTIL_HtmlTag::generateAutoId('mobile_page');
     $menuItem->setDocumentKey($documentKey);
     $menuItem->setPrefix(self::MENU_PREFIX);
     $menuItem->setKey($documentKey);
     $menuItem->setType($menu);
     $menuItem->setOrder($order);
     $this->navigationService->saveMenuItem($menuItem);
     $document = new BOL_Document();
     $document->isStatic = true;
     $document->isMobile = true;
     $document->setKey($menuItem->getKey());
     $document->setUri($menuItem->getKey());
     $this->navigationService->saveDocument($document);
     $document->setUri("cp-" . $document->getId());
     $this->navigationService->saveDocument($document);
     $this->editItem($menuItem, array(self::SETTING_LABEL => OW::getLanguage()->text("mobile", "admin_nav_default_menu_name"), self::SETTING_TITLE => OW::getLanguage()->text("mobile", "admin_nav_default_page_title"), self::SETTING_CONTENT => OW::getLanguage()->text("mobile", "admin_nav_default_page_content"), self::SETTING_VISIBLE_FOR => 3));
     return $menuItem;
 }
Ejemplo n.º 10
0
 public function uploadAttachment($params)
 {
     if (empty($_FILES['file']) || empty($params['opponentId'])) {
         throw new ApiResponseErrorException("Files were not uploaded");
     }
     $conversationService = MAILBOX_BOL_ConversationService::getInstance();
     $userId = OW::getUser()->getId();
     $opponentId = $params['opponentId'];
     $lastMessageTimestamp = $params['lastMessageTimestamp'];
     $checkResult = $conversationService->checkUser($userId, $opponentId);
     if ($checkResult['isSuspended']) {
         $this->assign('result', array('error' => true, 'message' => $checkResult['suspendReasonMessage']));
         return;
     }
     $conversationId = $conversationService->getChatConversationIdWithUserById($userId, $opponentId);
     if (empty($conversationId)) {
         $actionName = 'send_chat_message';
     } else {
         $firstMessage = $conversationService->getFirstMessage($conversationId);
         if (empty($firstMessage)) {
             $actionName = 'send_chat_message';
         } else {
             $actionName = 'reply_to_chat_message';
         }
     }
     if (!OW::getUser()->isAuthorized('mailbox', $actionName)) {
         $status = BOL_AuthorizationService::getInstance()->getActionStatus('mailbox', $actionName);
         if ($status['status'] == BOL_AuthorizationService::STATUS_PROMOTED) {
             $this->assign('result', array('error' => true, 'message' => $status['msg']));
         } else {
             if ($status['status'] != BOL_AuthorizationService::STATUS_AVAILABLE) {
                 $language = OW::getLanguage();
                 $this->assign('result', array('error' => true, 'message' => $language->text('mailbox', $actionName . '_permission_denied')));
             }
         }
         return;
     }
     $attachmentService = BOL_AttachmentService::getInstance();
     $maxUploadSize = OW::getConfig()->getValue('base', 'attch_file_max_size_mb');
     $validFileExtensions = json_decode(OW::getConfig()->getValue('base', 'attch_ext_list'), true);
     $conversationId = $conversationService->getChatConversationIdWithUserById($userId, $opponentId);
     if (empty($conversationId)) {
         $conversation = $conversationService->createChatConversation($userId, $opponentId);
         $conversationId = $conversation->getId();
     } else {
         $conversation = $conversationService->getConversation($conversationId);
     }
     $uid = UTIL_HtmlTag::generateAutoId('mailbox_conversation_' . $conversationId . '_' . $opponentId);
     try {
         $dtoArr = $attachmentService->processUploadedFile('mailbox', $_FILES['file'], $uid, $validFileExtensions, $maxUploadSize);
     } catch (Exception $e) {
         $this->assign('result', array('error' => true, 'message' => $e->getMessage()));
         return;
     }
     $files = $attachmentService->getFilesByBundleName('mailbox', $uid);
     if (!empty($files)) {
         try {
             $message = $conversationService->createMessage($conversation, $userId, OW::getLanguage()->text('mailbox', 'attachment'));
             $conversationService->addMessageAttachments($message->id, $files);
             BOL_AuthorizationService::getInstance()->trackAction('mailbox', $actionName);
         } catch (Exception $e) {
             $this->assign('result', array('error' => true, 'message' => $e->getMessage()));
             return;
         }
     }
     $this->assign('result', array('list' => $this->service->getNewMessages($userId, $opponentId, $lastMessageTimestamp), 'billingInfo' => $this->service->getBillingInfo(array(SKANDROID_ABOL_MailboxService::ACTION_SEND_CHAT_MESSAGE, SKANDROID_ABOL_MailboxService::ACTION_READ_CHAT_MESSAGE, SKANDROID_ABOL_MailboxService::ACTION_REPLY_CHAT_MESSAGE))));
 }
Ejemplo n.º 11
0
 /**
  * Class constructor
  *
  */
 public function __construct(MAILBOX_CMP_NewMessage $component = null)
 {
     $language = OW::getLanguage();
     parent::__construct('mailbox-new-message-form');
     $this->setId('mailbox-new-message-form');
     $this->setAjax(true);
     $this->setAjaxResetOnSuccess(false);
     $this->setAction(OW::getRouter()->urlFor('MAILBOX_CTRL_Ajax', 'newMessage'));
     $this->setEmptyElementsErrorMessage('');
     $this->setEnctype('multipart/form-data');
     $subject = new TextField('subject');
     //        $subject->setHasInvitation(true);
     //        $subject->setInvitation($language->text('mailbox', 'subject'));
     $subject->addAttribute('placeholder', $language->text('mailbox', 'subject'));
     $requiredValidator = new RequiredValidator();
     $requiredValidator->setErrorMessage($language->text('mailbox', 'subject_is_required'));
     $subject->addValidator($requiredValidator);
     $validatorSubject = new StringValidator(1, 2048);
     $validatorSubject->setErrorMessage($language->text('mailbox', 'message_too_long_error', array('maxLength' => 2048)));
     $subject->addValidator($validatorSubject);
     $this->addElement($subject);
     $validator = new StringValidator(1, MAILBOX_BOL_AjaxService::MAX_MESSAGE_TEXT_LENGTH);
     $validator->setErrorMessage($language->text('mailbox', 'message_too_long_error', array('maxLength' => MAILBOX_BOL_AjaxService::MAX_MESSAGE_TEXT_LENGTH)));
     $textarea = OW::getClassInstance("MAILBOX_CLASS_Textarea", "message");
     /* @var $textarea MAILBOX_CLASS_Textarea */
     $textarea->addValidator($validator);
     $textarea->setCustomBodyClass("mailbox");
     //        $textarea->setHasInvitation(true);
     //        $textarea->setInvitation($language->text('mailbox', 'message_invitation'));
     $textarea->addAttribute('placeholder', $language->text('mailbox', 'message_invitation'));
     $requiredValidator = new RequiredValidator();
     $requiredValidator->setErrorMessage($language->text('mailbox', 'chat_message_empty'));
     $textarea->addValidator($requiredValidator);
     $this->addElement($textarea);
     $user = OW::getClassInstance("MAILBOX_CLASS_UserField", "opponentId");
     /* @var $user MAILBOX_CLASS_UserField */
     //        $user->setHasInvitation(true);
     //        $user->setInvitation($language->text('mailbox', 'to'));
     $requiredValidator = new RequiredValidator();
     $requiredValidator->setErrorMessage($language->text('mailbox', 'recipient_is_required'));
     $user->addValidator($requiredValidator);
     $this->addElement($user);
     if (OW::getSession()->isKeySet('mailbox.new_message_form_attachments_uid')) {
         $uidValue = OW::getSession()->get('mailbox.new_message_form_attachments_uid');
     } else {
         $uidValue = UTIL_HtmlTag::generateAutoId('mailbox_new_message');
         OW::getSession()->set('mailbox.new_message_form_attachments_uid', $uidValue);
     }
     $uid = new HiddenField('uid');
     $uid->setValue($uidValue);
     $this->addElement($uid);
     $configs = OW::getConfig()->getValues('mailbox');
     if (!empty($configs['enable_attachments']) && !empty($component)) {
         $attachmentCmp = new BASE_CLASS_FileAttachment('mailbox', $uidValue);
         $attachmentCmp->setInputSelector('#newMessageWindowAttachmentsBtn');
         $component->addComponent('attachments', $attachmentCmp);
     }
     $submit = new Submit("send");
     $submit->setValue($language->text('mailbox', 'send_button'));
     $this->addElement($submit);
     if (!OW::getRequest()->isAjax()) {
         $this->initStatic();
     }
 }
Ejemplo n.º 12
0
 /**
  * @param string $entityType
  * @param int $entityId
  * @return string
  */
 public function generateAttachmentUid($entityType, $entityId)
 {
     return UTIL_HtmlTag::generateAutoId($entityType . "_" . $entityId);
 }
Ejemplo n.º 13
0
 public function view($params)
 {
     $event = $this->getEventForParams($params);
     $cmpId = UTIL_HtmlTag::generateAutoId('cmp');
     $this->assign('contId', $cmpId);
     $language = OW::getLanguage();
     if (!OW::getUser()->isAuthorized('eventx', 'view_event') && $event->getUserId() != OW::getUser()->getId()) {
         $this->assign('authErrorText', OW::getLanguage()->text('eventx', 'event_view_permission_error_message'));
         return;
     }
     // guest gan't view private events
     if ((int) $event->getWhoCanView() === EVENTX_BOL_EventService::CAN_VIEW_INVITATION_ONLY && !OW::getUser()->isAuthenticated()) {
         $this->redirect(OW::getRouter()->urlForRoute('eventx.private_event', array('eventId' => $event->getId())));
     }
     $eventInvite = $this->eventService->findEventInvite($event->getId(), OW::getUser()->getId());
     $eventUser = $this->eventService->findEventUser($event->getId(), OW::getUser()->getId());
     // check if user can view event
     if ((int) $event->getWhoCanView() === EVENTX_BOL_EventService::CAN_VIEW_INVITATION_ONLY && $eventUser === null && $eventInvite === null && !OW::getUser()->isAuthorized('eventx')) {
         $this->redirect(OW::getRouter()->urlForRoute('eventx.private_event', array('eventId' => $event->getId())));
     }
     $modPermissions = OW::getUser()->isAuthorized('eventx');
     $ownerMode = $event->getUserId() == OW::getUser()->getId();
     $whoCanDeleteEvent = explode(",", OW::getConfig()->getValue('eventx', 'eventDelete'));
     $toolbar = array();
     if (OW::getUser()->isAuthenticated()) {
         array_push($toolbar, array('href' => 'javascript://', 'id' => 'btn-eventx-flag', 'label' => OW::getLanguage()->text('base', 'flag')));
     }
     if ($ownerMode || $modPermissions) {
         array_push($toolbar, array('href' => OW::getRouter()->urlForRoute('eventx.edit', array('eventId' => $event->getId())), 'label' => OW::getLanguage()->text('eventx', 'edit_button_label')));
     }
     if ($modPermissions) {
         if ($event->status == 'approved') {
             array_push($toolbar, array('href' => 'javascript://', 'id' => 'eventx-set-approval-staus', 'rel' => 'disapprove', 'label' => $language->text('base', 'disapprove')));
         } else {
             array_push($toolbar, array('href' => 'javascript://', 'id' => 'eventx-set-approval-staus', 'rel' => 'approve', 'label' => $language->text('base', 'approve')));
         }
     }
     $canDelete = FALSE;
     if ($ownerMode && in_array(3, $whoCanDeleteEvent)) {
         $canDelete = TRUE;
     }
     if (OW::getUser()->isAuthorized('eventx') && in_array(2, $whoCanDeleteEvent)) {
         $canDelete = TRUE;
     }
     if (OW::getUser()->isAdmin() && in_array(1, $whoCanDeleteEvent)) {
         $canDelete = TRUE;
     }
     if ($canDelete) {
         array_push($toolbar, array('href' => 'javascript://', 'id' => 'eventx-delete', 'label' => OW::getLanguage()->text('eventx', 'delete_button_label')));
     }
     $this->assign('toolbar', $toolbar);
     OW::getNavigation()->activateMenuItem(OW_Navigation::MAIN, 'eventx', 'main_menu_item');
     $this->setPageHeading($event->getTitle());
     $this->setPageTitle(OW::getLanguage()->text('eventx', 'event_view_page_heading', array('event_title' => $event->getTitle())));
     $this->setPageHeadingIconClass('ow_ic_calendar');
     OW::getDocument()->setDescription(UTIL_String::truncate(strip_tags($event->getDescription()), 200, '...'));
     $maxInvites = $event->getMaxInvites();
     $currentInvites = $this->eventService->findEventUsersCount($event->getId(), EVENTX_BOL_EventService::USER_STATUS_YES);
     $isFullyBooked = $currentInvites >= $maxInvites && $maxInvites > 0;
     $infoArray = array('id' => $event->getId(), 'image' => $event->getImage() ? $this->eventService->generateImageUrl($event->getImage(), false) : null, 'date' => $this->eventService->formatSimpleDate($event->getStartTimeStamp(), $event->getStartTimeDisable()), 'endDate' => $event->getEndTimeStamp() === null || !$event->getEndDateFlag() ? null : $this->eventService->formatSimpleDate($event->getEndTimeDisable() ? strtotime("-1 day", $event->getEndTimeStamp()) : $event->getEndTimeStamp(), $event->getEndTimeDisable()), 'location' => $event->getLocation(), 'desc' => UTIL_HtmlTag::autoLink($event->getDescription()), 'title' => $event->getTitle(), 'maxInvites' => $maxInvites, 'currentInvites' => $currentInvites, 'availableInvites' => $maxInvites - $currentInvites, 'creatorName' => BOL_UserService::getInstance()->getDisplayName($event->getUserId()), 'creatorLink' => BOL_UserService::getInstance()->getUserUrl($event->getUserId()));
     $this->assign('info', $infoArray);
     // event attend form
     if (OW::getUser()->isAuthenticated() && $event->getEndTimeStamp() > time()) {
         if ($eventUser !== null) {
             $this->assign('currentStatus', OW::getLanguage()->text('eventx', 'user_status_label_' . $eventUser->getStatus()));
         }
         $this->addForm(new AttendForm($event->getId(), $cmpId));
         $onloadJs = "\n                var \$context = \$('#" . $cmpId . "');";
         $onloadJs .= " \$('#event_attend_yes_btn').click(\n                    function(){\n                        \$('input[name=attend_status]', \$context).val(" . EVENTX_BOL_EventService::USER_STATUS_YES . ");\n                    }\n                );\n                \n                \$('#event_attend_maybe_btn').click(\n                    function(){\n                        \$('input[name=attend_status]', \$context).val(" . EVENTX_BOL_EventService::USER_STATUS_MAYBE . ");\n                    }\n                );\n                \$('#event_attend_no_btn').click(\n                    function(){\n                        \$('input[name=attend_status]', \$context).val(" . EVENTX_BOL_EventService::USER_STATUS_NO . ");\n                    }\n                );\n\n                \$('.current_status a', \$context).click(\n                    function(){\n                        \$('.attend_buttons .buttons', \$context).fadeIn(500);\n                    }\n                );\n            ";
         OW::getDocument()->addOnloadScript($onloadJs);
     } else {
         $this->assign('no_attend_form', true);
     }
     if ($event->getEndTimeStamp() > time() && ((int) $event->getUserId() === OW::getUser()->getId() || (int) $event->getWhoCanInvite() === EVENTX_BOL_EventService::CAN_INVITE_PARTICIPANT && $eventUser !== null)) {
         $params = array($event->id);
         $this->assign('inviteLink', true);
         OW::getDocument()->addOnloadScript("\n                var eventFloatBox;\n                \$('#inviteLink', \$('#" . $cmpId . "')).click(\n                    function(){\n                        eventFloatBox = OW.ajaxFloatBox('EVENTX_CMP_InviteUserListSelect', " . json_encode($params) . ", {width:600, height:400, iconClass: 'ow_ic_user', title: '" . OW::getLanguage()->text('eventx', 'friends_invite_button_label') . "'});\n                    }\n                );\n                OW.bind('base.avatar_user_list_select',\n                    function(list){\n                        eventFloatBox.close();\n                        \$.ajax({\n                            type: 'POST',\n                            url: " . json_encode(OW::getRouter()->urlFor('EVENTX_CTRL_Base', 'inviteResponder')) . ",\n                            data: 'eventId=" . json_encode($event->getId()) . "&userIdList='+JSON.stringify(list),\n                            dataType: 'json',\n                            success : function(data){\n                                if( data.messageType == 'error' ){\n                                    OW.error(data.message);\n                                }\n                                else{\n                                    OW.info(data.message);\n                                }\n                            },\n                            error : function( XMLHttpRequest, textStatus, errorThrown ){\n                                OW.error(textStatus);\n                            }\n                        });\n                    }\n                );\n            ");
     }
     $cmntParams = new BASE_CommentsParams('eventx', 'eventx');
     $cmntParams->setEntityId($event->getId());
     $cmntParams->setOwnerId($event->getUserId());
     $this->addComponent('comments', new BASE_CMP_Comments($cmntParams));
     $this->addComponent('userListCmp', new EVENTX_CMP_EventUsers($event->getId()));
     $tagCloud = new BASE_CMP_EntityTagCloud('eventx');
     $tagCloud->setEntityId($event->id);
     $tagCloud->setRouteName('eventx_view_tagged_list');
     $this->addComponent('tagCloud', $tagCloud);
     OW::getDocument()->addScript(OW::getPluginManager()->getPlugin("eventx")->getStaticJsUrl() . 'eventx.js');
     OW::getDocument()->addScript("http://maps.google.com/maps/api/js?sensor=false");
     OW::getDocument()->addScript(OW::getPluginManager()->getPlugin("eventx")->getStaticJsUrl() . 'jquery.gmap.min.js');
     $objParams = array('ajaxResponder' => $this->ajaxResponder, 'id' => $event->getId(), 'txtDelConfirm' => $language->text('eventx', 'confirm_delete'), 'txtApprove' => $language->text('base', 'approve'), 'txtDisapprove' => $language->text('base', 'disapprove'));
     $script = "\$(document).ready(function(){\n                   var item = new eventxItem( " . json_encode($objParams) . ");\n                 });";
     OW::getDocument()->addOnloadScript($script);
     $js = UTIL_JsGenerator::newInstance()->jQueryEvent('#btn-eventx-flag', 'click', 'OW.flagContent(e.data.entity, e.data.id, e.data.title, e.data.href, "eventx+flags");', array('e'), array('entity' => 'eventx_event', 'id' => $event->getId(), 'title' => $event->getTitle(), 'href' => OW::getRouter()->urlForRoute('eventx.view', array('eventId' => $event->getId()))));
     OW::getDocument()->addOnloadScript($js, 1001);
     $categoryList = $this->eventService->getItemCategories($event->id);
     $i = 0;
     $categoryUrlList = array();
     foreach ($categoryList as $category) {
         $catName = $this->eventService->getCategoryName($category->categoryId);
         $categoryUrlList[$i]['id'] = $category->categoryId;
         $categoryUrlList[$i]['name'] = $catName;
         $categoryUrlList[$i]['url'] = OW::getRouter()->urlForRoute('eventx_category_items', array('category' => $catName));
         $i += 1;
     }
     $this->assign('categoryUrl', $categoryUrlList);
     $this->assign('mapWidth', OW::getConfig()->getValue('eventx', 'mapWidth'));
     $this->assign('mapHeight', OW::getConfig()->getValue('eventx', 'mapHeight'));
 }
Ejemplo n.º 14
0
 public function onBeforeRender()
 {
     parent::onBeforeRender();
     if (empty($this->idList)) {
         return;
     }
     $avatars = BOL_AvatarService::getInstance()->getDataForUserAvatars($this->idList, true, false, false);
     $this->assign('avatars', $avatars);
     $displayNames = BOL_UserService::getInstance()->getDisplayNamesForList($this->idList);
     $usernames = BOL_UserService::getInstance()->getUserNamesForList($this->idList);
     $orderdList = BOL_UserService::getInstance()->getRecentlyActiveOrderedIdList($this->idList);
     $this->idList = array();
     foreach ($orderdList as $list) {
         $this->idList[] = $list['id'];
     }
     $arrayToAssign = array();
     $jsArray = array();
     $contexId = UTIL_HtmlTag::generateAutoId('cmp');
     foreach ($this->idList as $id) {
         $linkId = UTIL_HtmlTag::generateAutoId('user-select');
         if (!empty($avatars[$id])) {
             $avatars[$id]['url'] = 'javascript://';
         }
         $arrayToAssign[$id] = array('id' => $id, 'title' => empty($displayNames[$id]) ? '_DISPLAY_NAME_' : $displayNames[$id], 'linkId' => $linkId, 'username' => $usernames[$id]);
         $jsArray[$id] = array('linkId' => $linkId, 'userId' => $id);
     }
     OW::getDocument()->addScript(OW::getPluginManager()->getPlugin('base')->getStaticJsUrl() . 'avatar_user_select.js');
     OW::getDocument()->addOnloadScript("\n            var cmp = new AvatarUserSelect(" . json_encode($jsArray) . ", '" . $contexId . "');\n            cmp.init();  ");
     OW::getLanguage()->text('base', 'avatar_user_select_empty_list_message');
     $this->assign('users', $arrayToAssign);
     $this->assign('contexId', $contexId);
     $langs = array('countLabel' => $this->countLabel, 'startCountLabel' => !empty($this->countLabel) ? str_replace('#count#', '0', $this->countLabel) : null, 'buttonLabel' => $this->buttonLabel, 'startButtonLabel' => str_replace('#count#', '0', $this->buttonLabel));
     $this->assign('langs', $langs);
 }
Ejemplo n.º 15
0
 public function update(array $params)
 {
     $themeDto = $this->getThemeDtoByKeyInParamsArray($params);
     $language = OW::getLanguage();
     $router = OW::getRouter();
     if (!empty($_GET["mode"])) {
         switch (trim($_GET["mode"])) {
             case "theme_up_to_date":
                 $this->feedback->warning($language->text("admin", "manage_themes_up_to_date_message"));
                 break;
             case "theme_update_success":
                 $this->feedback->info($language->text("admin", "manage_themes_update_success_message"));
                 break;
             default:
                 $this->feedback->error($language->text("admin", "manage_themes_update_process_error"));
                 break;
         }
         $this->redirect($router->urlForRoute("admin_themes_choose"));
     }
     $remoteThemeInfo = (array) $this->storageService->getItemInfoForUpdate($themeDto->getKey(), $themeDto->getDeveloperKey(), $themeDto->getBuild());
     if (empty($remoteThemeInfo) || !empty($remoteThemeInfo["error"])) {
         $this->feedback->error($language->text("admin", "manage_themes_update_process_error"));
         $this->redirect($router->urlForRoute("admin_themes_choose"));
     }
     if (!(bool) $remoteThemeInfo["freeware"] && ($themeDto->getLicenseKey() == null || !$this->storageService->checkLicenseKey($themeDto->getKey(), $themeDto->getDeveloperKey(), $themeDto->getLicenseKey()))) {
         $this->feedback->error($language->text("admin", "manage_plugins_update_invalid_key_error"));
         $this->redirect($router->urlForRoute("admin_themes_choose"));
     }
     $ftp = $this->getFtpConnection();
     try {
         $archivePath = $this->storageService->downloadItem($themeDto->getKey(), $themeDto->getDeveloperKey(), $themeDto->getLicenseKey());
     } catch (Exception $e) {
         $this->feedback->error($e->getMessage());
         $this->redirect($router->urlForRoute("admin_themes_choose"));
     }
     if (!file_exists($archivePath)) {
         $this->feedback->error($language->text("admin", "theme_update_download_error"));
         $this->redirect($router->urlForRoute("admin_themes_choose"));
     }
     $zip = new ZipArchive();
     $pluginfilesDir = OW::getPluginManager()->getPlugin("base")->getPluginFilesDir();
     $tempDirPath = $pluginfilesDir . UTIL_HtmlTag::generateAutoId("theme_update") . DS;
     if ($zip->open($archivePath) === true) {
         $zip->extractTo($tempDirPath);
         $zip->close();
     } else {
         $this->feedback->error($language->text("admin", "theme_update_download_error"));
         $this->redirect($router->urlForRoute("admin_themes_choose"));
     }
     $result = UTIL_File::findFiles($tempDirPath, array("xml"));
     $localThemeRootPath = null;
     foreach ($result as $item) {
         if (basename($item) == BOL_ThemeService::THEME_XML) {
             $localThemeRootPath = dirname($item) . DS;
         }
     }
     if ($localThemeRootPath == null) {
         $this->feedback->error($language->text("admin", "manage_theme_update_extract_error"));
         $this->redirect($router->urlForRoute("admin_themes_choose"));
     }
     $remoteDir = OW_DIR_THEME . $themeDto->getKey();
     if (!file_exists($remoteDir)) {
         $this->feedback->error($language->text("admin", "manage_theme_update_theme_not_found"));
         $this->redirect($router->urlForRoute("admin_themes_choose"));
     }
     $ftp->uploadDir($localThemeRootPath, $remoteDir);
     UTIL_File::removeDir($localThemeRootPath);
     $params = array("theme" => $themeDto->getKey(), "back-uri" => urlencode(OW::getRequest()->getRequestUri()));
     $this->redirect(OW::getRequest()->buildUrlQueryString($this->storageService->getUpdaterUrl(), $params));
 }
Ejemplo n.º 16
0
 public function __construct($controller)
 {
     $this->setId(UTIL_HtmlTag::generateAutoId('form'));
     $this->setMethod(self::METHOD_POST);
     $this->setAjaxResetOnSuccess(true);
     $this->setAjaxDataType(self::AJAX_DATA_TYPE_JSON);
     $this->bindedFunctions = array(self::BIND_SUBMIT => array(), self::BIND_SUCCESS => array());
     $this->setEmptyElementsErrorMessage(OW::getLanguage()->text('base', 'form_validate_common_error_message'));
     $formNameHidden = new HiddenField('form_name');
     $formNameHidden->setValue('joinForm');
     $this->addElement($formNameHidden);
     $this->setName('joinForm');
     $this->setId('joinForm');
     $stamp = OW::getSession()->get(self::SESSION_START_STAMP);
     if (empty($stamp)) {
         OW::getSession()->set(self::SESSION_START_STAMP, time());
     }
     unset($stamp);
     $this->checkSession();
     $stepCount = 1;
     $joinSubmitLabel = "";
     // get available account types from DB
     $accounts = $this->getAccountTypes();
     $joinData = OW::getSession()->get(self::SESSION_JOIN_DATA);
     if (!isset($joinData) || !is_array($joinData)) {
         $joinData = array();
     }
     $accountsKeys = array_keys($accounts);
     $this->accountType = $accountsKeys[0];
     if (isset($joinData['accountType'])) {
         $this->accountType = trim($joinData['accountType']);
     }
     $step = $this->getStep();
     if (count($accounts) > 1) {
         $this->stepCount = 2;
         switch ($step) {
             case 1:
                 $this->displayAccountType = true;
                 $joinSubmitLabel = OW::getLanguage()->text('base', 'join_submit_button_continue');
                 break;
             case 2:
                 $this->isLastStep = true;
                 $joinSubmitLabel = OW::getLanguage()->text('base', 'join_submit_button_join');
                 break;
         }
     } else {
         $this->isLastStep = true;
         $joinSubmitLabel = OW::getLanguage()->text('base', 'join_submit_button_join');
     }
     $joinSubmit = new Submit('joinSubmit');
     $joinSubmit->addAttribute('class', 'ow_button ow_ic_submit');
     $joinSubmit->setValue($joinSubmitLabel);
     $this->addElement($joinSubmit);
     /* if ( $this->displayAccountType )
               {
               $questionValueList = BOL_QuestionService::getInstance()->findQuestionsValuesByQuestionNameList(array('sex', 'match_sex'));
     
               $sex = new RadioField('sex');
               $sex->setLabel(BOL_QuestionService::getInstance()->getQuestionLang('sex'));
               $sex->setRequired();
     
               $this->setFieldOptions($sex, 'sex', $questionValueList['sex']);
     
               if ( !empty($joinData['sex']) )
               {
               $sex->setValue($joinData['sex']);
               }
     
               $this->addElement($sex);
     
               $matchSex = new RadioField('match_sex');
               $matchSex->setLabel(BOL_QuestionService::getInstance()->getQuestionLang('match_sex'));
               $matchSex->setRequired();
     
               $this->setFieldOptions($matchSex, 'match_sex', $questionValueList['match_sex']);
     
               if ( !empty($joinData['match_sex']) )
               {
               $matchSex->setValue($joinData['match_sex']);
               }
     
               $this->addElement($matchSex);
               } */
     $this->getQuestions();
     $section = null;
     //$this->questionListBySection = array();
     $questionNameList = array();
     $this->sortedQuestionsList = array();
     foreach ($this->questions as $sort => $question) {
         if ((string) $question['base'] === '0' && $step === 2 || $step === 1) {
             if ($section !== $question['sectionName']) {
                 $section = $question['sectionName'];
             }
             //$this->questionListBySection[$section][] = $this->questions[$sort];
             $questionNameList[] = $this->questions[$sort]['name'];
             $this->sortedQuestionsList[] = $this->questions[$sort];
         }
     }
     $this->questionValuesList = BOL_QuestionService::getInstance()->findQuestionsValuesByQuestionNameList($questionNameList);
     $this->addFakeQuestions();
     $this->addQuestions($this->sortedQuestionsList, $this->questionValuesList, $this->updateJoinData());
     $this->setQuestionsLabel();
     $this->addClassToBaseQuestions();
     if ($this->isLastStep) {
         $this->addLastStepQuestions($controller);
     }
     $controller->assign('step', $step);
     $controller->assign('questionArray', $this->questionListBySection);
     $controller->assign('displayAccountType', $this->displayAccountType);
     $controller->assign('isLastStep', $this->isLastStep);
 }
Ejemplo n.º 17
0
 /**
  * Constructor.
  * 
  * @param string $name
  */
 public function __construct($name)
 {
     $this->setId(UTIL_HtmlTag::generateAutoId('form'));
     $this->setMethod(self::METHOD_POST);
     $this->setAction('');
     $this->setAjaxResetOnSuccess(true);
     $this->setAjaxDataType(self::AJAX_DATA_TYPE_JSON);
     $this->bindedFunctions = array(self::BIND_SUBMIT => array(), self::BIND_SUCCESS => array());
     $this->setEmptyElementsErrorMessage(OW::getLanguage()->text('base', 'form_validate_common_error_message'));
     $formNameHidden = new HiddenField('form_name');
     $formNameHidden->setValue($name);
     $this->addElement($formNameHidden);
     $this->setName($name);
 }
Ejemplo n.º 18
0
 public function __construct($controller)
 {
     $this->setId(UTIL_HtmlTag::generateAutoId('form'));
     $this->setMethod(self::METHOD_POST);
     $this->setAjaxResetOnSuccess(true);
     $this->setAjaxDataType(self::AJAX_DATA_TYPE_JSON);
     $this->bindedFunctions = array(self::BIND_SUBMIT => array(), self::BIND_SUCCESS => array());
     $this->setEmptyElementsErrorMessage(OW::getLanguage()->text('base', 'form_validate_common_error_message'));
     $formNameHidden = new HiddenField('form_name');
     $formNameHidden->setValue('joinForm');
     $this->addElement($formNameHidden);
     $this->setName('joinForm');
     $this->setId('joinForm');
     $stamp = OW::getSession()->get(self::SESSION_START_STAMP);
     if (empty($stamp)) {
         OW::getSession()->set(self::SESSION_START_STAMP, time());
     }
     unset($stamp);
     $this->checkSession();
     $stepCount = 1;
     $joinSubmitLabel = "";
     // get available account types from DB
     $accounts = $this->getAccountTypes();
     $joinData = OW::getSession()->get(self::SESSION_JOIN_DATA);
     if (!isset($joinData) || !is_array($joinData)) {
         $joinData = array();
     }
     $accountsKeys = array_keys($accounts);
     $this->accountType = $accountsKeys[0];
     if (isset($joinData['accountType'])) {
         $this->accountType = trim($joinData['accountType']);
     }
     $step = $this->getStep();
     if (count($accounts) > 1) {
         $this->stepCount = 2;
         switch ($step) {
             case 1:
                 $this->displayAccountType = true;
                 $joinSubmitLabel = OW::getLanguage()->text('base', 'join_submit_button_continue');
                 break;
             case 2:
                 $this->isLastStep = true;
                 $joinSubmitLabel = OW::getLanguage()->text('base', 'join_submit_button_join');
                 break;
         }
     } else {
         $this->isLastStep = true;
         $joinSubmitLabel = OW::getLanguage()->text('base', 'join_submit_button_join');
     }
     $joinSubmit = new Submit('joinSubmit');
     $joinSubmit->addAttribute('class', 'ow_button ow_ic_submit');
     $joinSubmit->setValue($joinSubmitLabel);
     $this->addElement($joinSubmit);
     //
     $questionValueList = BOL_QuestionService::getInstance()->findQuestionsValuesByQuestionNameList(array('field_8eb4e427b80ac66d870fc0a5a0cc22ba'));
     //        echo "<pre>";
     //        print_r($questionValueList);
     //        echo "</pre>";
     //        $new = new RadioField('field_8eb4e427b80ac66d870fc0a5a0cc22ba');
     //        $new->setLabel(BOL_QuestionService::getInstance()->getQuestionLang('field_8eb4e427b80ac66d870fc0a5a0cc22ba'));
     //        $new->setRequired();
     //
     //        $this->setFieldOptions($new, 'field_8eb4e427b80ac66d870fc0a5a0cc22ba', $questionValueList['field_8eb4e427b80ac66d870fc0a5a0cc22ba']);
     //
     //        if (!empty($joinData['field_8eb4e427b80ac66d870fc0a5a0cc22ba'])) {
     //            $new->setValue($joinData['field_8eb4e427b80ac66d870fc0a5a0cc22ba']);
     //        }
     //
     //        $this->addElement($new);
     /* if ( $this->displayAccountType )
               {
               $questionValueList = BOL_QuestionService::getInstance()->findQuestionsValuesByQuestionNameList(array('sex', 'match_sex'));
     
               $sex = new RadioField('sex');
               $sex->setLabel(BOL_QuestionService::getInstance()->getQuestionLang('sex'));
               $sex->setRequired();
     
               $this->setFieldOptions($sex, 'sex', $questionValueList['sex']);
     
               if ( !empty($joinData['sex']) )
               {
               $sex->setValue($joinData['sex']);
               }
     
               $this->addElement($sex);
     
               $matchSex = new RadioField('match_sex');
               $matchSex->setLabel(BOL_QuestionService::getInstance()->getQuestionLang('match_sex'));
               $matchSex->setRequired();
     
               $this->setFieldOptions($matchSex, 'match_sex', $questionValueList['match_sex']);
     
               if ( !empty($joinData['match_sex']) )
               {
               $matchSex->setValue($joinData['match_sex']);
               }
     
               $this->addElement($matchSex);
               } */
     $this->getQuestions();
     $section = null;
     //$this->questionListBySection = array();
     $questionNameList = array();
     $this->sortedQuestionsList = array();
     $allquer = $this->questions;
     //        $allquer[] = array
     //            (
     //            "id" => 197,
     //            "name" => "field_2d686163771de45485b437e4d0ecc4f2",
     //            "sectionName" => '179290597507249aa67160dc240b7cae',
     //            "accountTypeName" => "",
     //            "type" => "multiselect",
     //            "presentation" => "multicheckbox",
     //            "required" => 0,
     //            "onJoin" => 1,
     //            "onEdit" => 1,
     //            "onSearch" => 0,
     //            "onView" => 1,
     //            "base" => 0,
     //            "removable" => 1,
     //            "columnCount" => 1,
     //            "sortOrder" => 3,
     //            "custom" => [],
     //            "parent" => "",
     //        );
     //        echo '<pre>';
     //        print_r($allquer);
     //        echo '</pre>';
     foreach ($allquer as $sort => $question) {
         if ((string) $question['base'] === '0' && $step === 2 || $step === 1) {
             if ($section !== $question['sectionName']) {
                 $section = $question['sectionName'];
             }
             //$this->questionListBySection[$section][] = $this->questions[$sort];
             $questionNameList[] = $this->questions[$sort]['name'];
             if (!empty($_SESSION["joinData"][HAMMU_DB_IM_USING_HAMMU_AS_KEY]) && $_SESSION["joinData"][HAMMU_DB_IM_USING_HAMMU_AS_KEY] == 1) {
                 //CLIENT doNOT have
                 if ($question['name'] == HAMMU_DB_PRICE_KEY) {
                     unset($this->questions[$sort]);
                 }
                 if ($question['name'] == HAMMU_DB_METTING_POINT_KEY) {
                     unset($this->questions[$sort]);
                 }
                 //
                 //echo "got here";
                 if ($question['name'] == HAMMU_HOTEL_SERVICE) {
                     unset($this->questions[$sort]);
                 }
                 if ($question['name'] == HAMMU_HOME_VISIT) {
                     unset($this->questions[$sort]);
                 }
                 if ($question['name'] == HAMMU_SECRET_FANTASY) {
                     unset($this->questions[$sort]);
                 }
                 if ($question['name'] == HAMMU_LANGUAGE) {
                     unset($this->questions[$sort]);
                 }
                 if ($question['name'] == HAMMU_COUNTRY) {
                     unset($this->questions[$sort]);
                 }
             } else {
                 //ESCORT doNOT have
                 if ($question['name'] == HAMMU_DB_PAYMENT_TYPE_KEY) {
                     unset($this->questions[$sort]);
                 }
             }
             @($this->sortedQuestionsList[] = @$this->questions[$sort]);
         }
     }
     //
     $this->questionValuesList = BOL_QuestionService::getInstance()->findQuestionsValuesByQuestionNameList($questionNameList);
     //        echo '<pre>';
     //        print_r($this->sortedQuestionsList);
     //        echo '</pre>';
     //        echo '<pre>';
     //        print_r($this->questionValuesList);
     //        echo '</pre>';
     //field_538100b702f6e0ff23756c14be12281b
     $this->addFakeQuestions();
     $this->addQuestions($this->sortedQuestionsList, $this->questionValuesList, $this->updateJoinData());
     //        echo '<pre>';
     //        print_r($this->questionListBySection);
     //        echo '</pre>';
     $this->setQuestionsLabel();
     $this->addClassToBaseQuestions();
     if ($this->isLastStep) {
         $this->addLastStepQuestions($controller);
     }
     //  $questionValueList = BOL_QuestionService::getInstance()->findQuestionsValuesByQuestionNameList(array('field_8eb4e427b80ac66d870fc0a5a0cc22ba'));
     //        $new = new Selectbox('field_8eb4e427b80ac66d870fc0a5a0cc22ba');
     //        $new->setLabel(BOL_QuestionService::getInstance()->getQuestionLang('field_8eb4e427b80ac66d870fc0a5a0cc22ba'));
     //        $new->setRequired();
     //
     //        $this->setFieldOptions($new, 'field_8eb4e427b80ac66d870fc0a5a0cc22ba', $questionValueList['field_8eb4e427b80ac66d870fc0a5a0cc22ba']);
     //
     //        if (!empty($joinData['field_8eb4e427b80ac66d870fc0a5a0cc22ba'])) {
     //            $new->setValue($joinData['field_8eb4e427b80ac66d870fc0a5a0cc22ba']);
     //        }
     //
     //        $this->addElement($new);
     $controller->assign('step', $step);
     $controller->assign('questionArray', $this->questionListBySection);
     $controller->assign('displayAccountType', $this->displayAccountType);
     $controller->assign('isLastStep', $this->isLastStep);
 }
Ejemplo n.º 19
0
 public function onBeforeRender()
 {
     parent::onBeforeRender();
     $language = OW::getLanguage();
     OW::getDocument()->addBodyClass('ow_admin_area');
     $this->setTemplate(OW::getThemeManager()->getMasterPageTemplate(OW_MasterPage::TEMPLATE_ADMIN));
     $arrayToAssign = array();
     srand(time());
     /* @var $value ADMIN_CMP_AdminMenu */
     foreach ($this->menuCmps as $key => $value) {
         //check if there are any items in the menu
         if ($value->getElementsCount() <= 0) {
             continue;
         }
         $id = UTIL_HtmlTag::generateAutoId("mi");
         $value->setCategory($key);
         $value->onBeforeRender();
         $menuItem = $value->getFirstElement();
         $arrayToAssign[$key] = array('id' => $id, 'firstLink' => $menuItem->getUrl(), 'key' => $key, 'isActive' => $value->isActive(), 'label' => $language->text('admin', 'sidebar_' . $key), 'sub_menu' => $value->getElementsCount() < 2 ? '' : $value->render(), 'active_sub_menu' => $value->getElementsCount() < 2 ? '' : $value->render('ow_admin_submenu'));
     }
     $this->assign('menuArr', $arrayToAssign);
 }
Ejemplo n.º 20
0
    public function __construct(array $params)
    {
        parent::__construct();
        $this->scope = $params['scope'];
        $value = isset($params['token']) ? trim(htmlspecialchars($params['token'])) : null;
        $userValue = isset($params['userToken']) ? trim(htmlspecialchars($params['userToken'])) : null;
        $invitation = $this->getInvitationLabel();
        $inputParams = array('type' => 'text', 'class' => !mb_strlen($value) ? 'invitation' : '', 'value' => mb_strlen($value) ? $value : $invitation, 'id' => UTIL_HtmlTag::generateAutoId('input'));
        $this->assign('input', UTIL_HtmlTag::generateTag('input', $inputParams));
        $userInputParams = array('type' => 'text', 'value' => $userValue, 'id' => $inputParams['id'] . '_user');
        $this->assign('userInput', UTIL_HtmlTag::generateTag('input', $userInputParams));
        $this->addComponent('filterContext', $this->getFilterContextAction());
        $this->assign('themeUrl', OW::getThemeManager()->getCurrentTheme()->getStaticImagesUrl());
        $this->assign('userToken', $userValue);
        switch ($this->scope) {
            case 'topic':
                $location = json_encode(OW::getRouter()->urlForRoute('forum_search_topic', array('topicId' => $params['topicId'])));
                break;
            case 'group':
                $location = json_encode(OW::getRouter()->urlForRoute('forum_search_group', array('groupId' => $params['groupId'])));
                break;
            case 'section':
                $location = json_encode(OW::getRouter()->urlForRoute('forum_search_section', array('sectionId' => $params['sectionId'])));
                break;
            default:
                $location = json_encode(OW::getRouter()->urlForRoute('forum_search'));
                break;
        }
        $userInvitation = OW::getLanguage()->text('forum', 'enter_username');
        $script = 'var invitation = ' . json_encode($invitation) . ';
        var input = ' . json_encode($inputParams['id']) . ';
        var userInvitation = ' . json_encode($userInvitation) . ';
        var userInput = ' . json_encode($userInputParams['id']) . ';

        $("#" + userInput).focus(function() {
            if ( $(this).val() == userInvitation ) {
                $(this).removeClass("invitation").val("");
            }
        });
        $("#" + userInput).blur(function() {
            if ( $(this).val() == "" ) {
                $(this).addClass("invitation").val(userInvitation);
            }
        });
        ';
        if (!mb_strlen($value)) {
            $script .= '$("#" + input).focus(function() {
                if ( $(this).val() == invitation ) {
                    $(this).removeClass("invitation").val("");
                }
            });
            $("#" + input).blur(function() {
                if ( $(this).val() == "" ) {
                    $(this).addClass("invitation").val(invitation);
                }
            });
            ';
        }
        $script .= 'var $form = $("form#forum_search");
        $(".ow_miniic_delete", $form).click(function() {
            $(".forum_search_tag_input", $form).css({visibility : "hidden", height: "0px", padding: "0px"});
            $(".add_filter", $form).show();
            $("#forum_search_cont").removeClass("forum_search_inputs");
            $("#" + userInput).val("").removeClass("invitation");
        });

        $("#btn-filter-by-user").click(function() {
            $(".forum_search_tag_input", $form).css({visibility : "visible", height: "auto", padding: "4px"});
            $("#" + userInput).val(userInvitation).addClass("invitation");
            $(".add_filter", $form).hide();
            $("#forum_search_cont").addClass("forum_search_inputs");
        });

        $("#' . $inputParams['id'] . ', #' . $userInputParams['id'] . '").keydown(function(e){
            if (e.keyCode == 13) {
                $(this).parents("form").submit();
                return false;
            }
        });
            
        $form.submit(function() {
            var value = $("#" + input).val();
            var userValue = $("#" + userInput).val();

            if ( value == invitation && !userValue.length || userValue == userInvitation && !value.length ) {
                return false;
            }

            if ( value == invitation ) {
                value = ""; $("#" + input).val(value);
            }

            if ( userValue == userInvitation ) {
                userValue = ""; $("#" + userInput).val(userValue);
            }

            var search = encodeURIComponent(value);
            userSearch = encodeURIComponent(userValue);
            document.location.href = ' . $location . ' + "?"
                + (search.length ? "&q=" + search : "")
                + (userSearch.length ? "&u=" + userSearch : "");

            return false;
        });
        ';
        OW::getDocument()->addOnloadScript($script);
    }
Ejemplo n.º 21
0
 public function process($params)
 {
     $service = BOL_NavigationService::getInstance();
     /* @var $service BOL_NavigationService */
     $menuItem = new BOL_MenuItem();
     $doc_key = UTIL_HtmlTag::generateAutoId('page');
     $menuItem->setDocumentKey($doc_key);
     $menuItem->setPrefix('base');
     $menuItem->setKey($doc_key);
     $menuItem->setType($params['type']);
     $order = $service->findMaxSortOrderForMenuType($params['type']);
     $order;
     $menuItem->setOrder($order);
     $visibleFor = 0;
     $arr = !empty($_POST['visible-for']) ? $_POST['visible-for'] : array();
     foreach ($arr as $val) {
         $visibleFor += $val;
     }
     //hotfix
     if ($visibleFor === 0) {
         $visibleFor = 3;
     }
     $menuItem->setVisibleFor($visibleFor);
     $url = '';
     $languageService = BOL_LanguageService::getInstance();
     $prefixDto = $languageService->findPrefix($menuItem->getPrefix());
     switch ($_POST['type']) {
         case 'local':
             $service->saveMenuItem($menuItem);
             $document = new BOL_Document();
             $document->setIsStatic(true);
             $document->setKey($menuItem->getKey());
             $url = str_replace(UTIL_String::removeFirstAndLastSlashes(OW::getRouter()->getBaseUrl()), '', UTIL_String::removeFirstAndLastSlashes($_POST['local-url']));
             $document->setUri(UTIL_String::removeFirstAndLastSlashes($url));
             $service->saveDocument($document);
             //- name
             $currentLanguageId = $languageService->getCurrent()->getId();
             $keyDto = $languageService->addKey($prefixDto->getId(), $menuItem->getKey());
             $menuName = $_POST['name'];
             $languageService->addValue($currentLanguageId, $menuItem->getPrefix(), $keyDto->getKey(), $menuName);
             //- title
             $keyDto = $languageService->addKey($prefixDto->getId(), 'local_page_title_' . $menuItem->getKey());
             $title = empty($_POST['title']) ? '' : $_POST['title'];
             $languageService->addValue($currentLanguageId, $menuItem->getPrefix(), $keyDto->getKey(), $title);
             //-	meta tags
             $keyDto = $languageService->addKey($prefixDto->getId(), 'local_page_meta_tags_' . $menuItem->getKey());
             $metaTagsStr = empty($_POST['meta-tags']) ? '' : $_POST['meta-tags'];
             $languageService->addValue($currentLanguageId, $menuItem->getPrefix(), $keyDto->getKey(), $metaTagsStr);
             //- content
             $keyDto = $languageService->addKey($prefixDto->getId(), 'local_page_content_' . $menuItem->getKey());
             $contentStr = empty($_POST['content']) ? '' : $_POST['content'];
             $languageService->addValue($currentLanguageId, $menuItem->getPrefix(), $keyDto->getKey(), $contentStr);
             //~
             $languageService->generateCache($currentLanguageId);
             break;
         case 'external':
             $menuItem->setExternalUrl($_POST['external-url']);
             $menuItem->setNewWindow(!empty($_POST['ext-open-in-new-window']) && $_POST['ext-open-in-new-window'] == 'on' ? true : false);
             $service->saveMenuItem($menuItem);
             $keyDto = $languageService->addKey($prefixDto->getId(), $menuItem->getKey());
             $languageService->addValue($languageService->getCurrent()->getId(), $menuItem->getPrefix(), $keyDto->getKey(), $_POST['name']);
             $languageService->generateCache($languageService->getCurrent()->getId());
             break;
     }
     header('location: ' . OW::getRouter()->urlForRoute('admin_pages_main'));
     exit;
 }
Ejemplo n.º 22
0
 /**
  * @see FormElement::renderInput()
  *
  * @param array $params
  * @return string
  */
 public function renderInput($params = null)
 {
     parent::renderInput($params);
     $name = $this->getName();
     $billingService = BOL_BillingService::getInstance();
     $gateways = $billingService->getActiveGatewaysList();
     $paymentOptions = array();
     if ($gateways) {
         foreach ($gateways as $gateway) {
             /* @var $adapter OW_BillingAdapter */
             if ($adapter = new $gateway->adapterClassName()) {
                 $paymentOptions[$gateway->gatewayKey]['dto'] = $gateway;
                 $paymentOptions[$gateway->gatewayKey]['orderUrl'] = $adapter->getOrderFormUrl();
                 $paymentOptions[$gateway->gatewayKey]['logoUrl'] = $adapter->getLogoUrl();
             }
         }
         $gatewaysNumber = count($paymentOptions);
         $id = UTIL_HtmlTag::generateAutoId('input');
         $urlFieldAttrs = array('type' => 'hidden', 'id' => 'url-' . $id, 'value' => '', 'name' => $name . '[url]');
         $renderedString = UTIL_HtmlTag::generateTag('input', $urlFieldAttrs);
         $cont_id = $id . '-cont';
         $renderedString .= '<ul class="ow_billing_gateways clearfix" id="' . $cont_id . '">';
         $i = 0;
         foreach ($paymentOptions as $option) {
             $this->addAttributes(array('type' => 'radio', 'rel' => $option['orderUrl'], 'value' => $option['dto']->gatewayKey, 'name' => $name . '[key]'));
             if ($i == 0) {
                 $url = $option['orderUrl'];
                 $this->addAttribute(self::ATTR_CHECKED, 'checked');
             }
             if ($gatewaysNumber == 1) {
                 $renderedString .= '<li style="display: inline-block; padding-right: 20px;">' . OW::getLanguage()->text('base', 'billing_pay_with') . '</li>';
                 $field = UTIL_HtmlTag::generateTag('input', array('type' => 'hidden', 'id' => 'url-' . $id, 'value' => $option['dto']->gatewayKey, 'name' => $name . '[key]'));
             } else {
                 $field = UTIL_HtmlTag::generateTag('input', $this->attributes);
             }
             $renderedString .= '<li style="display: inline-block;">
                 <label>' . $field . '<img src="' . $option['logoUrl'] . '" alt="' . $option['dto']->gatewayKey . '" /></label>
             </li>';
             $i++;
             $this->removeAttribute(self::ATTR_CHECKED);
         }
         $renderedString .= '</ul>';
         $js = 'var $url_field = $("#url-' . $id . '");
             $url_field.val("' . $url . '");
             $("ul#' . $cont_id . ' input").change(function(){
                 $url_field.val($(this).attr("rel"));
             });';
         OW::getDocument()->addOnloadScript($js);
     } else {
         $renderedString = OW::getLanguage()->text('base', 'billing_no_gateways');
     }
     return $renderedString;
 }
Ejemplo n.º 23
0
 /**
  * View event controller
  * 
  * @param array $params
  */
 public function view($params)
 {
     $event = $this->getEventForParams($params);
     $cmpId = UTIL_HtmlTag::generateAutoId('cmp');
     $this->assign('contId', $cmpId);
     if (!OW::getUser()->isAuthorized('event', 'view_event') && $event->getUserId() != OW::getUser()->getId()) {
         $status = BOL_AuthorizationService::getInstance()->getActionStatus('event', 'view_event');
         throw new AuthorizationException($status['msg']);
     }
     if ($event->status != 1 && !OW::getUser()->isAuthorized('event') && $event->getUserId() != OW::getUser()->getId()) {
         throw new Redirect403Exception();
     }
     // guest gan't view private events
     if ((int) $event->getWhoCanView() === EVENT_BOL_EventService::CAN_VIEW_INVITATION_ONLY && !OW::getUser()->isAuthenticated()) {
         $this->redirect(OW::getRouter()->urlForRoute('event.private_event', array('eventId' => $event->getId())));
     }
     $eventInvite = $this->eventService->findEventInvite($event->getId(), OW::getUser()->getId());
     $eventUser = $this->eventService->findEventUser($event->getId(), OW::getUser()->getId());
     // check if user can view event
     if ((int) $event->getWhoCanView() === EVENT_BOL_EventService::CAN_VIEW_INVITATION_ONLY && $eventUser === null && $eventInvite === null && !OW::getUser()->isAuthorized('event')) {
         $this->redirect(OW::getRouter()->urlForRoute('event.private_event', array('eventId' => $event->getId())));
     }
     $buttons = array();
     $toolbar = array();
     if (OW::getUser()->isAuthorized('event') || OW::getUser()->getId() == $event->getUserId()) {
         $buttons = array('edit' => array('url' => OW::getRouter()->urlForRoute('event.edit', array('eventId' => $event->getId())), 'label' => OW::getLanguage()->text('event', 'edit_button_label')), 'delete' => array('url' => OW::getRouter()->urlForRoute('event.delete', array('eventId' => $event->getId())), 'label' => OW::getLanguage()->text('event', 'delete_button_label'), 'confirmMessage' => OW::getLanguage()->text('event', 'delete_confirm_message')));
     }
     $this->assign('editArray', $buttons);
     OW::getNavigation()->activateMenuItem(OW_Navigation::MAIN, 'event', 'main_menu_item');
     $moderationStatus = '';
     if ($event->status == 2) {
         $moderationStatus = " <span class='ow_remark ow_small'>(" . OW::getLanguage()->text('event', 'moderation_status_pending_approval') . ")</span>";
     }
     $this->setPageHeading($event->getTitle() . $moderationStatus);
     $this->setPageTitle(OW::getLanguage()->text('event', 'event_view_page_heading', array('event_title' => $event->getTitle())));
     $this->setPageHeadingIconClass('ow_ic_calendar');
     OW::getDocument()->setDescription(UTIL_String::truncate(strip_tags($event->getDescription()), 200, '...'));
     $infoArray = array('id' => $event->getId(), 'image' => $event->getImage() ? $this->eventService->generateImageUrl($event->getImage(), false) : null, 'date' => UTIL_DateTime::formatSimpleDate($event->getStartTimeStamp(), $event->getStartTimeDisable()), 'endDate' => $event->getEndTimeStamp() === null || !$event->getEndDateFlag() ? null : UTIL_DateTime::formatSimpleDate($event->getEndTimeDisable() ? strtotime("-1 day", $event->getEndTimeStamp()) : $event->getEndTimeStamp(), $event->getEndTimeDisable()), 'location' => $event->getLocation(), 'desc' => UTIL_HtmlTag::autoLink($event->getDescription()), 'title' => $event->getTitle(), 'creatorName' => BOL_UserService::getInstance()->getDisplayName($event->getUserId()), 'creatorLink' => BOL_UserService::getInstance()->getUserUrl($event->getUserId()), 'moderationStatus' => $event->status);
     $this->assign('info', $infoArray);
     // event attend form
     if (OW::getUser()->isAuthenticated() && $event->getEndTimeStamp() > time()) {
         if ($eventUser !== null) {
             $this->assign('currentStatus', OW::getLanguage()->text('event', 'user_status_label_' . $eventUser->getStatus()));
         }
         $this->addForm(new AttendForm($event->getId(), $cmpId));
         $onloadJs = "\n                var \$context = \$('#" . $cmpId . "');\n                \$('#event_attend_yes_btn').click(\n                    function(){\n                        \$('input[name=attend_status]', \$context).val(" . EVENT_BOL_EventService::USER_STATUS_YES . ");\n                    }\n                );\n                \$('#event_attend_maybe_btn').click(\n                    function(){\n                        \$('input[name=attend_status]', \$context).val(" . EVENT_BOL_EventService::USER_STATUS_MAYBE . ");\n                    }\n                );\n                \$('#event_attend_no_btn').click(\n                    function(){\n                        \$('input[name=attend_status]', \$context).val(" . EVENT_BOL_EventService::USER_STATUS_NO . ");\n                    }\n                );\n\n                \$('.current_status a', \$context).click(\n                    function(){\n                        \$('.attend_buttons .buttons', \$context).fadeIn(500);\n                    }\n                );\n            ";
         OW::getDocument()->addOnloadScript($onloadJs);
     } else {
         $this->assign('no_attend_form', true);
     }
     if ($event->status == EVENT_BOL_EventService::MODERATION_STATUS_ACTIVE && ($event->getEndTimeStamp() > time() && ((int) $event->getUserId() === OW::getUser()->getId() || (int) $event->getWhoCanInvite() === EVENT_BOL_EventService::CAN_INVITE_PARTICIPANT && $eventUser !== null))) {
         $params = array($event->id);
         $this->assign('inviteLink', true);
         OW::getDocument()->addOnloadScript("\n                var eventFloatBox;\n                \$('#inviteLink', \$('#" . $cmpId . "')).click(\n                    function(){\n                        eventFloatBox = OW.ajaxFloatBox('EVENT_CMP_InviteUserListSelect', " . json_encode($params) . ", {width:600, iconClass: 'ow_ic_user', title: " . json_encode(OW::getLanguage()->text('event', 'friends_invite_button_label')) . "});\n                    }\n                );\n                OW.bind('base.avatar_user_list_select',\n                    function(list){\n                        eventFloatBox.close();\n                        \$.ajax({\n                            type: 'POST',\n                            url: " . json_encode(OW::getRouter()->urlFor('EVENT_CTRL_Base', 'inviteResponder')) . ",\n                            data: 'eventId=" . json_encode($event->getId()) . "&userIdList='+JSON.stringify(list),\n                            dataType: 'json',\n                            success : function(data){\n                                if( data.messageType == 'error' ){\n                                    OW.error(data.message);\n                                }\n                                else{\n                                    OW.info(data.message);\n                                }\n                            },\n                            error : function( XMLHttpRequest, textStatus, errorThrown ){\n                                OW.error(textStatus);\n                            }\n                        });\n                    }\n                );\n            ");
     }
     if ($event->status == EVENT_BOL_EventService::MODERATION_STATUS_ACTIVE) {
         $cmntParams = new BASE_CommentsParams('event', 'event');
         $cmntParams->setEntityId($event->getId());
         $cmntParams->setOwnerId($event->getUserId());
         $this->addComponent('comments', new BASE_CMP_Comments($cmntParams));
     }
     $this->addComponent('userListCmp', new EVENT_CMP_EventUsers($event->getId()));
     $event = new BASE_CLASS_EventCollector(EVENT_BOL_EventService::EVENT_COLLECT_TOOLBAR, array("event" => $event));
     OW::getEventManager()->trigger($event);
     $this->assign("toolbar", $event->getData());
 }
Ejemplo n.º 24
0
 public function __construct($name)
 {
     if ($name === null || !$name || strlen(trim($name)) === 0) {
         throw new InvalidArgumentException('Invalid form element name!');
     }
     $this->setName($name);
     $this->setId(UTIL_HtmlTag::generateAutoId('input'));
     $this->addAttribute('type', 'text');
     $this->jsObjectName = self::CAPTCHA_PREFIX . preg_replace('/[^\\d^\\w]/', '_', $this->getId());
     $this->addAttribute('style', 'width:100px;');
 }
Ejemplo n.º 25
0
 public function uploadAttachment($params)
 {
     $userId = OW::getUser()->getId();
     if (!$userId) {
         throw new ApiResponseErrorException("Undefined userId");
     }
     if (empty($_FILES['images'])) {
         throw new ApiResponseErrorException("Files were not uploaded");
     }
     $conversationService = MAILBOX_BOL_ConversationService::getInstance();
     $checkResult = $conversationService->checkUser($params['userId'], $params['opponentId']);
     if ($checkResult['isSuspended']) {
         $this->assign('error', true);
         $this->assign('message', $checkResult['suspendReasonMessage']);
         $this->assign('suspendReason', $checkResult['suspendReason']);
         return;
     }
     $attachmentService = BOL_AttachmentService::getInstance();
     $conversationId = $conversationService->getChatConversationIdWithUserById($userId, $params['opponentId']);
     if (empty($conversationId)) {
         $actionName = 'send_chat_message';
     } else {
         $firstMessage = $conversationService->getFirstMessage($conversationId);
         if (empty($firstMessage)) {
             $actionName = 'send_chat_message';
         } else {
             $actionName = 'reply_to_chat_message';
         }
     }
     $isAuthorized = OW::getUser()->isAuthorized('mailbox', $actionName);
     if (!$isAuthorized) {
         $status = BOL_AuthorizationService::getInstance()->getActionStatus('mailbox', $actionName);
         if ($status['status'] == BOL_AuthorizationService::STATUS_PROMOTED) {
             $this->assign('error', true);
             $this->assign('message', $status['msg']);
         } else {
             if ($status['status'] != BOL_AuthorizationService::STATUS_AVAILABLE) {
                 $language = OW::getLanguage();
                 $this->assign('error', true);
                 $this->assign('message', $language->text('mailbox', $actionName . '_permission_denied'));
             }
         }
         return;
     }
     $finalFileArr = array();
     foreach ($_FILES['images'] as $key => $items) {
         foreach ($items as $index => $item) {
             if (!isset($finalFileArr[$index])) {
                 $finalFileArr[$index] = array();
             }
             $finalFileArr[$index][$key] = $item;
         }
     }
     foreach ($finalFileArr as $item) {
         $opponentId = $params['opponentId'];
         $conversationId = $conversationService->getChatConversationIdWithUserById($userId, $opponentId);
         if (empty($conversationId)) {
             $conversation = $conversationService->createChatConversation($userId, $opponentId);
             $conversationId = $conversation->getId();
         } else {
             $conversation = $conversationService->getConversation($conversationId);
         }
         $uid = UTIL_HtmlTag::generateAutoId('mailbox_conversation_' . $conversationId . '_' . $opponentId);
         try {
             $maxUploadSize = OW::getConfig()->getValue('base', 'attch_file_max_size_mb');
             $validFileExtensions = json_decode(OW::getConfig()->getValue('base', 'attch_ext_list'), true);
             $dtoArr = $attachmentService->processUploadedFile('mailbox', $item, $uid, $validFileExtensions, $maxUploadSize);
         } catch (Exception $e) {
             throw new ApiResponseErrorException($e->getMessage());
         }
         $files = $attachmentService->getFilesByBundleName('mailbox', $uid);
         if (!empty($files)) {
             try {
                 $message = $conversationService->createMessage($conversation, $userId, OW::getLanguage()->text('mailbox', 'attachment'));
                 $conversationService->addMessageAttachments($message->id, $files);
                 $this->assign('message', $conversationService->getMessageData($message));
             } catch (InvalidArgumentException $e) {
                 throw new ApiResponseErrorException($e->getMessage());
             }
         }
     }
 }