From 10b1959390468f5259871d3cb988f4c967e932fe Mon Sep 17 00:00:00 2001 From: flk Date: Mon, 5 Oct 2015 15:40:54 +0300 Subject: [PATCH] =?UTF-8?q?=D0=B2=D0=B5=D1=80=D1=81=D0=B8=D1=8F=201.4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 2 +- Common/AnalogTypes.php | 75 +++--- Common/Paginator.php | 253 +++++++++++------- Common/PaginatorOptions.php | 66 +++-- Common/TecDocApiConfig.php | 16 +- Common/View.php | 118 ++++---- Interfaces/PageInterface.php | 18 +- Pages/Adaptability.php | 50 ++-- Pages/Analogs.php | 50 ++-- Pages/ArticleInfo.php | 50 ++-- Pages/FullInfoModelVariant.php | 80 ++---- Pages/Group.php | 211 ++++++++------- Pages/Index.php | 89 +++--- Pages/ModelVariant.php | 113 ++++---- Pages/Models.php | 175 ++++++------ Pages/Modifications.php | 135 +++++----- README.md | 66 ++++- Router/Router.php | 113 ++++---- View/article.info.tpl | 2 +- View/common/breadcumbs.tpl | 2 +- View/group.details.tpl | 20 +- View/models.tpl | 8 +- __autoload.php | 30 +-- composer.json | 4 +- composer.lock | 15 +- composer.phar | Bin 1053395 -> 1177820 bytes docker-compose.yml | 26 ++ ...breadcumbs_arr.png => breadcrumbs_arr.png} | Bin index.php | 8 + js/jquery.extends.js | 0 30 files changed, 1024 insertions(+), 771 deletions(-) mode change 100644 => 100755 Common/Paginator.php mode change 100644 => 100755 Common/PaginatorOptions.php mode change 100644 => 100755 Pages/FullInfoModelVariant.php mode change 100644 => 100755 View/common/breadcumbs.tpl create mode 100755 docker-compose.yml rename images/{breadcumbs_arr.png => breadcrumbs_arr.png} (100%) mode change 100644 => 100755 mode change 100644 => 100755 js/jquery.extends.js diff --git a/.gitignore b/.gitignore index 0775b2c..9d852e4 100755 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ tmp/smarty/* vendor .idea -vde \ No newline at end of file +dev/* \ No newline at end of file diff --git a/Common/AnalogTypes.php b/Common/AnalogTypes.php index 2d13526..199dc3e 100755 --- a/Common/AnalogTypes.php +++ b/Common/AnalogTypes.php @@ -1,38 +1,45 @@ options = isset($options) ? $options : new PaginatorOptions(); - } - - public function __destruct() { - unset($this->options); - unset($this->displayedPages); - } - - public function deploy() { - $this->make(); - - $page = ''; - if (self::ONE_PAGE < $this->getPagesCount()) { - $options = $this->getOptions(); - $url = is_null($options->url) ? $_SERVER['REQUEST_URI'] : $options->url; - $parsedUrl = parse_url($url); - parse_str($parsedUrl['query'], $urlQueryArray); - unset($urlQueryArray[$options->argName]); - $newUrlData = array(); - foreach ($urlQueryArray as $k => $oneUrlQueryItem) { - $newUrlData[] = "$k=$oneUrlQueryItem"; - } - $url = $newUrlData ? '?' . implode('&', $newUrlData) : ''; - $dataTemplate = array( - 'displayedPages' => $this->getDisplayedPages(), - 'options' => $options, - 'argName' => $options->argName, - 'url' => $url, - 'currentPage' => $this->getCurrentPage(), - 'pagesCount' => $this->getPagesCount() - ); - $page = View::deploy($options->template, $dataTemplate); - } - return $page; - } - - final protected function make() { - $options = $this->getOptions(); - - $startRecord = abs((int) $options->startRecord); - $maxRecords = ceil(($options->totalRecords - $options->recordsPageCount) / $options->recordsPageCount) * $options->recordsPageCount; - if ($startRecord > $maxRecords) { - $startRecord = $maxRecords; - } - $this->currentPage = floor($startRecord / $options->recordsPageCount) + 1; - $this->pagesCount = floor($maxRecords / $options->recordsPageCount) + 1; - - $leftEdgePage = $this->currentPage - floor($options->displayedPagesCount / 2); - if ($leftEdgePage <= 1) { - $leftEdgePage = 1; - } - - $rightEdgePage = $leftEdgePage + $options->displayedPagesCount - 1; - if ($rightEdgePage >= $this->pagesCount) { - $rightEdgePage = $this->pagesCount; - } - - if (($rightEdgePage - $leftEdgePage) < $options->displayedPagesCount) { - $leftEdgePage = $rightEdgePage - $options->displayedPagesCount + 1; - if ($leftEdgePage <= 1) { - $leftEdgePage = 1; - } - } - - for ($number = $leftEdgePage; $number <= $rightEdgePage; $number++) { - $this->displayedPages[$number] = ($number - 1) * $options->recordsPageCount; - } - } - - final protected function getOptions() { - return $this->options; - } - - final protected function getDisplayedPages() { - return $this->displayedPages; - } - - final protected function getCurrentPage() { - return $this->currentPage; - } - - final protected function getPagesCount() { - return $this->pagesCount; - } +class Paginator +{ + /** + * Одна страница + */ + const ONE_PAGE = 1; + /** + * Настройки пагинатора + * + * @var PaginatorOptions|null + */ + private $options = null; + /** + * Отображаемые страницы + * + * @var array + */ + private $displayedPages = array(); + /** + * Текущая страница + * + * @var int + */ + private $currentPage = 0; + /** + * Количество страниц + * + * @var int + */ + private $pagesCount = 0; + + /** + * Конструктор класса + * + * @param PaginatorOptions|null $options + */ + public function __construct(PaginatorOptions $options = null) + { + $this->options = isset($options) ? $options : new PaginatorOptions(); + } + + /** + * Деструктор класса + */ + public function __destruct() + { + unset($this->options); + unset($this->displayedPages); + } + + /** + * Возвращает интерфейс пагинатора в виде html + * + * @return string + */ + public function deploy() + { + $this->make(); + $page = ''; + if (self::ONE_PAGE < $this->getPagesCount()) { + $options = $this->getOptions(); + $url = is_null($options->url) ? $_SERVER['REQUEST_URI'] : $options->url; + $parsedUrl = parse_url($url); + parse_str($parsedUrl['query'], $urlQueryArray); + unset($urlQueryArray[$options->argName]); + $newUrlData = array(); + foreach ($urlQueryArray as $k => $oneUrlQueryItem) { + $newUrlData[] = "$k=$oneUrlQueryItem"; + } + $url = $newUrlData ? '?' . implode('&', $newUrlData) : ''; + $dataTemplate = array( + 'displayedPages' => $this->getDisplayedPages(), + 'options' => $options, + 'argName' => $options->argName, + 'url' => $url, + 'currentPage' => $this->getCurrentPage(), + 'pagesCount' => $this->getPagesCount() + ); + $page = View::deploy($options->template, $dataTemplate); + } + return $page; + } + + /** + * Инициализация опций + */ + final protected function make() + { + $options = $this->getOptions(); + $startRecord = abs((int)$options->startRecord); + $maxRecords = ceil(($options->totalRecords - $options->recordsPageCount) / $options->recordsPageCount) * $options->recordsPageCount; + if ($startRecord > $maxRecords) { + $startRecord = $maxRecords; + } + $this->currentPage = floor($startRecord / $options->recordsPageCount) + 1; + $this->pagesCount = floor($maxRecords / $options->recordsPageCount) + 1; + $leftEdgePage = $this->currentPage - floor($options->displayedPagesCount / 2); + if ($leftEdgePage <= 1) { + $leftEdgePage = 1; + } + $rightEdgePage = $leftEdgePage + $options->displayedPagesCount - 1; + if ($rightEdgePage >= $this->pagesCount) { + $rightEdgePage = $this->pagesCount; + } + if (($rightEdgePage - $leftEdgePage) < $options->displayedPagesCount) { + $leftEdgePage = $rightEdgePage - $options->displayedPagesCount + 1; + if ($leftEdgePage <= 1) { + $leftEdgePage = 1; + } + } + for ($number = $leftEdgePage; $number <= $rightEdgePage; $number++) { + $this->displayedPages[$number] = ($number - 1) * $options->recordsPageCount; + } + } + + /** + * Вовращает опции для инициализации пагинатора + * + * @return PaginatorOptions|null + */ + final protected function getOptions() + { + return $this->options; + } + + /** + * Возвращает количество страниц + * + * @return int + */ + final protected function getPagesCount() + { + return $this->pagesCount; + } + + /** + * Возвращает отображаемые страницы + * + * @return array + */ + final protected function getDisplayedPages() + { + return $this->displayedPages; + } + + /** + * Возвращает текущую страницу + * + * @return int + */ + final protected function getCurrentPage() + { + return $this->currentPage; + } } \ No newline at end of file diff --git a/Common/PaginatorOptions.php b/Common/PaginatorOptions.php old mode 100644 new mode 100755 index 992a918..04506d6 --- a/Common/PaginatorOptions.php +++ b/Common/PaginatorOptions.php @@ -1,22 +1,54 @@ setTemplateDir(__DIR__ . '/../View/'); - self::$smarty->setCompileDir($compiledPath); - self::$smarty->setCacheDir($cachedPath); - } - return self::$smarty; - } + /** + * Возвращает результат компиляции шаблона + * + * @param string $templateName + * @param array $templateData + * @return string + */ + public static function deploy($templateName, $templateData = array()) + { + $smarty = self::getSmarty(); + $smarty->assign("data", $templateData); + return self::$smarty->fetch($templateName); + } - /** - * Возвращает результат компиляции шаблона. - * - * @param string $templateName - * @param array $templateData - * @return string - */ - public static function deploy($templateName, $templateData = array()) { - $smarty = self::getSmarty(); - $smarty->assign("data", $templateData); - return self::$smarty->fetch($templateName); - } + /** + * Возращает экземпляр \Smarty использует синглтон + * + * @return \Smarty + */ + public static function getSmarty() + { + if (self::$smarty === null) { + self::$smarty = new \Smarty(); + list($compiledPath, $cachedPath) = self::getSmartyDirectories(); + self::$smarty->setTemplateDir(__DIR__ . '/../View/'); + self::$smarty->setCompileDir($compiledPath); + self::$smarty->setCacheDir($cachedPath); + } + return self::$smarty; + } - /** - * Возвращает массив с директориями для smarty - * - * @return string[] - */ - private static function getSmartyDirectories() { - $tempPath = __DIR__ . '/../tmp/smarty'; - if (!file_exists($tempPath)) { - mkdir($tempPath, 0777, TRUE); - } + /** + * Возвращает массив с директориями для smarty + * + * @return string[] + */ + private static function getSmartyDirectories() + { + $tempPath = __DIR__ . '/../tmp/smarty'; + if (!file_exists($tempPath)) { + mkdir($tempPath, 0777, true); + } - $compiledPath = $tempPath . '/compiled'; - if (!file_exists($compiledPath)) { - mkdir($compiledPath, 0777, TRUE); - } + $compiledPath = $tempPath . '/compiled'; + if (!file_exists($compiledPath)) { + mkdir($compiledPath, 0777, true); + } - $cachedPath = $tempPath . '/cached'; - if (!file_exists($cachedPath)) { - mkdir($cachedPath, 0777, TRUE); - } - return array($compiledPath, $cachedPath); - } -} \ No newline at end of file + $cachedPath = $tempPath . '/cached'; + if (!file_exists($cachedPath)) { + mkdir($cachedPath, 0777, true); + } + return array($compiledPath, $cachedPath); + } +} \ No newline at end of file diff --git a/Interfaces/PageInterface.php b/Interfaces/PageInterface.php index 2f9bd0f..04869a5 100755 --- a/Interfaces/PageInterface.php +++ b/Interfaces/PageInterface.php @@ -1,6 +1,18 @@ setUserKey(TecDocApiConfig::USER_KEY) - ->setUserLogin(TecDocApiConfig::USER_LOGIN) - ->setUserPsw(TecDocApiConfig::USER_PSW); - $articleId = $_GET['articleId']; - $adaptability = $tecDocRestClient->getAdaptability($articleId); - $contentTemplateData = array( - 'adaptability' => $adaptability - ); - $content = View::deploy('adaptability.tpl', $contentTemplateData); - $templateData = array('content' => $content); - return View::deploy('index.tpl', $templateData); - } -} \ No newline at end of file +/** + * Обеспечивает отображение страницы с применимостями + * + * Class Adaptability + * @package NS\TecDocSite\Pages + */ +class Adaptability implements PageInterface +{ + /** + * Возвращает html страницы с приминимостями + * + * @return string + */ + public function getHtml() + { + $tecDocRestClient = new TecDoc(); + $tecDocRestClient->setUserKey(TecDocApiConfig::USER_KEY) + ->setUserLogin(TecDocApiConfig::USER_LOGIN) + ->setUserPsw(TecDocApiConfig::USER_PSW); + $articleId = $_GET['articleId']; + $adaptability = $tecDocRestClient->getAdaptability($articleId); + $contentTemplateData = array( + 'adaptability' => $adaptability + ); + $content = View::deploy('adaptability.tpl', $contentTemplateData); + $templateData = array('content' => $content); + return View::deploy('index.tpl', $templateData); + } +} \ No newline at end of file diff --git a/Pages/Analogs.php b/Pages/Analogs.php index 0fd9f38..8f39b3a 100755 --- a/Pages/Analogs.php +++ b/Pages/Analogs.php @@ -7,24 +7,32 @@ use NS\TecDocSite\Common\View; use NS\TecDocSite\Interfaces\PageInterface; -class Analogs implements PageInterface { - /** - * Возвращает html страницы с аналогами. - * - * @return string - */ - public function getHtml() { - $tecDocRestClient = new TecDoc(); - $tecDocRestClient->setUserKey(TecDocApiConfig::USER_KEY) - ->setUserLogin(TecDocApiConfig::USER_LOGIN) - ->setUserPsw(TecDocApiConfig::USER_PSW); - $number = $_GET['number']; - $analogs = $tecDocRestClient->getAnalogs($number, AnalogTypes::ANY); - $contentTemplateData = array( - 'analogs' => $analogs - ); - $content = View::deploy('analogs.tpl', $contentTemplateData); - $templateData = array('content' => $content); - return View::deploy('index.tpl', $templateData); - } -} \ No newline at end of file +/** + * Обеспечивает отображение страницы с аналогами + * + * Class Analogs + * @package NS\TecDocSite\Pages + */ +class Analogs implements PageInterface +{ + /** + * Возвращает html страницы с аналогами + * + * @return string + */ + public function getHtml() + { + $tecDocRestClient = new TecDoc(); + $tecDocRestClient->setUserKey(TecDocApiConfig::USER_KEY) + ->setUserLogin(TecDocApiConfig::USER_LOGIN) + ->setUserPsw(TecDocApiConfig::USER_PSW); + $number = $_GET['number']; + $analogs = $tecDocRestClient->getAnalogs($number, AnalogTypes::ANY); + $contentTemplateData = array( + 'analogs' => $analogs + ); + $content = View::deploy('analogs.tpl', $contentTemplateData); + $templateData = array('content' => $content); + return View::deploy('index.tpl', $templateData); + } +} \ No newline at end of file diff --git a/Pages/ArticleInfo.php b/Pages/ArticleInfo.php index 6444f5a..e06493a 100755 --- a/Pages/ArticleInfo.php +++ b/Pages/ArticleInfo.php @@ -6,24 +6,32 @@ use NS\TecDocSite\Common\View; use NS\TecDocSite\Interfaces\PageInterface; -class ArticleInfo implements PageInterface { - /** - * Возвращает html страницы с информацией о детали. - * - * @return string - */ - public function getHtml() { - $tecDocRestClient = new TecDoc(); - $tecDocRestClient->setUserKey(TecDocApiConfig::USER_KEY) - ->setUserLogin(TecDocApiConfig::USER_LOGIN) - ->setUserPsw(TecDocApiConfig::USER_PSW); - $articleId = $_GET['articleId']; - $article = $tecDocRestClient->getArticle($articleId); - $contentTemplateData = array( - 'articleInfo' => $article - ); - $content = View::deploy('article.info.tpl', $contentTemplateData); - $templateData = array('content' => $content); - return View::deploy('index.tpl', $templateData); - } -} \ No newline at end of file +/** + * Обеспечивает отображение страницы с информацией о детали + * + * Class ArticleInfo + * @package NS\TecDocSite\Pages + */ +class ArticleInfo implements PageInterface +{ + /** + * Возвращает html страницы с информацией о детали + * + * @return string + */ + public function getHtml() + { + $tecDocRestClient = new TecDoc(); + $tecDocRestClient->setUserKey(TecDocApiConfig::USER_KEY) + ->setUserLogin(TecDocApiConfig::USER_LOGIN) + ->setUserPsw(TecDocApiConfig::USER_PSW); + $articleId = $_GET['articleId']; + $article = $tecDocRestClient->getArticle($articleId); + $contentTemplateData = array( + 'articleInfo' => $article + ); + $content = View::deploy('article.info.tpl', $contentTemplateData); + $templateData = array('content' => $content); + return View::deploy('index.tpl', $templateData); + } +} \ No newline at end of file diff --git a/Pages/FullInfoModelVariant.php b/Pages/FullInfoModelVariant.php old mode 100644 new mode 100755 index 301135c..5f9c195 --- a/Pages/FullInfoModelVariant.php +++ b/Pages/FullInfoModelVariant.php @@ -3,57 +3,35 @@ use NS\ABCPApi\RestApiClients\TecDoc; use NS\TecDocSite\Common\TecDocApiConfig; -use NS\TecDocSite\Interfaces\PageInterface; use NS\TecDocSite\Common\View; +use NS\TecDocSite\Interfaces\PageInterface; - - -class FullInfoModelVariant implements PageInterface { - /** - * Возвращает html страницы с модификациями. - * - * @return string - */ - public function getHtml() { - $tecDocRestClient = new TecDoc(); - $tecDocRestClient->setUserKey(TecDocApiConfig::USER_KEY) - ->setUserLogin(TecDocApiConfig::USER_LOGIN) - ->setUserPsw(TecDocApiConfig::USER_PSW); - $modelId = $_GET['modelVariant']; - $modification = $tecDocRestClient->getModificationById($modelId); - $contentTemplateData = array( - 'modification' => $modification - ); - $content = View::deploy('full.info.model.variant.tpl', $contentTemplateData); - $templateData = array('content' => $content); - return View::deploy('index.tpl', $templateData); - } - - /** - * Возвращает html код с хлебными крошками. - * - * @return string - */ - private static function getBreadcrumbs() { - $tecDocRestClient = new TecDoc(); - $tecDocRestClient->setUserKey(TecDocApiConfig::USER_KEY) - ->setUserLogin(TecDocApiConfig::USER_LOGIN) - ->setUserPsw(TecDocApiConfig::USER_PSW); - $breadcrumbs = array(); - $manufacturerId = $_GET['man']; - $manufacturers = $tecDocRestClient->getManufacturers(); - if (is_array($manufacturers)) { - foreach ($manufacturers as $oneManufacturer) { - if ($oneManufacturer->id == $manufacturerId) { - $breadcrumbs[] = array( - 'name' => $oneManufacturer->name - ); - } - } - } - $templateData = array( - 'breadcrumbs' => $breadcrumbs - ); - return View::deploy('common/breadcumbs.tpl', $templateData); - } +/** + * Обеспечивает отображение страницы с модификациями + * + * Class FullInfoModelVariant + * @package NS\TecDocSite\Pages + */ +class FullInfoModelVariant implements PageInterface +{ + /** + * Возвращает html страницы с модификациями + * + * @return string + */ + public function getHtml() + { + $tecDocRestClient = new TecDoc(); + $tecDocRestClient->setUserKey(TecDocApiConfig::USER_KEY) + ->setUserLogin(TecDocApiConfig::USER_LOGIN) + ->setUserPsw(TecDocApiConfig::USER_PSW); + $modelId = $_GET['modelVariant']; + $modification = $tecDocRestClient->getModificationById($modelId); + $contentTemplateData = array( + 'modification' => $modification + ); + $content = View::deploy('full.info.model.variant.tpl', $contentTemplateData); + $templateData = array('content' => $content); + return View::deploy('index.tpl', $templateData); + } } \ No newline at end of file diff --git a/Pages/Group.php b/Pages/Group.php index 2dd6ae6..3b85632 100755 --- a/Pages/Group.php +++ b/Pages/Group.php @@ -9,110 +9,119 @@ use NS\TecDocSite\Common\View; use NS\TecDocSite\Interfaces\PageInterface; -class Group implements PageInterface { - /** - * Варианты отображения единиц на страницу. - * - * @var int[] - */ - private $itemsPerPage = array(20, 40, 100); +/** + * Обеспечивает отображение страницы с отображением дерева категорий для модификаций + * + * Class Group + * @package NS\TecDocSite\Pages + */ +class Group implements PageInterface +{ + /** + * Варианты отображения единиц на страницу + * + * @var int[] + */ + private $itemsPerPage = array(20, 40, 100); - /** - * Дефолтный вид отображения плитка - */ - const DEFAULT_VIEW_MODE = 'tile'; + /** + * Дефолтный вид отображения плитка + */ + const DEFAULT_VIEW_MODE = 'tile'; - /** - * Возвращает html дерева категорий для модификации. - * - * @return string - */ - public function getHtml() { - $tecDocRestClient = new TecDoc(); - $tecDocRestClient->setUserKey(TecDocApiConfig::USER_KEY) - ->setUserLogin(TecDocApiConfig::USER_LOGIN) - ->setUserPsw(TecDocApiConfig::USER_PSW); - $modificationId = $_GET['modelVariant']; - $categoryId = $_GET['group']; - $articles = $tecDocRestClient->getArticles($modificationId, $categoryId); - $viewMode = isset($_GET['viewMode']) ? $_GET['viewMode'] : self::DEFAULT_VIEW_MODE; - $itemsPerPage = isset($_GET['itemsPerPage']) && in_array($_GET['itemsPerPage'], $this->itemsPerPage, TRUE) ? $_GET['itemsPerPage'] : current($this->itemsPerPage); - $totalArticles = count($articles); - $start = isset($_GET['start']) && is_numeric($_GET['start']) && $_GET['start'] < $totalArticles && $_GET['start'] > 0 ? $_GET['start'] : 0; - $articles = array_slice($articles, $start, $itemsPerPage); - $baseUrlArray = array( - 'man' => $_GET['man'], - 'model' => $_GET['model'], - 'modelVariant' => $_GET['modelVariant'], - 'group' => $_GET['group'] - ); - $baseUrl = http_build_query($baseUrlArray); - $paginatorOption = new PaginatorOptions(); - $paginatorOption->startRecord = $start; - $paginatorOption->recordsPageCount = $itemsPerPage; - $paginatorOption->totalRecords = $totalArticles; - $paginator = new Paginator($paginatorOption); - $contentTemplateData = array( - 'breadcrumbs' => self::getBreadcrumbs(), - 'itemsPerPareValues' => $this->itemsPerPage, - 'selectedItemsPerPage' => $itemsPerPage, - 'baseUrl' => $baseUrl, - 'viewMode' => $viewMode, - 'itemsPerPage' => $itemsPerPage, - 'start' => $start, - 'paginator' => isset($paginator) ? $paginator->deploy() : '', - 'articles' => $articles - ); - $content = View::deploy('group.details.tpl', $contentTemplateData); - $templateData = array('content' => $content); + /** + * Возвращает html дерева категорий для модификации + * + * @return string + */ + public function getHtml() + { + $tecDocRestClient = new TecDoc(); + $tecDocRestClient->setUserKey(TecDocApiConfig::USER_KEY) + ->setUserLogin(TecDocApiConfig::USER_LOGIN) + ->setUserPsw(TecDocApiConfig::USER_PSW); + $modificationId = $_GET['modelVariant']; + $categoryId = $_GET['group']; + $articles = $tecDocRestClient->getArticleSimplified($modificationId, $categoryId); + $viewMode = isset($_GET['viewMode']) ? $_GET['viewMode'] : self::DEFAULT_VIEW_MODE; + $itemsPerPage = isset($_GET['itemsPerPage']) && in_array((int)$_GET['itemsPerPage'], $this->itemsPerPage, + true) ? (int)$_GET['itemsPerPage'] : current($this->itemsPerPage); + $totalArticles = count($articles); + $start = isset($_GET['start']) && is_numeric($_GET['start']) && $_GET['start'] < $totalArticles && $_GET['start'] > 0 && $_GET['itemsPerPage'] < $totalArticles ? $_GET['start'] : 0; + $articles = array_slice($articles, $start, $itemsPerPage); + $baseUrlArray = array( + 'man' => $_GET['man'], + 'model' => $_GET['model'], + 'modelVariant' => $_GET['modelVariant'], + 'group' => $_GET['group'] + ); + $baseUrl = http_build_query($baseUrlArray); + $paginatorOption = new PaginatorOptions(); + $paginatorOption->startRecord = $start; + $paginatorOption->recordsPageCount = $itemsPerPage; + $paginatorOption->totalRecords = $totalArticles; + $paginator = new Paginator($paginatorOption); + $contentTemplateData = array( + 'breadcrumbs' => self::getBreadcrumbs(), + 'itemsPerPageValues' => $this->itemsPerPage, + 'selectedItemsPerPage' => $itemsPerPage, + 'baseUrl' => $baseUrl, + 'viewMode' => $viewMode, + 'start' => $start, + 'paginator' => isset($paginator) ? $paginator->deploy() : '', + 'articles' => $articles + ); + $content = View::deploy('group.details.tpl', $contentTemplateData); + $templateData = array('content' => $content); - return View::deploy('index.tpl', $templateData); - } + return View::deploy('index.tpl', $templateData); + } - /** - * Возвращает html код с хлебными крошками. - * - * @return string - */ - private static function getBreadcrumbs() { - $tecDocRestClient = new TecDoc(); - $tecDocRestClient->setUserKey(TecDocApiConfig::USER_KEY) - ->setUserLogin(TecDocApiConfig::USER_LOGIN) - ->setUserPsw(TecDocApiConfig::USER_PSW); - $modificationId = (int)$_GET['modelVariant']; - $selectedGroupId = (int)$_GET['group']; - $modification = $tecDocRestClient->getModificationById($modificationId); - $modelVariants = $tecDocRestClient->getModelVariant($modificationId); - $modelVariant = new ModelVariant(); - if (is_array($modelVariants)) { - foreach ($modelVariants as $oneModelVariant) { - if ($oneModelVariant->id === $selectedGroupId) { - $modelVariant = $oneModelVariant; - break; - } - } - } - $breadcrumbs = array( - array( - 'name' => $modification->manufacturerName, - 'url' => "?man={$modification->manufacturerId}" - ), - array( - 'name' => $modification->modelName, - 'url' => "?man={$modification->manufacturerId}&model={$modification->modelId}" - ), - array( - 'name' => $modification->typeName, - 'url' => "?man={$modification->manufacturerId}&model={$modification->modelId}&modelVariant={$modification->id}" - ), - array( - 'name' => $modelVariant->name - ) - ); - $templateData = array( - 'breadcrumbs' => $breadcrumbs - ); + /** + * Возвращает html код с хлебными крошками + * + * @return string + */ + private static function getBreadcrumbs() + { + $tecDocRestClient = new TecDoc(); + $tecDocRestClient->setUserKey(TecDocApiConfig::USER_KEY) + ->setUserLogin(TecDocApiConfig::USER_LOGIN) + ->setUserPsw(TecDocApiConfig::USER_PSW); + $modificationId = (int)$_GET['modelVariant']; + $selectedGroupId = (int)$_GET['group']; + $modification = $tecDocRestClient->getModificationById($modificationId); + $modelVariants = $tecDocRestClient->getModelVariant($modificationId); + $modelVariant = new ModelVariant(); + if (is_array($modelVariants)) { + foreach ($modelVariants as $oneModelVariant) { + if ($oneModelVariant->id === $selectedGroupId) { + $modelVariant = $oneModelVariant; + break; + } + } + } + $breadcrumbs = array( + array( + 'name' => $modification->manufacturerName, + 'url' => "?man={$modification->manufacturerId}" + ), + array( + 'name' => $modification->modelName, + 'url' => "?man={$modification->manufacturerId}&model={$modification->modelId}" + ), + array( + 'name' => $modification->name, + 'url' => "?man={$modification->manufacturerId}&model={$modification->modelId}&modelVariant={$modification->id}" + ), + array( + 'name' => $modelVariant->name + ) + ); + $templateData = array( + 'breadcrumbs' => $breadcrumbs + ); - return View::deploy('common/breadcumbs.tpl', $templateData); - } + return View::deploy('common/breadcumbs.tpl', $templateData); + } } \ No newline at end of file diff --git a/Pages/Index.php b/Pages/Index.php index f198dd4..6fa0e7e 100755 --- a/Pages/Index.php +++ b/Pages/Index.php @@ -7,48 +7,53 @@ use NS\TecDocSite\Interfaces\PageInterface; /** - * Главная страница. Выводится по умолчанию. + * Главная страница + * + * Class Index + * @package NS\TecDocSite\Pages */ -class Index implements PageInterface { +class Index implements PageInterface +{ + /** + * Возвращает html страницы + * + * @return string + */ + public function getHtml() + { + $tecDocRestClient = new TecDoc(); + $tecDocRestClient->setUserKey(TecDocApiConfig::USER_KEY) + ->setUserLogin(TecDocApiConfig::USER_LOGIN) + ->setUserPsw(TecDocApiConfig::USER_PSW); + $carType = isset($_GET['carType']) ? $_GET['carType'] : 0; + $selectedLetter = !empty($_GET['letter']) ? $_GET['letter'] : ''; + $manufacturers = $tecDocRestClient->getManufacturers($carType); + $manufacturersTemplateData = array(); + foreach ($manufacturers as $oneManufacturer) { + $firstLetter = substr($oneManufacturer->name, 0, 1); + $manufacturersTemplateData[$firstLetter][] = $oneManufacturer; + } + $contentTemplateData = array( + 'manufacturers' => $manufacturersTemplateData, + 'carType' => $carType, + 'breadcrumbs' => self::getBreadcrumbs(), + 'selectedLetter' => $selectedLetter + ); + $content = View::deploy('manufacturers.tpl', $contentTemplateData); + $templateData = array('content' => $content); + return View::deploy('index.tpl', $templateData); + } - /** - * Возвращает html страницы. - * - * @return string - */ - public function getHtml() { - $tecDocRestClient = new TecDoc(); - $tecDocRestClient->setUserKey(TecDocApiConfig::USER_KEY) - ->setUserLogin(TecDocApiConfig::USER_LOGIN) - ->setUserPsw(TecDocApiConfig::USER_PSW); - $carType = isset($_GET['carType']) ? $_GET['carType'] : 0; - $selectedLetter = !empty($_GET['letter']) ? $_GET['letter'] : ''; - $manufacturers = $tecDocRestClient->getManufacturers($carType); - $manufacturersTemplateData = array(); - foreach ($manufacturers as $oneManufacturer) { - $firstLetter = substr($oneManufacturer->name, 0, 1); - $manufacturersTemplateData[$firstLetter][] = $oneManufacturer; - } - $contentTemplateData = array( - 'manufacturers' => $manufacturersTemplateData, - 'carType' => $carType, - 'breadcrumbs' => self::getBreadcrumbs(), - 'selectedLetter' => $selectedLetter - ); - $content = View::deploy('manufacturers.tpl', $contentTemplateData); - $templateData = array('content' => $content); - return View::deploy('index.tpl', $templateData); - } - - /** - * Возвращает html код с хлебными крошками. - * - * @return string - */ - private static function getBreadcrumbs() { - $templateData = array( - 'breadcrumbs' => array() - ); - return View::deploy('common/breadcumbs.tpl', $templateData); - } + /** + * Возвращает html код с хлебными крошками + * + * @return string + */ + private static function getBreadcrumbs() + { + $templateData = array( + 'breadcrumbs' => array() + ); + return View::deploy('common/breadcumbs.tpl', $templateData); + } } \ No newline at end of file diff --git a/Pages/ModelVariant.php b/Pages/ModelVariant.php index f45869e..240cbc9 100755 --- a/Pages/ModelVariant.php +++ b/Pages/ModelVariant.php @@ -6,57 +6,66 @@ use NS\TecDocSite\Common\View; use NS\TecDocSite\Interfaces\PageInterface; -class ModelVariant implements PageInterface { - /** - * Возвращает html список деталей для выбранной категории. - * - * @return string - */ - public function getHtml() { - $tecDocRestClient = new TecDoc(); - $tecDocRestClient->setUserKey(TecDocApiConfig::USER_KEY) - ->setUserLogin(TecDocApiConfig::USER_LOGIN) - ->setUserPsw(TecDocApiConfig::USER_PSW); - $modificationId = $_GET['modelVariant']; - $tree = $tecDocRestClient->getModelVariant($modificationId); - $contentTemplateData = array( - 'tree' => $tree, - 'breadcrumbs' => self::getBreadcrumbs(), - 'url' => "/?man={$_REQUEST['man']}&model={$_REQUEST['model']}&modelVariant={$_REQUEST['modelVariant']}&group=" - ); - $content = View::deploy('tree.tpl', $contentTemplateData); - $templateData = array('content' => $content); - return View::deploy('index.tpl', $templateData); - } +/** + * Обеспечивает отображение страницы со списком деталей для выбранной категории + * + * Class ModelVariant + * @package NS\TecDocSite\Pages + */ +class ModelVariant implements PageInterface +{ + /** + * Возвращает html список деталей для выбранной категории + * + * @return string + */ + public function getHtml() + { + $tecDocRestClient = new TecDoc(); + $tecDocRestClient->setUserKey(TecDocApiConfig::USER_KEY) + ->setUserLogin(TecDocApiConfig::USER_LOGIN) + ->setUserPsw(TecDocApiConfig::USER_PSW); + $modificationId = $_GET['modelVariant']; + $tree = $tecDocRestClient->getModelVariant($modificationId); + $contentTemplateData = array( + 'tree' => $tree, + 'breadcrumbs' => self::getBreadcrumbs(), + 'url' => "/?man={$_REQUEST['man']}&model={$_REQUEST['model']}&modelVariant={$_REQUEST['modelVariant']}&group=" + ); + $content = View::deploy('tree.tpl', $contentTemplateData); + $templateData = array('content' => $content); + return View::deploy('index.tpl', $templateData); + } - /** - * Возвращает html код с хлебными крошками. - * - * @return string - */ - private static function getBreadcrumbs() { - $tecDocRestClient = new TecDoc(); - $tecDocRestClient->setUserKey(TecDocApiConfig::USER_KEY) - ->setUserLogin(TecDocApiConfig::USER_LOGIN) - ->setUserPsw(TecDocApiConfig::USER_PSW); - $modificationId = (int)$_GET['modelVariant']; - $modification = $tecDocRestClient->getModificationById($modificationId); - $breadcrumbs = array( - array( - 'name' => $modification->manufacturerName, - 'url' => "?man={$modification->manufacturerId}" - ), - array( - 'name' => $modification->modelName, - 'url' => "?man={$modification->manufacturerId}&model={$modification->modelId}" - ), - array( - 'name' => $modification->typeName - ) - ); - $templateData = array( - 'breadcrumbs' => $breadcrumbs - ); - return View::deploy('common/breadcumbs.tpl', $templateData); - } + /** + * Возвращает html код с хлебными крошками + * + * @return string + */ + private static function getBreadcrumbs() + { + $tecDocRestClient = new TecDoc(); + $tecDocRestClient->setUserKey(TecDocApiConfig::USER_KEY) + ->setUserLogin(TecDocApiConfig::USER_LOGIN) + ->setUserPsw(TecDocApiConfig::USER_PSW); + $modificationId = (int)$_GET['modelVariant']; + $modification = $tecDocRestClient->getModificationById($modificationId); + $breadcrumbs = array( + array( + 'name' => $modification->manufacturerName, + 'url' => "?man={$modification->manufacturerId}" + ), + array( + 'name' => $modification->modelName, + 'url' => "?man={$modification->manufacturerId}&model={$modification->modelId}" + ), + array( + 'name' => $modification->name + ) + ); + $templateData = array( + 'breadcrumbs' => $breadcrumbs + ); + return View::deploy('common/breadcumbs.tpl', $templateData); + } } \ No newline at end of file diff --git a/Pages/Models.php b/Pages/Models.php index 0faea12..0325881 100755 --- a/Pages/Models.php +++ b/Pages/Models.php @@ -6,91 +6,100 @@ use NS\TecDocSite\Common\View; use NS\TecDocSite\Interfaces\PageInterface; -class Models implements PageInterface { - /** - * Возвращает html страницы с моделями. - * - * @return string - */ - public function getHtml() { - $tecDocRestClient = new TecDoc(); - $tecDocRestClient->setUserKey(TecDocApiConfig::USER_KEY) - ->setUserLogin(TecDocApiConfig::USER_LOGIN) - ->setUserPsw(TecDocApiConfig::USER_PSW); - $manufacturerId = $_GET['man']; - $dataModels = $tecDocRestClient->getModels($manufacturerId); +/** + * Обеспечивает отображение страницы с моделями + * + * Class Models + * @package NS\TecDocSite\Pages + */ +class Models implements PageInterface +{ + /** + * Возвращает html страницы с моделями + * + * @return string + */ + public function getHtml() + { + $tecDocRestClient = new TecDoc(); + $tecDocRestClient->setUserKey(TecDocApiConfig::USER_KEY) + ->setUserLogin(TecDocApiConfig::USER_LOGIN) + ->setUserPsw(TecDocApiConfig::USER_PSW); + $manufacturerId = $_GET['man']; + $dataModels = $tecDocRestClient->getModels($manufacturerId); - $begin = 1990; - $end = (int)date('Y'); - $step = 10; - $selectedYear = isset($_GET['yearFilter']) && isset($_GET['yearFilter']) ? (int)$_GET['yearFilter'] : 'all'; - $yearsFilter = array(); - $outModels = array(); - for ($i = $begin - $step; $i < $end; $i += $step) { - $yearsFilter[] = array( - 'begin' => $i < $begin ? 0 : $i, - 'end' => $i >= $end - $step ? $end : $i + $step, - 'endView' => $i >= $end - $step ? '' : $i + $step, - 'isVisible' => FALSE - ); - } - $isModelVisible = $selectedYear === 'all'; - foreach ($dataModels as $oneModel) { - $yearTo = $oneModel->yearTo ? $oneModel->yearTo : new \DateTime(); - $yearFrom = $oneModel->yearFrom ? $oneModel->yearFrom : new \DateTime('1970-01-01'); - foreach ($yearsFilter as &$oneRangeValue) { - if ($yearFrom->format('Y') <= $oneRangeValue['end'] && $yearTo->format('Y') >= $oneRangeValue['begin']) { - $oneRangeValue['isVisible'] = TRUE; - if ($selectedYear === $oneRangeValue['end']) { - $isModelVisible = TRUE; - } - } - } - if ($isModelVisible) { - $outModels[] = $oneModel; - } - } + $begin = 1990; + $end = (int)date('Y'); + $step = 10; + $selectedYear = isset($_GET['yearFilter']) && $_GET['yearFilter'] !== 'all' ? (int)$_GET['yearFilter'] : -1; + $yearsFilter = array(); + $outModels = array(); + for ($i = $begin - $step; $i < $end; $i += $step) { + $yearsFilter[] = array( + 'begin' => $i < $begin ? 0 : $i, + 'end' => $i >= $end - $step ? $end : $i + $step, + 'endView' => $i >= $end - $step ? '' : $i + $step, + 'isVisible' => false + ); + } + foreach ($dataModels as $oneModel) { + $isModelVisible = $selectedYear === -1; + $yearTo = $oneModel->yearTo ? $oneModel->yearTo : new \DateTime(); + $yearFrom = $oneModel->yearFrom ? $oneModel->yearFrom : new \DateTime('1970-01-01'); + foreach ($yearsFilter as &$oneRangeValue) { + if ($yearFrom->format('Y') <= $oneRangeValue['end'] && $yearTo->format('Y') >= $oneRangeValue['begin']) { + $oneRangeValue['isVisible'] = true; + if ($selectedYear === $oneRangeValue['end']) { + $isModelVisible = true; + } + } + } + if ($isModelVisible) { + $outModels[] = $oneModel; + } + } - $contentTemplateData = array( - 'models' => $outModels, - 'breadcrumbs' => self::getBreadcrumbs(), - 'selectedYear' => $selectedYear, - 'yearsFilter' => $yearsFilter, - 'man' => $manufacturerId - ); - $templateData = array( - 'content' => View::deploy('models.tpl', $contentTemplateData) - ); + $contentTemplateData = array( + 'models' => $outModels, + 'breadcrumbs' => self::getBreadcrumbs(), + 'selectedYear' => $selectedYear, + 'yearsFilter' => $yearsFilter, + 'man' => $manufacturerId + ); + $templateData = array( + 'content' => View::deploy('models.tpl', $contentTemplateData) + ); - return View::deploy('index.tpl', $templateData); - } + return View::deploy('index.tpl', $templateData); + } - /** - * Возвращает html код с хлебными крошками. - * - * @return string - */ - private static function getBreadcrumbs() { - $tecDocRestClient = new TecDoc(); - $tecDocRestClient->setUserKey(TecDocApiConfig::USER_KEY) - ->setUserLogin(TecDocApiConfig::USER_LOGIN) - ->setUserPsw(TecDocApiConfig::USER_PSW); - $breadcrumbs = array(); - $manufacturerId = (int)$_GET['man']; - $manufacturers = $tecDocRestClient->getManufacturers(); - if (is_array($manufacturers)) { - foreach ($manufacturers as $oneManufacturer) { - if ($oneManufacturer->id === $manufacturerId) { - $breadcrumbs[] = array( - 'name' => $oneManufacturer->name - ); - } - } - } - $templateData = array( - 'breadcrumbs' => $breadcrumbs - ); + /** + * Возвращает html код с хлебными крошками + * + * @return string + */ + private static function getBreadcrumbs() + { + $tecDocRestClient = new TecDoc(); + $tecDocRestClient->setUserKey(TecDocApiConfig::USER_KEY) + ->setUserLogin(TecDocApiConfig::USER_LOGIN) + ->setUserPsw(TecDocApiConfig::USER_PSW); + $breadcrumbs = array(); + $manufacturerId = (int)$_GET['man']; + $manufacturers = $tecDocRestClient->getManufacturers(); + if (is_array($manufacturers)) { + foreach ($manufacturers as $oneManufacturer) { + if ($oneManufacturer->id === $manufacturerId) { + $breadcrumbs[] = array( + 'name' => $oneManufacturer->name + ); + } + } + } + $templateData = array( + 'breadcrumbs' => $breadcrumbs + ); - return View::deploy('common/breadcumbs.tpl', $templateData); - } -} \ No newline at end of file + return View::deploy('common/breadcumbs.tpl', $templateData); + } +} \ No newline at end of file diff --git a/Pages/Modifications.php b/Pages/Modifications.php index dc5b737..2ba618e 100755 --- a/Pages/Modifications.php +++ b/Pages/Modifications.php @@ -6,67 +6,76 @@ use NS\TecDocSite\Common\View; use NS\TecDocSite\Interfaces\PageInterface; -class Modifications implements PageInterface { - /** - * Возвращает html страницы с модификациями. - * - * @return string - */ - public function getHtml() { - $tecDocRestClient = new TecDoc(); - $tecDocRestClient->setUserKey(TecDocApiConfig::USER_KEY) - ->setUserLogin(TecDocApiConfig::USER_LOGIN) - ->setUserPsw(TecDocApiConfig::USER_PSW); - $manufacturerId = $_GET['man']; - $modelId = $_GET['model']; - $modifications = $tecDocRestClient->getModifications($manufacturerId, $modelId); - $contentTemplateData = array( - 'modifications' => $modifications, - 'breadcrumbs' => self::getBreadcrumbs(), - 'man' => $manufacturerId - ); - $content = View::deploy('modifications.tpl', $contentTemplateData); - $templateData = array('content' => $content); - return View::deploy('index.tpl', $templateData); - } +/** + * Обеспечивает отображение страницы с модификациями + * + * Class Modifications + * @package NS\TecDocSite\Pages + */ +class Modifications implements PageInterface +{ + /** + * Возвращает html страницы с модификациями + * + * @return string + */ + public function getHtml() + { + $tecDocRestClient = new TecDoc(); + $tecDocRestClient->setUserKey(TecDocApiConfig::USER_KEY) + ->setUserLogin(TecDocApiConfig::USER_LOGIN) + ->setUserPsw(TecDocApiConfig::USER_PSW); + $manufacturerId = $_GET['man']; + $modelId = $_GET['model']; + $modifications = $tecDocRestClient->getModifications($manufacturerId, $modelId); + $contentTemplateData = array( + 'modifications' => $modifications, + 'breadcrumbs' => self::getBreadcrumbs(), + 'man' => $manufacturerId + ); + $content = View::deploy('modifications.tpl', $contentTemplateData); + $templateData = array('content' => $content); + return View::deploy('index.tpl', $templateData); + } - /** - * Возвращает html код с хлебными крошками. - * - * @return string - */ - private static function getBreadcrumbs() { - $tecDocRestClient = new TecDoc(); - $tecDocRestClient->setUserKey(TecDocApiConfig::USER_KEY) - ->setUserLogin(TecDocApiConfig::USER_LOGIN) - ->setUserPsw(TecDocApiConfig::USER_PSW); - $breadcrumbs = array(); - $manufacturerId = (int)$_GET['man']; - $manufacturers = $tecDocRestClient->getManufacturers(); - if (is_array($manufacturers)) { - foreach ($manufacturers as $oneManufacturer) { - if ($oneManufacturer->id === $manufacturerId) { - $breadcrumbs[] = array( - 'name' => $oneManufacturer->name, - 'url' => "?man={$manufacturerId}" - ); - } - } - } - $models = $tecDocRestClient->getModels($manufacturerId); - $modelId = (int)$_GET['model']; - if (is_array($models)) { - foreach ($models as $oneModel) { - if ($oneModel->id === $modelId) { - $breadcrumbs[] = array( - 'name' => $oneModel->name - ); - } - } - } - $templateData = array( - 'breadcrumbs' => $breadcrumbs - ); - return View::deploy('common/breadcumbs.tpl', $templateData); - } -} \ No newline at end of file + /** + * Возвращает html код с хлебными крошками + * + * @return string + */ + private static function getBreadcrumbs() + { + $tecDocRestClient = new TecDoc(); + $tecDocRestClient->setUserKey(TecDocApiConfig::USER_KEY) + ->setUserLogin(TecDocApiConfig::USER_LOGIN) + ->setUserPsw(TecDocApiConfig::USER_PSW); + $breadcrumbs = array(); + $manufacturerId = (int)$_GET['man']; + $manufacturers = $tecDocRestClient->getManufacturers(); + if (is_array($manufacturers)) { + foreach ($manufacturers as $oneManufacturer) { + if ($oneManufacturer->id === $manufacturerId) { + $breadcrumbs[] = array( + 'name' => $oneManufacturer->name, + 'url' => "?man={$manufacturerId}" + ); + } + } + } + $models = $tecDocRestClient->getModels($manufacturerId); + $modelId = (int)$_GET['model']; + if (is_array($models)) { + foreach ($models as $oneModel) { + if ($oneModel->id === $modelId) { + $breadcrumbs[] = array( + 'name' => $oneModel->name + ); + } + } + } + $templateData = array( + 'breadcrumbs' => $breadcrumbs + ); + return View::deploy('common/breadcumbs.tpl', $templateData); + } +} \ No newline at end of file diff --git a/README.md b/README.md index 4800b91..d2509e2 100755 --- a/README.md +++ b/README.md @@ -1,20 +1,62 @@ -TecDocSite -========== +## TecDocSite Пример каталога TecDoc с использованием TecDoc API от ABCP -Внимание -======== -Директория ./tmp должна быть доступна для записи web-сервером +### Внимание + +Директория ```./tmp``` должна быть доступна для записи web-сервером Требования: -php 5.3.10 и выше. -Установка: +```php 5.3.10 - 7.0``` + +#### Установка: Распаковать или клонировать репозиторий в корень сайта. -Выполнить в корне сайта в консоли команду: + +Выполнить в корне репозитория в консоли команду: + +```bash +php composer.phar install +``` +Заполнить данные выданные при регистрации в файле: +`Common/TecDocApiConfig.php` + +Отредактировать ссылку для перехода к поиску на вашем сайте. + +Ссылка находится в файле: `View/group.details.tpl` +строка 62 и 110 +`Каталог {foreach from=$data.breadcrumbs item=oneItem} - + {if isset($oneItem.url)} {$oneItem.name} {else} diff --git a/View/group.details.tpl b/View/group.details.tpl index 2877a61..5dbc3a9 100755 --- a/View/group.details.tpl +++ b/View/group.details.tpl @@ -5,12 +5,12 @@
На странице:
- {foreach from=$data.itemsPerPareValues item=oneItemPerPage} + {foreach from=$data.itemsPerPageValues item=oneItemPerPage} {if $oneItemPerPage == $data.selectedItemsPerPage} {$oneItemPerPage} {else} @@ -40,8 +40,8 @@
- {if !empty($oneArticle->documents->data)} - + {if !empty($oneArticle->imageName)} + {else} {/if} @@ -72,7 +72,7 @@ Фирма Код детали - Модель + Описание @@ -83,10 +83,8 @@
- {if !empty($oneArticle->documents->data)} - - - + {if !empty($oneArticle->imageName)} + {else} {/if} @@ -101,7 +99,7 @@ {$oneArticle->number} - {*Модель*} + {*Описание*} {$oneArticle->description} diff --git a/View/models.tpl b/View/models.tpl index a5a1665..87e69b9 100755 --- a/View/models.tpl +++ b/View/models.tpl @@ -6,7 +6,7 @@