コード例 #1
0
     header("Location: {$URL}");
     break;
 }
 if ($result->rowCount() != 1) {
     //Fail 2
     $URL .= "&updateReturn=fail2";
     header("Location: {$URL}");
 } else {
     //Check that date is not in the future
     if ($currentDate > $today) {
         //Fail 4
         $URL .= "&updateReturn=fail4";
         header("Location: {$URL}");
     } else {
         //Check that date is a school day
         if (isSchoolOpen($guid, $currentDate, $connection2) == FALSE) {
             //Fail 5
             $URL .= "&updateReturn=fail5";
             header("Location: {$URL}");
         } else {
             //Write to database
             try {
                 $data = array("gibbonPersonIDTaker" => $_SESSION[$guid]["gibbonPersonID"], "gibbonRollGroupID" => $gibbonRollGroupID, "date" => $currentDate, "timestampTaken" => date("Y-m-d H:i:s"));
                 $sql = "INSERT INTO gibbonAttendanceLogRollGroup SET gibbonPersonIDTaker=:gibbonPersonIDTaker, gibbonRollGroupID=:gibbonRollGroupID, date=:date, timestampTaken=:timestampTaken";
                 $result = $connection2->prepare($sql);
                 $result->execute($data);
             } catch (PDOException $e) {
                 //Fail 2
                 $URL .= "&updateReturn=fail2";
                 header("Location: {$URL}");
                 break;
コード例 #2
0
     $URL .= "&bumpReturn=fail2{$params}";
     header("Location: {$URL}");
     break;
 }
 while ($rowList = $resultList->fetch()) {
     //Look for last available slot
     try {
         $dataNext = array("gibbonCourseClassID" => $gibbonCourseClassID, "date" => $rowList["date"]);
         $sqlNext = "SELECT timeStart, timeEnd, date FROM gibbonTTDayRowClass JOIN gibbonTTColumnRow ON (gibbonTTDayRowClass.gibbonTTColumnRowID=gibbonTTColumnRow.gibbonTTColumnRowID) JOIN gibbonTTColumn ON (gibbonTTColumnRow.gibbonTTColumnID=gibbonTTColumn.gibbonTTColumnID) JOIN gibbonTTDay ON (gibbonTTDayRowClass.gibbonTTDayID=gibbonTTDay.gibbonTTDayID) JOIN gibbonTTDayDate ON (gibbonTTDayDate.gibbonTTDayID=gibbonTTDay.gibbonTTDayID) WHERE gibbonCourseClassID=:gibbonCourseClassID AND date<=:date ORDER BY date DESC, timestart DESC LIMIT 0, 10";
         $resultNext = $connection2->prepare($sqlNext);
         $resultNext->execute($dataNext);
     } catch (PDOException $e) {
         $partialFail = true;
     }
     while ($rowNext = $resultNext->fetch()) {
         if (isSchoolOpen($guid, $row["date"], $connection2)) {
             try {
                 $dataPlanner = array("date" => $rowNext["date"], "timeStart" => $rowNext["timeStart"], "timeEnd" => $rowNext["timeEnd"], "gibbonCourseClassID" => $gibbonCourseClassID);
                 $sqlPlanner = "SELECT * FROM gibbonPlannerEntry WHERE date=:date AND timeStart=:timeStart AND timeEnd=:timeEnd AND gibbonCourseClassID=:gibbonCourseClassID";
                 $resultPlanner = $connection2->prepare($sqlPlanner);
                 $resultPlanner->execute($dataPlanner);
             } catch (PDOException $e) {
                 $partialFail = true;
             }
             if ($resultPlanner->rowCount() == 0) {
                 try {
                     $dataNext = array("gibbonPlannerEntryID" => $rowList["gibbonPlannerEntryID"], "date" => $rowNext["date"], "timeStart" => $rowNext["timeStart"], "timeEnd" => $rowNext["timeEnd"]);
                     $sqlNext = "UPDATE gibbonPlannerEntry  set date=:date, timeStart=:timeStart, timeEnd=:timeEnd WHERE gibbonPlannerEntryID=:gibbonPlannerEntryID";
                     $resultNext = $connection2->prepare($sqlNext);
                     $resultNext->execute($dataNext);
                 } catch (PDOException $e) {
コード例 #3
0
     print _("The specified date is in the future: it must be today or earlier.");
     print "</div>";
 } else {
     if (isSchoolOpen($guid, $currentDate, $connection2) == FALSE) {
         print "<div class='error'>";
         print _("School is closed on the specified date, and so attendance information cannot be recorded.");
         print "</div>";
     } else {
         //Get last 5 school days from currentDate within the last 100
         $timestamp = dateConvertToTimestamp($currentDate);
         $count = 0;
         $spin = 1;
         $last5SchoolDays = array();
         while ($count < 5 and $spin <= 100) {
             $date = date("Y-m-d", $timestamp - $spin * 86400);
             if (isSchoolOpen($guid, $date, $connection2)) {
                 $last5SchoolDays[$count] = $date;
                 $count++;
             }
             $spin++;
         }
         $last5SchoolDaysCount = $count;
         //Show attendance log for the current day
         try {
             $dataLog = array("gibbonRollGroupID" => $gibbonRollGroupID, "date" => $currentDate . "%");
             $sqlLog = "SELECT * FROM gibbonAttendanceLogRollGroup, gibbonPerson WHERE gibbonAttendanceLogRollGroup.gibbonPersonIDTaker=gibbonPerson.gibbonPersonID AND gibbonRollGroupID=:gibbonRollGroupID AND date LIKE :date ORDER BY timestampTaken";
             $resultLog = $connection2->prepare($sqlLog);
             $resultLog->execute($dataLog);
         } catch (PDOException $e) {
             print "<div class='error'>" . $e->getMessage() . "</div>";
         }
コード例 #4
0
        setlocale(LC_ALL, $_SESSION[$guid]["i18n"]["code"]);
        bindtextdomain("gibbon", getcwd() . "/../i18n");
        textdomain("gibbon");
    }
}
//Set timezone from session variable
date_default_timezone_set($_SESSION[$guid]["timezone"]);
//Check for CLI, so this cannot be run through browser
//if (php_sapi_name()!="cli") {
//	print _("This script cannot be run from a browser, only via CLI.") . "\n\n" ;
//}
//else {
//Check that one of the days in question is a school day
$isSchoolOpen = FALSE;
for ($i = 0; $i < 7; $i++) {
    if (isSchoolOpen($guid, date('Y-m-d', strtotime("-{$i} day")), $connection2, TRUE) == TRUE) {
        $isSchoolOpen = TRUE;
    }
}
if ($isSchoolOpen == FALSE) {
    //No school on any day in the last week
    print _("School is not open, so no emails will be sent.") . "\n\n";
} else {
    //Yes school, so go ahead.
    if ($_SESSION[$guid]["organisationEmail"] == "") {
        print _("This script cannot be run, as no school email address has been set.") . "\n\n";
    } else {
        //Lock table
        $lock = true;
        try {
            $sqlLock = "LOCK TABLE gibbonBehaviour WRITE, gibbonCourse WRITE, gibbonCourse AS gibbonCourse2 WRITE, gibbonCourseClass WRITE, gibbonCourseClass AS gibbonCourseClass2 WRITE, gibbonCourseClassPerson WRITE, gibbonCourseClassPerson AS gibbonCourseClassPerson2 WRITE, gibbonFamily WRITE, gibbonFamilyAdult WRITE, gibbonFamilyChild WRITE, gibbonPerson WRITE, gibbonPlannerEntry WRITE, gibbonPlannerEntry AS gibbonPlannerEntry2 WRITE, gibbonPlannerEntryStudentHomework WRITE, gibbonPlannerParentWeeklyEmailSummary WRITE, gibbonRollGroup WRITE, gibbonStudentEnrolment WRITE";
コード例 #5
0
ファイル: planner.php プロジェクト: actcattest001/core
         } else {
             if ($updateReturn == "fail2") {
                 $updateReturnMessage = _("Your request failed due to a database error.");
             } else {
                 if ($updateReturn == "success0") {
                     $updateReturnMessage = _("Your request was completed successfully.");
                     $class = "success";
                 }
             }
         }
     }
     print "<div class='{$class}'>";
     print $updateReturnMessage;
     print "</div>";
 }
 if (isSchoolOpen($guid, date("Y-m-d", $dateStamp), $connection2) == FALSE) {
     print "<div class='warning'>";
     print _("School is closed on the specified day.");
     print "</div>";
 } else {
     if (isset($_GET["deleteReturn"])) {
         $deleteReturn = $_GET["deleteReturn"];
     } else {
         $deleteReturn = "";
     }
     $deleteReturnMessage = "";
     $class = "error";
     if (!($deleteReturn == "")) {
         if ($deleteReturn == "success0") {
             $deleteReturnMessage = _("Your request was completed successfully.");
             $class = "success";
コード例 #6
0
ファイル: moduleFunctions.php プロジェクト: dpredster/core
function isSpaceFree($guid, $connection2, $gibbonSpaceID, $date, $timeStart, $timeEnd)
{
    $return = TRUE;
    //Check if school is open
    if (isSchoolOpen($guid, $date, $connection2) == FALSE) {
        $return = FALSE;
    } else {
        //Check timetable inc classes moved out
        $ttClear = FALSE;
        try {
            $dataSpace = array("gibbonSpaceID" => $gibbonSpaceID, "date" => $date, "timeStart1" => $timeStart, "timeStart2" => $timeStart, "timeStart3" => $timeStart, "timeEnd1" => $timeEnd, "timeStart4" => $timeStart, "timeEnd2" => $timeEnd);
            $sqlSpace = "SELECT gibbonTTDayRowClass.gibbonSpaceID, gibbonTTDayDate.date, timeStart, timeEnd, gibbonTTSpaceChangeID FROM gibbonTTDayRowClass JOIN gibbonTTColumnRow ON (gibbonTTDayRowClass.gibbonTTColumnRowID=gibbonTTColumnRow.gibbonTTColumnRowID) JOIN gibbonTTDay ON (gibbonTTDayRowClass.gibbonTTDayID=gibbonTTDay.gibbonTTDayID) JOIN gibbonTTDayDate ON (gibbonTTDayDate.gibbonTTDayID=gibbonTTDay.gibbonTTDayID) LEFT JOIN gibbonTTSpaceChange ON (gibbonTTSpaceChange.gibbonTTDayRowClassID=gibbonTTDayRowClass.gibbonTTDayRowClassID AND gibbonTTSpaceChange.date=gibbonTTDayDate.date) WHERE gibbonTTDayRowClass.gibbonSpaceID=:gibbonSpaceID AND gibbonTTDayDate.date=:date AND ((timeStart<=:timeStart1 AND timeEnd>:timeStart2) OR (timeStart>=:timeStart3 AND timeEnd<:timeEnd1) OR (timeStart>=:timeStart4 AND timeStart<:timeEnd2))";
            $resultSpace = $connection2->prepare($sqlSpace);
            $resultSpace->execute($dataSpace);
        } catch (PDOException $e) {
            $return = FALSE;
        }
        if ($resultSpace->rowCount() < 1) {
            $ttClear = TRUE;
        } else {
            $ttClashFixed = TRUE;
            while ($rowSpace = $resultSpace->fetch()) {
                if ($rowSpace["gibbonTTSpaceChangeID"] == "") {
                    $ttClashFixed = FALSE;
                }
            }
            if ($ttClashFixed == TRUE) {
                $ttClear = TRUE;
            }
        }
        if ($ttClear == FALSE) {
            $return = FALSE;
        } else {
            //Check room changes moving in
            try {
                $dataSpace = array("gibbonSpaceID" => $gibbonSpaceID, "date1" => $date, "date2" => $date, "timeStart1" => $timeStart, "timeStart2" => $timeStart, "timeStart3" => $timeStart, "timeEnd1" => $timeEnd, "timeStart4" => $timeStart, "timeEnd2" => $timeEnd);
                $sqlSpace = "SELECT * FROM gibbonTTSpaceChange JOIN gibbonTTDayRowClass ON (gibbonTTSpaceChange.gibbonTTDayRowClassID=gibbonTTDayRowClass.gibbonTTDayRowClassID) JOIN gibbonTTColumnRow ON (gibbonTTDayRowClass.gibbonTTColumnRowID=gibbonTTColumnRow.gibbonTTColumnRowID) JOIN gibbonTTDay ON (gibbonTTDayRowClass.gibbonTTDayID=gibbonTTDay.gibbonTTDayID) JOIN gibbonTTDayDate ON (gibbonTTDayDate.gibbonTTDayID=gibbonTTDay.gibbonTTDayID) WHERE gibbonTTSpaceChange.gibbonSpaceID=:gibbonSpaceID AND gibbonTTSpaceChange.date=:date1 AND gibbonTTDayDate.date=:date2 AND ((timeStart<=:timeStart1 AND timeEnd>:timeStart2) OR (timeStart>=:timeStart3 AND timeEnd<:timeEnd1) OR (timeStart>=:timeStart4 AND timeStart<:timeEnd2))";
                $resultSpace = $connection2->prepare($sqlSpace);
                $resultSpace->execute($dataSpace);
            } catch (PDOException $e) {
                $return = FALSE;
            }
            if ($resultSpace->rowCount() > 0) {
                $return = FALSE;
            } else {
                //Check room bookings
                try {
                    $dataSpace = array("gibbonSpaceID" => $gibbonSpaceID, "date" => $date, "timeStart1" => $timeStart, "timeStart2" => $timeStart, "timeStart3" => $timeStart, "timeEnd1" => $timeEnd, "timeStart4" => $timeStart, "timeEnd2" => $timeEnd);
                    $sqlSpace = "SELECT * FROM gibbonTTSpaceBooking WHERE gibbonSpaceID=:gibbonSpaceID AND date=:date AND ((timeStart<=:timeStart1 AND timeEnd>:timeStart2) OR (timeStart>=:timeStart3 AND timeEnd<:timeEnd1) OR (timeStart>=:timeStart4 AND timeStart<:timeEnd2))";
                    $resultSpace = $connection2->prepare($sqlSpace);
                    $resultSpace->execute($dataSpace);
                } catch (PDOException $e) {
                    $return = FALSE;
                }
                if ($resultSpace->rowCount() > 0) {
                    $return = FALSE;
                }
            }
        }
    }
    return $return;
}
コード例 #7
0
if (isset($_SESSION[$guid]["i18n"]["code"])) {
    if ($_SESSION[$guid]["i18n"]["code"] != NULL) {
        putenv("LC_ALL=" . $_SESSION[$guid]["i18n"]["code"]);
        setlocale(LC_ALL, $_SESSION[$guid]["i18n"]["code"]);
        bindtextdomain("gibbon", getcwd() . "/../i18n");
        textdomain("gibbon");
    }
}
//Set timezone from session variable
date_default_timezone_set($_SESSION[$guid]["timezone"]);
//Check for CLI, so this cannot be run through browser
if (php_sapi_name() != "cli") {
    print _("This script cannot be run from a browser, only via CLI.") . "\n\n";
} else {
    $currentDate = date("Y-m-d");
    if (isSchoolOpen($guid, $currentDate, $connection2, TRUE)) {
        $ids = array();
        $report = "";
        $reportInner = "";
        //Produce array of attendance data
        try {
            $data = array("date" => $currentDate);
            $sql = "SELECT gibbonRollGroupID FROM gibbonAttendanceLogRollGroup WHERE date=:date";
            $result = $connection2->prepare($sql);
            $result->execute($data);
        } catch (PDOException $e) {
            $report = _("Your request failed due to a database error.");
        }
        $log = array();
        while ($row = $result->fetch()) {
            $log[$row["gibbonRollGroupID"]] = TRUE;
コード例 #8
0
ファイル: functions.php プロジェクト: dpredster/core
function getParentalDashboardContents($connection2, $guid, $gibbonPersonID)
{
    $return = FALSE;
    $alert = getAlert($connection2, 02);
    $entryCount = 0;
    //PREPARE PLANNER SUMMARY
    $plannerOutput = "<span style='font-size: 85%; font-weight: bold'>" . _('Today\'s Classes') . "</span> . <span style='font-size: 70%'><a href='" . $_SESSION[$guid]["absoluteURL"] . "/index.php?q=/modules/Planner/planner.php&search=" . $gibbonPersonID . "'>" . _('View Planner') . "</a></span>";
    if (isset($_GET["updateReturn"])) {
        $updateReturn = $_GET["updateReturn"];
    } else {
        $updateReturn = "";
    }
    $updateReturnMessage = "";
    $class = "error";
    if (!($updateReturn == "")) {
        if ($updateReturn == "fail0") {
            $updateReturnMessage = _("Your request failed because you do not have access to this action.");
        } else {
            if ($updateReturn == "fail1") {
                $updateReturnMessage = _("Your request failed because your inputs were invalid.");
            } else {
                if ($updateReturn == "fail2") {
                    $updateReturnMessage = _("Your request failed due to a database error.");
                } else {
                    if ($updateReturn == "success0") {
                        $updateReturnMessage = _("Your request was completed successfully.");
                        $class = "success";
                    }
                }
            }
        }
        $plannerOutput .= "<div class='{$class}'>";
        $plannerOutput .= $updateReturnMessage;
        $plannerOutput .= "</div>";
    }
    $classes = FALSE;
    $date = date("Y-m-d");
    if (isSchoolOpen($guid, $date, $connection2) == TRUE and isActionAccessible($guid, $connection2, "/modules/Planner/planner.php") and $_SESSION[$guid]["username"] != "") {
        try {
            $data = array("gibbonSchoolYearID" => $_SESSION[$guid]["gibbonSchoolYearID"], "date" => $date, "gibbonPersonID" => $gibbonPersonID, "date2" => $date, "gibbonPersonID2" => $gibbonPersonID);
            $sql = "(SELECT gibbonPlannerEntry.gibbonPlannerEntryID, gibbonUnitID, gibbonHookID, gibbonPlannerEntry.gibbonCourseClassID, gibbonCourse.nameShort AS course, gibbonCourseClass.nameShort AS class, gibbonPlannerEntry.name, timeStart, timeEnd, viewableStudents, viewableParents, homework, homeworkSubmission, homeworkCrowdAssess, role, date, summary, gibbonPlannerEntryStudentHomework.homeworkDueDateTime AS myHomeworkDueDateTime FROM gibbonPlannerEntry JOIN gibbonCourseClass ON (gibbonPlannerEntry.gibbonCourseClassID=gibbonCourseClass.gibbonCourseClassID) JOIN gibbonCourseClassPerson ON (gibbonCourseClass.gibbonCourseClassID=gibbonCourseClassPerson.gibbonCourseClassID) JOIN gibbonCourse ON (gibbonCourse.gibbonCourseID=gibbonCourseClass.gibbonCourseID) LEFT JOIN gibbonPlannerEntryStudentHomework ON (gibbonPlannerEntryStudentHomework.gibbonPlannerEntryID=gibbonPlannerEntry.gibbonPlannerEntryID AND gibbonPlannerEntryStudentHomework.gibbonPersonID=gibbonCourseClassPerson.gibbonPersonID) WHERE gibbonSchoolYearID=:gibbonSchoolYearID AND date=:date AND gibbonCourseClassPerson.gibbonPersonID=:gibbonPersonID AND NOT role='Student - Left' AND NOT role='Teacher - Left') UNION (SELECT gibbonPlannerEntry.gibbonPlannerEntryID, gibbonUnitID, gibbonHookID, gibbonPlannerEntry.gibbonCourseClassID, gibbonCourse.nameShort AS course, gibbonCourseClass.nameShort AS class, gibbonPlannerEntry.name, timeStart, timeEnd, viewableStudents, viewableParents, homework, homeworkSubmission, homeworkCrowdAssess, role, date, summary, NULL AS myHomeworkDueDateTime FROM gibbonPlannerEntry JOIN gibbonCourseClass ON (gibbonPlannerEntry.gibbonCourseClassID=gibbonCourseClass.gibbonCourseClassID) JOIN gibbonPlannerEntryGuest ON (gibbonPlannerEntryGuest.gibbonPlannerEntryID=gibbonPlannerEntry.gibbonPlannerEntryID) JOIN gibbonCourse ON (gibbonCourse.gibbonCourseID=gibbonCourseClass.gibbonCourseID) WHERE date=:date2 AND gibbonPlannerEntryGuest.gibbonPersonID=:gibbonPersonID2) ORDER BY date, timeStart";
            $result = $connection2->prepare($sql);
            $result->execute($data);
        } catch (PDOException $e) {
            $plannerOutput .= "<div class='error'>" . $e->getMessage() . "</div>";
        }
        if ($result->rowCount() > 0) {
            $classes = TRUE;
            $plannerOutput .= "<table cellspacing='0' style='margin: 3px 0px; width: 100%'>";
            $plannerOutput .= "<tr class='head'>";
            $plannerOutput .= "<th>";
            $plannerOutput .= _("Class") . "<br/>";
            $plannerOutput .= "</th>";
            $plannerOutput .= "<th>";
            $plannerOutput .= _("Lesson") . "<br/>";
            $plannerOutput .= "<span style='font-size: 85%; font-weight: normal; font-style: italic'>" . _("Summary") . "</span>";
            $plannerOutput .= "</th>";
            $plannerOutput .= "<th>";
            $plannerOutput .= _("Homework");
            $plannerOutput .= "</th>";
            $plannerOutput .= "<th>";
            $plannerOutput .= _("Like");
            $plannerOutput .= "</th>";
            $plannerOutput .= "<th>";
            $plannerOutput .= _("Action");
            $plannerOutput .= "</th>";
            $plannerOutput .= "</tr>";
            $count2 = 0;
            $rowNum = "odd";
            while ($row = $result->fetch()) {
                if ($count2 % 2 == 0) {
                    $rowNum = "even";
                } else {
                    $rowNum = "odd";
                }
                $count2++;
                //Highlight class in progress
                if (date("H:i:s") > $row["timeStart"] and date("H:i:s") < $row["timeEnd"] and $date == date("Y-m-d")) {
                    $rowNum = "current";
                }
                //COLOR ROW BY STATUS!
                $plannerOutput .= "<tr class={$rowNum}>";
                $plannerOutput .= "<td>";
                $plannerOutput .= "<b>" . $row["course"] . "." . $row["class"] . "</b><br/>";
                $plannerOutput .= "</td>";
                $plannerOutput .= "<td>";
                $plannerOutput .= $row["name"] . "<br/>";
                $unit = getUnit($connection2, $row["gibbonUnitID"], $row["gibbonHookID"], $row["gibbonCourseClassID"]);
                if (isset($unit[0])) {
                    $plannerOutput .= $unit[0];
                    if ($unit[1] != "") {
                        $plannerOutput .= "<br/><i>" . $unit[1] . " " . _('Unit') . "</i><br/>";
                    }
                }
                $plannerOutput .= "<span style='font-size: 85%; font-weight: normal; font-style: italic'>";
                $plannerOutput .= $row["summary"];
                $plannerOutput .= "</span>";
                $plannerOutput .= "</td>";
                $plannerOutput .= "<td>";
                if ($row["homework"] == "N" and $row["myHomeworkDueDateTime"] == "") {
                    $plannerOutput .= _("No");
                } else {
                    if ($row["homework"] == "Y") {
                        $plannerOutput .= _("Yes") . ": " . _("Teacher Recorded") . "<br/>";
                        if ($row["homeworkSubmission"] == "Y") {
                            $plannerOutput .= "<span style='font-size: 85%; font-style: italic'>+" . _("Submission") . "</span><br/>";
                            if ($row["homeworkCrowdAssess"] == "Y") {
                                $plannerOutput .= "<span style='font-size: 85%; font-style: italic'>+" . _("Crowd Assessment") . "</span><br/>";
                            }
                        }
                    }
                    if ($row["myHomeworkDueDateTime"] != "") {
                        $plannerOutput .= _("Yes") . ": " . _("Student Recorded") . "</br>";
                    }
                }
                $plannerOutput .= "</td>";
                $plannerOutput .= "<td>";
                $likesGiven = countLikesByContextAndGiver($connection2, "Planner", "gibbonPlannerEntryID", $row["gibbonPlannerEntryID"], $_SESSION[$guid]["gibbonPersonID"]);
                if ($likesGiven != 1) {
                    $plannerOutput .= "<a href='" . $_SESSION[$guid]["absoluteURL"] . "/modules/Planner/plannerProcess.php?gibbonPlannerEntryID=" . $row["gibbonPlannerEntryID"] . "&address=/modules/Planner/planner.php&viewBy=date&date={$date}&gibbonPersonID=" . $gibbonPersonID . "&returnToIndex=Y'><img src='" . $_SESSION[$guid]["absoluteURL"] . "/themes/" . $_SESSION[$guid]["gibbonThemeName"] . "/img/like_off.png'></a>";
                } else {
                    $plannerOutput .= "<a href='" . $_SESSION[$guid]["absoluteURL"] . "/modules/Planner/plannerProcess.php?gibbonPlannerEntryID=" . $row["gibbonPlannerEntryID"] . "&address=/modules/Planner/planner.php&viewBy=date&date={$date}&gibbonPersonID=" . $gibbonPersonID . "&returnToIndex=Y'><img src='" . $_SESSION[$guid]["absoluteURL"] . "/themes/" . $_SESSION[$guid]["gibbonThemeName"] . "/img/like_on.png'></a>";
                }
                $plannerOutput .= "</td>";
                $plannerOutput .= "<td>";
                $plannerOutput .= "<a href='" . $_SESSION[$guid]["absoluteURL"] . "/index.php?q=/modules/Planner/planner_view_full.php&search=" . $gibbonPersonID . "&viewBy=date&gibbonPlannerEntryID=" . $row["gibbonPlannerEntryID"] . "&date={$date}&width=1000&height=550'><img title='" . _('View') . "' src='./themes/" . $_SESSION[$guid]["gibbonThemeName"] . "/img/plus.png'/></a> ";
                $plannerOutput .= "</td>";
                $plannerOutput .= "</tr>";
            }
            $plannerOutput .= "</table>";
        }
    }
    if ($classes == FALSE) {
        $plannerOutput .= "<div style='margin-top: 2px' class='warning'>";
        $plannerOutput .= _("There are no records to display.");
        $plannerOutput .= "</div>";
    }
    //PREPARE RECENT GRADES
    $gradesOutput = "<div style='margin-top: 20px'><span style='font-size: 85%; font-weight: bold'>" . _('Recent Grades') . "</span> . <span style='font-size: 70%'><a href='" . $_SESSION[$guid]["absoluteURL"] . "/index.php?q=/modules/Markbook/markbook_view.php&search=" . $gibbonPersonID . "'>" . _('View Markbook') . "</a></span></div>";
    $grades = FALSE;
    //Get alternative header names
    $attainmentAlternativeName = getSettingByScope($connection2, "Markbook", "attainmentAlternativeName");
    $attainmentAlternativeNameAbrev = getSettingByScope($connection2, "Markbook", "attainmentAlternativeNameAbrev");
    $effortAlternativeName = getSettingByScope($connection2, "Markbook", "effortAlternativeName");
    $effortAlternativeNameAbrev = getSettingByScope($connection2, "Markbook", "effortAlternativeNameAbrev");
    try {
        $dataEntry = array("gibbonSchoolYearID" => $_SESSION[$guid]["gibbonSchoolYearID"], "gibbonPersonID" => $gibbonPersonID);
        $sqlEntry = "SELECT *, gibbonMarkbookColumn.comment AS commentOn, gibbonMarkbookColumn.uploadedResponse AS uploadedResponseOn, gibbonMarkbookEntry.comment AS comment FROM gibbonMarkbookEntry JOIN gibbonMarkbookColumn ON (gibbonMarkbookEntry.gibbonMarkbookColumnID=gibbonMarkbookColumn.gibbonMarkbookColumnID) JOIN gibbonCourseClass ON (gibbonMarkbookColumn.gibbonCourseClassID=gibbonCourseClass.gibbonCourseClassID) JOIN gibbonCourse ON (gibbonCourse.gibbonCourseID=gibbonCourseClass.gibbonCourseID) WHERE gibbonSchoolYearID=:gibbonSchoolYearID AND gibbonPersonIDStudent=:gibbonPersonID AND complete='Y' AND completeDate<='" . date("Y-m-d") . "' AND viewableParents='Y' ORDER BY completeDate DESC LIMIT 0, 3";
        $resultEntry = $connection2->prepare($sqlEntry);
        $resultEntry->execute($dataEntry);
    } catch (PDOException $e) {
        $gradesOutput .= "<div class='error'>" . $e->getMessage() . "</div>";
    }
    if ($resultEntry->rowCount() > 0) {
        $showParentAttainmentWarning = getSettingByScope($connection2, "Markbook", "showParentAttainmentWarning");
        $showParentEffortWarning = getSettingByScope($connection2, "Markbook", "showParentEffortWarning");
        $grades = TRUE;
        $gradesOutput .= "<table cellspacing='0' style='margin: 3px 0px; width: 100%'>";
        $gradesOutput .= "<tr class='head'>";
        $gradesOutput .= "<th style='width: 120px'>";
        $gradesOutput .= _("Assessment");
        $gradesOutput .= "</th>";
        $gradesOutput .= "<th style='width: 75px'>";
        if ($attainmentAlternativeName != "") {
            $gradesOutput .= $attainmentAlternativeName;
        } else {
            $gradesOutput .= _('Attainment');
        }
        $gradesOutput .= "</th>";
        $gradesOutput .= "<th style='width: 75px'>";
        if ($effortAlternativeName != "") {
            $gradesOutput .= $effortAlternativeName;
        } else {
            $gradesOutput .= _('Effort');
        }
        $gradesOutput .= "</th>";
        $gradesOutput .= "<th>";
        $gradesOutput .= _("Comment");
        $gradesOutput .= "</th>";
        $gradesOutput .= "<th style='width: 75px'>";
        $gradesOutput .= _("Submission");
        $gradesOutput .= "</th>";
        $gradesOutput .= "</tr>";
        $count3 = 0;
        while ($rowEntry = $resultEntry->fetch()) {
            if ($count3 % 2 == 0) {
                $rowNum = "even";
            } else {
                $rowNum = "odd";
            }
            $count3++;
            $gradesOutput .= "<a name='" . $rowEntry["gibbonMarkbookEntryID"] . "'></a>";
            $gradesOutput .= "<tr class={$rowNum}>";
            $gradesOutput .= "<td>";
            $gradesOutput .= "<span title='" . htmlPrep($rowEntry["description"]) . "'>" . $rowEntry["name"] . "</span><br/>";
            $gradesOutput .= "<span style='font-size: 90%; font-style: italic; font-weight: normal'>";
            $gradesOutput .= _("Marked on") . " " . dateConvertBack($guid, $rowEntry["completeDate"]) . "<br/>";
            $gradesOutput .= "</span>";
            $gradesOutput .= "</td>";
            if ($rowEntry["attainment"] == "N" or $rowEntry["gibbonScaleIDAttainment"] == "" and $rowEntry["gibbonRubricIDAttainment"] == "") {
                $gradesOutput .= "<td class='dull' style='color: #bbb; text-align: center'>";
                $gradesOutput .= _('N/A');
                $gradesOutput .= "</td>";
            } else {
                $gradesOutput .= "<td style='text-align: center'>";
                $attainmentExtra = "";
                try {
                    $dataAttainment = array("gibbonScaleID" => $rowEntry["gibbonScaleIDAttainment"]);
                    $sqlAttainment = "SELECT * FROM gibbonScale WHERE gibbonScaleID=:gibbonScaleID";
                    $resultAttainment = $connection2->prepare($sqlAttainment);
                    $resultAttainment->execute($dataAttainment);
                } catch (PDOException $e) {
                }
                if ($resultAttainment->rowCount() == 1) {
                    $rowAttainment = $resultAttainment->fetch();
                    $attainmentExtra = "<br/>" . _($rowAttainment["usage"]);
                }
                $styleAttainment = "style='font-weight: bold'";
                if ($rowEntry["attainmentConcern"] == "Y" and $showParentAttainmentWarning == "Y") {
                    $styleAttainment = "style='color: #" . $alert["color"] . "; font-weight: bold; border: 2px solid #" . $alert["color"] . "; padding: 2px 4px; background-color: #" . $alert["colorBG"] . "'";
                } else {
                    if ($rowEntry["attainmentConcern"] == "P" and $showParentAttainmentWarning == "Y") {
                        $styleAttainment = "style='color: #390; font-weight: bold; border: 2px solid #390; padding: 2px 4px; background-color: #D4F6DC'";
                    }
                }
                $gradesOutput .= "<div {$styleAttainment}>" . $rowEntry["attainmentValue"];
                if ($rowEntry["gibbonRubricIDAttainment"] != "") {
                    $gradesOutput .= "<a class='thickbox' href='" . $_SESSION[$guid]["absoluteURL"] . "/fullscreen.php?q=/modules/Markbook/markbook_view_rubric.php&gibbonRubricID=" . $rowEntry["gibbonRubricIDAttainment"] . "&gibbonCourseClassID=" . $rowEntry["gibbonCourseClassID"] . "&gibbonMarkbookColumnID=" . $rowEntry["gibbonMarkbookColumnID"] . "&gibbonPersonID=" . $gibbonPersonID . "&mark=FALSE&type=attainment&width=1100&height=550'><img style='margin-bottom: -3px; margin-left: 3px' title='View Rubric' src='./themes/" . $_SESSION[$guid]["gibbonThemeName"] . "/img/rubric.png'/></a>";
                }
                $gradesOutput .= "</div>";
                if ($rowEntry["attainmentValue"] != "") {
                    $gradesOutput .= "<div class='detailItem' style='font-size: 75%; font-style: italic; margin-top: 2px'><b>" . htmlPrep(_($rowEntry["attainmentDescriptor"])) . "</b>" . _($attainmentExtra) . "</div>";
                }
                $gradesOutput .= "</td>";
            }
            if ($rowEntry["effort"] == "N" or $rowEntry["gibbonScaleIDEffort"] == "" and $rowEntry["gibbonRubricIDEffort"] == "") {
                $gradesOutput .= "<td class='dull' style='color: #bbb; text-align: center'>";
                $gradesOutput .= _('N/A');
                $gradesOutput .= "</td>";
            } else {
                $gradesOutput .= "<td style='text-align: center'>";
                $effortExtra = "";
                try {
                    $dataEffort = array("gibbonScaleID" => $rowEntry["gibbonScaleIDEffort"]);
                    $sqlEffort = "SELECT * FROM gibbonScale WHERE gibbonScaleID=:gibbonScaleID";
                    $resultEffort = $connection2->prepare($sqlEffort);
                    $resultEffort->execute($dataEffort);
                } catch (PDOException $e) {
                }
                if ($resultEffort->rowCount() == 1) {
                    $rowEffort = $resultEffort->fetch();
                    $effortExtra = "<br/>" . _($rowEffort["usage"]);
                }
                $styleEffort = "style='font-weight: bold'";
                if ($rowEntry["effortConcern"] == "Y" and $showParentEffortWarning == "Y") {
                    $styleEffort = "style='color: #" . $alert["color"] . "; font-weight: bold; border: 2px solid #" . $alert["color"] . "; padding: 2px 4px; background-color: #" . $alert["colorBG"] . "'";
                }
                $gradesOutput .= "<div {$styleEffort}>" . $rowEntry["effortValue"];
                if ($rowEntry["gibbonRubricIDEffort"] != "") {
                    $gradesOutput .= "<a class='thickbox' href='" . $_SESSION[$guid]["absoluteURL"] . "/fullscreen.php?q=/modules/Markbook/markbook_view_rubric.php&gibbonRubricID=" . $rowEntry["gibbonRubricIDEffort"] . "&gibbonCourseClassID=" . $rowEntry["gibbonCourseClassID"] . "&gibbonMarkbookColumnID=" . $rowEntry["gibbonMarkbookColumnID"] . "&gibbonPersonID=" . $gibbonPersonID . "&mark=FALSE&type=effort&width=1100&height=550'><img style='margin-bottom: -3px; margin-left: 3px' title='View Rubric' src='./themes/" . $_SESSION[$guid]["gibbonThemeName"] . "/img/rubric.png'/></a>";
                }
                $gradesOutput .= "</div>";
                if ($rowEntry["effortValue"] != "") {
                    $gradesOutput .= "<div class='detailItem' style='font-size: 75%; font-style: italic; margin-top: 2px'><b>" . htmlPrep(_($rowEntry["effortDescriptor"])) . "</b>" . _($effortExtra) . "</div>";
                }
                $gradesOutput .= "</td>";
            }
            if ($rowEntry["commentOn"] == "N" and $rowEntry["uploadedResponseOn"] == "N") {
                $gradesOutput .= "<td class='dull' style='color: #bbb; text-align: left'>";
                $gradesOutput .= _('N/A');
                $gradesOutput .= "</td>";
            } else {
                $gradesOutput .= "<td>";
                if ($rowEntry["comment"] != "") {
                    if (strlen($rowEntry["comment"]) > 50) {
                        $gradesOutput .= "<script type='text/javascript'>";
                        $gradesOutput .= "\$(document).ready(function(){";
                        $gradesOutput .= "\$(\".comment-{$entryCount}-{$gibbonPersonID}\").hide();";
                        $gradesOutput .= "\$(\".show_hide-{$entryCount}-{$gibbonPersonID}\").fadeIn(1000);";
                        $gradesOutput .= "\$(\".show_hide-{$entryCount}-{$gibbonPersonID}\").click(function(){";
                        $gradesOutput .= "\$(\".comment-{$entryCount}-{$gibbonPersonID}\").fadeToggle(1000);";
                        $gradesOutput .= "});";
                        $gradesOutput .= "});";
                        $gradesOutput .= "</script>";
                        $gradesOutput .= "<span>" . substr($rowEntry["comment"], 0, 50) . "...<br/>";
                        $gradesOutput .= "<a title='" . _('View Description') . "' class='show_hide-{$entryCount}-{$gibbonPersonID}' onclick='return false;' href='#'>" . _('Read more') . "</a></span><br/>";
                    } else {
                        $gradesOutput .= $rowEntry["comment"];
                    }
                    $gradesOutput .= "<br/>";
                }
                if ($rowEntry["response"] != "") {
                    $gradesOutput .= "<a title='" . _('Uploaded Response') . "' href='" . $_SESSION[$guid]["absoluteURL"] . "/" . $rowEntry["response"] . "'>" . _('Uploaded Response') . "</a><br/>";
                }
                $gradesOutput .= "</td>";
            }
            if ($rowEntry["gibbonPlannerEntryID"] == 0) {
                $gradesOutput .= "<td class='dull' style='color: #bbb; text-align: left'>";
                $gradesOutput .= _('N/A');
                $gradesOutput .= "</td>";
            } else {
                try {
                    $dataSub = array("gibbonPlannerEntryID" => $rowEntry["gibbonPlannerEntryID"]);
                    $sqlSub = "SELECT * FROM gibbonPlannerEntry WHERE gibbonPlannerEntryID=:gibbonPlannerEntryID AND homeworkSubmission='Y'";
                    $resultSub = $connection2->prepare($sqlSub);
                    $resultSub->execute($dataSub);
                } catch (PDOException $e) {
                    $gradesOutput .= "<div class='error'>" . $e->getMessage() . "</div>";
                }
                if ($resultSub->rowCount() != 1) {
                    $gradesOutput .= "<td class='dull' style='color: #bbb; text-align: left'>";
                    $gradesOutput .= _('N/A');
                    $gradesOutput .= "</td>";
                } else {
                    $gradesOutput .= "<td>";
                    $rowSub = $resultSub->fetch();
                    try {
                        $dataWork = array("gibbonPlannerEntryID" => $rowEntry["gibbonPlannerEntryID"], "gibbonPersonID" => $gibbonPersonID);
                        $sqlWork = "SELECT * FROM gibbonPlannerEntryHomework WHERE gibbonPlannerEntryID=:gibbonPlannerEntryID AND gibbonPersonID=:gibbonPersonID ORDER BY count DESC";
                        $resultWork = $connection2->prepare($sqlWork);
                        $resultWork->execute($dataWork);
                    } catch (PDOException $e) {
                        $gradesOutput .= "<div class='error'>" . $e->getMessage() . "</div>";
                    }
                    if ($resultWork->rowCount() > 0) {
                        $rowWork = $resultWork->fetch();
                        if ($rowWork["status"] == "Exemption") {
                            $linkText = _("Exemption");
                        } else {
                            if ($rowWork["version"] == "Final") {
                                $linkText = _("Final");
                            } else {
                                $linkText = _("Draft") . " " . $rowWork["count"];
                            }
                        }
                        $style = "";
                        $status = "On Time";
                        if ($rowWork["status"] == "Exemption") {
                            $status = _("Exemption");
                        } else {
                            if ($rowWork["status"] == "Late") {
                                $style = "style='color: #ff0000; font-weight: bold; border: 2px solid #ff0000; padding: 2px 4px'";
                                $status = _("Late");
                            }
                        }
                        if ($rowWork["type"] == "File") {
                            $gradesOutput .= "<span title='" . $rowWork["version"] . ". {$status}. " . sprintf(_('Submitted at %1$s on %2$s'), substr($rowWork["timestamp"], 11, 5), dateConvertBack($guid, substr($rowWork["timestamp"], 0, 10))) . "' {$style}><a href='" . $_SESSION[$guid]["absoluteURL"] . "/" . $rowWork["location"] . "'>{$linkText}</a></span>";
                        } else {
                            if ($rowWork["type"] == "Link") {
                                $gradesOutput .= "<span title='" . $rowWork["version"] . ". {$status}. " . sprintf(_('Submitted at %1$s on %2$s'), substr($rowWork["timestamp"], 11, 5), dateConvertBack($guid, substr($rowWork["timestamp"], 0, 10))) . "' {$style}><a target='_blank' href='" . $rowWork["location"] . "'>{$linkText}</a></span>";
                            } else {
                                $gradesOutput .= "<span title='{$status}. " . sprintf(_('Recorded at %1$s on %2$s'), substr($rowWork["timestamp"], 11, 5), dateConvertBack($guid, substr($rowWork["timestamp"], 0, 10))) . "' {$style}>{$linkText}</span>";
                            }
                        }
                    } else {
                        if (date("Y-m-d H:i:s") < $rowSub["homeworkDueDateTime"]) {
                            $gradesOutput .= "<span title='Pending'>" . _('Pending') . "</span>";
                        } else {
                            if ($row["dateStart"] > $rowSub["date"]) {
                                $gradesOutput .= "<span title='" . _('Student joined school after assessment was given.') . "' style='color: #000; font-weight: normal; border: 2px none #ff0000; padding: 2px 4px'>" . _('NA') . "</span>";
                            } else {
                                if ($rowSub["homeworkSubmissionRequired"] == "Compulsory") {
                                    $gradesOutput .= "<div style='color: #ff0000; font-weight: bold; border: 2px solid #ff0000; padding: 2px 4px; margin: 2px 0px'>" . _('Incomplete') . "</div>";
                                } else {
                                    $gradesOutput .= _("Not submitted online");
                                }
                            }
                        }
                    }
                    $gradesOutput .= "</td>";
                }
            }
            $gradesOutput .= "</tr>";
            if (strlen($rowEntry["comment"]) > 50) {
                $gradesOutput .= "<tr class='comment-{$entryCount}-{$gibbonPersonID}' id='comment-{$entryCount}-{$gibbonPersonID}'>";
                $gradesOutput .= "<td colspan=6>";
                $gradesOutput .= $rowEntry["comment"];
                $gradesOutput .= "</td>";
                $gradesOutput .= "</tr>";
            }
            $entryCount++;
        }
        $gradesOutput .= "</table>";
    }
    if ($grades == FALSE) {
        $gradesOutput .= "<div style='margin-top: 2px' class='warning'>";
        $gradesOutput .= _("There are no records to display.");
        $gradesOutput .= "</div>";
    }
    //PREPARE UPCOMING DEADLINES
    $deadlinesOutput = "<div style='margin-top: 20px'><span style='font-size: 85%; font-weight: bold'>" . _('Upcoming Deadlines') . "</span> . <span style='font-size: 70%'><a href='" . $_SESSION[$guid]["absoluteURL"] . "/index.php?q=/modules/Planner/planner_deadlines.php&search=" . $gibbonPersonID . "'>" . _('View All Deadlines') . "</a></span></div>";
    $deadlines = FALSE;
    try {
        $data = array("gibbonSchoolYearID" => $_SESSION[$guid]["gibbonSchoolYearID"], "gibbonPersonID" => $gibbonPersonID);
        $sql = "\n\t\t(SELECT 'teacherRecorded' AS type, gibbonPlannerEntryID, gibbonUnitID, gibbonCourse.nameShort AS course, gibbonCourseClass.nameShort AS class, gibbonPlannerEntry.name, date, timeStart, timeEnd, viewableStudents, viewableParents, homework, homeworkDueDateTime, role FROM gibbonPlannerEntry JOIN gibbonCourseClass ON (gibbonPlannerEntry.gibbonCourseClassID=gibbonCourseClass.gibbonCourseClassID) JOIN gibbonCourseClassPerson ON (gibbonCourseClass.gibbonCourseClassID=gibbonCourseClassPerson.gibbonCourseClassID) JOIN gibbonCourse ON (gibbonCourse.gibbonCourseID=gibbonCourseClass.gibbonCourseID) WHERE gibbonSchoolYearID=:gibbonSchoolYearID AND gibbonCourseClassPerson.gibbonPersonID=:gibbonPersonID AND NOT role='Student - Left' AND NOT role='Teacher - Left' AND homework='Y' AND (role='Teacher' OR (role='Student' AND viewableStudents='Y')) AND homeworkDueDateTime>'" . date("Y-m-d H:i:s") . "' AND ((date<'" . date("Y-m-d") . "') OR (date='" . date("Y-m-d") . "' AND timeEnd<='" . date("H:i:s") . "')))\n\t\tUNION\n\t\t(SELECT 'studentRecorded' AS type, gibbonPlannerEntry.gibbonPlannerEntryID, gibbonUnitID, gibbonCourse.nameShort AS course, gibbonCourseClass.nameShort AS class, gibbonPlannerEntry.name, date, timeStart, timeEnd, 'Y' AS viewableStudents, 'Y' AS viewableParents, 'Y' AS homework, gibbonPlannerEntryStudentHomework.homeworkDueDateTime, role FROM gibbonPlannerEntry JOIN gibbonCourseClass ON (gibbonPlannerEntry.gibbonCourseClassID=gibbonCourseClass.gibbonCourseClassID) JOIN gibbonCourseClassPerson ON (gibbonCourseClass.gibbonCourseClassID=gibbonCourseClassPerson.gibbonCourseClassID) JOIN gibbonCourse ON (gibbonCourse.gibbonCourseID=gibbonCourseClass.gibbonCourseID) JOIN gibbonPlannerEntryStudentHomework ON (gibbonPlannerEntryStudentHomework.gibbonPlannerEntryID=gibbonPlannerEntry.gibbonPlannerEntryID AND gibbonPlannerEntryStudentHomework.gibbonPersonID=gibbonCourseClassPerson.gibbonPersonID) WHERE gibbonSchoolYearID=:gibbonSchoolYearID AND gibbonCourseClassPerson.gibbonPersonID=:gibbonPersonID AND NOT role='Student - Left' AND NOT role='Teacher - Left' AND (role='Teacher' OR (role='Student' AND viewableStudents='Y')) AND gibbonPlannerEntryStudentHomework.homeworkDueDateTime>'" . date("Y-m-d H:i:s") . "' AND ((date<'" . date("Y-m-d") . "') OR (date='" . date("Y-m-d") . "' AND timeEnd<='" . date("H:i:s") . "')))\n\t\tORDER BY homeworkDueDateTime, type";
        $result = $connection2->prepare($sql);
        $result->execute($data);
    } catch (PDOException $e) {
        $deadlinesOutput .= "<div class='error'>" . $e->getMessage() . "</div>";
    }
    if ($result->rowCount() > 0) {
        $deadlines = TRUE;
        $deadlinesOutput .= "<ol style='margin-left: 15px'>";
        while ($row = $result->fetch()) {
            $diff = (strtotime(substr($row["homeworkDueDateTime"], 0, 10)) - strtotime(date("Y-m-d"))) / 86400;
            $style = "style='padding-right: 3px;'";
            if ($diff < 2) {
                $style = "style='padding-right: 3px; border-right: 10px solid #cc0000'";
            } else {
                if ($diff < 4) {
                    $style = "style='padding-right: 3px; border-right: 10px solid #D87718'";
                }
            }
            $deadlinesOutput .= "<li {$style}>";
            $deadlinesOutput .= "<a href='" . $_SESSION[$guid]["absoluteURL"] . "/index.php?q=/modules/Planner/planner_view_full.php&search=" . $gibbonPersonID . "&gibbonPlannerEntryID=" . $row["gibbonPlannerEntryID"] . "&viewBy=date&date={$date}&width=1000&height=550'>" . $row["course"] . "." . $row["class"] . "</a> ";
            $deadlinesOutput .= "<span style='font-style: italic'>" . sprintf(_('Due at %1$s on %2$s'), substr($row["homeworkDueDateTime"], 11, 5), dateConvertBack($guid, substr($row["homeworkDueDateTime"], 0, 10)));
            $deadlinesOutput .= "</li>";
        }
        $deadlinesOutput .= "</ol>";
    }
    if ($deadlines == FALSE) {
        $deadlinesOutput .= "<div style='margin-top: 2px' class='warning'>";
        $deadlinesOutput .= _("There are no records to display.");
        $deadlinesOutput .= "</div>";
    }
    //PREPARE TIMETABLE
    $timetable = FALSE;
    $timetableOutput = "";
    if (isActionAccessible($guid, $connection2, "/modules/Timetable/tt_view.php")) {
        $date = date("Y-m-d");
        if (isset($_POST["ttDate"])) {
            $date = dateConvert($guid, $_POST["ttDate"]);
        }
        $params = "";
        if ($classes != FALSE or $grades != FALSE or $deadlines != FALSE) {
            $params = "&tab=1";
        }
        $timetableOutputTemp = renderTT($guid, $connection2, $gibbonPersonID, NULL, NULL, dateConvertToTimestamp($date), "", $params, TRUE);
        if ($timetableOutputTemp != FALSE) {
            $timetable = TRUE;
            $timetableOutput .= $timetableOutputTemp;
        }
    }
    //PREPARE ACTIVITIES
    $activities = FALSE;
    $activitiesOutput = FALSE;
    if (!isActionAccessible($guid, $connection2, "/modules/Activities/activities_view.php")) {
        $activitiesOutput .= "<div class='error'>";
        $activitiesOutput .= _("Your request failed because you do not have access to this action.");
        $activitiesOutput .= "</div>";
    } else {
        $activities = TRUE;
        $activitiesOutput .= "<div class='linkTop'>";
        $activitiesOutput .= "<a href='" . $_SESSION[$guid]["absoluteURL"] . "/index.php?q=/modules/Activities/activities_view.php'>" . _('View Available Activities') . "</a>";
        $activitiesOutput .= "</div>";
        $dateType = getSettingByScope($connection2, 'Activities', 'dateType');
        if ($dateType == "Term") {
            $maxPerTerm = getSettingByScope($connection2, 'Activities', 'maxPerTerm');
        }
        try {
            $dataYears = array("gibbonPersonID" => $gibbonPersonID);
            $sqlYears = "SELECT * FROM gibbonStudentEnrolment JOIN gibbonSchoolYear ON (gibbonStudentEnrolment.gibbonSchoolYearID=gibbonSchoolYear.gibbonSchoolYearID) WHERE gibbonSchoolYear.status='Current' AND gibbonPersonID=:gibbonPersonID ORDER BY sequenceNumber DESC";
            $resultYears = $connection2->prepare($sqlYears);
            $resultYears->execute($dataYears);
        } catch (PDOException $e) {
            $activitiesOutput .= "<div class='error'>" . $e->getMessage() . "</div>";
        }
        if ($resultYears->rowCount() < 1) {
            $activitiesOutput .= "<div class='error'>";
            $activitiesOutput .= _("There are no records to display.");
            $activitiesOutput .= "</div>";
        } else {
            $yearCount = 0;
            while ($rowYears = $resultYears->fetch()) {
                $yearCount++;
                try {
                    $data = array("gibbonPersonID" => $gibbonPersonID, "gibbonSchoolYearID" => $rowYears["gibbonSchoolYearID"]);
                    $sql = "SELECT gibbonActivity.*, gibbonActivityStudent.status, NULL AS role FROM gibbonActivity JOIN gibbonActivityStudent ON (gibbonActivity.gibbonActivityID=gibbonActivityStudent.gibbonActivityID) WHERE gibbonActivityStudent.gibbonPersonID=:gibbonPersonID AND gibbonSchoolYearID=:gibbonSchoolYearID AND active='Y' ORDER BY name";
                    $result = $connection2->prepare($sql);
                    $result->execute($data);
                } catch (PDOException $e) {
                    $activitiesOutput .= "<div class='error'>" . $e->getMessage() . "</div>";
                }
                if ($result->rowCount() < 1) {
                    $activitiesOutput .= "<div class='error'>";
                    $activitiesOutput .= _("There are no records to display.");
                    $activitiesOutput .= "</div>";
                } else {
                    $activitiesOutput .= "<table cellspacing='0' style='width: 100%'>";
                    $activitiesOutput .= "<tr class='head'>";
                    $activitiesOutput .= "<th>";
                    $activitiesOutput .= _("Activity");
                    $activitiesOutput .= "</th>";
                    $options = getSettingByScope($connection2, "Activities", "activityTypes");
                    if ($options != "") {
                        $activitiesOutput .= "<th>";
                        $activitiesOutput .= _("Type");
                        $activitiesOutput .= "</th>";
                    }
                    $activitiesOutput .= "<th>";
                    if ($dateType != "Date") {
                        $activitiesOutput .= _("Term");
                    } else {
                        $activitiesOutput .= _("Dates");
                    }
                    $activitiesOutput .= "</th>";
                    $activitiesOutput .= "<th>";
                    $activitiesOutput .= _("Status");
                    $activitiesOutput .= "</th>";
                    $activitiesOutput .= "</tr>";
                    $count = 0;
                    $rowNum = "odd";
                    while ($row = $result->fetch()) {
                        if ($count % 2 == 0) {
                            $rowNum = "even";
                        } else {
                            $rowNum = "odd";
                        }
                        $count++;
                        //COLOR ROW BY STATUS!
                        $activitiesOutput .= "<tr class={$rowNum}>";
                        $activitiesOutput .= "<td>";
                        $activitiesOutput .= $row["name"];
                        $activitiesOutput .= "</td>";
                        if ($options != "") {
                            $activitiesOutput .= "<td>";
                            $activitiesOutput .= trim($row["type"]);
                            $activitiesOutput .= "</td>";
                        }
                        $activitiesOutput .= "<td>";
                        if ($dateType != "Date") {
                            $terms = getTerms($connection2, $_SESSION[$guid]["gibbonSchoolYearID"], true);
                            $termList = "";
                            for ($i = 0; $i < count($terms); $i = $i + 2) {
                                if (is_numeric(strpos($row["gibbonSchoolYearTermIDList"], $terms[$i]))) {
                                    $termList .= $terms[$i + 1] . "<br/>";
                                }
                            }
                            $activitiesOutput .= $termList;
                        } else {
                            if (substr($row["programStart"], 0, 4) == substr($row["programEnd"], 0, 4)) {
                                if (substr($row["programStart"], 5, 2) == substr($row["programEnd"], 5, 2)) {
                                    $activitiesOutput .= date("F", mktime(0, 0, 0, substr($row["programStart"], 5, 2))) . " " . substr($row["programStart"], 0, 4);
                                } else {
                                    $activitiesOutput .= date("F", mktime(0, 0, 0, substr($row["programStart"], 5, 2))) . " - " . date("F", mktime(0, 0, 0, substr($row["programEnd"], 5, 2))) . "<br/>" . substr($row["programStart"], 0, 4);
                                }
                            } else {
                                $activitiesOutput .= date("F", mktime(0, 0, 0, substr($row["programStart"], 5, 2))) . " " . substr($row["programStart"], 0, 4) . " -<br/>" . date("F", mktime(0, 0, 0, substr($row["programEnd"], 5, 2))) . " " . substr($row["programEnd"], 0, 4);
                            }
                        }
                        $activitiesOutput .= "</td>";
                        $activitiesOutput .= "<td>";
                        if ($row["status"] != "") {
                            $activitiesOutput .= $row["status"];
                        } else {
                            $activitiesOutput .= "<i>" . _('NA') . "</i>";
                        }
                        $activitiesOutput .= "</td>";
                        $activitiesOutput .= "</tr>";
                    }
                    $activitiesOutput .= "</table>";
                }
            }
        }
    }
    //GET HOOKS INTO DASHBOARD
    $hooks = array();
    try {
        $dataHooks = array();
        $sqlHooks = "SELECT * FROM gibbonHook WHERE type='Parental Dashboard'";
        $resultHooks = $connection2->prepare($sqlHooks);
        $resultHooks->execute($dataHooks);
    } catch (PDOException $e) {
        print "<div class='error'>" . $e->getMessage() . "</div>";
    }
    if ($resultHooks->rowCount() > 0) {
        $count = 0;
        while ($rowHooks = $resultHooks->fetch()) {
            $options = unserialize($rowHooks["options"]);
            //Check for permission to hook
            try {
                $dataHook = array("gibbonRoleIDCurrent" => $_SESSION[$guid]["gibbonRoleIDCurrent"], "sourceModuleName" => $options["sourceModuleName"]);
                $sqlHook = "SELECT gibbonHook.name, gibbonModule.name AS module, gibbonAction.name AS action FROM gibbonHook JOIN gibbonModule ON (gibbonHook.gibbonModuleID=gibbonModule.gibbonModuleID) JOIN gibbonAction ON (gibbonAction.gibbonModuleID=gibbonModule.gibbonModuleID) JOIN gibbonPermission ON (gibbonPermission.gibbonActionID=gibbonAction.gibbonActionID) WHERE gibbonAction.gibbonModuleID=(SELECT gibbonModuleID FROM gibbonModule WHERE gibbonPermission.gibbonRoleID=:gibbonRoleIDCurrent AND name=:sourceModuleName) AND gibbonHook.type='Parental Dashboard'  AND gibbonAction.name='" . $options["sourceModuleAction"] . "' AND gibbonModule.name='" . $options["sourceModuleName"] . "' ORDER BY name";
                $resultHook = $connection2->prepare($sqlHook);
                $resultHook->execute($dataHook);
            } catch (PDOException $e) {
            }
            if ($resultHook->rowCount() == 1) {
                $rowHook = $resultHook->fetch();
                $hooks[$count]["name"] = $rowHooks["name"];
                $hooks[$count]["sourceModuleName"] = $rowHook["module"];
                $hooks[$count]["sourceModuleInclude"] = $options["sourceModuleInclude"];
                $count++;
            }
        }
    }
    if ($classes == FALSE and $grades == FALSE and $deadlines == FALSE and $timetable == FALSE and $activities == FALSE and count($hooks) < 1) {
        $return .= "<div class='warning'>";
        $return .= _("There are no records to display.");
        $return .= "</div>";
    } else {
        $defaultTab = 0;
        if (isset($_GET["tab"])) {
            $defaultTab = $_GET["tab"];
        }
        $return .= "<script type='text/javascript'>";
        $return .= "\$(function() {";
        $return .= "\$( \"#" . $gibbonPersonID . "tabs\" ).tabs({";
        $return .= "active: " . $defaultTab . ",";
        $return .= "ajaxOptions: {";
        $return .= "error: function( xhr, status, index, anchor ) {";
        $return .= "\$( anchor.hash ).html(";
        $return .= "\"Couldn't load this tab.\" );";
        $return .= "}";
        $return .= "}";
        $return .= "});";
        $return .= "});";
        $return .= "</script>";
        $return .= "<div id='" . $gibbonPersonID . "tabs' style='margin: 0 0'>";
        $return .= "<ul>";
        if ($classes != FALSE or $grades != FALSE or $deadlines != FALSE) {
            $return .= "<li><a href='#tabs1'>" . _('Learning Overview') . "</a></li>";
        }
        if ($timetable != FALSE) {
            $return .= "<li><a href='#tabs2'>" . _('Timetable') . "</a></li>";
        }
        if ($activities != FALSE) {
            $return .= "<li><a href='#tabs3'>" . _('Activities') . "</a></li>";
        }
        $tabCountExtra = 3;
        foreach ($hooks as $hook) {
            $tabCountExtra++;
            $return .= "<li><a href='#tabs" . $tabCountExtra . "'>" . _($hook["name"]) . "</a></li>";
        }
        $return .= "</ul>";
        if ($classes != FALSE or $grades != FALSE or $deadlines != FALSE) {
            $return .= "<div id='tabs1'>";
            $return .= $plannerOutput;
            $return .= $gradesOutput;
            $return .= $deadlinesOutput;
            $return .= "</div>";
        }
        if ($timetable != FALSE) {
            $return .= "<div id='tabs2'>";
            $return .= $timetableOutput;
            $return .= "</div>";
        }
        if ($activities != FALSE) {
            $return .= "<div id='tabs3'>";
            $return .= $activitiesOutput;
            $return .= "</div>";
        }
        $tabCountExtra = 3;
        foreach ($hooks as $hook) {
            $tabCountExtra++;
            $return .= "<div style='min-height: 100px' id='tabs" . $tabCountExtra . "'>";
            $include = $_SESSION[$guid]["absolutePath"] . "/modules/" . $hook["sourceModuleName"] . "/" . $hook["sourceModuleInclude"];
            if (!file_exists($include)) {
                $return .= "<div class='error'>";
                $return .= _("The selected page cannot be displayed due to a hook error.");
                $return .= "</div>";
            } else {
                $return .= (include $include);
            }
            $return .= "</div>";
        }
        $return .= "</div>";
    }
    return $return;
}
コード例 #9
0
ファイル: index.php プロジェクト: dpredster/core
             }
             print "</div>";
         }
     }
 } else {
     if ($category == "Student" or $category == "Staff") {
         //Get Smart Workflow help message
         if ($category == "Staff") {
             $smartWorkflowHelp = getSmartWorkflowHelp($connection2, $guid);
             if ($smartWorkflowHelp != false) {
                 print $smartWorkflowHelp;
             }
         }
         //Display planner
         $date = date("Y-m-d");
         if (isSchoolOpen($guid, $date, $connection2) == TRUE and isActionAccessible($guid, $connection2, "/modules/Planner/planner.php") and $_SESSION[$guid]["username"] != "") {
             try {
                 $data = array("gibbonSchoolYearID" => $_SESSION[$guid]["gibbonSchoolYearID"], "date" => $date, "gibbonPersonID" => $_SESSION[$guid]["gibbonPersonID"], "gibbonSchoolYearID2" => $_SESSION[$guid]["gibbonSchoolYearID"], "date2" => $date, "gibbonPersonID2" => $_SESSION[$guid]["gibbonPersonID"]);
                 $sql = "(SELECT gibbonCourseClass.gibbonCourseClassID, gibbonPlannerEntry.gibbonPlannerEntryID, gibbonUnitID, gibbonHookID, gibbonPlannerEntry.gibbonCourseClassID, gibbonCourse.nameShort AS course, gibbonCourseClass.nameShort AS class, gibbonPlannerEntry.name, timeStart, timeEnd, viewableStudents, viewableParents, homework, homeworkSubmission, homeworkCrowdAssess, role, date, summary, gibbonPlannerEntryStudentHomework.homeworkDueDateTime AS myHomeworkDueDateTime FROM gibbonPlannerEntry JOIN gibbonCourseClass ON (gibbonPlannerEntry.gibbonCourseClassID=gibbonCourseClass.gibbonCourseClassID) JOIN gibbonCourseClassPerson ON (gibbonCourseClass.gibbonCourseClassID=gibbonCourseClassPerson.gibbonCourseClassID) JOIN gibbonCourse ON (gibbonCourse.gibbonCourseID=gibbonCourseClass.gibbonCourseID) LEFT JOIN gibbonPlannerEntryStudentHomework ON (gibbonPlannerEntryStudentHomework.gibbonPlannerEntryID=gibbonPlannerEntry.gibbonPlannerEntryID AND gibbonPlannerEntryStudentHomework.gibbonPersonID=gibbonCourseClassPerson.gibbonPersonID) WHERE gibbonSchoolYearID=:gibbonSchoolYearID AND date=:date AND gibbonCourseClassPerson.gibbonPersonID=:gibbonPersonID AND NOT role='Student - Left' AND NOT role='Teacher - Left') UNION (SELECT gibbonCourseClass.gibbonCourseClassID, gibbonPlannerEntry.gibbonPlannerEntryID, gibbonUnitID, gibbonHookID, gibbonPlannerEntry.gibbonCourseClassID, gibbonCourse.nameShort AS course, gibbonCourseClass.nameShort AS class, gibbonPlannerEntry.name, timeStart, timeEnd, viewableStudents, viewableParents, homework, homeworkSubmission, homeworkCrowdAssess,  role, date, summary, NULL AS myHomeworkDueDateTime FROM gibbonPlannerEntry JOIN gibbonCourseClass ON (gibbonPlannerEntry.gibbonCourseClassID=gibbonCourseClass.gibbonCourseClassID) JOIN gibbonPlannerEntryGuest ON (gibbonPlannerEntryGuest.gibbonPlannerEntryID=gibbonPlannerEntry.gibbonPlannerEntryID) JOIN gibbonCourse ON (gibbonCourse.gibbonCourseID=gibbonCourseClass.gibbonCourseID) WHERE gibbonSchoolYearID=:gibbonSchoolYearID2 AND date=:date2 AND gibbonPlannerEntryGuest.gibbonPersonID=:gibbonPersonID2) ORDER BY date, timeStart, course, class";
                 $result = $connection2->prepare($sql);
                 $result->execute($data);
             } catch (PDOException $e) {
                 print "<div class='error'>" . $e->getMessage() . "</div>";
             }
             if ($result->rowCount() > 0) {
                 print "<h2>";
                 print _("Today's Lessons");
                 print "</h2>";
                 if (isset($_GET["updateReturn"])) {
                     $updateReturn = $_GET["updateReturn"];
                 } else {
コード例 #10
0
ファイル: moduleFunctions.php プロジェクト: dpredster/core
function sidebarExtra($guid, $connection2, $todayStamp, $gibbonPersonID, $dateStamp = "", $gibbonCourseClassID = "")
{
    $highestAction = getHighestGroupedAction($guid, $_GET["q"], $connection2);
    if ($highestAction == FALSE) {
        $output = "<div class='error'>";
        $output .= _("The highest grouped action cannot be determined.");
        $output .= "</div>";
    } else {
        //Show date picker in sidebar
        $output = "<h2 class='sidebar'>";
        $output .= _("Choose A Date");
        $output .= "</h2>";
        //Count back to first Monday before first day
        $startDayStamp = $todayStamp;
        while (date("D", $startDayStamp) != "Mon") {
            $startDayStamp = $startDayStamp - 86400;
        }
        //Count forward 6 weeks after start day
        $endDayStamp = $startDayStamp + 86400 * 41;
        //Check which days are school days
        $days = array();
        $days["Mon"] = "Y";
        $days["Tue"] = "Y";
        $days["Wed"] = "Y";
        $days["Thu"] = "Y";
        $days["Fri"] = "Y";
        $days["Sat"] = "Y";
        $days["Sun"] = "Y";
        try {
            $dataDays = array();
            $sqlDays = "SELECT * FROM gibbonDaysOfWeek WHERE schoolDay='N'";
            $resultDays = $connection2->prepare($sqlDays);
            $resultDays->execute($dataDays);
        } catch (PDOException $e) {
            print "<div class='error'>" . $e->getMessage() . "</div>";
        }
        while ($rowDays = $resultDays->fetch()) {
            if ($rowDays["nameShort"] == "Mon") {
                $days["Mon"] = "N";
            } else {
                if ($rowDays["nameShort"] == "Tue") {
                    $days["Tue"] = "N";
                } else {
                    if ($rowDays["nameShort"] == "Wed") {
                        $days["Wed"] = "N";
                    } else {
                        if ($rowDays["nameShort"] == "Thu") {
                            $days["Thu"] = "N";
                        } else {
                            if ($rowDays["nameShort"] == "Fri") {
                                $days["Fri"] = "N";
                            } else {
                                if ($rowDays["nameShort"] == "Sat") {
                                    $days["Sat"] = "N";
                                } else {
                                    if ($rowDays["nameShort"] == "Sun") {
                                        $days["Sun"] = "N";
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
        $count = 1;
        $output .= "<table class='mini' cellspacing='0' style='width: 250px; margin-bottom: 0px'>";
        $output .= "<tr class='head'>";
        $output .= "<th style='width: 35px; text-align: center'>";
        $output .= _("Mon");
        $output .= "</th>";
        $output .= "<th style='width: 35px; text-align: center'>";
        $output .= _("Tue");
        $output .= "</th>";
        $output .= "<th style='width: 35px; text-align: center'>";
        $output .= _("Wed");
        $output .= "</th>";
        $output .= "<th style='width: 35px; text-align: center'>";
        $output .= _("Thu");
        $output .= "</th>";
        $output .= "<th style='width: 35px; text-align: center'>";
        $output .= _("Fri");
        $output .= "</th>";
        $output .= "<th style='width: 35px; text-align: center'>";
        $output .= _("Sat");
        $output .= "</th>";
        $output .= "<th style='width: 35px; text-align: center'>";
        $output .= _("Sun");
        $output .= "</th>";
        $output .= "</tr>";
        for ($i = $startDayStamp; $i <= $endDayStamp; $i = $i + 86400) {
            if (date("D", $i) == "Mon") {
                $output .= "<tr style='height: 25px'>";
            }
            if ($days[date("D", $i)] == "N" or isSchoolOpen($guid, date("Y-m-d", $i), $connection2) == FALSE) {
                $output .= "<td style='text-align: center; background-color: #bbbbbb; font-size: 10px; color: #858586'>";
                if ($i == $dateStamp) {
                    $output .= "<span style='border: 1px solid #ffffff; padding: 0px 2px 0px 1px'>" . date("d", $i) . "</span><br/>";
                    $output .= "<span style='font-size: 65%'>" . date("M", $i) . "</span>";
                } else {
                    $output .= date("d", $i) . "<br/>";
                    $output .= "<span style='font-size: 65%'>" . date("M", $i) . "</span>";
                }
                $output .= "</td>";
            } else {
                $output .= "<td style='text-align: center; background-color: #eeeeee; font-size: 10px'>";
                if ($i == $dateStamp) {
                    if ($i == $todayStamp) {
                        $output .= "<a style='color: #6B99CE; font-weight: bold; text-decoration: none' href='" . $_SESSION[$guid]["absoluteURL"] . "/index.php?q=/modules/Planner/planner.php&search={$gibbonPersonID}&date=" . date("Y-m-d", $i) . "'>";
                        $output .= "<span style='border: 1px solid #cc0000; padding: 0px 2px 0px 1px'>" . date("d", $i) . "</span><br/>";
                        $output .= "<span style='font-size: 65%'>" . date("M", $i) . "</span>";
                        $output .= "</a>";
                    } else {
                        $output .= "<a style='text-decoration: none' href='" . $_SESSION[$guid]["absoluteURL"] . "/index.php?q=/modules/Planner/planner.php&search={$gibbonPersonID}&date=" . date("Y-m-d", $i) . "'>";
                        $output .= "<span style='border: 1px solid #cc0000; padding: 0px 2px 0px 1px'>" . date("d", $i) . "</span><br/>";
                        $output .= "<span style='font-size: 65%'>" . date("M", $i) . "</span>";
                        $output .= "</a>";
                    }
                } else {
                    if ($i == $todayStamp) {
                        $output .= "<a style='color: #6B99CE; font-weight: bold; text-decoration: none' href='" . $_SESSION[$guid]["absoluteURL"] . "/index.php?q=/modules/Planner/planner.php&search={$gibbonPersonID}&date=" . date("Y-m-d", $i) . "'>";
                        $output .= date("d", $i) . "<br/>";
                        $output .= "<span style='font-size: 65%'>" . date("M", $i) . "</span>";
                        $output .= "</a>";
                    } else {
                        $output .= "<a style='text-decoration: none' href='" . $_SESSION[$guid]["absoluteURL"] . "/index.php?q=/modules/Planner/planner.php&search={$gibbonPersonID}&date=" . date("Y-m-d", $i) . "'>";
                        $output .= date("d", $i) . "<br/>";
                        $output .= "<span style='font-size: 65%'>" . date("M", $i) . "</span>";
                        $output .= "</a>";
                    }
                }
                $output .= "</td>";
            }
            if (date("D", $i) == "Sun") {
                $output .= "</tr>";
            }
            $count++;
        }
        $output .= "</table>";
        $output .= "<form method='get' action='" . $_SESSION[$guid]["absoluteURL"] . "/index.php'>";
        $output .= "<table class='smallIntBorder' cellspacing='0' style='width: 200px; margin: 0px 0px'>";
        $output .= "<tr>";
        $output .= "<td style='width: 200px'>";
        $output .= "<input name='q' id='q' type='hidden' value='/modules/Planner/planner.php'>";
        $output .= "<input name='search' id='search' type='hidden' value='{$gibbonPersonID}'>";
        if ($dateStamp == "") {
            $dateHuman = "";
        } else {
            $dateHuman = date($_SESSION[$guid]["i18n"]["dateFormatPHP"], $dateStamp);
        }
        $output .= "<input name='dateHuman' id='dateHuman' maxlength=20 type='text' value='{$dateHuman}' style='width:161px'>";
        $output .= "<script type='text/javascript'>";
        $output .= "\$(function() {";
        $output .= "\$('#dateHuman').datepicker();";
        $output .= "});";
        $output .= "</script>";
        $output .= "</td>";
        $output .= "<td class='right'>";
        $output .= "<input type='submit' value='" . _('Go') . "'>";
        $output .= "</td>";
        $output .= "</tr>";
        $output .= "</table>";
        $output .= "</form>";
        //Show class picker in sidebar
        $output .= "<h2>";
        $output .= _("Choose A Class");
        $output .= "</h2>";
        $selectCount = 0;
        $output .= "<form method='get' action='" . $_SESSION[$guid]["absoluteURL"] . "/index.php'>";
        $output .= "<table class='smallIntBorder' cellspacing='0' style='width: 100%; margin: 0px 0px'>";
        $output .= "<tr>";
        $output .= "<td style='width: 190px'>";
        $output .= "<input name='q' id='q' type='hidden' value='/modules/Planner/planner.php'>";
        $output .= "<input name='search' id='search' type='hidden' value='{$gibbonPersonID}'>";
        $output .= "<input name='viewBy' id='viewBy' type='hidden' value='class'>";
        $output .= "<select name='gibbonCourseClassID' id='gibbonCourseClassID' style='width:161px'>";
        $output .= "<option value=''></option>";
        try {
            $dataSelect = array("gibbonSchoolYearID" => $_SESSION[$guid]["gibbonSchoolYearID"], "gibbonPersonID" => $gibbonPersonID);
            $sqlSelect = "SELECT gibbonCourseClass.gibbonCourseClassID, gibbonCourse.nameShort AS course, gibbonCourseClass.nameShort AS class FROM gibbonCourseClassPerson JOIN gibbonCourseClass ON (gibbonCourseClassPerson.gibbonCourseClassID=gibbonCourseClass.gibbonCourseClassID) JOIN gibbonCourse ON (gibbonCourseClass.gibbonCourseID=gibbonCourse.gibbonCourseID) WHERE gibbonCourse.gibbonSchoolYearID=:gibbonSchoolYearID AND gibbonPersonID=:gibbonPersonID ORDER BY course, class";
            $resultSelect = $connection2->prepare($sqlSelect);
            $resultSelect->execute($dataSelect);
        } catch (PDOException $e) {
        }
        if ($highestAction == "Lesson Planner_viewEditAllClasses" or $highestAction == "Lesson Planner_viewAllEditMyClasses") {
            $output .= "<optgroup label='--" . _('My Classes') . "--'>";
        }
        while ($rowSelect = $resultSelect->fetch()) {
            $selected = "";
            if ($rowSelect["gibbonCourseClassID"] == $gibbonCourseClassID and $selectCount == 0) {
                $selected = "selected";
                $selectCount++;
            }
            $output .= "<option {$selected} value='" . $rowSelect["gibbonCourseClassID"] . "'>" . htmlPrep($rowSelect["course"]) . "." . htmlPrep($rowSelect["class"]) . "</option>";
        }
        if ($highestAction == "Lesson Planner_viewEditAllClasses" or $highestAction == "Lesson Planner_viewAllEditMyClasses") {
            $output .= "</optgroup>";
        }
        if ($highestAction == "Lesson Planner_viewEditAllClasses" or $highestAction == "Lesson Planner_viewAllEditMyClasses") {
            try {
                $dataSelect = array("gibbonSchoolYearID" => $_SESSION[$guid]["gibbonSchoolYearID"]);
                $sqlSelect = "SELECT gibbonCourseClass.gibbonCourseClassID, gibbonCourse.nameShort AS course, gibbonCourseClass.nameShort AS class FROM gibbonCourseClass JOIN gibbonCourse ON (gibbonCourseClass.gibbonCourseID=gibbonCourse.gibbonCourseID) WHERE gibbonCourse.gibbonSchoolYearID=:gibbonSchoolYearID ORDER BY course, class";
                $resultSelect = $connection2->prepare($sqlSelect);
                $resultSelect->execute($dataSelect);
            } catch (PDOException $e) {
            }
            $output .= "<optgroup label='--" . _('All Classes') . "--'>";
            while ($rowSelect = $resultSelect->fetch()) {
                $selected = "";
                if ($rowSelect["gibbonCourseClassID"] == $gibbonCourseClassID and $selectCount == 0) {
                    $selected = "selected";
                    $selectCount++;
                }
                $output .= "<option {$selected} value='" . $rowSelect["gibbonCourseClassID"] . "'>" . htmlPrep($rowSelect["course"]) . "." . htmlPrep($rowSelect["class"]) . "</option>";
            }
            $output .= "</optgroup>";
        }
        $output .= "</select>";
        $output .= "</td>";
        $output .= "<td class='right'>";
        $output .= "<input type='submit' value='" . _('Go') . "'>";
        $output .= "</td>";
        $output .= "</tr>";
        $output .= "</table>";
        $output .= "</form>";
        if ($_GET["q"] != "/modules/Planner/planner_deadlines.php") {
            //Show upcoming deadlines
            $output .= "<h2>";
            $output .= _("Homework & Deadlines");
            $output .= "</h2>";
            try {
                if ($highestAction == "Lesson Planner_viewMyChildrensClasses") {
                    $data = array("gibbonPersonID" => $gibbonPersonID, "dateTime" => date("Y-m-d H:i:s"), "date1" => date("Y-m-d"), "date2" => date("Y-m-d"), "timeEnd" => date("H:i:s"));
                    $sql = "SELECT gibbonPlannerEntryID, gibbonUnitID, gibbonCourse.nameShort AS course, gibbonCourseClass.nameShort AS class, gibbonPlannerEntry.name, date, timeStart, timeEnd, viewableStudents, viewableParents, homework, homeworkDueDateTime, role FROM gibbonPlannerEntry JOIN gibbonCourseClass ON (gibbonPlannerEntry.gibbonCourseClassID=gibbonCourseClass.gibbonCourseClassID) JOIN gibbonCourseClassPerson ON (gibbonCourseClass.gibbonCourseClassID=gibbonCourseClassPerson.gibbonCourseClassID) JOIN gibbonCourse ON (gibbonCourse.gibbonCourseID=gibbonCourseClass.gibbonCourseID) WHERE gibbonCourseClassPerson.gibbonPersonID=:gibbonPersonID AND NOT role='Student - Left' AND NOT role='Teacher - Left' AND homework='Y' AND role='Student' AND viewableParents='Y' AND homeworkDueDateTime>:dateTime AND ((date<:date1) OR (date=:date2 AND timeEnd<=:timeEnd)) ORDER BY homeworkDueDateTime";
                } else {
                    if ($highestAction == "Lesson Planner_viewEditAllClasses" or $highestAction == "Lesson Planner_viewAllEditMyClasses" or $highestAction == "Lesson Planner_viewMyClasses") {
                        $data = array("gibbonPersonID" => $gibbonPersonID, "dateTime" => date("Y-m-d H:i:s"), "date1" => date("Y-m-d"), "date2" => date("Y-m-d"), "timeEnd" => date("H:i:s"));
                        $sql = "SELECT gibbonPlannerEntryID, gibbonUnitID, gibbonCourse.nameShort AS course, gibbonCourseClass.nameShort AS class, gibbonPlannerEntry.name, date, timeStart, timeEnd, viewableStudents, viewableParents, homework, homeworkDueDateTime, role FROM gibbonPlannerEntry JOIN gibbonCourseClass ON (gibbonPlannerEntry.gibbonCourseClassID=gibbonCourseClass.gibbonCourseClassID) JOIN gibbonCourseClassPerson ON (gibbonCourseClass.gibbonCourseClassID=gibbonCourseClassPerson.gibbonCourseClassID) JOIN gibbonCourse ON (gibbonCourse.gibbonCourseID=gibbonCourseClass.gibbonCourseID) WHERE gibbonCourseClassPerson.gibbonPersonID=:gibbonPersonID AND NOT role='Student - Left' AND NOT role='Teacher - Left' AND homework='Y' AND (role='Teacher' OR (role='Student' AND viewableStudents='Y')) AND homeworkDueDateTime>:dateTime AND ((date<:date1) OR (date=:date2 AND timeEnd<=:timeEnd)) ORDER BY homeworkDueDateTime";
                    }
                }
                $result = $connection2->prepare($sql);
                $result->execute($data);
            } catch (PDOException $e) {
                $output .= "<div class='error'>" . $e->getMessage() . "</div>";
            }
            if ($result->rowCount() < 1) {
                $output .= "<div class='success'>";
                $output .= _("No upcoming deadlines!");
                $output .= "</div>";
            } else {
                $output .= "<ol>";
                $count = 0;
                while ($row = $result->fetch()) {
                    if ($count < 5) {
                        $diff = (strtotime(substr($row["homeworkDueDateTime"], 0, 10)) - strtotime(date("Y-m-d"))) / 86400;
                        $style = "style='padding-right: 3px;'";
                        if ($diff < 2) {
                            $style = "style='padding-right: 3px; border-right: 10px solid #cc0000'";
                        } else {
                            if ($diff < 4) {
                                $style = "style='padding-right: 3px; border-right: 10px solid #D87718'";
                            }
                        }
                        $output .= "<li {$style}>";
                        $output .= "<a href='" . $_SESSION[$guid]["absoluteURL"] . "/index.php?q=/modules/" . $_SESSION[$guid]["module"] . "/planner_view_full.php&search={$gibbonPersonID}&gibbonPlannerEntryID=" . $row["gibbonPlannerEntryID"] . "&viewBy=date&date=" . $row["date"] . "&width=1000&height=550'>" . $row["course"] . "." . $row["class"] . "</a><br/>";
                        $output .= "<span style='font-style: italic'>Due at " . substr($row["homeworkDueDateTime"], 11, 5) . " on " . dateConvertBack($guid, substr($row["homeworkDueDateTime"], 0, 10));
                        $output .= "</li>";
                    }
                    $count++;
                }
                $output .= "</ol>";
            }
            $output .= "<p style='padding-top: 15px; text-align: right'>";
            $output .= "<a href='" . $_SESSION[$guid]["absoluteURL"] . "/index.php?q=/modules/Planner/planner_deadlines.php&search={$gibbonPersonID}'>View Homework</a>";
            $output .= "</p>";
        }
    }
    $_SESSION[$guid]["sidebarExtraPosition"] = "bottom";
    return $output;
}
コード例 #11
0
*/
@session_start();
if (isActionAccessible($guid, $connection2, "/modules/Timetable Admin/ttDates_edit_add.php") == FALSE) {
    //Acess denied
    print "<div class='error'>";
    print _("You do not have access to this action.");
    print "</div>";
} else {
    $gibbonSchoolYearID = $_GET["gibbonSchoolYearID"];
    $dateStamp = $_GET["dateStamp"];
    if ($gibbonSchoolYearID == "" or $dateStamp == "") {
        print "<div class='error'>";
        print _("You have not specified one or more required parameters.");
        print "</div>";
    } else {
        if (isSchoolOpen($guid, date("Y-m-d", $dateStamp), $connection2, TRUE) != TRUE) {
            print "<div class='error'>";
            print _("School is not open on the specified day.");
            print "</div>";
        } else {
            try {
                $data = array("gibbonSchoolYearID" => $gibbonSchoolYearID);
                $sql = "SELECT * FROM gibbonSchoolYear WHERE gibbonSchoolYearID=:gibbonSchoolYearID";
                $result = $connection2->prepare($sql);
                $result->execute($data);
            } catch (PDOException $e) {
                print "<div class='error'>" . $e->getMessage() . "</div>";
            }
            if ($result->rowCount() != 1) {
                print "<div class='error'>";
                print _("The specified record does not exist.");
コード例 #12
0
     $result = $connection2->prepare($sql);
     $result->execute($data);
 } catch (PDOException $e) {
     //Fail 2
     $URL .= "&addReturn=fail2";
     header("Location: {$URL}");
     break;
 }
 if ($result->rowCount() != 1) {
     //Fail 2
     $URL .= "&addReturn=fail2";
     header("Location: {$URL}");
 } else {
     $partialFail = FALSE;
     foreach ($dates as $date) {
         if (isSchoolOpen($guid, date("Y-m-d", $date), $connection2, TRUE) == FALSE) {
             $partialFail = TRUE;
         } else {
             //Check if a day from the TT is already set. Not enough time to add this now, but should do this one day
             //Write to database
             try {
                 $data = array("gibbonTTDayID" => $gibbonTTDayID, "date" => date("Y-m-d", $date));
                 $sql = "INSERT INTO gibbonTTDayDate SET gibbonTTDayID=:gibbonTTDayID, date=:date";
                 $result = $connection2->prepare($sql);
                 $result->execute($data);
             } catch (PDOException $e) {
                 $partialFail = TRUE;
             }
         }
     }
     //Report result