Skip to main content

Nieuw Cohort

  1. Pas de file config/subdomain.php aan:
<?php

function subDomain() {
    $subDomain = "www";

    if ( isset($_SERVER['SERVER_NAME'])) {
        $subDomain = explode('.', $_SERVER['SERVER_NAME'])[0];
    }


    if ( $subDomain == '...') {
        $DB='......';
    } elseif ( $subDomain == '...') {
        $DB='......';
    } elseif ( $subDomain == '...') {
        $DB='......';
    } else {
        $DB='...';
    }

    return $DB;
}

?>
  1. Maak de nieuwe database aan.
  2. Pas de SQL views aan.
  3. /etc/apache2/sites-enabled/....conf server alias toevoegen

    vergeet de dev-omving niet,
    C:\xampp\apache\conf\extra\httpd-vhosts.conf
    en eventueel de hosts file in
    C:\Windows\System32\drivers\etc
  4. Maak gebruikers/docenten in database aan (export/import uit vorig cohort)
  5. Voeg cursussen toe via de GUI.
  6. Draai een update.
  7. Voeg modules toe via de GUI.
  8. Draai een update.
  9. Pas de rotate functie aan (als je op het log links boven klikt).
    ResultaatController.php,  function actionRotate()
  10. Pas de vakanties aan in de import.py ten behoeve van de predictions.

Importeren Studenten


# Get all users created in a particular year (note that these must be assigned to a course)
# then create inserts to insert these users in the database
# use thsi script at the beginning of the year to add students to the CM (klas still needs to be edited by hand)

from canvasapi import Canvas
import configparser
import sys

config = configparser.ConfigParser()
if ( not (config.read("../import/canvas.ini") or config.read("canvas.ini"))):
    print()
    dd('Error: canvas.ini not found')

# Canvas API URL
API_URL = config.get('main', 'host')
# Canvas API key
API_KEY = config.get('main', 'api_key')

canvas = Canvas(API_URL, API_KEY)

course_id = 18660

course = canvas.get_course(course_id)
all_users = course.get_users(enrollment_type=['student'])

print(f"Course Name: {course.name}")

# for user in all_users:
#     if user.created_at[0:4] != '2023':
#     print(user.name, user.id, user.created_at)

# sys.exit()

# Iterate through the list of users
i=1
for user in all_users:
    student_nr = user.sis_user_id[1:]
    email = student_nr + 'talnet.nl'
    # print(f"{i} id: {user.id}, name: {user.name}, login_id: {email} student_nr: {student_nr}")
    print(f"insert into user (id, name, login_id, student_nr, klas) values ('{user.id}', '{user.name}', '{email}', '{student_nr}', '4x');")
    i=i+1