Tabs & relation panels

General info

Tabs are used to split page content into different topics. They can be switched in the top part of the page compared to tabs in a browser.

Relation panels contain related models and/or informations related to the current model. As standard it is a list of related models but it can be a whole view as well.

Tabs and relation panels are structured in view_has_many() of the specific model.

Examples

Tabs

Relation Panels

view_has_many() - structure

return array() formatted like:

Fast Array Description: Tab Name => Panel Name => view / html / class, relation,(options => array())

Nested Level

1


2


3


4


Description
Tab Name





Panel Name





'view' => Name of View To Display

Display the given view



'view' => 'View to Load'
View Name to Display



'vars' => 'array of vars to send to view'
Variables send to new loaded view


'html' => HTML string to display on panel

Display HTML Code


'class' => class name of required relation


MUST

The relation Model class name to display



'relation' => collection
MUST with 'class' in 3rd levelCollection containing the related models


'method' => the method to call; defaults to edit

OPTIONAL

if set we build link in relaton to 'method'


'options' => array()




OPTIONAL





'hide_create_button' => 1hide create button in relation blade view



'hide_delete_button' => 1hide delete button in relation blade view



'create_button_text' => <STRING>overwrites the default text message on create button



'delete_button_text' => <STRING>overwrites the default text message on delete button



'many_to_many' => '<functionname>'add this key with the models functionname of the relation to make the deletion of pivot entries of an N:M relationship possible


'info' => 'info message'

Info message above create and delete button

TODO: Add colorization option

Examples

Contract:

    // View Relation.
    public function view_has_many()
    {
        if ($this->module_is_active('billingbase'))
        {
            $ret['Base']['Modem'] = $this->modems;
            $ret['Base']['Item']        = $this->items;
            $ret['Base']['SepaMandate'] = $this->sepamandates;
        }
        $ret['Technical']['Modem'] = $this->modems;
        if ($this->module_is_active('billingbase'))
        {
            $ret['Billing']['Item']        = $this->items;
            $ret['Billing']['SepaMandate'] = $this->sepamandates;
        }
        if ($this->module_is_active('provvoipenvia'))
        {
            $ret['Envia']['EnviaOrder'] = $this->external_orders;
            // TODO: auth - loading controller from model could be a security issue ?
            $ret['Envia']['Envia API']['view']['view'] = 'provvoipenvia::ProvVoipEnvia.actions';
            $ret['Envia']['Envia API']['view']['vars']['extra_data'] = \Modules\ProvBase\Http\Controllers\ContractController::_get_envia_management_jobs($this);
        }
        return $ret;
    }


DeviceType (only for Testing):

    // returns all objects that are related to a DeviceType
    public function view_has_many()
    {
        return [
            'Test' =>  ['Device Class Header' => ['class' => 'Device',
                                                  'relation' => $this->devices,
                                                  'options' => ['hide_create_button' => 1, 'hide_delete_button' => 1]],
                        'Snmp Mib Header' => ['class' => 'SnmpMib', 'relation' => $this->snmpmibs]],
            'Test2' => ['SnmpMib Header' => ['class' => 'SnmpMib', 'relation' => $this->snmpmibs],
                        'View Stuff Header' => ['view' => ['view' => 'test', 'vars' => ['test' => 'Geld']]], 'View 2' => ['view' => 'test'],
                        'Html Stuff Header' => ['html' => '<li><a href=google.de>Test</a></li>']],
            'Test3' => ['hua' => ['class' => 'Device', 'relation' => $this->devices],
                        'hua2' => ['class' => 'SnmpMib', 'relation' => $this->snmpmibs],
                        'Test Panel' => ['html' => 'HUA']]
        ];
    }