function writeData($values, $timeStamp = false, $timeSpanType = 'day', $state = 0)
 {
     if (is_bool($timeStamp)) {
         $timeStamp = false;
     }
     $file = $this->getIOFile($timeStamp, $timeSpanType);
     $t = 0;
     //--- include used methods ---//
     include_once $this->fileManagerPath;
     if (!class_exists('fileManager')) {
         throw new Exception('Unable to include "fileManager".');
         return false;
     }
     include_once $this->csvManagerPath;
     if (!class_exists('csvManager')) {
         throw new Exception('Unable to include "csvManager".');
         return false;
     }
     //--- check access + try to create a flow file while there's no access ---//
     while (!($fileHandle = fopen($checkedFile = $t ? fileManager::preExtendFile($file, '#' . $t) : $file, 'a+')) && $t >= 0) {
         if ($t >= $this->maxFlowFiles) {
             $t = -1;
             break;
         }
         $t++;
     }
     if ($fileHandle) {
         fclose($fileHandle);
     } else {
         return false;
     }
     if ($t < 0) {
         return false;
     }
     $row = array();
     if (!array_key_exists($this->dateColumnLabel, $values)) {
         switch ($timeSpanType) {
             case 'day':
                 $date = date('H:i:s', $timeStamp);
                 break;
             case 'month':
                 $date = date('Y-m-d', $timeStamp);
                 break;
             case 'year':
                 $date = date('Y M', $timeStamp);
                 break;
             case 'all':
                 $date = date('Y', $timeStamp);
                 break;
         }
         $row[$this->dateColumnLabel] = $date;
     }
     if ($timeSpanType !== 'day' && !array_key_exists($this->stateColumnLabel, $values)) {
         $row[$this->stateColumnLabel] = $state;
     }
     $row = array_merge($row, $values);
     $csvWriter = new csvManager();
     $csvWriter->delimiter = $this->logDelimiter;
     $success = $csvWriter->write($checkedFile, $row, $this->dateColumnLabel);
     unset($csvWriter);
     return $success;
 }
 private function writeDataLevel($identifier, $dataLevel, $timeStamp = false)
 {
     if ($timeStamp == false) {
         $timeStamp = time();
     }
     if (!(include_once $this->libPath . 'class.csvManager.inc.php')) {
         trigger_error('Unable to include "csvManager". Not warning level data written.', E_USER_WARNING);
         return false;
     }
     $csv = new csvManager();
     $rowToWrite = array('id' => $identifier, 'level' => $dataLevel, 'time' => $timeStamp);
     return $csv->write($this->warningLevelFile, $rowToWrite, 'id');
 }