CMC Algebra Seminar
'; echo ''; echo ''.$year_past.' Seminars'; function sheet_to_array($sheet_id){ //Request Google Sheets JSON API v4 with PHP //https://gist.github.com/marcus-at-localhost/1886c1f35647ff682752c19880bd9dd1 /** //sample sheet $spreadsheet_id = '1TlhxvW4GxayktKdjoWKt620qTzysEquC4UPGmOlGxb0'; $sheet_id = 'Formularantworten%203'; **/ $api_key = 'AIzaSyCFdE7R-62_k7EIuJTAByhLrgFLhUKSOwE'; $spreadsheet_id = '1kCJk6nmlLPvsJMKrLgLgsSwNm7x49oWYYzprIGSfzQU'; $url = 'https://sheets.googleapis.com/v4/spreadsheets/'.$spreadsheet_id.'/values/'.$sheet_id.'?key='.$api_key; //echo $url; $web_file= file_get_contents($url); $json = json_decode($web_file); $rows = $json->values; return $rows; } $template_file = 'row-template.php'; /** * Simple Templating function * @param $file - Path to the PHP file that acts as a template. * @param $args - Associative array of variables to pass to the template file. * @return string - Output of the template file. Likely HTML. **/ function template( $file, $args ){ // ensure the file exists if ( !file_exists( $file ) ) { return ''; } // Make values in the associative array easier to access by extracting them if ( is_array( $args ) ){ extract( $args ); } // buffer the output (including the file is "output") ob_start(); include $file; return ob_get_clean(); } $counter = 1; $collect = array(); $rows = sheet_to_array($sheet_id); foreach($rows as $data) { $date = $data[0]; $time = $data[1]; $room = $data[2]; $speaker = $data[3]; $affiliation = $data[4]; $title = $data[5]; $abstract = $data[6]; $weekday = $data[7]; $upcomingQ = $data[8]; if ($upcomingQ == $upcomingQ_opt) { $object = array( 'date' => $date, 'weekday' => $weekday, 'time' => $time, 'room' => $room, 'speaker' => $speaker, 'affiliation' => $affiliation, 'title' => $title, 'abstract' => $abstract, 'time' => $time, 'location' => $location, 'objid' => strval($counter) ); $output = template($template_file, $object); $collect[]= $output; //echo $output; } $counter++; } if ($upcomingQ_opt=="FALSE"){ echo implode(PHP_EOL,array_reverse($collect)); } else { echo implode(PHP_EOL,$collect); } ?>
'; echo '
Past Seminars
= 2023; $year--) { if($year_past != $year) { echo ''.$year.' Seminars
'; } } ?>
ORGANIZERS '; } else { $td_organizers = ''; } echo ' '.$td_organizers.' '; if ($homepage != '') { echo ''.$name.''; } else { echo ''.$name.''; } echo ' - '.$affiliation.' '; $counter++; } } ?>