yf_manage_conf admin module

Fileplugins/conf/admin_modules/yf_manage_conf.class.php
Useadmin URL ?object=manage_conf

Public properties

A site sets them in its config with $PROJECT_CONF['manage_conf']['NAME'] = ...;

PropertyDefaultDescription
$_table null

Constants

table'conf'

Public methods 8

active

public function active()
    public function active()
    {
        return _class('admin_methods')->active($this->_table);
    }

add

public function add()
    public function add()
    {
        $replace = _class('admin_methods')->add($this->_table);
        return form($replace)
            ->text('name')
            ->text('value')
            ->textarea('desc')
            ->text('linked_table')
            ->text('linked_data')
            ->text('linked_method')
            ->save_and_back();
    }

clone_item

public function clone_item()
    public function clone_item()
    {
        return _class('admin_methods')->clone_item($this->_table);
    }

delete

public function delete()
    public function delete()
    {
        return _class('admin_methods')->delete($this->_table);
    }

edit

public function edit()
    public function edit()
    {
        $replace = _class('admin_methods')->edit($this->_table);
        $data = [];
        if ($replace['linked_data']) {
            $data = main()->get_data($replace['linked_data']);
        } elseif ($replace['linked_table']) {
            $q = db()->query('SELECT id, name FROM `' . db($replace['linked_table']) . '` ORDER BY name ASC');
            while ($a = db()->fetch_assoc($q)) {
                $data[$a['id']] = $a['name'];
            }
        } elseif ($replace['linked_method']) {
            list($module, $method) = explode('.', trim($replace['linked_method']));
            $module_obj = module($module);
            if (method_exists($module_obj, $method)) {
                $data = $module_obj->$method();
            }
        }
        $form = form($replace);
        $form->info('name');
        if ($data) {
            $form->select_box('value', $data);
        } else {
            $form->text('value');
        }
        $form->textarea('desc');
        $form->save_and_back();
        return $form;
    }

show

public function show()
    public function show()
    {
        return table('SELECT * FROM ' . db(self::table) . ' ORDER BY `name` ASC')
            ->text('name', '', ['badge' => 'info'])
            ->text('value')
            ->text('desc', 'Description')
            ->btn_edit()
            ->btn_delete()
            ->btn_active()
            ->footer_add();
    }

sortable

public function sortable()
    public function sortable()
    {
        return _class('admin_methods')->sortable($this->_table);
    }

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

_init

public function _init()
    public function _init()
    {
        $this->_table = [
            'table' => self::table,
            'fields' => [
                'name',
                'value',
                'desc',
            ],
        ];
    }