Full UI theme for CakePHP
ViewExtension helperExample:
$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
$pageTitle - string title of page;$headerMenuActions - array of actions links.Add HTML options to element:
['data-toggle' => 'tooltip', 'title' => 'Some tooltip'];['data-toggle' => 'someToggle', 'title' => 'Some tooltip'];['data-tooltip-text' => Some tooltip]
Example:echo $this->Html->link('some link', '/', ['data-toggle' => 'tooltip', 'title' => 'Some tooltip']);
Example:
$this->ViewExtension->timeAgo($time, $format);
Where:
$time UNIX timestamp, strtotime() valid string or DateTime object$format strftime format stringAdd HTML options to element: ['data-toggle' => 'repeat']
Example:
echo $this->Html->div('some-class', 'Data to update', ['data-toggle' => 'repeat']);
Example:
echo $this->ViewExtension->buttonPrint();
Yes or No for target dataExample:
echo $this->ViewExtension->yesNo($data);
$listYesNo = $this->ViewExtension->yesNoList();
<None> if target data is emptyExample:
echo $this->ViewExtension->showEmpty($data, $dataRet, $emptyRet, $isHtml);
Where:
$data - Data for checking$dataRet - Data for return, if target data is not empty. Default - target data$emptyRet - Data for return, if target data is empty (default - <None>)$isHtml - Flag of trimmings HTML tags from result, if FalseExample:
echo $this->ViewExtension->iconTag($icon, $options);
Where:
$icon - Class of icon$options - HTML options for icon element
See http://fontawesome.ioExample:
echo $this->ViewExtension->button($icon, $btn, $options);
Where:
$icon - Class of icon$btn - Class of button$options - HTML options for button element
See http://fontawesome.ioExample:
echo $this->ViewExtension->addUserPrefixUrl($url);
Where:
$url - URL for adding prefixExample:
echo $this->ViewExtension->getIconForExtension($extension);
Where:
$extension - Extension of file`expand and roll upExample:
echo $this->ViewExtension->truncateText($text, $length);
Where:
$text - Text to truncate$length - Length of returned stringRequire plugin Tools. Use the composer to install:
composer require dereuromark/cakephp-tools:^0.12.3
Example:
echo $this->ViewExtension->numberText($number, $langCode);
Where:
$number - Number for processing$langCode - Languge code in format ISO 639-1 or ISO 639-2Example:
echo $this->ViewExtension->barState($stateData);
Where:
$stateData - Array of state in format:
stateName, value: name of state;stateId, value: ID of state;amount, value: amount elements in this statestateUrl, value: url for state, e.g.:
array(‘controller’ => ‘posts’, ‘action’ => ‘index’, ‘?’ => array(‘data[FilterData][0][Post][state_id]’ => ‘2’)) [Not necessary]class: ID of state, value: class of state for progress bar,
e.g.: ‘progress-bar-danger progress-bar-striped’ [Not necessary]Example:
echo $this->ViewExtension->listLastInfo($lastInfo, $labelList, $controllerName, $actionName, $length);
Where:
$lastInfo - Array of last information in format:
label, value: label of list item;modified, value: date and time of last modification;id, value: ID of record.$labelList - Label of list$controllerName - Name of controller for viewing$actionName - Name of controller action for viewing$length - Length of list item label stringExample:
echo $this->ViewExtension->collapsibleList($listData, $showLimit, $listClass, $listTag);
Where:
$listData - List data$showLimit - Limit of the displayed list$listClass - Class of the list tag$listTag - Type of list tag to use (ol/ul)