/** * Method for processing nightly data * @param string $day YYYYMMDD string for date * @access private */ private function processData($p) { // QueryServer config $queryType = "sessions"; // Create new ServerIO instance $io = new ServerIO(); $params = array('id' => $p['id'], 'sdate' => $p['sdate'], 'edate' => $p['edate'], 'stime' => $p['stime'], 'etime' => $p['etime']); // Retrieve data for each initiative try { $io = new ServerIO(); $this->populateHash($io->getData($params, $queryType)); while ($io->hasMore()) { $this->populateHash($io->next()); } } catch (Exception $e) { throw new Exception($e->getMessage()); } }
/** * Initiate request to Suma server * * @access private * @param array $sumaParams Parameters sent to suma server, subset of params * @param string $queryType Query type, 'sessions' or 'counts' * @param array $params Full parameters object */ private function processData($sumaParams, $queryType, $params) { // Instantiate ServerIO class, begin retrieval of data from Suma Server, // and continue retrieval until the hasMore property is false try { $io = new ServerIO(); $this->populateHash($io->getData($sumaParams, $queryType), $params); while ($io->hasMore()) { $this->populateHash($io->next(), $params); } } catch (Exception $e) { throw new Exception($e->getMessage()); } }
/** * Method for processing nightly data * @param string $day YYYYMMDD string for date * @access private */ private function processData($day) { // QueryServer config $queryType = "counts"; // Retrieve all active initiatives $initiatives = $this->activeInitiatives(); // Build array of param arrays for active inits $inits = array(); // Adjust end day if start hour !== "0000" and define boundaries if ($this->startHour === "0000") { $eDate = $day; $boundaryStart = strtotime($day . "0000"); $boundaryEnd = strtotime($eDate . "2359"); } else { $eDate = str_replace("-", "", date('Y-m-d', strtotime('+1 day', strtotime($day)))); $boundaryStart = strtotime($day . $this->startHour); $boundaryEnd = strtotime(date('Y-m-d H:i', strtotime('-1 minute', strtotime($eDate . $this->startHour)))); } foreach ($initiatives as $id => $title) { $params = array('id' => $id, 'format' => "lc", 'sdate' => $day, 'edate' => $eDate); array_push($inits, $params); } // Retrieve data for each initiative foreach ($inits as $params) { try { $io = new ServerIO(); $this->populateHash($io->getData($params, $queryType), $boundaryStart, $boundaryEnd, $day, $this->startHour); while ($io->hasMore()) { $this->populateHash($io->next(), $boundaryStart, $boundaryEnd, $day, $this->startHour); } } catch (Exception $e) { throw $e; } } }