/** * Returns class instance * * @return PCGALLERY_CLASS_PhotoBridge */ public static function getInstance() { if (!isset(self::$classInstance)) { self::$classInstance = new self(); } return self::$classInstance; }
function pcgallery_class_get_instance(OW_Event $event) { $params = $event->getParams(); if ($params['className'] != 'BASE_CMP_ProfileActionToolbar') { return; } if (!PCGALLERY_CLASS_PhotoBridge::getInstance()->isActive()) { return; } $arguments = $params['arguments']; $cmp = new PCGALLERY_CMP_ProfileActionToolbarMock($arguments[0]); $event->setData($cmp); return $cmp; }
public function onBeforeRender() { parent::onBeforeRender(); $permissions = $this->getPemissions(); PCGALLERY_CLASS_PhotoBridge::getInstance()->initFloatbox(); $staticUrl = OW::getPluginManager()->getPlugin('pcgallery')->getStaticUrl(); OW::getDocument()->addStyleSheet($staticUrl . 'style.css'); OW::getDocument()->addScript($staticUrl . 'script.js'); $this->assign("avatarApproval", $this->avatarDto && $this->avatarDto->status != "active"); $this->initJs($permissions); $toolbar = new BASE_CMP_ProfileActionToolbar($this->userId); $this->addComponent('actionToolbar', $toolbar); $this->assign('uniqId', $this->uniqId); $this->assign('user', $this->getUserInfo()); $this->assign('permissions', $permissions); $photos = $permissions["view"] ? $this->getPhotos() : array(); $this->assign('empty', empty($photos)); if (empty($photos)) { $this->initEmptyGallery(); } else { $this->initFullGallery(); } $this->assign('photos', $photos); $source = BOL_PreferenceService::getInstance()->getPreferenceValue("pcgallery_source", $this->userId); $settings = array("changeInterval" => self::PHOTO_CHANGE_INTERVAL, "userId" => $this->userId, "listType" => $source == "all" ? "userPhotos" : "albumPhotos"); $js = UTIL_JsGenerator::newInstance(); $js->callFunction(array('PCGALLERY', 'init'), array($this->uniqId, $settings, $photos)); OW::getDocument()->addOnloadScript($js); OW::getLanguage()->addKeyForJs("pcgallery", "setting_fb_title"); }