本文整理匯總了PHP中OW::getDocument方法的典型用法代碼示例。如果您正苦於以下問題:PHP OW::getDocument方法的具體用法?PHP OW::getDocument怎麽用?PHP OW::getDocument使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類OW
的用法示例。
在下文中一共展示了OW::getDocument方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: __construct
public function __construct($userId)
{
parent::__construct();
$data = OW::getEventManager()->call("photo.entity_albums_find", array("entityType" => "user", "entityId" => $userId));
$albums = empty($data["albums"]) ? array() : $data["albums"];
$source = BOL_PreferenceService::getInstance()->getPreferenceValue("pcgallery_source", $userId);
$this->assign("source", $source == "album" ? "album" : "all");
$selectedAlbum = BOL_PreferenceService::getInstance()->getPreferenceValue("pcgallery_album", $userId);
$form = new Form("pcGallerySettings");
$form->setEmptyElementsErrorMessage(null);
$form->setAction(OW::getRouter()->urlFor("PCGALLERY_CTRL_Gallery", "saveSettings"));
$element = new HiddenField("userId");
$element->setValue($userId);
$form->addElement($element);
$element = new Selectbox("album");
$element->setHasInvitation(true);
$element->setInvitation(OW::getLanguage()->text("pcgallery", "settings_album_invitation"));
$validator = new PCGALLERY_AlbumValidator();
$element->addValidator($validator);
$albumsPhotoCount = array();
foreach ($albums as $album) {
$element->addOption($album["id"], $album["name"] . " ({$album["photoCount"]})");
$albumsPhotoCount[$album["id"]] = $album["photoCount"];
if ($album["id"] == $selectedAlbum) {
$element->setValue($album["id"]);
}
}
OW::getDocument()->addOnloadScript(UTIL_JsGenerator::composeJsString('window.pcgallery_settingsAlbumCounts = {$albumsCount};', array("albumsCount" => $albumsPhotoCount)));
$element->setLabel(OW::getLanguage()->text("pcgallery", "source_album_label"));
$form->addElement($element);
$submit = new Submit("save");
$submit->setValue(OW::getLanguage()->text("pcgallery", "save_settings_btn_label"));
$form->addElement($submit);
$this->addForm($form);
}
示例2: __construct
public function __construct()
{
parent::__construct('delete-membership-form');
$this->setAjaxResetOnSuccess(false);
$this->setAjax(true);
$this->setAction(OW::getRouter()->urlForRoute('membership_delete_type'));
$lang = OW::getLanguage();
$typeId = new HiddenField('typeId');
$typeId->setRequired(true);
$this->addElement($typeId);
$newTypeId = new Selectbox('newTypeId');
$newTypeId->setHasInvitation(false);
$this->addElement($newTypeId);
$types = new RadioGroupItemField('type');
$types->setRequired(true);
$types->setLabel($lang->text('membership', 'set_membership'));
$this->addElement($types);
$this->bindJsFunction(Form::BIND_SUCCESS, "function( data ) {\n if ( data.result ) {\n document.location.reload();\n }\n }");
$script = '$("#btn-confirm-type-delete").click(function(){
if ( confirm(' . json_encode($lang->text('membership', 'type_delete_confirm')) . ') ) {
$(this).parents("form:eq(0)").submit();
}
});
';
OW::getDocument()->addOnloadScript($script);
}
示例3: render
public function render()
{
$cssUrl = OW::getPluginManager()->getPlugin('FBCONNECT')->getStaticCssUrl() . 'fbconnect.css';
OW::getDocument()->addStyleSheet($cssUrl);
FBCONNECT_BOL_Service::getInstance()->initializeJs(array('email', 'user_about_me', 'user_birthday'), $_GET);
return parent::render();
}
示例4: initJs
protected function initJs()
{
$js = UTIL_JsGenerator::newInstance();
$js->addScript('OW.Console.addItem(new OW_ConsoleDropdownClick({$uniqId}, {$contentIniqId}), {$key});', array('uniqId' => $this->consoleItem->getUniqId(), 'key' => $this->getKey(), 'contentIniqId' => $this->consoleItem->getContentUniqId()));
OW::getDocument()->addOnloadScript($js);
return $this->consoleItem->getUniqId();
}
示例5: render
public function render()
{
$defaultAvatarUrl = BOL_AvatarService::getInstance()->getDefaultAvatarUrl();
$this->assign('defaultAvatarUrl', $defaultAvatarUrl);
$js = "OW.Mailbox.conversationController = new MAILBOX_ConversationView();";
OW::getDocument()->addOnloadScript($js, 3006);
//TODO check this config
$enableAttachments = OW::getConfig()->getValue('mailbox', 'enable_attachments');
$this->assign('enableAttachments', $enableAttachments);
$replyToMessageActionPromotedText = '';
$isAuthorizedReplyToMessage = OW::getUser()->isAuthorized('mailbox', 'reply_to_message');
$isAuthorizedReplyToMessage = $isAuthorizedReplyToMessage || OW::getUser()->isAuthorized('mailbox', 'send_chat_message');
if (!$isAuthorizedReplyToMessage) {
$status = BOL_AuthorizationService::getInstance()->getActionStatus('mailbox', 'reply_to_message');
if ($status['status'] == BOL_AuthorizationService::STATUS_PROMOTED) {
$replyToMessageActionPromotedText = $status['msg'];
}
}
$this->assign('isAuthorizedReplyToMessage', $isAuthorizedReplyToMessage);
$isAuthorizedReplyToChatMessage = OW::getUser()->isAuthorized('mailbox', 'reply_to_chat_message');
if (!$isAuthorizedReplyToChatMessage) {
$status = BOL_AuthorizationService::getInstance()->getActionStatus('mailbox', 'reply_to_chat_message');
if ($status['status'] == BOL_AuthorizationService::STATUS_PROMOTED) {
$replyToMessageActionPromotedText = $status['msg'];
}
}
$this->assign('isAuthorizedReplyToChatMessage', $isAuthorizedReplyToChatMessage);
$this->assign('replyToMessageActionPromotedText', $replyToMessageActionPromotedText);
if ($isAuthorizedReplyToMessage) {
$text = new WysiwygTextarea('mailbox_message');
$text->setId('conversationTextarea');
$this->assign('mailbox_message', $text->renderInput());
}
return parent::render();
}
示例6: __construct
/**
* @return Constructor.
*/
public function __construct($groupId)
{
parent::__construct();
$service = GROUPS_BOL_Service::getInstance();
$groupDto = $service->findGroupById($groupId);
$group = array('title' => htmlspecialchars($groupDto->title), 'description' => $groupDto->description, 'time' => $groupDto->timeStamp, 'imgUrl' => empty($groupDto->imageHash) ? false : $service->getGroupImageUrl($groupDto), 'url' => OW::getRouter()->urlForRoute('groups-view', array('groupId' => $groupDto->id)), "id" => $groupDto->id);
$imageUrl = empty($groupDto->imageHash) ? '' : $service->getGroupImageUrl($groupDto);
OW::getDocument()->addMetaInfo('image', $imageUrl, 'itemprop');
OW::getDocument()->addMetaInfo('og:image', $imageUrl, 'property');
$createDate = UTIL_DateTime::formatDate($groupDto->timeStamp);
$adminName = BOL_UserService::getInstance()->getDisplayName($groupDto->userId);
$adminUrl = BOL_UserService::getInstance()->getUserUrl($groupDto->userId);
$js = UTIL_JsGenerator::newInstance()->jQueryEvent('#groups_toolbar_flag', 'click', UTIL_JsGenerator::composeJsString('OW.flagContent({$entity}, {$id}, {$title}, {$href}, "groups+flags", {$ownerId});', array('entity' => GROUPS_BOL_Service::WIDGET_PANEL_NAME, 'id' => $groupDto->id, 'title' => $group['title'], 'href' => $group['url'], 'ownerId' => $groupDto->userId)));
OW::getDocument()->addOnloadScript($js, 1001);
$toolbar = array(array('label' => OW::getLanguage()->text('groups', 'widget_brief_info_create_date', array('date' => $createDate))), array('label' => OW::getLanguage()->text('groups', 'widget_brief_info_admin', array('name' => $adminName, 'url' => $adminUrl))));
if ($service->isCurrentUserCanEdit($groupDto)) {
$toolbar[] = array('label' => OW::getLanguage()->text('groups', 'edit_btn_label'), 'href' => OW::getRouter()->urlForRoute('groups-edit', array('groupId' => $groupId)));
}
if (OW::getUser()->isAuthenticated() && OW::getUser()->getId() != $groupDto->userId) {
$toolbar[] = array('label' => OW::getLanguage()->text('base', 'flag'), 'href' => 'javascript://', 'id' => 'groups_toolbar_flag');
}
$event = new BASE_CLASS_EventCollector('groups.on_toolbar_collect', array('groupId' => $groupId));
OW::getEventManager()->trigger($event);
foreach ($event->getData() as $item) {
$toolbar[] = $item;
}
$this->assign('toolbar', $toolbar);
$this->assign('group', $group);
}
示例7: __construct
public function __construct()
{
parent::__construct();
$this->setPageHeading(OW::getLanguage()->text('admin', 'pages_page_heading'));
$this->setPageHeadingIconClass('ow_ic_gear_wheel');
OW::getDocument()->getMasterPage()->getMenu(OW_Navigation::ADMIN_PAGES)->getElement('sidebar_menu_item_pages_manage')->setActive(true);
}
示例8: chooseTheme
public function chooseTheme()
{
$this->themeService->updateThemeList();
$this->themeService->updateThemesInfo();
$themes = $this->themeService->findAllThemes();
$themesInfo = array();
$activeTheme = OW::getThemeManager()->getSelectedTheme()->getDto()->getName();
/* @var $theme BOL_Theme */
foreach ($themes as $theme) {
$themesInfo[$theme->getName()] = (array) json_decode($theme->getDescription());
$themesInfo[$theme->getName()]['key'] = $theme->getName();
$themesInfo[$theme->getName()]['title'] = $theme->getTitle();
$themesInfo[$theme->getName()]['iconUrl'] = $this->themeService->getStaticUrl($theme->getName()) . BOL_ThemeService::ICON_FILE;
$themesInfo[$theme->getName()]['previewUrl'] = $this->themeService->getStaticUrl($theme->getName()) . BOL_ThemeService::PREVIEW_FILE;
$themesInfo[$theme->getName()]['active'] = $theme->getName() === $activeTheme;
$themesInfo[$theme->getName()]['changeUrl'] = OW::getRouter()->urlFor(__CLASS__, 'changeTheme', array('theme' => $theme->getName()));
$themesInfo[$theme->getName()]['update_url'] = (int) $theme->getUpdate() === 1 && !defined('OW_PLUGIN_XP') ? OW::getRouter()->urlFor('ADMIN_CTRL_Themes', 'updateRequest', array('name' => $theme->getName())) : false;
}
OW::getDocument()->addScript(OW::getPluginManager()->getPlugin('admin')->getStaticJsUrl() . 'theme_select.js');
OW::getDocument()->addScript(OW::getPluginManager()->getPlugin('base')->getStaticJsUrl() . 'jquery.sticky.js');
OW::getDocument()->addOnloadScript("window.owThemes = new ThemesSelect(" . json_encode($themesInfo) . ");\n \t\$('.selected_theme_info input.theme_select_submit').click(function(){\n \t\t\twindow.location.href = '" . $themesInfo[$activeTheme]['changeUrl'] . "';\n \t\t});\n \$('.selected_theme_info_stick').sticky({topSpacing:60});\n ");
$adminTheme = OW::getThemeManager()->getThemeService()->getThemeObjectByName('origin');
$defaultThemeImgUrl = $adminTheme === null ? '' : $adminTheme->getStaticImagesUrl();
$this->assign('themeInfo', $themesInfo[$activeTheme]);
$this->assign('themes', $themesInfo);
$this->assign('defaultThemeImgDir', $defaultThemeImgUrl);
}
示例9: __construct
public function __construct(BASE_CLASS_WidgetParameter $paramObject)
{
parent::__construct();
$text = OW::getLanguage()->text('base', 'welcome_widget_content');
$text = str_replace('</li>', "</li>\n", $text);
//if the tags are written in a line it is necessary to make a compulsory hyphenation?
$photoKey = str_replace('{$key}', self::KEY_PHOTO_UPLOAD, self::PATTERN);
$avatarKey = str_replace('{$key}', self::KEY_CHANGE_AVATAR, self::PATTERN);
if (OW::getPluginManager()->isPluginActive('photo') && mb_stripos($text, self::KEY_PHOTO_UPLOAD) !== false) {
$label = OW::getLanguage()->text('photo', 'upload_photos');
$js = OW::getEventManager()->call('photo.getAddPhotoURL');
$langLabel = $this->getLangLabel($photoKey, $text, self::KEY_PHOTO_UPLOAD);
if ($langLabel != NULL) {
$label = $langLabel;
}
$text = preg_replace($photoKey, '<li><a href="javascript://" onclick="' . $js . '();">' . $label . '</a></li>', $text);
} else {
$text = preg_replace($photoKey, '', $text);
}
if (mb_stripos($text, self::KEY_CHANGE_AVATAR) !== false) {
$label = OW::getLanguage()->text('base', 'avatar_change');
$js = ' $("#welcomeWinget_loadAvatarChangeCmp").click(function(){' . 'document.avatarFloatBox = OW.ajaxFloatBox("BASE_CMP_AvatarChange", [], {width: 749, title: ' . json_encode($label) . '});' . '});';
OW::getDocument()->addOnloadScript($js);
$langLabel = $this->getLangLabel($avatarKey, $text, self::KEY_CHANGE_AVATAR);
if ($langLabel != NULL) {
$label = $langLabel;
}
$text = preg_replace($avatarKey, '<li><a id="welcomeWinget_loadAvatarChangeCmp" href="javascript://">' . $label . '</a></li>', $text);
} else {
$text = preg_replace($avatarKey, '', $text);
}
$this->assign('text', $text);
}
示例10: index
/**
* Finance list page controller
*
* @param array $params
*/
public function index(array $params)
{
$service = BOL_BillingService::getInstance();
$lang = OW::getLanguage();
$page = isset($_GET['page']) ? $_GET['page'] : 1;
$onPage = 20;
$list = $service->getFinanceList($page, $onPage);
$userIdList = array();
foreach ($list as $sale) {
if (isset($sale['userId']) && !in_array($sale['userId'], $userIdList)) {
array_push($userIdList, $sale['userId']);
}
}
$displayNames = BOL_UserService::getInstance()->getDisplayNamesForList($userIdList);
$userNames = BOL_UserService::getInstance()->getUserNamesForList($userIdList);
$this->assign('list', $list);
$this->assign('displayNames', $displayNames);
$this->assign('userNames', $userNames);
$total = $service->countSales();
// Paging
$pages = (int) ceil($total / $onPage);
$paging = new BASE_CMP_Paging($page, $pages, 10);
$this->assign('paging', $paging->render());
$this->assign('total', $total);
$stats = $service->getTotalIncome();
$this->assign('stats', $stats);
OW::getDocument()->setHeading($lang->text('admin', 'page_title_finance'));
OW::getDocument()->setHeadingIconClass('ow_ic_app');
}
示例11: smarty_block_style
/**
* Smarty style block function.
*
* @author Sardar Madumarov <madumarov@gmail.com>
* @package ow.ow_smarty.plugin
* @since 1.0
*/
function smarty_block_style($params, $styles, $smarty)
{
if ($styles === null) {
return;
}
OW::getDocument()->addStyleDeclaration($styles);
}
示例12: onConsolePagesCollect
public function onConsolePagesCollect(BASE_CLASS_EventCollector $event)
{
OW::getDocument()->addScript(OW::getPluginManager()->getPlugin('base')->getStaticJsUrl() . 'underscore-min.js', 'text/javascript', 3000);
OW::getDocument()->addScript(OW::getPluginManager()->getPlugin('base')->getStaticJsUrl() . 'backbone-min.js', 'text/javascript', 3000);
// OW::getDocument()->addScript( OW::getPluginManager()->getPlugin('base')->getStaticJsUrl().'backbone.js', 'text/javascript', 3000 );
OW::getDocument()->addScript(OW::getPluginManager()->getPlugin('mailbox')->getStaticJsUrl() . 'mobile_mailbox.js', 'text/javascript', 3000);
$userListUrl = OW::getRouter()->urlForRoute('mailbox_user_list');
$convListUrl = OW::getRouter()->urlForRoute('mailbox_conv_list');
$authorizationResponderUrl = OW::getRouter()->urlFor('MAILBOX_CTRL_Ajax', 'authorization');
$pingResponderUrl = OW::getRouter()->urlFor('MAILBOX_CTRL_Ajax', 'ping');
$getHistoryResponderUrl = OW::getRouter()->urlFor('MAILBOX_CTRL_Ajax', 'getHistory');
$userId = OW::getUser()->getId();
$displayName = BOL_UserService::getInstance()->getDisplayName($userId);
$avatarUrl = BOL_AvatarService::getInstance()->getAvatarUrl($userId);
if (empty($avatarUrl)) {
$avatarUrl = BOL_AvatarService::getInstance()->getDefaultAvatarUrl();
}
$profileUrl = BOL_UserService::getInstance()->getUserUrl($userId);
$lastSentMessage = MAILBOX_BOL_ConversationService::getInstance()->getLastSentMessage($userId);
$lastMessageTimestamp = (int) ($lastSentMessage ? $lastSentMessage->timeStamp : 0);
$params = array('getHistoryResponderUrl' => $getHistoryResponderUrl, 'pingResponderUrl' => $pingResponderUrl, 'authorizationResponderUrl' => $authorizationResponderUrl, 'userListUrl' => $userListUrl, 'convListUrl' => $convListUrl, 'pingInterval' => 5000, 'lastMessageTimestamp' => $lastMessageTimestamp, 'user' => array('userId' => $userId, 'displayName' => $displayName, 'profileUrl' => $profileUrl, 'avatarUrl' => $avatarUrl));
$js = UTIL_JsGenerator::composeJsString('OWM.Mailbox = new MAILBOX_Mobile({$params});', array('params' => $params));
OW::getDocument()->addOnloadScript($js, 'text/javascript', 3000);
$event->add(array('key' => 'convers', 'cmpClass' => 'MAILBOX_MCMP_ConsoleConversationsPage', 'order' => 2));
}
示例13: onCollectButtons
/**
* @param BASE_CLASS_EventCollector $event
*/
public function onCollectButtons(BASE_CLASS_EventCollector $event)
{
$params = $event->getParams();
if ($params["entityType"] != HINT_BOL_Service::ENTITY_TYPE_USER) {
return;
}
$userId = $params["entityId"];
if (!OW::getUser()->isAuthenticated() || $userId == OW::getUser()->getId() || !OW::getUser()->isAuthorized('ocsfavorites', 'add_to_favorites')) {
return;
}
$service = OCSFAVORITES_BOL_Service::getInstance();
$lang = OW::getLanguage();
$isFavorite = $service->isFavorite(OW::getUser()->getId(), $userId);
$uniqId = uniqid("hint-favorites-");
if ($isFavorite) {
$command = "favorites.remove";
$label = $lang->text('ocsfavorites', 'remove_favorite_button');
} else {
$command = "favorites.add";
$label = $lang->text('ocsfavorites', 'add_favorite_button');
}
$js = UTIL_JsGenerator::newInstance();
$js->jQueryEvent('#' . $uniqId, 'click', '
var self = $(this), command = self.data("command");
HINT.UTILS.toggleText(this, e.data.l1, e.data.l2);
self.data("command", command == "favorites.remove" ? "favorites.add" : "favorites.remove");
HINT.UTILS.query(command, e.data.params); return false;', array('e'), array("l1" => $lang->text('ocsfavorites', 'add_favorite_button'), "l2" => $lang->text('ocsfavorites', 'remove_favorite_button'), "params" => array("userId" => $userId)));
OW::getDocument()->addOnloadScript($js);
$button = array("key" => "ocsfavorites", "label" => $label, "attrs" => array("id" => $uniqId, "data-command" => $command));
$event->add($button);
}
示例14: rated
public function rated()
{
if (!OW::getUser()->isAuthenticated()) {
throw new AuthenticateException();
}
$lang = OW::getLanguage();
$page = !empty($_GET['page']) && intval($_GET['page']) > 0 ? $_GET['page'] : 1;
$perPage = (int) OW::getConfig()->getValue('base', 'users_count_on_page');
$service = OCSTOPUSERS_BOL_Service::getInstance();
$userId = OW::getUser()->getId();
$users = $service->findRateUserList($userId, $page, $perPage);
if ($users) {
$count = $service->countRateUsers($userId);
$list = array();
$fields = array();
foreach ($users as $user) {
$list[] = $user['dto'];
$fields[$user['dto']->id] = array('score' => $user['score'], 'timeStamp' => $user['timeStamp']);
}
$cmp = new OCSTOPUSERS_CMP_RatedList($list, $count, $perPage, false, $fields);
$this->addComponent('users', $cmp);
} else {
$this->assign($users, null);
}
OW::getDocument()->setHeading($lang->text('ocstopusers', 'rated_me'));
OW::getDocument()->setHeadingIconClass('ow_ic_star');
OW::getNavigation()->activateMenuItem(BOL_NavigationService::MENU_TYPE_MAIN, 'base', 'users_main_menu_item');
$this->setTemplate(OW::getPluginManager()->getPlugin('ocstopusers')->getCtrlViewDir() . 'list_index.html');
}
示例15: __construct
public function __construct($data)
{
$script = UTIL_JsGenerator::composeJsString('
OWM.bind("mailbox.ready", function(readyStatus){
if (readyStatus == 2){
OWM.conversation = new MAILBOX_Conversation({$params});
OWM.conversationView = new MAILBOX_MailConversationView({model: OWM.conversation});
}
});
', array('params' => $data));
OW::getDocument()->addOnloadScript($script);
OW::getLanguage()->addKeyForJs('mailbox', 'text_message_invitation');
$form = new MAILBOX_MCLASS_NewMailMessageForm($data['conversationId'], $data['opponentId']);
$this->addForm($form);
$this->assign('data', $data);
$this->assign('defaultAvatarUrl', BOL_AvatarService::getInstance()->getDefaultAvatarUrl());
$firstMessage = MAILBOX_BOL_ConversationService::getInstance()->getFirstMessage($data['conversationId']);
if (empty($firstMessage)) {
$actionName = 'send_message';
} else {
$actionName = 'reply_to_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('sendAuthMessage', $status['msg']);
} elseif ($status['status'] != BOL_AuthorizationService::STATUS_AVAILABLE) {
$this->assign('sendAuthMessage', OW::getLanguage()->text('mailbox', $actionName . '_permission_denied'));
}
}
}