Example #1
0
 public function onBeforeRender()
 {
     parent::onBeforeRender();
     $count = 42;
     $photos = $this->bridge->findUserPhotos($this->userId, 0, $count);
     $this->addComponent('photoList', new UHEADER_CMP_MyPhotoList($photos));
     $js = UTIL_JsGenerator::composeJsString('UHEADER.GallerySwitcher.registerTab({$tabKey}, new UHEADER.PhotoSelector({$params}, _scope));', array('params' => array('responder' => OW::getRouter()->urlFor('UHEADER_CTRL_Header', 'rsp'), 'userId' => $this->userId, 'tabKey' => $this->tabKey, 'listFull' => count($photos) < $count), "tabKey" => $this->tabKey));
     OW::getDocument()->addOnloadScript($js);
 }
Example #2
0
 /**
  * Returns class instance
  *
  * @return UHEADER_CLASS_PhotoBridge
  */
 public static function getInstance()
 {
     if (!isset(self::$classInstance)) {
         self::$classInstance = new self();
     }
     return self::$classInstance;
 }
Example #3
0
 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;
 }
Example #4
0
 public function loadMorePhotos($query)
 {
     $count = 20;
     $start = $query['offset'];
     $userId = OW::getUser()->getId();
     $photos = UHEADER_CLASS_PhotoBridge::getInstance()->findUserPhotos($userId, $start, $count);
     $photoCount = count($photos);
     $listFull = $photoCount < $count;
     $list = new UHEADER_CMP_MyPhotoList($photos);
     return array('listFull' => $listFull, 'list' => $list->render());
 }
Example #5
0
 public function getPemissions()
 {
     $permissions = array("choose" => false, "stick" => false, 'add' => false, 'reposition' => false, 'restore' => false, 'delete' => false, 'view' => false, 'changeAvatar' => false, 'moderation' => false);
     $selfMode = $this->userId == OW::getUser()->getId();
     $moderationMode = OW::getUser()->isAuthorized('uheader');
     $choose = UHEADER_CLASS_PhotoBridge::getInstance()->isActive() || $this->service->findTemplatesCountForUser($this->userId) > 0;
     $permissions['changeAvatar'] = $selfMode;
     if ($selfMode || $moderationMode) {
         $permissions['delete'] = true;
         $permissions['view'] = true;
         $permissions["restore"] = true;
     }
     if ($selfMode && OW::getUser()->isAuthorized('uheader', 'add_cover')) {
         $permissions['reposition'] = true;
         $permissions['add'] = true;
         $permissions['choose'] = $choose;
         $permissions['stick'] = $this->defaultTemplatesCount > 1;
     }
     if (!$permissions['view'] && OW::getUser()->isAuthorized('uheader', 'view_cover')) {
         $permissions['view'] = UHEADER_CLASS_PrivacyBridge::getInstance()->checkPrivacy($this->userId);
     }
     if ($this->hasCover) {
         $permissions['controls'] = ($permissions['add'] || $permissions['reposition'] || $permissions['delete'] || $permissions['restore'] || $permissions['choose']) && $permissions['view'];
     } else {
         $permissions['controls'] = ($permissions['add'] || $permissions['choose'] || $permissions["stick"]) && $permissions['view'];
     }
     $permissions['moderation'] = !$selfMode && $moderationMode;
     return $permissions;
 }
Example #6
0
<?php

/**
 * Copyright (c) 2012, Sergey Kambalin
 * All rights reserved.
 * ATTENTION: This commercial software is intended for use with Oxwall Free Community Software http://www.oxwall.org/
 * and is licensed under Oxwall Store Commercial License.
 * Full text of this license can be found at http://www.oxwall.org/store/oscl
 */
$plugin = OW::getPluginManager()->getPlugin('uheader');
//Routs
$router = OW::getRouter();
$router->addRoute(new OW_Route('uheader-settings-page', 'admin/plugins/profile-cover', 'UHEADER_CTRL_Admin', 'index'));
$router->addRoute(new OW_Route('uheader-settings-gallery', 'admin/plugins/profile-cover/gallery', 'UHEADER_CTRL_Templates', 'index'));
$router->addRoute(new OW_Route('uheader-settings-gallery-item', 'admin/plugins/profile-cover/gallery/:tplId', 'UHEADER_CTRL_Templates', 'index'));
// Bridges
UHEADER_CLASS_PhotoBridge::getInstance()->init();
UHEADER_CLASS_NewsfeedBridge::getInstance()->init();
UHEADER_CLASS_PrivacyBridge::getInstance()->init();
UHEADER_CLASS_NotificationsBridge::getInstance()->init();
UHEADER_CLASS_CommentsBridge::getInstance()->init();
UHEADER_CLASS_CreditsBridge::getInstance()->init();
UHEADER_CLASS_UavatarsBridge::getInstance()->init();
UHEADER_CLASS_BaseBridge::getInstance()->init();
//Event handler
UHEADER_CLASS_EventHandler::getInstance()->init();