= 0 ) && // Starting hour between 0 and 23 ( $sh < 24 ) && // ( $eh >= 0 ) && // Ending hour between 0 and 23 ( $eh < 24 ) && // ( $sm >= 0 ) && // Starting minute between 0 and 59 ( $sm < 60 ) && // ( $em >= 0 ) && // Ending minute between 0 and 59 ( $em < 60 ) && // ( $int % 5 === 0 ) && // Intervall can be divided by 5 ( $dd > 0 ) && // Number of days between 1 and 7 ( $dd <= 7 ) && // ( $sh * 60 + $sm + $int < $eh * 60 + $em ) ) // Starting time less than ending time { $start_hour = $sh; $start_minute = $sm; $end_hour = $eh; $end_minute = $em; $intervall = $int; $days = $dd; } $empty_row = ""; $empty_cell = " "; $dummy_cell = ' '; $rowspan_factor = 2; $table_header = ""; $table_body = ""; $table_footer = $dummy_cell . "
"; $querystr = "SELECT * FROM li_plan, li_courses WHERE li_plan.cid=li_courses.cid ORDER BY begin, day"; $current_hour = $start_hour; $current_minute = $start_minute; $current_day = 1; $current_day_db = 0; $current_hour_db = 0; $current_minute_db = 0; $previous_day_db = 0; $previous_hour_db = 0; $previous_minute_db = 0; $skipper = array(); for( $i = 1; $i <= $days; $i++ ) { $skipper[$i] = 0; $table_body .= "" . $week[$i] . ""; $empty_row .= $empty_cell; } $table_body .= $dummy_cell . " 
" . str_pad($start_hour,2,"0",STR_PAD_LEFT) . ":" . str_pad($start_minute,2,"0",STR_PAD_LEFT) . "
" . $empty_row . $dummy_cell . "
" . str_pad($start_hour,2,"0",STR_PAD_LEFT) . ":" . str_pad($start_minute,2,"0",STR_PAD_LEFT) . "
" . "" ; $empty_row = ""; $result = mysqli_query($connection, $querystr); while ($row = mysqli_fetch_object($result)) { $current_day_db = $row->day; $current_hour_db = intval(substr($row->begin, 0, 2)); $current_minute_db = intval(substr($row->begin, 3, 2)); $current_endhour_db = intval(substr($row->end, 0, 2)); $current_endminute_db = intval(substr($row->end, 3, 2)); $rowspan = stepCount($current_hour_db, $current_minute_db, $current_endhour_db, $current_endminute_db, $intervall); while( timeLessThan( $current_hour, $current_minute, $current_hour_db, $current_minute_db ) && timeLessThan( $current_hour, $current_minute, $end_hour, $end_minute ) ) { for( $j=$previous_day_db; $j<$days; $j++ ) { if( $skipper[$j+1] > 0 ) { $skipper[$j+1] = $skipper[$j+1] - 1; } else { if( $admin ) { $table_body .= "Hinzufügen"; } else { $table_body .= $empty_cell; } $empty_row .= $empty_cell; } } $current_minute += $intervall; while( $current_minute >= 60 ) { $current_minute -= 60; $current_hour++; } $table_body .= $dummy_cell . "
" . str_pad($current_hour,2,"0",STR_PAD_LEFT) . ":" . str_pad($current_minute,2,"0",STR_PAD_LEFT) . "
" . $empty_row . $dummy_cell . "
" . str_pad($current_hour,2,"0",STR_PAD_LEFT) . ":" . str_pad($current_minute,2,"0",STR_PAD_LEFT) . "
" . "" ; $empty_row = ""; $previous_day_db = 0; $current_day = 1; } while( ( $current_day <= $days ) && ( $current_day <= $current_day_db ) ) { if( $current_day == $current_day_db ) { if( $admin ) { $table_body .= "color !== "" ? "style='background-color:#" . $row->color . "'>" : ">" ) . ($row->link !== "" ? "" : "" ) . $row->diffname . ($row->link !== "" ? "" : "" ) . ($row->diffname !== $row->name ? "
" . $row->name . "" : "") . "
" . umlaute($row->level) . "" . "
" . umlaute($row->description) . "" . "
" . "Editieren " . "Löschen " . "
"; } else { $table_body .= "color !== "" ? "style='background-color:#" . $row->color . "'>" : ">" ) . ($row->link !== "" ? "" : "" ) . $row->diffname . ($row->link !== "" ? "" : "" ) . ($row->diffname !== $row->name ? "
" . $row->name . "" : "") . "
" . umlaute($row->level) . "" . "
" . umlaute($row->description) . ""; } } else { if( $skipper[$current_day] > 0 ) { $skipper[$current_day] = $skipper[$current_day] - 1; } else { if( $admin ) { $table_body .= "Hinzufügen"; } else { $table_body .= $empty_cell; } $empty_row .= $empty_cell; } } $current_day++; } if( $current_day > $days ) { $current_day = 1; } $skipper[$current_day_db] += ($rowspan - 1); $previous_day_db = $current_day_db; $previous_hour_db = $current_hour_db; $previous_minute_db = $current_minute_db; } mysqli_free_result($result); while( timeLessThan( $current_hour, $current_minute, $end_hour, $end_minute ) ) { for( $j=$previous_day_db; $j<$days; $j++ ) { if( $skipper[$j+1] > 0 ) { $skipper[$j+1] = $skipper[$j+1] - 1; } else { if( $admin ) { $table_body .= "Hinzufügen"; } else { $table_body .= $empty_cell; } $empty_row .= $empty_cell; } } $current_minute += $intervall; while( $current_minute >= 60 ) { $current_minute -= 60; $current_hour++; } if( ( $current_hour != $end_hour ) || ( $current_minute != $end_minute ) ) { $table_body .= $dummy_cell . "
" . str_pad($current_hour,2,"0",STR_PAD_LEFT) . ":" . str_pad($current_minute,2,"0",STR_PAD_LEFT) . "
" . $empty_row . $dummy_cell . "
" . str_pad($current_hour,2,"0",STR_PAD_LEFT) . ":" . str_pad($current_minute,2,"0",STR_PAD_LEFT) . "
" . "" ; } $previous_day_db = 0; $current_day = 1; $empty_row = ""; } $cource_editor = ""; if( $admin ) { $course_editor = 'Kurse bearbeiten | Aktualisieren'; } return $table_header . $table_body . $table_footer . $course_editor; } function Kurse($connection) { $admin=login($GLOBALS["token"]); $return = ""; $currentDiv = ""; $querystr = "SELECT * FROM li_courses ORDER BY li_courses.cid"; $currentDiv = ""; $currentDiv .= "" . "" . "" . "" . "" . "" . ""; $result = mysqli_query($connection, $querystr); while ($row = mysqli_fetch_object($result)) { $currentDiv .= ""; $currentDiv .= ""; $currentDiv .= ""; $currentDiv .= ""; $currentDiv .= ($row->link !== "" ? "" : ""); $currentDiv .= ($row->color !== "" ? "" : ""); $currentDiv .= ""; } mysqli_free_result($result); $return .= $currentDiv . "
GruppennameTanzstilAlterLevelLinkFarbeAktion
" . $row->name . "" . $row->diffname . "" . umlaute($row->description) . "" . umlaute($row->level) . "Link
" . "Editieren " . "Löschen " . "
"; $return .= "Kurs hinzufügen | Zurück zum Plan | Aktualisieren"; if( $admin ) { return $return; } else { return "Sie sind nicht berechtigt um auf diesen Teil der Seite zuzugreifen!"; } } ?>