File: /home/temp/yarusvl.ru/adminx/core/SeoLinkPatternsAdmin.php
<?php
require_once('api/Mgc.php');
class SeoLinkPatternsAdmin extends Mgc {
public function fetch() {
// Обработка действий
if($this->request->method('post')) {
// Действия с выбранными
$ids = $this->request->post('check');
if(is_array($ids)) {
switch($this->request->post('action')) {
case 'disable': {
/*Выключение записей*/
$this->seo_link_patterns->update_seo_link($ids, array('visible'=>0));
break;
}
case 'enable': {
/*Включение записей*/
$this->seo_link_patterns->update_seo_link($ids, array('visible'=>1));
break;
}
case 'delete': {
/*Удаление записей*/
foreach($ids as $id) {
$this->seo_link_patterns->delete_seo_link($id);
}
break;
}
}
}
}
$filter = array();
$filter['page'] = max(1, $this->request->get('page', 'integer'));
$filter['limit'] = 20;
// Поиск
$keyword = $this->request->get('keyword', 'string');
if(!empty($keyword)) {
$filter['keyword'] = $keyword;
$this->design->assign('keyword', $keyword);
}
$seo_links_count = $this->seo_link_patterns->count_seo_links($filter);
// Показать все страницы сразу
if($this->request->get('page') == 'all') {
$filter['limit'] = $seo_links_count;
}
/*Выбираем записи*/
$seo_links = $this->seo_link_patterns->get_seo_links($filter);
$this->design->assign('seo_links_count', $seo_links_count);
$this->design->assign('seo_links_count', ceil($seo_links_count/$filter['limit']));
$this->design->assign('current_page', $filter['page']);
$this->design->assign('seo_links', $seo_links);
return $this->design->fetch('seo_link_patterns.tpl');
}
}