From fd6cd262468e67721b0b1ee3790b1a24ae7c558b Mon Sep 17 00:00:00 2001 From: xdrm-brackets Date: Tue, 12 Sep 2017 17:53:49 +0200 Subject: [PATCH] Information gathering done --- build/service/CalendarExtractor.php | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/build/service/CalendarExtractor.php b/build/service/CalendarExtractor.php index 1d58426..1ab71c2 100644 --- a/build/service/CalendarExtractor.php +++ b/build/service/CalendarExtractor.php @@ -122,6 +122,10 @@ } + /* (3) Remove last */ + unset( $col_ind[count($col_ind)-1] ); + + } @@ -132,13 +136,6 @@ /* (1) For each day */ foreach($col_ind as $day_n=>$col_x){ - // {1.1} Create the day in events // - $this->event[$day_n] = []; - - // {1.2} if inside a course current color, else 0 // - $cur_col = 0x0; - - /* (2) For each y pixel -> exctract event */ for( $y = self::$start_y ; $y < self::$stop_y ; $y++ ){ @@ -156,8 +153,10 @@ if( !isset($this->event_t[$p1]) ) $this->event_t[$p1] = $this->event_t[0]++; + $uid = $this->event_t[$p1]; + // {3} Store event start // - $this->event[$this->event_t[$p1]][$time] = []; + $this->event[$uid][$time] = []; // {4} Seek end of event // $y++; @@ -165,7 +164,7 @@ $y++; // {5} If end reached // - $this->event[$this->event_t[$p1]][$time] = $this->yToTime($day_n, $y); + $this->event[$uid][$time] = $this->yToTime($day_n, $y); } @@ -178,9 +177,6 @@ } - var_dump($this->event); - - die(1); } @@ -221,7 +217,7 @@ $day_ts = strtotime($this->start_d." + $day_n days"); /* (2) Format it */ - $day = date('d-m-Y', $day_ts); + $day = date('Ymd', $day_ts); } @@ -239,7 +235,7 @@ $min = round( 60 * ($time-$hour) ); /* (4) Round minutes to 10min */ - $min = floor($min/10)*10; + $min = round($min/10)*10; /* (5) Format to 2-digit */ $hour = ( $hour < 10 ) ? "0$hour" : $hour; @@ -247,9 +243,7 @@ } - - - return "$day $hour:$min:00"; + return "${day}T$hour${min}00"; }