public static function displaysessions() { $sessionbox = self::find_by_sql("SELECT * FROM `class_session` ORDER BY date DESC"); foreach ($sessionbox as $session_sheet) { $updatelink = '<a href="?s_upd=' . $session_sheet->id . '" >Update</a>'; if ($session_sheet->active == 1) { $status = "Active"; $removable = "---"; } else { $status = '<a href="?activate=' . $session_sheet->id . '" >Not Active</a>'; $removable = '<a href="?sessionrmv=' . $session_sheet->id . '">Remove</a>'; } echo '<tr><td><a href="classes-view.php?sid=' . $session_sheet->id . '">' . $session_sheet->name . '</a></td><td>' . DateManager::displaydatefromtmstp($session_sheet->s_date) . '</td><td>' . $status . '</td><td>' . $updatelink . '</td><td>' . $removable . '</td></tr>'; } }
?> <h2>Update Class of: <?php echo DateManager::frontdisplaytimefromtmstp($updateclass->c_date); ?> </h2> <form action="classes-view.php?sid=<?php echo $_GET['sid']; ?> " method="post"> <input type="hidden" value="<?php echo $updateclass->id; ?> " name="cls_id" /> Class Date: <input type="datetime" maxlength="40" name="class-date" value="<?php echo DateManager::displaydatefromtmstp($updateclass->c_date); ?> "/> MM/DD/YY Class Time: <input type="text" maxlength="40" name="class-time" value="<?php echo DateManager::backdisplaytimefromtmstp($updateclass->c_date); ?> "/>HH:MM<br /> Available Spots: <input type="text" maxlength="40" name="spots" value="<?php echo $updateclass->spots; ?> "/> <br />Note:<br /> <textarea rows="2" cols="60" name="note"> <?php echo $updateclass->note; ?> </textarea><br />
<?php if (isset($_GET['s_upd'])) { $updatesession = ClassSession::find_by_id($_GET['s_upd']); ?> <h2><a>Update Session:</a></h2> <form action="index.php" method="post"> <input type="hidden" value="<?php echo $updatesession->id; ?> " name="s_id" /> Session Name: <input type="text" maxlength="40" name="u_session_name" value="<?php echo $updatesession->name; ?> "/> Starting Date: <input type="text" maxlength="40" name="date" value="<?php echo DateManager::displaydatefromtmstp($updatesession->s_date); ?> "/> <?php if ($updatesession->active != 1) { ?> Make active: <input type="checkbox" name="active" value="1" /> <?php } else { ?> <input type="hidden" name="active" value="1" /> <?php } ?> <input type="submit" name="submit" /> </form> <a href="index.php">Add New Session</a> <?php