/** * Format value. * * @access public * @param string $value * @return string * @since 1.0.0-alpha * @version 1.0.0-alpha */ public function format($value) { $sOutput = ''; if ($value instanceof ModelCore\FileBroker) { $oAttributes = Helper\Attributes::factory(); $oField = $this->getField(); /* @var $oField View\ViewField */ $sFieldName = $oField->getName(); $oFile = $value->getFile(); /* @var $oFile \Model\File */ // get file path $sFilePath = $oFile->getFullPath(); // generate HTML $oAttributes->addToAttribute('href', Router::getBase() . '/' . $sFilePath); $sOutput = '<img src="/assets/system/file_icons/' . $oFile->getExt() . '.png" alt="" /> <a ' . $oAttributes->renderAttributes() . '>' . $sFilePath . '</a>'; // remove objects unset($oFileManager); } // return final output return $this->sPrefix . $sOutput . $this->sSuffix; }
/** * Get user image styled by "UserLogo" style. * * @access public * @return string * @since 2.1.2-dev * @version 2.1.2-dev */ public function getImageStyled() { $imgStyles = \Plethora\ImageStyles::factory(); $styled = $imgStyles->useStyle('UserLogo', $this->getImagePath()); return \Plethora\Router::getBase() . '/' . $styled; }
/** * Format value. * * @access public * @param ModelCore\FileBroker $oImageBroker * @return string * @since 1.0.0-alpha * @version 1.0.0-alpha */ public function format($oImageBroker) { $sOutput = ''; if ($oImageBroker instanceof ModelCore\FileBroker && $oImageBroker->getFile() instanceof \Model\File) { $oAttributes = Helper\Attributes::factory(); $oField = $this->getField(); /* @var $oField \Plethora\View\ViewField */ $oFile = $oImageBroker->getFile(); /* @var $oFile \Model\File */ // set proper ALT if (!empty($this->sImageAltPattern)) { $oModel = $oField->getEntity()->getModel(); $aFields = $oModel->getMetadata()->getFieldNames(); if ($oModel->hasLocales()) { $aFields = array_merge($aFields, $oModel->getLocalesMetadata()->getFieldNames()); } $sAlt = $this->sImageAltPattern; foreach ($aFields as $sField) { if (strpos($sAlt, ':' . $sField) !== FALSE) { $sAlt = str_replace(':' . $sField, $oModel->{$sField}, $sAlt); } if (strpos($sAlt, ':') === FALSE) { break; } } $oAttributes->addToAttribute('alt', $sAlt); } // get image path $sFieldName = $oField->getName(); $oFormField = $oField->getEntity()->getModel()->getConfig()->getField($sFieldName); /* @var $oFormField \Plethora\Form\Field\ImageModel */ $sImagePath = $oFile->getFullPath(); if (empty($sImagePath) && $oFormField->getDefaultImage() === NULL) { return NULL; } elseif (empty($sImagePath) && $oFormField->getDefaultImage() !== NULL) { $sImagePath = $oFormField->getDefaultImage(); } // stylize image if (!empty($this->sImageStyle)) { $sImagePath = ImageStyles::useStyle($this->sImageStyle, $sImagePath); } $oAttributes->addToAttribute('src', Router::getBase() . '/' . $sImagePath); $sOutput = '<img ' . $oAttributes->renderAttributes() . ' />'; // if this image should be linked to it's original-sized equivalent if ($this->bLinkToOriginalSize) { $sImagePathOriginal = '/' . $oFormField->getUploadPath(TRUE) . '/' . $oFile->getNameWithExt(); $oAttributes = Helper\Attributes::factory()->setAttributes($this->aLinkAttributes); $sOutput = Helper\Html::a($sImagePathOriginal, $sOutput, $oAttributes); } } // return final output return $this->sPrefix . $sOutput . $this->sSuffix; }
/** * Find active route in particular menu. * * @access private * @param array $routes * @param integer $parentKey * @param array $parent * @since 1.0.0-dev * @version 1.3.0-dev */ private function findActiveRoute(array &$routes, $parentKey = NULL, array $parent = []) { foreach ($routes as $i => &$route) { /* @var $route array */ /* @var $routeName string */ /* @var $routeParams array */ /* @var $activeRoutes array */ if (!isset($route['classes'])) { $route['classes'] = []; } $routeName = Helper\Arrays::get($route, 'route_name', NULL); $url = Helper\Arrays::get($route, 'url', NULL); $routeParams = Helper\Arrays::get($route, 'route_parameters', []); $activeRoutes = Helper\Arrays::get($route, 'active_routes', []); // $path = $url === NULL ? Route::factory($routeName)->path($routeParams) : $url; if ($routeName !== NULL) { $path = Route::factory($routeName)->path($routeParams); } else { $path = $url; } $path = str_replace(Router::getBase(), '', $path); $currentPath = Router::getCurrentUrl(); if (in_array(Router::getCurrentRouteName(), $activeRoutes)) { $route['classes'][] = ['current ' . $this->activeTrailClass]; } if ($parentKey !== NULL) { $route['parent_key'] = $parentKey; $route['parent'] = $parent; } if ($path === $currentPath) { $this->goBackAndSetActive($route); } if (isset($route['children']) && !empty($route['children'])) { $this->findActiveRoute($route['children'], $i, $routes); /* @var $oChildren View */ } } }
<span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <a class="navbar-brand navbar-brand-logo" href="<?php echo Route::factory('home')->url(); ?> " title="<?php echo __('Main page'); ?> "> <img src="<?php echo Router::getBase() . '/' . Theme::getThemePath(); ?> /images/navbar_logo.png" alt="<?php echo \Plethora\Core::getAppName(); ?> " /> </a> <a class="navbar-brand" href="<?php echo Route::factory('home')->url(); ?> " title="<?php echo __('Main page'); ?>
if ($oFileToShow instanceof \Model\File) { ?> <?php $sWholeFileURL = Router::getBase() . '/' . $oFileToShow->getFullPath(); ?> <?php if (file_exists($oFileToShow->getFullPath())) { ?> <p> <a href="<?php echo $sWholeFileURL; ?> " title=""> <img src="<?php echo Router::getBase() . '/' . ImageStyles::useStyle('admin_preview', $oFileToShow->getFullPath()); ?> " alt=""/> </a> </p> <?php } else { ?> <div class="file_doest_not_exists alert alert-danger"><?php echo __('File does not exists (path: ":path").', ['path' => $sWholeFileURL]); ?> </div> <?php } } ?>
?> </label> </div> <?php } ?> <?php if ($oField->isMultilanguage()) { ?> <div class="form-field-langbuttons"> <?php foreach (\Plethora\Router::getLangs() as $sLang) { ?> <?php $imgSrc = \Plethora\Router::getBase() . '/themes/_common/assets/system/languages/' . $sLang . '.jpg'; $imgAlt = __('Language') . ' ' . strtoupper($sLang); $classes = 'multilang_button multilang_button_' . $sLang; if ($sLang == \Plethora\Router::getLang()) { $classes .= ' multilang_checked'; } ?> <img class="<?php echo $classes; ?> " data-lang="<?php echo $sLang; ?> " src="<?php echo $imgSrc; ?>
/* @var $oField \Plethora\Form\Field\FileModel */ /* @var $oCurrentFile \Model\File */ /* @var $oTmpFile \Model\File */ ?> <?php $iCurrentFileID = $oCurrentFile instanceof \Model\File ? $oCurrentFile->getId() : NULL; $iTmpFileID = $oTmpFile instanceof \Model\File ? $oTmpFile->getId() : NULL; $oFileToShow = $oTmpFile instanceof \Model\File ? $oTmpFile : $oCurrentFile; ?> <?php if ($oFileToShow instanceof \Model\File) { ?> <?php $sWholeFileURL = \Plethora\Router::getBase() . '/' . $oFileToShow->getFullPath(); ?> <p> <a href="<?php echo $sWholeFileURL; ?> " title=""><?php echo $sWholeFileURL; ?> </a> </p> <?php } ?> <input value="" <?php