本文整理汇总了PHP中UTIL_JsGenerator类的典型用法代码示例。如果您正苦于以下问题:PHP UTIL_JsGenerator类的具体用法?PHP UTIL_JsGenerator怎么用?PHP UTIL_JsGenerator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了UTIL_JsGenerator类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: uninstall
public function uninstall()
{
if (isset($_POST['action']) && $_POST['action'] == 'delete_content') {
OW::getConfig()->saveConfig('blogs', 'uninstall_inprogress', 1);
//maint-ce mode
OW::getFeedback()->info(OW::getLanguage()->text('blogs', 'plugin_set_for_uninstall'));
$this->redirect();
}
$this->setPageHeading(OW::getLanguage()->text('blogs', 'page_title_uninstall'));
$this->setPageHeadingIconClass('ow_ic_delete');
$this->assign('inprogress', (bool) OW::getConfig()->getValue('blogs', 'uninstall_inprogress'));
$js = new UTIL_JsGenerator();
$js->jQueryEvent('#btn-delete-content', 'click', 'if ( !confirm("' . OW::getLanguage()->text('blogs', 'confirm_delete_photos') . '") ) return false;');
OW::getDocument()->addOnloadScript($js);
}
示例2: initJs
public function initJs()
{
$js = UTIL_JsGenerator::newInstance();
$js->newObject(array('OW_AttachmentItemColletction', $this->uniqId), 'OW_Attachment', array($this->uniqId, $this->oembed));
OW::getDocument()->addOnloadScript($js);
return $this->uniqId;
}
示例3: initJs
public function initJs($cacheList, $allCount)
{
$glob = array('rsp' => OW::getRouter()->urlFor('EQUESTIONS_CTRL_Common', 'rsp'), 'delegate' => $this->delegate);
$data = array('entityId' => $this->entityId, 'ajaxMode' => count($cacheList) < $allCount, 'friendsMode' => $this->friendsMode);
$js = UTIL_JsGenerator::newInstance()->newObject(array('CORE.ObjectRegistry', $this->uniqId), 'UI.UserSelector', array($this->uniqId, $data, $glob, $cacheList));
OW::getDocument()->addOnloadScript($js);
}
示例4: __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);
}
}
示例5: initJs
public function initJs($delegate)
{
$data = array();
$data = array('delegate' => $delegate, 'rsp' => OW::getRouter()->urlFor('ATTACHMENTS_CTRL_Attachments', 'rsp'));
$js = UTIL_JsGenerator::newInstance()->newObject(array('ATTP.CORE.ObjectRegistry', $this->uniqId), 'ATTP.LinkPanel', array($this->uniqId, $data));
ATTACHMENTS_Plugin::getInstance()->addJs($js);
}
示例6: initJs
public function initJs($delegate)
{
$data = array();
$data = array('delegate' => $delegate, 'rsp' => OW::getRouter()->urlFor('EQUESTIONS_CTRL_Attachments', 'rsp'));
$js = UTIL_JsGenerator::newInstance()->newObject(array('CORE.ObjectRegistry', $this->uniqId), 'ATTACHMENTS.LinkPanel', array($this->uniqId, $data));
OW::getDocument()->addOnloadScript($js);
}
示例7: initJs
public function initJs($delegate)
{
$js = UTIL_JsGenerator::newInstance();
$js->newObject(array('ATTP.CORE.ObjectRegistry', $this->uniqId), 'ATTP.Attachment', array($this->uniqId, $delegate, $this->type));
$this->initJs = $js->generateJs();
return $this->uniqId;
}
示例8: 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));
}
示例9: onCollectButtons
public function onCollectButtons(BASE_CLASS_EventCollector $event)
{
$params = $event->getParams();
if ($params["entityType"] != HINT_BOL_Service::ENTITY_TYPE_USER) {
return;
}
$userId = $params["entityId"];
$uniqId = uniqid("hint-af-");
if (!OW::getUser()->isAuthenticated() || OW::getUser()->getId() == $userId) {
return;
}
$isFollowing = OW::getEventManager()->call("feed.is_follow", array("feedType" => "user", "feedId" => $userId, "userId" => OW::getUser()->getId()));
$label = $isFollowing ? OW::getLanguage()->text('newsfeed', 'unfollow_button') : OW::getLanguage()->text('newsfeed', 'follow_button');
$toggleLabel = !$isFollowing ? OW::getLanguage()->text('newsfeed', 'unfollow_button') : OW::getLanguage()->text('newsfeed', 'follow_button');
$command = $isFollowing ? "newsfeed.unfollow" : "newsfeed.follow";
$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 == "newsfeed.follow" ? "newsfeed.unfollow" : "newsfeed.follow");
HINT.UTILS.query(command, e.data.params); return false;', array('e'), array("l1" => $label, "l2" => $toggleLabel, "params" => array("userId" => $userId)));
OW::getDocument()->addOnloadScript($js);
$button = array("key" => "follow", "label" => $label, "attrs" => array("id" => $uniqId, "data-command" => $command));
$event->add($button);
}
示例10: __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);
}
示例11: 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);
}
示例12: initJs
public function initJs()
{
parent::initJs();
$js = UTIL_JsGenerator::newInstance();
$js->addScript('OW.Invitation = new OW_Invitation({$key}, {$params});', array('key' => $this->getKey(), 'params' => array('rsp' => OW::getRouter()->urlFor('BASE_CTRL_Invitation', 'ajax'))));
OW::getDocument()->addOnloadScript($js);
}
示例13: 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();
}
示例14: __construct
/**
* Constructor.
*/
public function __construct($params = array())
{
parent::__construct();
$userId = (int) $params['userId'];
$showMessage = (bool) $params['showMessage'];
$rspUrl = OW::getRouter()->urlFor('BASE_CTRL_User', 'deleteUser', array('user-id' => $userId));
$rspUrl = OW::getRequest()->buildUrlQueryString($rspUrl, array('showMessage' => (int) $showMessage));
$js = UTIL_JsGenerator::composeJsString('$("#baseDCButton").click(function()
{
var button = this;
OW.inProgressNode(button);
$.getJSON({$rsp}, function(r)
{
OW.activateNode(button);
if ( _scope.floatBox )
{
_scope.floatBox.close();
}
if ( _scope.deleteCallback )
{
_scope.deleteCallback(r);
}
});
});', array('rsp' => $rspUrl));
OW::getDocument()->addOnloadScript($js);
}
示例15: __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);
}