include OLIB_PATH . '/class.cfg.php'; error_reporting(E_ERROR); // setlocale(LC_ALL, 'ru_RU'); function toUnixTimestamp($d, $t) { return mktime(substr($t, 0, 2), substr($t, 3, 2), 0, substr($d, 3, 2), substr($d, 0, 2), substr($d, 6, 4)); } $fn = '/home/webserver/PCOUNTER.LOG'; //$fn = '/home/webserver/PCOUNTER_2010_06.LOG'; $cn = 'printjoblogposition'; $tst = new Parser(array('username', 'document', 'prnname', 'date', 'time', 'pc', 'f1', 'f2', 'paper', 'param', 'size', 'pages', 'n1', 'n2'), ','); $tst->fileOpen($fn, $cn); while ($str = $tst->fileStr()) { $tst->load($str); $ora = new PrintJob(); $ora->username[0] = substr($tst->username, 4); $ora->docum[0] = convert_cyr_string(addslashes(str_replace('\'', '', $tst->document)), 'd', 'w'); $ora->prnname[0] = substr($tst->prnname, strpos($tst->prnname, '\\', 3) + 1); $ora->pcname[0] = substr($tst->pc, 2); $ora->paper[0] = $tst->paper; $ora->pages[0] = $tst->pages; $ora->bsize[0] = $tst->size; $ora->time[0] = toUnixTimestamp($tst->date, $tst->time); $param = explode('/', $tst->param); $ora->jt[0] = substr($param[1], 3); $ora->cp[0] = substr($param[2], 3); $ora->ts[0] = substr($param[3], 3); $ora->count = 1; $ora->insert(); } $tst->commit();
/** * Retrieve filepaths and timestamps for images at a specified cadence of * a given type between the specified start and end dates. * * @param object $imgIndex An ImgIndex object with access to the database * @param int $numFrames The number of frames to go into the JPX movie * * @return array List of filepaths to images to use during JPX generation * as well as a list of times for each image in the series. */ private function _queryJPXImageFramesByCadence($imgIndex, $numFrames) { $images = array(); $dates = array(); // Timer $time = toUnixTimestamp($this->_endTime); // Get nearest JP2 images to each time-step for ($i = 0; $i < $numFrames; $i++) { // Get next image $isoDate = toISOString(parseUnixTimestamp($time)); $img = $imgIndex->getDataFromDatabase($isoDate, $this->_sourceId); $filepath = HV_JP2_DIR . $img['filepath'] . '/' . $img['filename']; // Ignore redundant images if (!$images || $images[0] != $filepath) { array_unshift($images, $filepath); array_unshift($dates, toUnixTimestamp($img['date'])); } $time -= $this->_cadence; } // Add entry for start time if it isn't already included $img = $imgIndex->getDataFromDatabase($this->_startTime, $this->_sourceId); $jp2 = HV_JP2_DIR . $img['filepath'] . '/' . $img['filename']; if ($images && $images[0] != $jp2) { array_unshift($images, $jp2); array_unshift($dates, toUnixTimestamp($img['date'])); } return array($images, $dates); }