本文整理汇总了PHP中UTIL_HtmlTag::generateAutoId方法的典型用法代码示例。如果您正苦于以下问题:PHP UTIL_HtmlTag::generateAutoId方法的具体用法?PHP UTIL_HtmlTag::generateAutoId怎么用?PHP UTIL_HtmlTag::generateAutoId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UTIL_HtmlTag
的用法示例。
在下文中一共展示了UTIL_HtmlTag::generateAutoId方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: renderInput
/**
* @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) . ' <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) . ' <label for="' . $this->getId() . '">' . $language->text('matchmaking', 'this_is_unimportant') . '</label></li>';
return $renderedString . '</ul>';
}
示例2: __construct
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);
}
}
示例3: __construct
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);
}
}
}
示例4: __construct
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'));
}
示例5: __construct
/**
* 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);
}
示例6: renderInput
/**
* @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;
}
示例7: __construct
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'));
}
示例8: addUserList
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);
}
示例9: createEmptyItem
/**
*
* @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;
}
示例10: uploadAttachment
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))));
}
示例11: __construct
/**
* 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();
}
}
示例12: generateAttachmentUid
/**
* @param string $entityType
* @param int $entityId
* @return string
*/
public function generateAttachmentUid($entityType, $entityId)
{
return UTIL_HtmlTag::generateAutoId($entityType . "_" . $entityId);
}
示例13: view
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);
//.........这里部分代码省略.........
示例14: onBeforeRender
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);
}
示例15: update
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));
}