59 lines
1.6 KiB
PHP
59 lines
1.6 KiB
PHP
<?
|
|
|
|
namespace controller\themes\merakomis\time\absence;
|
|
|
|
use themes\merakomis\Emp;
|
|
use themes\merakomis\structure\merakomisControllerTable;
|
|
use themes\merakomis\time\Absence;
|
|
|
|
class Api extends merakomisControllerTable {
|
|
|
|
static $class = 'themes\merakomis\time\Absence';
|
|
|
|
|
|
|
|
public static function setDays($post = []) {
|
|
$res = [];
|
|
if(Emp::$IS_AUTH){
|
|
$emp_id = intval($_POST['emp_id']) ?: ($_POST['emp'] ? : Emp::$AUTH_ID) ;
|
|
//$emp_id = intval($_POST['emp_id']) ? : Emp::$AUTH_ID;
|
|
$absence_id = $_POST['absence_id'];
|
|
$begin = $_POST['begin'];
|
|
$end = $_POST['end'];
|
|
|
|
$res = Absence::setDays($emp_id,$absence_id,$begin,$end);
|
|
|
|
|
|
$res['notify']['color'] = $res['e'];
|
|
$res['notify']['content'] = $res['m'];
|
|
}
|
|
echo je($res);
|
|
}
|
|
public static function getTableData($post = []) {
|
|
|
|
$and = [];
|
|
if($emp = intval($post['data']['params']['emp'])){
|
|
$and[] = \Where::_operator(Absence::$EMP,'=',$emp);
|
|
} else {
|
|
$and[] = \Where::_operator(Absence::$EMP,'=',Emp::$AUTH_ID);
|
|
}
|
|
|
|
|
|
if($and){
|
|
$post['options'][\Query::WHERE] = \Where::_and($and);
|
|
}
|
|
|
|
$post['options'][\Query::SORT] = [Absence::$DATE=>'DESC'];
|
|
$post['getData'] = true;
|
|
$res = parent::getTableData($post);
|
|
/*
|
|
switch (intval($id)){
|
|
case merakomru::$PARTNERS->id_for_theme : $res['title'] = 'Партнёры'; break;
|
|
}
|
|
*/
|
|
echo je($res);
|
|
}
|
|
|
|
}
|
|
|