function getLatestHDHRStatus() { $hdhr = DVRUI_Vars::DVR_qpkgPath . '/' . DVRUI_Vars::DVR_bin; $DVRBin = new DVRUI_HDHRbintools($hdhr); $statusmsg = $DVRBin->get_DVR_status(); $lastline = ''; $configFile = new DVRUI_Engine_Config(); $logList = new DVRUI_Engine_LogList($configFile->getRecordPath()); $logfile = $logList->getNewestLogFile(); if (file_exists($logfile)) { $lines = file($logfile); $linecount = count($lines); $lastline = $lines[$linecount - 1]; } $htmlstr = preg_replace('/\\s+/', ' ', trim($statusmsg . ' | ' . $lastline)); return $htmlstr; }
function getLogFileList($logPath) { $listStr = ''; $logList = new DVRUI_Engine_LogList($logPath); $logListEntry = file_get_contents('style/loglist_entry.html'); if ($logList->pathExists()) { $listStr = '<ul>'; for ($i = $logList->getListLength() - 1; $i >= 0; $i--) { $logfile = basename($logList->getNextLogFile($i), '.log'); $logfullname = basename($logList->getNextLogFile($i)); $logEntry = str_replace('<!--logfile-name -->', $logfile, $logListEntry); $logEntry = str_replace('<!--logfile-fname -->', $logfullname, $logEntry); $listStr .= $logEntry; } $listStr .= '</ul>'; } else { $listStr = "ERROR: recording path is invalid"; } return $listStr; }