本文整理汇总了PHP中UTIL_JsGenerator::newInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP UTIL_JsGenerator::newInstance方法的具体用法?PHP UTIL_JsGenerator::newInstance怎么用?PHP UTIL_JsGenerator::newInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UTIL_JsGenerator
的用法示例。
在下文中一共展示了UTIL_JsGenerator::newInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: initJs
public function initJs($delegate)
{
$js = UTIL_JsGenerator::newInstance();
$js->newObject(array('ATTP.CORE.ObjectRegistry', $this->uniqId), 'ATTP.Attachment', array($this->uniqId, $delegate));
ATTACHMENTS_Plugin::getInstance()->addJs($js);
return $this->uniqId;
}
示例3: 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);
}
示例4: 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);
}
示例5: __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);
}
示例6: 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();
}
示例7: initJs
public function initJs($delegate)
{
$js = UTIL_JsGenerator::newInstance();
$js->newObject(array('CORE.ObjectRegistry', $this->uniqId), 'ATTACHMENTS.Attachment', array($this->uniqId, $delegate));
OW::getDocument()->addOnloadScript($js);
return $this->uniqId;
}
示例8: 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);
}
示例9: 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;
}
示例10: __construct
public function __construct($feedAutoId, $feedType, $feedId, $actionVisibility = null)
{
parent::__construct();
$form = new NEWSFEED_StatusForm($feedAutoId, $feedType, $feedId, $actionVisibility);
$this->addForm($form);
$uniqId = uniqid('statusUpdate');
$attachmentId = $this->initAttachments();
$attachmentInputId = $form->getElement('attachment')->getId();
$inputId = $form->getElement('status')->getId();
$this->assign('uniqId', $uniqId);
$js = UTIL_JsGenerator::newInstance()->newObject(array('ATTP.CORE.ObjectRegistry', $uniqId), 'ATTP.AttachmentsControl', array($uniqId, array('attachmentId' => $attachmentId, 'attachmentInputId' => $attachmentInputId, 'inputId' => $inputId, 'formName' => $form->getName())));
ATTACHMENTS_Plugin::getInstance()->addJs($js);
$js = 'owForms[{$form}].bind("success", function(data){
if ( !data || data.error )
{
return;
}
if ( ATTP.CORE.ObjectRegistry[{$attachId}] )
{
ATTP.CORE.ObjectRegistry[{$attachId}].reset();
}
});
owForms[{$form}].reset = false;';
$js = UTIL_JsGenerator::composeJsString($js, array('form' => $form->getName(), 'attachId' => $attachmentId));
OW::getDocument()->addOnloadScript($js);
}
示例11: 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);
}
示例12: 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);
}
示例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: initJs
public function initJs()
{
$js = UTIL_JsGenerator::newInstance();
$code = BOL_TextFormatService::getInstance()->addVideoCodeParam($this->oembed["html"], "autoplay", 1);
$code = BOL_TextFormatService::getInstance()->addVideoCodeParam($code, "play", 1);
$js->addScript('$(".ow_oembed_video_cover", "#" + {$uniqId}).click(function() { ' . '$(".two_column", "#" + {$uniqId}).addClass("ow_video_playing"); ' . '$(".attachment_left", "#" + {$uniqId}).html({$embed});' . 'OW.trigger("base.comment_video_play", {});' . 'return false; });', array("uniqId" => $this->uniqId, "embed" => $code));
OW::getDocument()->addOnloadScript($js);
}
示例15: addStatic
public function addStatic($ajax = false)
{
if ($this->staticAdded) {
return;
}
$staticUrl = OW::getPluginManager()->getPlugin(self::PLUGIN_KEY)->getStaticUrl();
$scriptUrl = $staticUrl . 'equestions.js' . '?' . self::PLUGIN_VERSION;
$styleUrl = $staticUrl . 'equestions.css' . '?' . self::PLUGIN_VERSION;
$imagesUrl = OW::getThemeManager()->getThemeImagesUrl();
$css = 'html body div .q_ic_preloader { background-image: url(' . $imagesUrl . 'ajax_preloader_button.gif) };';
OW::getDocument()->addStyleDeclaration($css);
if (!$ajax) {
OW::getDocument()->addScript($scriptUrl);
OW::getDocument()->addStyleSheet($styleUrl);
} else {
OW::getDocument()->addOnloadScript(UTIL_JsGenerator::composeJsString('
if ( !window.QUESTIONS_Loaded )
{
OW.addScriptFiles([{$scriptUrl}], function(){
if ( window.EQAjaxLoadCallbacksRun )
{
window.EQAjaxLoadCallbacksRun();
}
});
OW.addCssFile({$styleUrl});
}
', array('styleUrl' => $styleUrl, 'scriptUrl' => $scriptUrl)));
}
$messages = EQUESTIONS_CLASS_CreditsBridge::getInstance()->getAllPermissionMessages();
$actions = EQUESTIONS_CLASS_CreditsBridge::getInstance()->getAllPermissions();
$js = UTIL_JsGenerator::newInstance();
$js->addScript(UTIL_JsGenerator::composeJsString('UTILS.Credits = new UTILS.CreditsConstructor({$actions}, {$messages}); ', array('messages' => $messages, 'actions' => $actions)));
$friendMode = (bool) OW::getEventManager()->call('plugin.friends');
$js->setVariable(array('QUESTIONS', 'friendMode'), $friendMode);
if (!$ajax) {
OW::getDocument()->addOnloadScript($js);
} else {
OW::getDocument()->addOnloadScript('window.EQAjaxLoadCallbackQueue = [];');
OW::getDocument()->addOnloadScript('(function() {
var loaded = function() {
' . $js->generateJs() . '
};
if ( window.QUESTIONS_Loaded )
loaded.call();
else
window.EQAjaxLoadCallbackQueue.push(loaded);
})();');
}
OW::getLanguage()->addKeyForJs('equestions', 'selector_title_friends');
OW::getLanguage()->addKeyForJs('equestions', 'selector_title_users');
OW::getLanguage()->addKeyForJs('equestions', 'followers_fb_title');
OW::getLanguage()->addKeyForJs('equestions', 'toolbar_unfollow_btn');
OW::getLanguage()->addKeyForJs('equestions', 'toolbar_follow_btn');
$this->staticAdded = true;
}