예제 #1
0
파일: cmd.ajax.php 프로젝트: saez0pub/core
         throw new Exception(__('401 - Accès non autorisé', __FILE__));
     }
     $cmd_ajax = jeedom::fromHumanReadable(json_decode(init('cmd'), true));
     $cmd = cmd::byId($cmd_ajax['id']);
     if (!is_object($cmd)) {
         $cmd = new cmd();
     }
     utils::a2o($cmd, $cmd_ajax);
     $cmd->save();
     ajax::success();
 }
 if (init('action') == 'changeHistoryPoint') {
     if (!isConnect('admin')) {
         throw new Exception(__('401 - Accès non autorisé', __FILE__));
     }
     $history = history::byCmdIdDatetime(init('cmd_id'), init('datetime'));
     if (!is_object($history)) {
         throw new Exception(__('Aucun point ne correspond pour l\'historique : ', __FILE__) . init('cmd_id') . ' - ' . init('datetime'));
     }
     $history->setValue(init('value', null));
     $history->save(null, true);
     ajax::success();
 }
 if (init('action') == 'getHistory') {
     $return = array();
     $data = array();
     $dateStart = null;
     $dateEnd = null;
     if (init('dateRange') != '' && init('dateRange') != 'all') {
         if (is_json(init('dateRange'))) {
             $dateRange = json_decode(init('dateRange'), true);