This commit is contained in:
yfl
2019-05-05 18:40:51 +08:00
parent b860286d04
commit e4952b3eb2
6 changed files with 90 additions and 21 deletions
+11 -8
View File
@@ -331,20 +331,23 @@ class custom extends control
*/
public function setDynamic()
{
if($_POST)
if($_SERVER['REQUEST_METHOD'] == 'POST')
{
$actions = $this->post->actions;
$actions = implode(',', array_filter($actions));
$actions = json_encode($actions);
$this->loadModel('setting')->setItem('system.common.global.setdynamic', $actions);
$this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => 'reload'));
}
$this->app->loadLang('action');
$this->view->title = $this->lang->custom->setDynamic;
$this->view->position[] = $this->lang->custom->common;
$this->view->position[] = $this->view->title;
$this->view->actions = $this->lang->action->search->label;
$this->view->actioned = $this->loadModel('setting')->getItem("owner=system&module=common&section=global&key=setdynamic");
$this->app->loadLang('group');
$this->view->title = $this->lang->custom->setDynamic;
$this->view->position[] = $this->lang->custom->common;
$this->view->position[] = $this->view->title;
$this->view->objectTypes = $this->lang->action->objectTypes;
$this->view->dynamicAction = $this->lang->action->dynamicAction;
$this->view->actions = $this->lang->action->search->label;
$this->view->setActions = json_decode($this->loadModel('setting')->getItem("owner=system&module=common&section=global&key=setdynamic"), true);
$this->display();
}
+24 -3
View File
@@ -10,6 +10,9 @@
*/
?>
<?php include 'header.html.php';?>
<style>
.checkbox-primary{float:left;margin-left:5px;}
</style>
<div id='mainContent' class='main-content'>
<form class="load-indicator main-form form-ajax" method='post'>
<div class='main-header'>
@@ -17,11 +20,29 @@
<strong><?php echo $lang->custom->setDynamic?></strong>
</div>
</div>
<table class='table table-form'>
<table class='table table-hover table-striped table-bordered'>
<thead>
<tr class='text-center'>
<th class='w-150px'><?php echo $lang->group->module;?></th>
<th><?php echo $lang->action->action;?></th>
</tr>
</thead>
<?php foreach($objectTypes as $objectKey => $objectTypeName):?>
<tr>
<th class='w-100px'><?php echo $lang->custom->setAction;?></th>
<td><?php echo html::select("actions[]", $actions, $actioned, "class='form-control chosen' multiple");?></td>
<th class='text-middle w-150px'>
<div class="text-center check-all">
<?php echo $objectTypeName?>
</div>
</th>
<td class='pv-10px'>
<?php if(isset($dynamicAction->$objectKey)):?>
<div class='group-item'>
<?php echo html::checkbox("actions[{$objectKey}]", $dynamicAction->$objectKey, isset($setActions[$objectKey]) ? $setActions[$objectKey] : '', '');?>
</div>
<?php endif;?>
</td>
</tr>
<?php endforeach;?>
<tr>
<th></th>
<td class='form-actions'>