2016-06-04 01:10:45 +02:00
|
|
|
<?php
|
2020-11-10 13:30:32 +01:00
|
|
|
echo '<div class="index">';
|
|
|
|
if ($isSiteAdmin) {
|
|
|
|
echo '<div id="hiddenFormDiv">';
|
|
|
|
echo $this->Form->create('Warninglist', array('url' => $baseurl . '/warninglists/toggleEnable'));
|
|
|
|
echo $this->Form->input('data', array('label' => false, 'style' => 'display:none;'));
|
|
|
|
echo $this->Form->end();
|
|
|
|
echo '</div>';
|
|
|
|
}
|
|
|
|
echo $this->element('/genericElements/IndexTable/index_table', array(
|
|
|
|
'data' => array(
|
|
|
|
'data' => $warninglists,
|
|
|
|
'top_bar' => array(
|
|
|
|
'children' => array(
|
2021-02-10 21:04:06 +01:00
|
|
|
array(
|
|
|
|
'type' => 'simple',
|
|
|
|
'children' => array(
|
|
|
|
array(
|
|
|
|
'url' => $baseurl . '/warninglists/index',
|
|
|
|
'text' => __('All'),
|
|
|
|
'active' => !isset($passedArgsArray['enabled']),
|
|
|
|
),
|
|
|
|
array(
|
|
|
|
'url' => $baseurl . '/warninglists/index/enabled:1',
|
|
|
|
'text' => __('Enabled'),
|
|
|
|
'active' => isset($passedArgsArray['enabled']) && $passedArgsArray['enabled'] === "1",
|
|
|
|
),
|
|
|
|
array(
|
|
|
|
'url' => $baseurl . '/warninglists/index/enabled:0',
|
|
|
|
'text' => __('Disabled'),
|
|
|
|
'active' => isset($passedArgsArray['enabled']) && $passedArgsArray['enabled'] === "0",
|
|
|
|
)
|
|
|
|
)
|
|
|
|
),
|
2020-11-10 13:30:32 +01:00
|
|
|
array(
|
|
|
|
'type' => 'search',
|
|
|
|
'button' => __('Filter'),
|
|
|
|
'placeholder' => __('Enter value to search'),
|
|
|
|
'data' => '',
|
|
|
|
'searchKey' => 'value'
|
|
|
|
)
|
|
|
|
)
|
|
|
|
),
|
|
|
|
'title' => __('Warninglists'),
|
|
|
|
'primary_id_path' => 'Warninglist.id',
|
|
|
|
'fields' => array(
|
|
|
|
array(
|
|
|
|
'name' => __('ID'),
|
|
|
|
'sort' => 'id',
|
|
|
|
'class' => 'short',
|
|
|
|
'data_path' => 'Warninglist.id',
|
|
|
|
'element' => 'links',
|
2021-01-21 15:20:26 +01:00
|
|
|
'url' => $baseurl . '/warninglists/view/%s'
|
2020-11-10 13:30:32 +01:00
|
|
|
),
|
|
|
|
array(
|
|
|
|
'name' => __('Name'),
|
|
|
|
'sort' => 'name',
|
|
|
|
'data_path' => 'Warninglist.name',
|
|
|
|
),
|
|
|
|
array(
|
|
|
|
'name' => __('Version'),
|
|
|
|
'sort' => 'version',
|
|
|
|
'class' => 'short',
|
|
|
|
'data_path' => 'Warninglist.version',
|
|
|
|
),
|
|
|
|
array(
|
|
|
|
'name' => __('Description'),
|
|
|
|
'data_path' => 'Warninglist.description',
|
|
|
|
),
|
|
|
|
array(
|
2021-06-01 17:49:45 +02:00
|
|
|
'name' => __('Category'),
|
|
|
|
'sort' => 'category',
|
2020-11-10 13:30:32 +01:00
|
|
|
'class' => 'short',
|
2021-06-01 17:49:45 +02:00
|
|
|
'element' => 'custom',
|
|
|
|
'function' => function (array $row) use ($possibleCategories) {
|
|
|
|
return $possibleCategories[$row['Warninglist']['category']];
|
|
|
|
}
|
2020-11-10 13:30:32 +01:00
|
|
|
),
|
|
|
|
array(
|
2021-06-01 17:49:45 +02:00
|
|
|
'name' => __('Type'),
|
|
|
|
'sort' => 'type',
|
2020-11-10 13:30:32 +01:00
|
|
|
'class' => 'short',
|
2021-06-01 17:49:45 +02:00
|
|
|
'data_path' => 'Warninglist.type',
|
2020-11-10 13:30:32 +01:00
|
|
|
),
|
|
|
|
array(
|
|
|
|
'name' => __('Entries'),
|
|
|
|
'sort' => 'warninglist_entry_count',
|
|
|
|
'class' => 'short',
|
|
|
|
'data_path' => 'Warninglist.warninglist_entry_count',
|
|
|
|
),
|
2021-06-01 17:49:45 +02:00
|
|
|
array(
|
|
|
|
'name' => __('Default'),
|
|
|
|
'sort' => 'default',
|
|
|
|
'class' => 'short',
|
|
|
|
'element' => 'boolean',
|
|
|
|
'data_path' => 'Warninglist.default',
|
|
|
|
),
|
2020-11-10 13:30:32 +01:00
|
|
|
array(
|
|
|
|
'name' => __('Enabled'),
|
2021-06-01 17:49:45 +02:00
|
|
|
'sort' => 'enabled',
|
2020-11-10 13:30:32 +01:00
|
|
|
'class' => 'short',
|
|
|
|
'element' => 'boolean',
|
|
|
|
'data_path' => 'Warninglist.enabled',
|
|
|
|
),
|
|
|
|
),
|
|
|
|
'actions' => array(
|
|
|
|
array(
|
|
|
|
'title' => __('Enable'),
|
|
|
|
'icon' => 'play',
|
|
|
|
'onclick' => sprintf('toggleSetting(%s, \'%s\', \'%s\')', 'event', 'warninglist_enable', '[onclick_params_data_path]'),
|
|
|
|
'onclick_params_data_path' => 'Warninglist.id',
|
|
|
|
'complex_requirement' => array(
|
|
|
|
'function' => function ($row, $options) {
|
|
|
|
return $options['me']['Role']['perm_site_admin'] && !$options['datapath']['enabled'];
|
|
|
|
},
|
|
|
|
'options' => array(
|
|
|
|
'me' => $me,
|
|
|
|
'datapath' => array(
|
|
|
|
'orgc' => 'Event.orgc_id',
|
|
|
|
'enabled' => 'Warninglist.enabled'
|
|
|
|
)
|
|
|
|
)
|
|
|
|
),
|
|
|
|
),
|
|
|
|
array(
|
2021-01-06 16:19:55 +01:00
|
|
|
'title' => __('Disable'),
|
2020-11-10 13:30:32 +01:00
|
|
|
'icon' => 'stop',
|
|
|
|
'onclick' => sprintf('toggleSetting(%s, \'%s\', \'%s\')', 'event', 'warninglist_enable', '[onclick_params_data_path]'),
|
|
|
|
'onclick_params_data_path' => 'Warninglist.id',
|
|
|
|
'complex_requirement' => array(
|
|
|
|
'function' => function ($row, $options) {
|
|
|
|
return $options['me']['Role']['perm_site_admin'] && $options['datapath']['enabled'];
|
|
|
|
},
|
|
|
|
'options' => array(
|
|
|
|
'me' => $me,
|
|
|
|
'datapath' => array(
|
|
|
|
'enabled' => 'Warninglist.enabled'
|
|
|
|
)
|
|
|
|
)
|
|
|
|
),
|
|
|
|
),
|
2021-06-01 17:49:45 +02:00
|
|
|
array(
|
|
|
|
'url' => $baseurl . '/warninglists/edit',
|
|
|
|
'url_params_data_paths' => array(
|
|
|
|
'Warninglist.id'
|
|
|
|
),
|
|
|
|
'title' => __('Edit'),
|
|
|
|
'icon' => 'edit',
|
|
|
|
'complex_requirement' => [
|
|
|
|
'function' => function($row) use ($me) {
|
2021-06-12 17:59:17 +02:00
|
|
|
return $row['Warninglist']['default'] == 0 && ($me['Role']['perm_warninglist'] || $me['Role']['perm_site_admin']);
|
2021-06-01 17:49:45 +02:00
|
|
|
}
|
|
|
|
]
|
|
|
|
),
|
2020-11-10 13:30:32 +01:00
|
|
|
array(
|
|
|
|
'url' => $baseurl . '/warninglists/view',
|
|
|
|
'url_params_data_paths' => array(
|
|
|
|
'Warninglist.id'
|
|
|
|
),
|
2021-06-01 17:49:45 +02:00
|
|
|
'title' => __('View'),
|
2020-11-10 13:30:32 +01:00
|
|
|
'icon' => 'eye',
|
|
|
|
'dbclickAction' => true
|
|
|
|
),
|
|
|
|
array(
|
|
|
|
'title' => __('Delete'),
|
2021-04-30 08:35:17 +02:00
|
|
|
'url' => $baseurl . '/warninglists/delete',
|
|
|
|
'url_params_data_paths' => array(
|
|
|
|
'Warninglist.id'
|
|
|
|
),
|
|
|
|
'postLink' => true,
|
|
|
|
'postLinkConfirm' => __('Are you sure you want to delete the entry?'),
|
2020-11-10 13:30:32 +01:00
|
|
|
'icon' => 'trash',
|
2021-05-03 09:43:18 +02:00
|
|
|
'requirement' => $me['Role']['perm_site_admin'],
|
2020-11-10 13:30:32 +01:00
|
|
|
),
|
|
|
|
)
|
|
|
|
)
|
|
|
|
));
|
|
|
|
echo '</div>';
|
2019-02-13 14:45:01 +01:00
|
|
|
echo $this->element('/genericElements/SideMenu/side_menu', array('menuList' => 'warninglist', 'menuItem' => 'index'));
|
2016-06-06 10:09:55 +02:00
|
|
|
?>
|
2020-11-10 13:30:32 +01:00
|
|
|
<script type="text/javascript">
|
2021-02-10 21:04:06 +01:00
|
|
|
$(function() {
|
2020-11-10 13:30:32 +01:00
|
|
|
$('#quickFilterButton').click(function() {
|
|
|
|
runIndexQuickFilter();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
</script>
|