コード例 #1
0
ファイル: visibility.php プロジェクト: TohuMuna/akonga
/**
 * Toggle a course visibility
 */
if ($_SESSION['username'] != "") {
    require_once 'web/core/navigation.php';
    // get and initiate the course class to access the functions
    require_once 'src/core/controller/classes.php';
    $ObjClass = new classes();
    require_once 'src/core/controller/quiz.php';
    $ObjQuiz = new quiz();
    if ($d) {
        $classid = $ObjClass->convertUUIDToClassID($d);
        $classes = $ObjClass->getClassInformation($classid);
        $documents = $ObjClass->getClassDocuments($classid);
        $classActivity = $ObjClass->getClassActivity($classid);
        $today = date('Y-m-d');
        $classDiary = $ObjClass->getClassDiary($classid, $today, $today);
        // Check if an administrator or owner of the class to b eable to toggle visibility
        if ($_SESSION['utype'] >= 8 || $ObjAkonga->usernametoid($_SESSION['username']) == $classes['teacherid']) {
            if ($e == "1") {
                $visibility = 1;
            } else {
                $visibility = 0;
            }
            $toggleClass = $ObjClass->toggleClass($classid, $visibility);
            if ($toggleClass != false) {
                $responseMsg = "Your class visibility has been changed.";
                $classes = $ObjClass->getClassInformation($classid);
                // Reload class information to stop it pulling in the wrong data now it's changed
            } else {