protected function getTabs() { $language = OW::getLanguage(); $service = UHEADER_BOL_Service::getInstance(); $photoBridge = UHEADER_CLASS_PhotoBridge::getInstance(); $templatesCount = $service->findTemplatesCountForUser($this->userId); if ($templatesCount > 0 || !$photoBridge->isActive()) { $activeTab = "gallery"; } else { $activeTab = "photos"; } $tabs = array(); if ($templatesCount > 0) { $tabKey = "gallery"; $dimensions = $this->getDimensions(); //$dimensions["height"] -= 45; if (OW::getConfig()->getValue('uheader', 'tpl_view_mode') == "list") { $coverGallery = new UHEADER_CMP_CoverGallery($this->userId, $tabKey, $dimensions); } else { $coverGallery = new UHEADER_CMP_CoverPreviewGallery($this->userId, $tabKey, $dimensions); } $coverGallery->assign("dimensions", $this->getDimensions()); $tabs[] = array("label" => $language->text("uheader", "gallery_tab_gallery"), "key" => $tabKey, "active" => $tabKey == $activeTab, "content" => $coverGallery->render()); } $tabKey = "photos"; $photoList = new UHEADER_CMP_MyPhotos($this->userId, $tabKey); $tabs[] = array("label" => $language->text("uheader", "gallery_tab_photos"), "key" => $tabKey, "active" => $tabKey == $activeTab, "content" => $photoList->render()); return $tabs; }
public function __construct($userId) { parent::__construct(); $cover = UHEADER_BOL_Service::getInstance()->findCoverByUserId($userId); if (empty($cover)) { $this->assign('error', OW::getLanguage()->text('uheader', 'cover_not_found')); return; } $src = UHEADER_BOL_Service::getInstance()->getCoverUrl($cover); $settings = $cover->getSettings(); $height = $settings['dimensions']['height']; $width = $settings['dimensions']['width']; $top = 0; if ($height < self::MIN_HEIGHT) { $top = (self::MIN_HEIGHT - $height) / 2; } $avatarsData = BOL_AvatarService::getInstance()->getDataForUserAvatars(array($userId)); $this->assign('user', $avatarsData[$userId]); $this->assign('src', $src); $this->assign('top', $top); $this->assign('dimensions', $settings['dimensions']); $cmtParams = new BASE_CommentsParams('uheader', UHEADER_CLASS_CommentsBridge::ENTITY_TYPE); $cmtParams->setWrapInBox(false); $cmtParams->setEntityId($cover->id); $cmtParams->setOwnerId($userId); $cmtParams->setDisplayType(BASE_CommentsParams::DISPLAY_TYPE_TOP_FORM_WITH_PAGING); $photoCmts = new BASE_CMP_Comments($cmtParams); $this->addComponent('comments', $photoCmts); }
public function getCoverUrl(UHEADER_BOL_Cover $cover) { if (!$this->isActive()) { return null; } return UHEADER_BOL_Service::getInstance()->getCoverUrl($cover); }
public function onItemRender(OW_Event $event) { $params = $event->getParams(); $data = $params["data"]; if (!in_array($params['entityType'], array(self::TYPE_COMMENT, self::TYPE_LIKE))) { return; } $coverId = null; if (empty($params["data"]["coverId"])) { $cover = UHEADER_BOL_Service::getInstance()->findCoverByUserId(OW::getUser()->getId()); if (!empty($cover)) { $coverId = $cover->id; } } else { $coverId = $params["data"]["coverId"]; } $url = null; if (!empty($coverId)) { $url = UHEADER_MCLASS_NewsfeedBridge::getInstance()->getCoverUrl($coverId); } if (!empty($url)) { $data["url"] = $url; } $event->setData($data); }
public function __construct($userId, $tabKey, $dimensions) { parent::__construct(); $this->userId = $userId; $this->tabKey = $tabKey; $this->service = UHEADER_BOL_Service::getInstance(); $this->dimensions = $dimensions; }
private function __construct() { $this->service = UHEADER_BOL_Service::getInstance(); $this->plugin = OW::getPluginManager()->getPlugin('uheader'); //66 - for 1000px themes //84 - for 780px themes $scale = (OW::getThemeManager()->getSelectedTheme()->getDto()->sidebarPosition == "none" ? 69 : 88) / 100; $this->config = OW::getConfig()->getValues("uheader"); $this->config["cover_height"] *= $scale; }
public function __construct() { parent::__construct(); $this->service = UHEADER_BOL_Service::getInstance(); $this->plugin = OW::getPluginManager()->getPlugin("uheader"); //66 - for 1000px themes //84 - for 780px themes $scale = (OW::getThemeManager()->getSelectedTheme()->getDto()->sidebarPosition == "none" ? 69 : 88) / 100; $this->config = OW::getConfig()->getValues("uheader"); $this->config["avatar_big_size"] = OW::getConfig()->getValue("base", "avatar_big_size") * $scale; $this->config["cover_height"] *= $scale; }
public function onBeforeRender() { parent::onBeforeRender(); $coverId = $this->vars["coverId"]; $cover = UHEADER_BOL_Service::getInstance()->findCoverById($coverId); if ($cover === null) { $this->setVisible(false); return; } UHEADER_CLASS_Plugin::getInstance()->includeStaticFile("uheader.css"); $src = UHEADER_BOL_Service::getInstance()->getCoverUrl($cover); $this->assign('src', $src); $this->assign('imageCss', $cover->getCssString()); $this->assign("scale", $cover->getRatio()); $this->assign("url", BOL_UserService::getInstance()->getUserUrl($cover->userId)); }
public function __construct($userId) { parent::__construct(); $cover = UHEADER_BOL_Service::getInstance()->findCoverByUserId($userId); if (empty($cover)) { $this->setVisible(false); return; } UHEADER_CLASS_Plugin::getInstance()->includeStaticFile("uheader.css"); $uniqId = uniqid('uheader-'); $this->assign('uniqId', $uniqId); $js = UTIL_JsGenerator::newInstance()->jQueryEvent('#' . $uniqId, 'click', 'OW.ajaxFloatBox("UHEADER_CMP_CoverView", [e.data.userId], { layout: "empty", top: 50 }); return false;', array('e'), array('userId' => $userId)); OW::getDocument()->addOnloadScript($js); $src = UHEADER_BOL_Service::getInstance()->getCoverUrl($cover); $this->assign('src', $src); $cavas = $cover->getCanvas(self::ITEM_WIDTH); $this->assign('imageCss', $cover->getCssString()); $this->assign('height', $cavas["height"]); }
public function onBeforeRender() { parent::onBeforeRender(); $service = UHEADER_BOL_Service::getInstance(); $cover = $service->findCoverByUserId($this->user->id, UHEADER_BOL_Cover::STATUS_ACTIVE); if ($cover === null) { $removedCover = $service->findCoverByUserId($this->user->id, UHEADER_BOL_Cover::STATUS_REMOVED); if ($removedCover === null) { $template = $service->findDefaultTemplateForUser($this->user->id); if ($template !== null) { $cover = $template->createCover($this->user->id); } } } if ($cover === null) { return; } UHEADER_CLASS_Plugin::getInstance()->includeStaticFile("uheader.css"); $tplCover = array(); $tplCover["src"] = UHEADER_BOL_Service::getInstance()->getCoverUrl($cover); $tplCover['imageCss'] = $cover->getCssString(); $tplCover["scale"] = $cover->getRatio(); $this->assign("cover", $tplCover); }
public function getSrc() { return UHEADER_BOL_Service::getInstance()->getTemplateUrl($this); }
public function onLike(OW_Event $event) { $params = $event->getParams(); if ($params['entityType'] != UHEADER_CLASS_CommentsBridge::ENTITY_TYPE) { return; } $userId = $params['userId']; $coverId = $params['entityId']; $cover = UHEADER_BOL_Service::getInstance()->findCoverById($coverId); $string = null; if ($cover->userId == $userId) { $string = array("key" => 'uheader+activity_string_cover_like_self'); } else { $userName = BOL_UserService::getInstance()->getDisplayName($cover->userId); $userUrl = BOL_UserService::getInstance()->getUserUrl($cover->userId); $userEmbed = '<a href="' . $userUrl . '">' . $userName . '</a>'; $string = array("key" => 'uheader+activity_string_cover_like', "vars" => array('user' => $userEmbed)); } OW::getEventManager()->trigger(new OW_Event('feed.activity', array('activityType' => 'like', 'activityId' => $userId, 'entityId' => $params['entityId'], 'entityType' => $params['entityType'], 'userId' => $userId, 'pluginKey' => $this->plugin->getKey()), array('string' => $string))); }
<?php Updater::getLanguageService()->importPrefixFromZip(dirname(__FILE__) . DS . 'langs.zip', 'uheader'); $sql = array(); $sql[] = "ALTER TABLE `" . OW_DB_PREFIX . "uheader_cover` ADD `templateId` int(11) DEFAULT NULL"; $sql[] = "CREATE TABLE IF NOT EXISTS `" . OW_DB_PREFIX . "uheader_template` (\n `id` int(11) NOT NULL AUTO_INCREMENT,\n `file` varchar(255) NOT NULL,\n `settings` text NOT NULL,\n `default` int(11) NOT NULL DEFAULT '0',\n `timeStamp` int(11) NOT NULL,\n PRIMARY KEY (`id`)\n) ENGINE=MyISAM DEFAULT CHARSET=utf8;"; $sql[] = "CREATE TABLE IF NOT EXISTS `" . OW_DB_PREFIX . "uheader_template_role` (\n `id` int(11) NOT NULL AUTO_INCREMENT,\n `templateId` int(11) NOT NULL,\n `roleId` int(11) NOT NULL,\n PRIMARY KEY (`id`),\n UNIQUE KEY `templateId` (`templateId`,`roleid`)\n) ENGINE=MyISAM DEFAULT CHARSET=utf8;"; foreach ($sql as $query) { Updater::getDbo()->query($query); } Updater::getConfigService()->addConfig('uheader', 'tpl_view_mode', 'list', 'Cover gallery view mode'); try { $plugin = OW::getPluginManager()->getPlugin("uheader"); $basePlugin = OW::getPluginManager()->getPlugin("base"); spl_autoload_register(array('OW_Autoload', 'autoload')); OW::getAutoloader()->addPackagePointer("UHEADER_BOL", $plugin->getBolDir()); OW::getAutoloader()->addPackagePointer("UHEADER_CLASS", $plugin->getClassesDir()); OW::getAutoloader()->addPackagePointer("BASE_CLASS", $basePlugin->getClassesDir()); } catch (Exception $e) { } try { //Add default templates $templatesBridge = UHEADER_CLASS_TemplatesBridge::getInstance(); $templatesBridge->addBuiltInCovers(); } catch (Exception $e) { } try { UHEADER_BOL_Service::getInstance()->saveInfoConfig(UHEADER_BOL_Service::INFO_LINE1, "base-gender-age"); UHEADER_BOL_Service::getInstance()->saveInfoConfig(UHEADER_BOL_Service::INFO_LINE2, "base-about"); } catch (Exception $e) { }
public function __construct() { parent::__construct(); $this->service = UHEADER_BOL_Service::getInstance(); }
protected function __construct() { $this->service = UHEADER_BOL_Service::getInstance(); }
public function onLike(OW_Event $event) { $params = $event->getParams(); if ($params['entityType'] != UHEADER_CLASS_CommentsBridge::ENTITY_TYPE) { return; } $userId = OW::getUser()->getId(); $cover = UHEADER_BOL_Service::getInstance()->findCoverById($params['entityId']); if ($cover->userId == $userId) { return; } $userUrl = BOL_UserService::getInstance()->getUserUrl($cover->userId); $avatars = BOL_AvatarService::getInstance()->getDataForUserAvatars(array($userId)); $avatar = $avatars[$userId]; $previewImage = null; $notificationParams = array('pluginKey' => $this->plugin->getKey(), 'action' => self::ACTION_LIKE, 'entityType' => self::TYPE_LIKE, 'entityId' => $cover->userId, 'userId' => $cover->userId, 'time' => time()); $users = array(); $users[] = array('userId' => $userId, 'userName' => $avatar['title'], 'userUrl' => $avatar['url']); $notificationData = array('string' => array('key' => 'uheader+notifications_like_1', 'vars' => array('user' => '<a href="' . $users[0]['userUrl'] . '">' . $users[0]['userName'] . '</a>')), 'users' => $users, 'userIds' => array($userId), 'avatar' => $avatar, 'contentImage' => $previewImage, 'url' => $userUrl, "coverId" => $cover->id); $event = new OW_Event('notifications.add', $notificationParams, $notificationData); OW::getEventManager()->trigger($event); }
public function getInfoLines() { return array(UHEADER_BOL_Service::INFO_LINE1 => UHEADER_BOL_Service::getInstance()->getInfoLine($this->userId, UHEADER_BOL_Service::INFO_LINE1), UHEADER_BOL_Service::INFO_LINE2 => UHEADER_BOL_Service::getInstance()->getInfoLine($this->userId, UHEADER_BOL_Service::INFO_LINE2)); }