Your IP : 216.73.217.79


Current Path : /var/www/cesa.co.za/php/includes/
Upload File :
Current File : /var/www/cesa.co.za/php/includes/CCEWeeklySessions.php

<?php

/*
 * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
 * Click nbfs://nbhost/SystemFileSystem/Templates/Scripting/PHPClass.php to edit this template 
 */

/**
 * Description of CCEWeeklySessions
 *
 * @author otto
 */
class CCEWeeklySessions extends BaseTableClass {

    public function checkCreateTable() {
        $sql = "DROP TABLE IF EXISTS `CCEWeeklySessions`;
CREATE TABLE IF NOT EXISTS `CCEWeeklySessions` (
  `CCEWeeklySessionID` int(11) NOT NULL AUTO_INCREMENT,
  `ScheduleID` int(11) DEFAULT NULL,
  `TrimesterNum` int(11) DEFAULT NULL,
  `WeekNum` int(11) DEFAULT NULL,
  `SessionDate` date DEFAULT NULL,
  `SessionDay` varchar(20) DEFAULT NULL,
  `StartTime` time DEFAULT NULL,
  `EndTime` time DEFAULT NULL,
  `Description` text DEFAULT NULL,
  `PresentationRef` varchar(50) DEFAULT NULL,
  `AssignmentRef` varchar(50) DEFAULT NULL,
  `AssignmentSubDate` date DEFAULT NULL,
  `PresenterName` varchar(255) DEFAULT NULL,
  `Duration` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`CCEWeeklySessionID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;";
    }

    public function findCurrent() {

        $nowDate = new DateTime();
        $nowDate->modify('-2 weeks');

        $sql = "SELECT * "
                . "FROM CCEWeeklySessions ws "
                . "INNER JOIN CCESetup s ON ws.ScheduleID = s.CurrentScheduleID "
                . "WHERE ws.SessionDate >= '" . $nowDate->format('Y-m-d') . "' "
                . "ORDER BY ws.SessionDate ASC, ws.StartTime";

//        echo $sql;

        return $this->sqlf->getAll($sql);
    }
}

function cceWeeklySessionsPageLoad($objThis) {

    global $CCEWeeklySessions;
    
    if (isset($CCEWeeklySessions) && $CCEWeeklySessions->Export == "" && $CCEWeeklySessions->CurrentAction == "") {
        
        if (isset($_SESSION[EW_SESSION_MESSAGE]) && $_SESSION[EW_SESSION_MESSAGE] != "") {
            $_SESSION[EW_SESSION_MESSAGE] .= '<br>';
        }

        $importUrl = (defined('CCEADMIN_IMPORT_URL') ? CCEADMIN_IMPORT_URL : '/cceadmin/CCEWeeklySessionsImport.php');
        $_SESSION[EW_SESSION_MESSAGE] .= '<A href="' . htmlspecialchars($importUrl) . '"><IMG title="Import" border=0 alt="Import" src="images/exportxls.gif" '
            . 'width=16 height=16> Import</A>';
    }
}