public function reloadMatch() { $json = []; $json['result'] = \Rebond\Core\ResultType::ERROR; // check $matchId = Util\Converter::toInt('matchId', 'post'); $logId = Util\Converter::toInt('logId', 'post'); $match = \Own\Bus\Match\Data::loadById($matchId); if (!isset($match)) { $json['message'] = Util\Lang::lang('matchNotFound'); return json_encode($json); } $options = []; $options['where'][] = ['match_id = ?', $matchId]; $options['where'][] = ['id > ?', $logId]; $options['order'][] = 'id'; $matchLog = \Own\Bus\Log\Data::loadAll($options); if (count($matchLog) == 0) { $json['message'] = Util\Lang::lang('pleaseWait'); return json_encode($json); } $logs = []; foreach ($matchLog as $log) { $logs[] = $log->toArray(); } // layout $json['result'] = \Rebond\Core\ResultType::SUCCESS; $json['logs'] = $logs; $json['matchStatus'] = $match->getStatus(); $json['message'] = Util\Lang::lang('loaded'); return json_encode($json); }