Skip to content

Commit

Permalink
Исправление ошибок уровня NOTICE
Browse files Browse the repository at this point in the history
  • Loading branch information
antflk committed May 6, 2015
1 parent 1f00db1 commit 51413b7
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 11 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
tmp/smarty/*
vendor
vendor
.idea
vde
23 changes: 18 additions & 5 deletions Pages/Group.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,18 @@
use NS\TecDocSite\Interfaces\PageInterface;

class Group implements PageInterface {
/**
* Варианты отображения единиц на страницу.
*
* @var int[]
*/
private $itemsPerPage = array(20, 40, 100);

/**
* Дефолтный вид отображения плитка
*/
const DEFAULT_VIEW_MODE = 'tile';

/**
* Возвращает html дерева категорий для модификации.
*
Expand All @@ -25,9 +35,10 @@ public function getHtml() {
$modificationId = $_GET['modelVariant'];
$categoryId = $_GET['group'];
$articles = $tecDocRestClient->getArticles($modificationId, $categoryId);
$itemsPerPage = in_array($_GET['itemsPerPage'], $this->itemsPerPage, TRUE) ? $_GET['itemsPerPage'] : current($this->itemsPerPage);
$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 = is_numeric($_GET['start']) && $_GET['start'] < $totalArticles && $_GET['start'] > 0 ? $_GET['start'] : 0;
$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'],
Expand All @@ -46,14 +57,15 @@ public function getHtml() {
'itemsPerPareValues' => $this->itemsPerPage,
'selectedItemsPerPage' => $itemsPerPage,
'baseUrl' => $baseUrl,
'viewMode' => $_GET['viewMode'],
'itemsPerPage' => $_GET['itemsPerPage'],
'start' => $_GET['start'],
'viewMode' => $viewMode,
'itemsPerPage' => $itemsPerPage,
'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);
}

Expand Down Expand Up @@ -100,6 +112,7 @@ private static function getBreadcrumbs() {
$templateData = array(
'breadcrumbs' => $breadcrumbs
);

return View::deploy('common/breadcumbs.tpl', $templateData);
}
}
10 changes: 6 additions & 4 deletions Pages/Models.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,19 @@ public function getHtml() {
$begin = 1990;
$end = (int)date('Y');
$step = 10;
$yearFilterValue = (int)$_GET['yearFilter'];
$selectedYear = $yearFilterValue ? $yearFilterValue : 'all';
$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
'endView' => $i >= $end - $step ? '' : $i + $step,
'isVisible' => FALSE
);
}
$isModelVisible = $selectedYear === 'all';
foreach ($dataModels as $oneModel) {
$isModelVisible = $selectedYear === 'all';
$yearTo = $oneModel->yearTo ? $oneModel->yearTo : new \DateTime();
$yearFrom = $oneModel->yearFrom ? $oneModel->yearFrom : new \DateTime('1970-01-01');
foreach ($yearsFilter as &$oneRangeValue) {
Expand All @@ -61,6 +61,7 @@ public function getHtml() {
$templateData = array(
'content' => View::deploy('models.tpl', $contentTemplateData)
);

return View::deploy('index.tpl', $templateData);
}

Expand Down Expand Up @@ -89,6 +90,7 @@ private static function getBreadcrumbs() {
$templateData = array(
'breadcrumbs' => $breadcrumbs
);

return View::deploy('common/breadcumbs.tpl', $templateData);
}
}
2 changes: 1 addition & 1 deletion View/common/breadcumbs.tpl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<a class="tecdocCrumb" href="/">Каталог</a>
{foreach from=$data.breadcrumbs item=oneItem}
<img src="/images/breadcumbs_arr.png">
{if $oneItem.url}
{if isset($oneItem.url)}
<a class="tecdocCrumb" href="{$oneItem.url}">{$oneItem.name}</a>
{else}
<span class="tecdocCrumb">{$oneItem.name}</span>
Expand Down

0 comments on commit 51413b7

Please sign in to comment.