meraproject/module/common/page/block/controller.php

42 lines
1.0 KiB
PHP
Raw Normal View History

<?
namespace controller\common\page\block;
use common\page\Block;
use ms\ms\structure\msControllerTable;
class Api extends msControllerTable {
static $class = 'common\page\Block';
public function updatePosForID($id=null,$pos=null,$where = null){
if(IF_AUTH) {
$C = Block::getByID($_POST['id']);
$where = \Where::_and([
\Where::_operator(Block::$TO, '=', $C[Block::$TO]),
\Where::_operator(Block::$OID, '=', $C[Block::$OID]),
]);
parent::updatePosForID($_POST['id'], $_POST['pos'], $where);
}
}
static function getSettingsForm(){
$res = [];
if(IF_AUTH) {
if($BLOCK = Block::isMy($_POST['id'])) {
$form = Block::getTemplateForm($BLOCK);
$res = [];
$res['form'] = $form;
$res['title'] = 'Шаблон';
$res['values'] = json_decode($BLOCK[Block::$DATA], true);
}
}
echo je($res);
}
}