38 lines
1014 B
PHP
38 lines
1014 B
PHP
|
|
<?php
|
||
|
|
|
||
|
|
class SubBlocksController extends BaseController {
|
||
|
|
public $model = null;
|
||
|
|
public function __construct() {
|
||
|
|
parent::__construct();
|
||
|
|
$this->model = new SubBlocksModel();
|
||
|
|
}
|
||
|
|
public function addSubblock($params) {
|
||
|
|
$insert_data = (array) $this->post;
|
||
|
|
// $insert_data['constructor_id'] = $params['constructor_id'];
|
||
|
|
// $insert_data['page_id'] = $params['page_id'];
|
||
|
|
$insert_data['block_id'] = $params['block_id'];
|
||
|
|
|
||
|
|
$result = $this->model->insert($insert_data);
|
||
|
|
if ($result) {
|
||
|
|
return $this->response(['message' => 'success']);
|
||
|
|
} else {
|
||
|
|
return $this->response(['message' => 'error']);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
public function updateSubblock($params)
|
||
|
|
{
|
||
|
|
$update_data = (array) $this->post;
|
||
|
|
|
||
|
|
$conditions = [
|
||
|
|
'id' => $params['subblock_id']
|
||
|
|
];
|
||
|
|
|
||
|
|
$result = $this->model->update($update_data, $conditions);
|
||
|
|
|
||
|
|
if ($result) {
|
||
|
|
return $this->response(['message' => 'success']);
|
||
|
|
} else {
|
||
|
|
return $this->response(['message' => 'error']);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|