HEX
Server: Apache/2.4.6 (CentOS) mpm-itk/2.4.7-04 mod_fcgid/2.3.9 PHP/5.4.16
System: Linux dvm.vladweb.ru 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64
User: region-gk.ru (1016)
PHP: 7.3.33
Disabled: NONE
Upload Files
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');
    }
    
}