From 7ec4b054da422b5cee4e6d76b6fb7d7e90cf29a5 Mon Sep 17 00:00:00 2001 From: louie Date: Mon, 11 Apr 2022 18:45:55 -0700 Subject: First commit --- hw_schedule2.php | 208 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 208 insertions(+) create mode 100644 hw_schedule2.php (limited to 'hw_schedule2.php') diff --git a/hw_schedule2.php b/hw_schedule2.php new file mode 100644 index 0000000..e333cf1 --- /dev/null +++ b/hw_schedule2.php @@ -0,0 +1,208 @@ +"; + + $name = empty($_REQUEST['add_class_desc']) ? "" : $_REQUEST['add_class_desc']; + $code = empty($_REQUEST['add_class_id']) ? "" : $_REQUEST['add_class_id']; + $location = empty($_REQUEST['add_class_location']) ? "left" : $_REQUEST['add_class_location']; + $link = empty($_REQUEST['add_class_link']) ? "" : $_REQUEST['add_class_link']; + + if(!$code) print "Missing inputs
"; + else{ + $location = $location == "left" ? 0 : 1; + + $name = mysqli_real_escape_string($db, $name); + $code = mysqli_real_escape_string($db, $code); + //$location = mysqli_real_escape_string($db, $location); + $link = mysqli_real_escape_string($db, $link); + $q = "INSERT INTO Classes (Name, Code, Location, Link) VALUES ('$name', '$code', '$location', '$link')"; + if(!mysqli_query($db, $q)) print "$q
Insertion Failed: " . mysqli_error($db) . "
"; + } + +} + */ + +$day = date("l, F jS"); +$bg_image_arr = array("rubber_duck_PNG33.png", +"dice.png"); + +function entry($due_date, $desc, $color, $highlight, $done){ + if($due_date != "ASAP" && $due_date != ""){ + $due_date_pieces = explode(" ", $due_date); + $due_date_num = date('z', mktime(0, 0, 0, substr($due_date_pieces[1], 0, 2), substr($due_date_pieces[1], 3, 2), date('Y'))); + + if($due_date_num - date('z') <= 1 && $color != "black" && $color != "brown") $color = "red"; + if((!$done && ($due_date_num - date('z') <= 0)) || ($highlight == "orange" && ($due_date_num - date('z') <= 7))) $highlight = "yellow"; + } + if($highlight != "none" && $color == "gray") $color = "black"; + if($done){ + $color = "green"; + $highlight = "none"; + } + + print "
  • "; + if($done) print ""; // "✅"; + print ""; + print ($due_date != "" ? "$due_date: " : "") . "$desc"; + print ""; + print "
  • "; +} + +/* Conceptual ** + +class Entry{ + public static $num_hw = 0; + public static $hw_strings = []; + //$hw_string[0] = HW description + //$hw_string[1] = HW due Date (0 to 365) + + function add_hw(){ + $hw_string[] = readline("What is the HW?\n"); + $days_til_due = readline("In how many days is the HW due?\n"); + $hw_strings[] = $days_til_due + date('z'); + $num_hw++; + } +} + +function list_hw($entry){ + if(!$entry->num_hw){ + print "The test is have work"; + return; + } + else{ + print ""; + } + + return; +} + +$ENGL2A = new Entry(); +$MATH13 = new Entry(); +$COEN11 = new Entry(); +$PHYS31 = new Entry(); +$COEN11L = new Entry(); +$ENGR1 = new Entry(); +$PHYS31L = new Entry(); + +$ENGL2A->add_hw(); +print "TEST: num_hw = $ENGL2A->num_hw"; + + */ + +?> + + + + Daily Homework Schedule + + + + + +
    + + +
    +
    +
    +
    +
    + +
    + + + + + + + -- cgit