public function render() { $template = parent::initTemplate(dirname(__FILE__) . '/adminMenu.latte'); $identity = $this->presenter->user->identity; $template->userId = $this->userId; $template->name = $this->name; $template->contextMenuSelector = 'structureManagerContextMenuSelector'; $template->optionsContextMenuSelector = 'optionsContextMenuSelector'; $template->treeNodeId = $this->presenter->getParam('id'); $template->actualLangCode = $this->getLanguage(); $template->labelViewGlobal = $this->sessionSection->labelViewGlobal; $template->labelViewLocal = $this->sessionSection->labelViewLocal; //$languageIndex = $this->presenter->context->pageManager->getLanguageCodeIndex(); //$languageCodes[$template->actualLangCode] = $languageIndex[$template->actualLangCode]; // foreach ($this->presenter->context->pageManager->getLanguageCodeIndex() as $code => $langugage) { // //if ($langugage->enabled && $code != $template->actualLangCode) { // if ($langugage->enabled) { // $languageCodes[$code] = $langugage; // } // } $this->presenter->langManagerService->getLangs(); $template->langCodes = $this->presenter->langManagerService->getLangs(); $template->render(); }
public function render() { if (!file_exists(dirname(__FILE__) . '/templates/' . $this->view . '.latte')) { $this->view = "default"; } $template = parent::initTemplate(dirname(__FILE__) . '/templates/' . $this->view . '.latte'); $template->display = $this->displayType ?: 'icons'; $vd = $this->presenter->virtualDriveService; $vd->setPresenter($this->presenter); $template->data = false; if ($this->view == 'default' || empty($this->view)) { $vd->setStorage('file'); $template->data = $vd->getDrive($this->fid); //gets folders and files in current folder $vd->setPathByFolderId($this->fid); } elseif ($this->view == 'galleries' || $this->view == 'addToGallery') { $vd->setStorage('gallery'); $template->galleries = $vd->getGalleries(); $template->files = false; $template->gal = ''; if ($this->gid > 0) { $template->galleries = false; $gal = $vd->getGalleries(array($this->gid)); $template->files = $vd->getGalleryFiles($this->gid); $template->gal = $gal[0]; $template->galThumb = $vd->getGalleryThumbnail($this->gid, 150, 150); } } elseif ($this->view == 'file') { $vd->setPathByFolderId($this->fid); $this->fileInfo = $this->presenter->virtualDriveService->getFileInfo($this->fileId); } $template->fileInfo = $this->fileInfo; $template->thumb = false; $template->gallery = false; $template->galleryConfig = false; if ($this->fileInfo) { if ($this->fileInfo['image']) { $template->thumb = $vd->getImageThumbnail($this->fileInfo['filename'], 190, 190, 'CROP'); if ($this->fileInfo['gallery_id'] > 0) { $gal = $vd->getGalleries(array($this->fileInfo['gallery_id'])); $template->detail = $gal[0]['path'] . '/' . $this->fileInfo['filename']; $template->gallery = $gal[0]; $template->galleryConfig = @unserialize($gal[0]['config']); } else { $template->detail = $vd->getFullPath() . '/' . $this->fileInfo['filename']; } } } $template->folderInfo = $this->folderInfo; $template->tree = $vd->getFolderTree($this->fid); $template->fid = $this->fid; $template->gid = $this->gid; $template->parent = isset($template->data['parent']) ? $template->data['parent'] : false; $template->render(); }