cakephp-theme

Full UI theme for CakePHP

View the Project on GitHub anklimsk/cakephp-theme

Using ViewExtension helper

Creating page header with small menu with typical actions

Example:

$this->ViewExtension->menuHeaderPage($headerMenuActions);

Where $headerMenuActions - array of actions links, e.g.:

$headerMenuActions = [
    $this->ViewExtension->menuActionLink(
        'far fa-trash-alt',
        __('Delete data'),
        ['controller' => 'some_controller', 'action' => 'delete', $data['SomeModel']['id']],
        [
            'title' => __('Delete profile'), 'action-type' => 'confirm-post',
            'data-confirm-msg' => __('Are you sure you wish to delete this data?'),
        ]
    ),
    'divider',
    $this->ViewExtension->menuActionLink(
        'fas fa-download',
        __('Download XML data'),
        ['controller' => 'some_controller', 'action' => 'download', $data['SomeModel']['id'], 'ext' => 'xml'],
        [
            'title' => __('Download XML file'),
            'skip-modal' => true
        ]
    ),
];
echo $this->ViewExtension->menuHeaderPage($headerMenuActions);

For using page header and small menu of actions:

echo $this->ViewExtension->headerPage($pageHeader, $headerMenuActions);

Where

Creating tooltips

Add HTML options to element:

echo $this->Html->link('some link', '/', ['data-toggle' => 'tooltip', 'title' => 'Some tooltip']);

Creating time ago block

Example:

$this->ViewExtension->timeAgo($time, $format);

Where:

AJAX render the block at regular intervals

Add HTML options to element: ['data-toggle' => 'repeat'] Example:

echo $this->Html->div('some-class', 'Data to update', ['data-toggle' => 'repeat']);

Create a button for printing page

Example:

echo $this->ViewExtension->buttonPrint();

Printing text Yes or No for target data

Example:

echo $this->ViewExtension->yesNo($data);
$listYesNo = $this->ViewExtension->yesNoList();

Printing text <None> if target data is empty

Example:

echo $this->ViewExtension->showEmpty($data, $dataRet, $emptyRet, $isHtml);

Where:

Creating HTML element of icon

Example:

echo $this->ViewExtension->iconTag($icon, $options);

Where:

Creating HTML element of button

Example:

echo $this->ViewExtension->button($icon, $btn, $options);

Where:

Adding user role prefix to URL

Example:

echo $this->ViewExtension->addUserPrefixUrl($url);

Where:

Getting icon class for file from extension

Example:

echo $this->ViewExtension->getIconForExtension($extension);

Where:

Creating truncated text with buttons expand and roll up

Example:

echo $this->ViewExtension->truncateText($text, $length);

Where:

Printing a number as text

Require plugin Tools. Use the composer to install: composer require dereuromark/cakephp-tools:^0.12.3 Example:

echo $this->ViewExtension->numberText($number, $langCode);

Where:

Creating progress bar with state

Example:

echo $this->ViewExtension->barState($stateData);

Where:

Creating a list of the most recently modified data

Example:

echo $this->ViewExtension->listLastInfo($lastInfo, $labelList, $controllerName, $actionName, $length);

Where:

Creating collapsible list

Example:

echo $this->ViewExtension->collapsibleList($listData, $showLimit, $listClass, $listTag);

Where: