yf_admin_wall admin module

Wall.

Fileplugins/admin/admin_modules/yf_admin_wall.class.php
Useadmin URL ?object=admin_wall

Public properties

PropertyDefaultDescription
None declared in this class.

Public methods 7

filter_save

public function filter_save()
    public function filter_save()
    {
        return _class('admin_methods')->filter_save();
    }

show

public function show()
    public function show()
    {
        $sql = 'SELECT * FROM ' . db('admin_walls');
        $filter = _class('admin_methods')->_get_filter();
        return table($sql, [
                'filter' => $filter,
                'filter_params' => [
                    'message' => 'like',
                    '__default_order' => 'ORDER BY add_date DESC',
                ],
            ])
            ->date('add_date')
            ->text('message')
            ->text('object')
            ->text('action')
            ->text('object_id')
            ->admin('user_id')
            ->btn_view();
    }
public function show_for_admin()
    public function show_for_admin()
    {
        $_GET['page'] = 'clear';
        $_GET['filter'] = 'user_id:' . (int) (($_GET['id'] ?? null));
        return $this->filter_save();
    }

view

public function view()

Proxy between real link and wall contents.

    public function view()
    {
        $id = (int) ($_GET['id']);
        $msg = null;
        if ($id) {
            $msg = db()->from('admin_walls')->where($id)->get();
        }
        if ( ! $msg['id']) {
            return _e('Wrong message id');
        }
        $link = '';
        $object = $msg['object'];
        $action = $msg['action'];
        $object_id = $msg['object_id'];
        $module = module($object);
        $hook_name = '_hook_wall_link';
        if (is_object($module) && method_exists($module, $hook_name)) {
            $link = $module->$hook_name($msg);
        }
        if ( ! $link) {
            $link = url('/' . $object . '/' . $action . '/' . $object_id);
        }
        return js_redirect($link);
    }

Methods starting with _ hooks and helpers; not routable as page actions

public function _hook_settings(&$selected = [])
    public function _hook_settings(&$selected = [])
    {
        return [];
    }
public function _hook_widget__admin_wall($params = [])
    public function _hook_widget__admin_wall($params = [])
    {
        $meta = [
            'name' => 'Admin wall',
            'desc' => 'Latest events for admin',
            'configurable' => [
//				'order_by'	=> array('id','name','active'),
            ],
        ];
        if ($params['describe_self']) {
            return $meta;
        }
        $config = $params;
        $sql = 'SELECT * FROM ' . db('admin_walls') . ' WHERE user_id=' . (int) (main()->ADMIN_ID) . ' ORDER BY add_date DESC';
        return table($sql, ['no_header' => 1, 'btn_no_text' => 1, 'pages_on_top' => 1, 'pager_path' => './?object=' . ($_GET['object'] ?? null) . '&action=show'])
            ->date('add_date')
            ->admin('user_id')
            ->text('message')
            ->btn_view();
    }

_show_filter

public function _show_filter()
    public function _show_filter()
    {
        if ( ! in_array(($_GET['action'] ?? null), ['show'])) {
            return false;
        }
        $order_fields = [];
        foreach (explode('|', 'add_date|message|object|action|object_id|admin_id') as $v) {
            $order_fields[$v] = $v;
        }
        $r = null;
        return form($r, [
                'filter' => true,
            ])
            ->number('user_id')
            ->text('message')
            ->text('object')
            ->text('action')
            ->integer('object_id')
            ->select_box('order_by', $order_fields, ['show_text' => 1])
            ->order_box()
            ->save_and_clear();
    }