Changeset View
Changeset View
Standalone View
Standalone View
core/kernel/db/cat_event_handler.php
Show First 20 Lines • Show All 1869 Lines • ▼ Show 20 Line(s) | |||||
protected function SetPagination(kEvent $event) | protected function SetPagination(kEvent $event) | ||||
{ | { | ||||
$object = $event->getObject(); | $object = $event->getObject(); | ||||
/* @var $object kDBList */ | /* @var $object kDBList */ | ||||
// get PerPage (forced -> session -> config -> 10) | // get PerPage (forced -> session -> config -> 10) | ||||
$object->SetPerPage($this->getPerPage($event)); | $object->SetPerPage($this->getPerPage($event)); | ||||
// main lists on Front-End have special get parameter for page | if ( !$this->Application->isWebRequest() ) { | ||||
$object->SetPage(1); | |||||
return; | |||||
} | |||||
// Main lists on Front-End have special get parameter for page. | |||||
$page = $object->isMainList() ? $this->Application->GetVar('page') : false; | $page = $object->isMainList() ? $this->Application->GetVar('page') : false; | ||||
if ( !$page ) { | if ( !$page ) { | ||||
// page is given in "env" variable for given prefix | // page is given in "env" variable for given prefix | ||||
$page = $this->Application->GetVar($event->getPrefixSpecial() . '_Page'); | $page = $this->Application->GetVar($event->getPrefixSpecial() . '_Page'); | ||||
} | } | ||||
if ( !$page && $event->Special ) { | if ( !$page && $event->Special ) { | ||||
▲ Show 20 Lines • Show All 869 Lines • ▼ Show 20 Line(s) | |||||
if ( $object->isMainList() ) { | if ( $object->isMainList() ) { | ||||
$sort_by = $this->Application->GetVar('sort_by', ''); | $sort_by = $this->Application->GetVar('sort_by', ''); | ||||
if ( !$sort_by ) { | if ( !$sort_by ) { | ||||
$this->Application->SetVar('sort_by', 'Relevance,desc|' . $default_sorting); | $this->Application->SetVar('sort_by', 'Relevance,desc|' . $default_sorting); | ||||
} | } | ||||
} | } | ||||
else { | else { | ||||
if ( $this->Application->isWebRequest() ) { | |||||
$sorting_settings = $this->getListSetting($event, 'Sortings'); | $sorting_settings = $this->getListSetting($event, 'Sortings'); | ||||
$sort_by = trim(getArrayValue($sorting_settings, 'Sort1') . ',' . getArrayValue($sorting_settings, 'Sort1_Dir'), ','); | $sort_by = trim(getArrayValue($sorting_settings, 'Sort1') . ',' . getArrayValue($sorting_settings, 'Sort1_Dir'), ','); | ||||
Lint: Generic.Files.LineLength.TooLong: Line exceeds 120 characters; contains 138 characters | |||||
} | |||||
else { | |||||
$sort_by = ''; | |||||
} | |||||
if ( !$sort_by ) { | if ( !$sort_by ) { | ||||
$event->setEventParam('sort_by', 'Relevance,desc|' . $default_sorting); | $event->setEventParam('sort_by', 'Relevance,desc|' . $default_sorting); | ||||
} | } | ||||
} | } | ||||
$this->_removeForcedSortings($event); | $this->_removeForcedSortings($event); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 91 Lines • ▼ Show 20 Line(s) | |||||
$config = $event->getUnitConfig(); | $config = $event->getUnitConfig(); | ||||
foreach (Array ('Default', 'Radio') as $process_grid) { | foreach (Array ('Default', 'Radio') as $process_grid) { | ||||
$grid_data = $config->getGridByName($process_grid); | $grid_data = $config->getGridByName($process_grid); | ||||
$grid_data['Fields']['CachedNavbar'] = Array ('title' => 'la_col_Path', 'data_block' => 'grid_primary_category_td', 'filter_block' => 'grid_like_filter'); | $grid_data['Fields']['CachedNavbar'] = Array ('title' => 'la_col_Path', 'data_block' => 'grid_primary_category_td', 'filter_block' => 'grid_like_filter'); | ||||
$config->addGrids($grid_data, $process_grid . 'ShowAll'); | $config->addGrids($grid_data, $process_grid . 'ShowAll'); | ||||
} | } | ||||
// add options for CategoryId field (quick way to select item's primary category) | if ( $this->Application->isWebRequest() ) { | ||||
// Add options for CategoryId field (quick way to select item's primary category). | |||||
$category_helper = $this->Application->recallObject('CategoryHelper'); | $category_helper = $this->Application->recallObject('CategoryHelper'); | ||||
/* @var $category_helper CategoryHelper */ | /* @var $category_helper CategoryHelper */ | ||||
Type comment must be in "/** @var ClassName $variable_name */" format Lint: CodingStandard.Commenting.TypeComment.WrongStyle: Type comment must be in "/** @var ClassName $variable_name */" format | |||||
$virtual_fields = $config->getVirtualFields(); | $virtual_fields = $config->getVirtualFields(); | ||||
$virtual_fields['CategoryId']['default'] = (int)$this->Application->GetVar('m_cat_id'); | $virtual_fields['CategoryId']['default'] = (int)$this->Application->GetVar('m_cat_id'); | ||||
$virtual_fields['CategoryId']['options'] = $category_helper->getStructureTreeAsOptions(); | $virtual_fields['CategoryId']['options'] = $category_helper->getStructureTreeAsOptions(); | ||||
$config->setVirtualFields($virtual_fields); | $config->setVirtualFields($virtual_fields); | ||||
} | } | ||||
} | |||||
/** | /** | ||||
* Changes default sorting according to system settings. | * Changes default sorting according to system settings. | ||||
* | * | ||||
* @param kEvent $event Event. | * @param kEvent $event Event. | ||||
* | * | ||||
* @return self | * @return self | ||||
* @access protected | * @access protected | ||||
▲ Show 20 Lines • Show All 210 Lines • Show Last 20 Lines |
Line exceeds 120 characters; contains 138 characters