/** * Returns class instance * * @return GHEADER_CLASS_PhotoBridge */ public static function getInstance() { if (!isset(self::$classInstance)) { self::$classInstance = new self(); } return self::$classInstance; }
public function onBeforeRender() { parent::onBeforeRender(); $count = 28; $photos = $this->bridge->findUserPhotos($this->userId, 0, $count); $height = $this->windowHeight - 250; $height = $height > 650 ? 650 : $height; if (empty($photos)) { $height = null; } else { $this->addComponent('photoList', new GHEADER_CMP_MyPhotoList($photos)); } $this->assign('height', $height); $js = UTIL_JsGenerator::composeJsString('var photoSelector = new GHEADER.PhotoSelector({$params}, _scope)', array('params' => array('responder' => OW::getRouter()->urlFor('GHEADER_CTRL_Header', 'rsp'), 'userId' => $this->userId, 'listFull' => count($photos) < $count))); OW::getDocument()->addOnloadScript($js); }
/** * * @return BASE_CMP_ContextAction */ private function getContextToolbar() { $language = OW::getLanguage(); $permissions = $this->getPemissions(); $contextActionMenu = new BASE_CMP_ContextAction(); $contextParentAction = new BASE_ContextAction(); $contextParentAction->setKey('gheaderToolbar'); $contextParentAction->setLabel('<span class="uh-toolbar-add-label">' . $language->text('gheader', 'set_covet_label') . '</span><span class="uh-toolbar-edit-label">' . $language->text('gheader', 'change_covet_label') . '</span>'); $contextParentAction->setId('uh-toolbar-parent'); //$contextParentAction->setClass('ow_ic_picture'); $contextActionMenu->addAction($contextParentAction); if ($permissions['add']) { if (GHEADER_CLASS_PhotoBridge::getInstance()->isActive()) { $contextAction = new BASE_ContextAction(); $contextAction->setParentKey($contextParentAction->getKey()); $contextAction->setLabel($language->text('gheader', 'choose_from_photos_label')); $contextAction->setUrl('javascript://'); $contextAction->setKey('uhChoose'); $contextAction->setId('uhco-choose'); $contextAction->setClass('uhco-item uhco-choose'); $contextAction->setOrder(1); $contextActionMenu->addAction($contextAction); } $contextAction = new BASE_ContextAction(); $contextAction->setParentKey($contextParentAction->getKey()); $contextAction->setLabel('<div class="uh-fake-file"><div>' . $language->text('gheader', 'upload_label') . '</div><input type="file" name="file" id="uh-upload-cover" size="1" /></div>'); $contextAction->setUrl('javascript://'); $contextAction->setKey('uhUpload'); $contextAction->setClass('uhco-item uhco-upload'); $contextAction->setOrder(2); $contextActionMenu->addAction($contextAction); } if ($permissions['reposition']) { $contextAction = new BASE_ContextAction(); $contextAction->setParentKey($contextParentAction->getKey()); $contextAction->setLabel($language->text('gheader', 'reposition_label')); $contextAction->setUrl('javascript://'); $contextAction->setKey('uhReposition'); $contextAction->setId('uhco-reposition'); $contextAction->setClass('uhco-item uhco-reposition'); $contextAction->setOrder(3); $contextActionMenu->addAction($contextAction); } if ($permissions['delete']) { $contextAction = new BASE_ContextAction(); $contextAction->setParentKey($contextParentAction->getKey()); $contextAction->setLabel($language->text('gheader', 'remove_label')); $contextAction->setUrl('javascript://'); $contextAction->setKey('uhRemove'); $contextAction->setId('uhco-remove'); $contextAction->setClass('uhco-item uhco-remove'); $contextAction->setOrder(4); $contextActionMenu->addAction($contextAction); } return $contextActionMenu; }
public function fullInit() { //FULL INIT $this->genericInit(); //OVerwrite require_once $this->getPlugin()->getRootDir() . 'overwrite' . DS . 'components' . DS . 'brief_info.php'; // Bridges GHEADER_CLASS_PhotoBridge::getInstance()->init(); GHEADER_CLASS_NewsfeedBridge::getInstance()->init(); GHEADER_CLASS_NotificationsBridge::getInstance()->init(); GHEADER_CLASS_CommentsBridge::getInstance()->init(); GHEADER_CLASS_CreditsBridge::getInstance()->init(); OW::getEventManager()->bind('admin.add_auth_labels', array($this, 'onAddAuthLabels')); }
public static function validateSettingList($settingList) { parent::validateSettingList($settingList); $validationMessage = OW::getLanguage()->text('gheader', 'widget_height_validation_error', array('min' => self::MIN_HEIGHT, 'max' => self::MAX_HEIGHT)); $settingList['coverHeight'] = intval($settingList['coverHeight']); if ($settingList['coverHeight'] < self::MIN_HEIGHT) { throw new WidgetSettingValidateException($validationMessage, 'coverHeight'); } if ($settingList['coverHeight'] > self::MAX_HEIGHT) { throw new WidgetSettingValidateException($validationMessage, 'coverHeight'); } if (!GHEADER_CLASS_PhotoBridge::getInstance()->isActive()) { return; } $albumName = trim($settingList['albumName']); if ($settingList['saveToPhoto'] && empty($albumName)) { $errorMessage = OW::getLanguage()->text('gheader', 'widget_album_name_validation_error'); throw new WidgetSettingValidateException($errorMessage, 'albumName'); } }
public function loadMorePhotos($query) { $count = 20; $start = $query['offset']; $listFull = false; $userId = OW::getUser()->getId(); $photos = GHEADER_CLASS_PhotoBridge::getInstance()->findUserPhotos($userId, $start, $count); $photoCount = count($photos); $listFull = $photoCount < $count; $list = new GHEADER_CMP_MyPhotoList($photos); return array('listFull' => $listFull, 'list' => $list->render()); }