本文整理匯總了PHP中Gallery::getInstance方法的典型用法代碼示例。如果您正苦於以下問題:PHP Gallery::getInstance方法的具體用法?PHP Gallery::getInstance怎麽用?PHP Gallery::getInstance使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Gallery
的用法示例。
在下文中一共展示了Gallery::getInstance方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: __construct
function __construct($folder, $filename)
{
$this->gallery = Gallery::getInstance();
$this->folder = $folder;
$this->filename = $filename;
$this->iptcInfo = new IPTC($this->gallery->getPhotosPath() . DS . $this->folder->getFolderPath() . DS . $this->filename);
}
示例2: __construct
private function __construct()
{
$this->gallery = Gallery::getInstance();
$this->folders = array();
// TODO is that effective? or use another data structure?
$this->photos = array();
}
示例3: __construct
/** @param String $folderPath relative path of folder */
public function __construct($relativeFolderPath)
{
$this->gallery = Gallery::getInstance();
$this->filesystem = Filesystem::getInstance();
$this->relativeFolderPath = $relativeFolderPath;
// TODO make sure it is relative
$this->absoluteFolderPath = $this->gallery->getPhotosPath() . DS . $relativeFolderPath;
}
示例4: validateRequestPath
public static function validateRequestPath()
{
$gallery = Gallery::getInstance();
if (JRequest::getVar('controller') == 'file') {
$fullPath = $gallery->getCachePath();
} else {
$fullPath = $gallery->getPhotosPath();
}
$fullPath .= DS . $gallery->getCurrentRequestPath();
if ($gallery->getCurrentRequestPath() != '' && !(JFolder::exists($fullPath) || JFile::exists($fullPath))) {
JError::raiseError(404, JText::_("Page Not Found"));
exit;
// TODO use return?
}
}
示例5: display
function display($tpl = null)
{
$this->app = JFactory::getApplication();
$this->document = JFactory::getDocument();
$this->pathway = JFactory::getApplication('site')->getPathway();
$this->gallery = Gallery::getInstance();
$this->filesystem = Filesystem::getInstance();
$this->folder = $this->filesystem->getFolder($this->gallery->getCurrentRequestPath());
// get child folders of this folder
$childFolders = $this->folder->getChildFolders();
// get photos of this folder
$photos = $this->folder->getPhotos();
// load js and css files
$this->loadJavaScripts();
$this->loadCSS();
// get title
if ($this->gallery->getCurrentRequestPath() == '') {
$title = 'Gallery';
} else {
$title = $this->folder->getFolderName();
}
// set breadcrumbs and title
$this->setBreadcrumbs();
$this->setTitle();
$this->childFoldersCount = count($childFolders);
$this->photosCount = count($photos);
// add noindex for category pages
if ($this->photosCount == 0) {
$this->document->addCustomTag('<meta name="robots" content="noindex" />');
}
// assign Variables
$this->assignRef('title', $title);
// TODO change to direct assign
$this->assignRef('childFolders', $childFolders);
// TODO change to direct assign
$this->assignRef('photos', $photos);
// TODO change to direct assign
$this->showBacklink = $this->gallery->showBacklink();
$this->useLazyLoading = $this->gallery->shouldUseLazyLoading();
$this->thumbnailSize = $this->gallery->getThumbnailSize();
parent::display($tpl);
}
示例6: display
function display($cachable = false, $urlparams = false)
{
$this->gallery = Gallery::getInstance();
$this->handleFileRequest();
}
示例7: __construct
public function __construct()
{
parent::__construct();
$this->gallery = Gallery::getInstance();
}
示例8: getHtmlForObjectId
public function getHtmlForObjectId(\FrameResponseObject $frameResponseObject)
{
$rawHtml = new \Widgets\RawHtml();
$objectId = $this->id;
if (isset($this->params[1])) {
$from = $this->params[1];
} else {
$from = 0;
}
$steam = $GLOBALS["STEAM"]->get_id();
$currentRoom = \steam_factory::get_object($steam, $objectId);
$this->object = $currentRoom;
$currentRoomPath = $currentRoom->get_path(1);
$currentRoomData = $currentRoom->get_attributes(array(OBJ_NAME, OBJ_DESC), 1);
$steamUser = $GLOBALS["STEAM"]->get_current_steam_user();
$steamUserId = $steamUser->get_id();
//check if user may write in this folder
$writeAllowed = $currentRoom->check_access_write($steamUser, 1);
//get inventory and inventorys attributes if allowed to
$allowed = $currentRoom->check_access_read($steamUser, 1);
$result = $GLOBALS["STEAM"]->buffer_flush();
$writeAllowed = $result[$writeAllowed];
$allowed = $result[$allowed];
$currentRoomPath = $result[$currentRoomPath];
$currentRoomData = $result[$currentRoomData];
$currentRoomDisplayName = str_replace("'s workarea", "", stripslashes($currentRoomData[OBJ_NAME]));
if (isset($currentRoomData[OBJ_DESC]) && $currentRoomData[OBJ_DESC] != "") {
$currentRoomDisplayName = $currentRoomData[OBJ_DESC];
}
$currentRoomDisplayName = str_replace("s workroom.", "", $currentRoomDisplayName);
$numberOfThumbs = 10;
//forces a stable navigation structure
$from -= $from % $numberOfThumbs;
//navigation commands
$picCount = sizeof($currentRoom->get_inventory());
$to = $from + ($numberOfThumbs - 1);
if ($from >= $picCount) {
$from = $picCount - 1 - ($picCount - 1) % $numberOfThumbs;
}
if ($to >= $picCount) {
$to = $picCount - 1;
}
if ($allowed && $currentRoom instanceof \steam_container) {
if ($from >= 0 && $to >= $numberOfThumbs - 1) {
$inventory = $currentRoom->get_inventory_paged($from, $to);
} else {
$inventory = $currentRoom->get_inventory_paged(0, $numberOfThumbs - 1);
}
} else {
$inventory = array();
}
//$contentJS = $this->loadTemplate("overlay.template.js");
//add css
// \Gallery::getInstance()->addCSS();
//add js
// \Gallery::getInstance()->addJS();
//\lms_portal::get_instance()->add_javascript_src("JQuery", PATH_URL . "gallery/js/jquery.min.js");
// \lms_portal::get_instance()->add_javascript_src("JQuery", PATH_URL . "gallery/js/jquery.colorbox.js");
// \lms_portal::get_instance()->add_javascript_src("JQuery", PATH_URL . "gallery/js/colorbox.control.js");
//TODO: overlay.template.js not working - overlay to start gallery missing
//$this->addJS("overlay.template.js");
$tpl = \Gallery::getInstance()->loadTemplate("gallery.template.html");
//$tpl= new \HTML_TEMPLATE_IT();
//$tpl->loadTemplateFile(\Gallery::getInstance()->getExtensionPath()."ui/html/gallery.template.html");
$tpl->setVariable("IMAGEURL", \Gallery::getInstance()->getAssetUrl() . "image/round_green_play_button_4044.jpg");
$tpl->setVariable("FROM", max($from + 1, 1));
$tpl->setVariable("TO", min($to + 1, $picCount));
$tpl->setVariable("PIC_COUNT", $picCount);
$pagemin = $from - $numberOfThumbs;
$pagemin = max($pagemin, 0);
//Navigation
$backlink = "<a href=\"" . PATH_URL . "gallery/index/" . $objectId . "/" . $pagemin . "\" class=\"pagingleft\"><img alt=\"Zurück\" title=\"Zurück\" src=\"" . \Gallery::getInstance()->getAssetUrl() . "/icons/top_seq_prev_on.gif\"></a>";
if ($from == 0) {
$backlink = "<a href=\"\" class=\"pagingleft\"><img alt=\"Zurück\" title=\"Zurück\" src=\"" . \Gallery::getInstance()->getAssetUrl() . "/icons/top_seq_prev_off.gif\"></a>";
$tpl->setVariable("BACKLINK", $backlink);
} else {
$tpl->setVariable("BACKLINK", $backlink);
}
$pagemax = min($to, $picCount - 1);
$forwardlink = "<a href=\"" . PATH_URL . "gallery/index/" . $objectId . "/" . ($pagemax + 1) . "\" class=\"pagingleft\"><img alt=\"Zurück\" title=\"Zurück\" src=\"" . \Gallery::getInstance()->getAssetUrl() . "/icons/top_seq_next_on.gif\"></a>";
if ($to >= $picCount - 1) {
$forwardlink = "<a href=\"\" class=\"pagingright\"><img alt=\"Vor\" title=\"Vor\" src=\"" . \Gallery::getInstance()->getAssetUrl() . "/icons/top_seq_next_off.gif\">";
$tpl->setVariable("FORWARDLINK", $forwardlink);
} else {
$tpl->setVariable("FORWARDLINK", $forwardlink);
}
//Rights
foreach ($inventory as $item) {
$tnr[$item->get_id()] = array();
$tnr[$item->get_id()]["creator"] = $item->get_creator(1);
$tnr[$item->get_id()]["item_write_access"] = $item->check_access_write($GLOBALS["STEAM"]->get_current_steam_user(), 1);
$tnr[$item->get_id()]["item_read_access"] = $item->check_access_read($GLOBALS["STEAM"]->get_current_steam_user(), 1);
}
$result = $GLOBALS["STEAM"]->buffer_flush();
$creators = array();
$itemWriteAccess = array();
$itemReadAccess = array();
foreach ($inventory as $item) {
$creators[$item->get_id()] = $result[$tnr[$item->get_id()]["creator"]];
$itemWriteAccess[$item->get_id()] = $result[$tnr[$item->get_id()]["item_write_access"]];
//.........這裏部分代碼省略.........