Back

Console Moodle

A recreation of the Moodle web app on a text-based console in C++, with ncurses. A project for the Programming Techniques course.

cpp

Media

The video below shows the console app in action.

If you can not see, watch on YouTube.

Data Format

  • <year> will be replaced with one number of the school year (e.g. 2019 represents the school year 2019-2020)
  • <semester> will be just numbers (1, 2 or 3)
  • <class> will be replaced with the class name/ID (e.g. 22clc01, 22clc02, etc.)
  • <course> will be replaced with the course ID (e.g. CS162, MTH00007, etc.)

General structure

  • ./data/input/.. will be the slots for users to import data.
  • ./data/output.. will be slots for exporting functions.
data/
 |-- input/
     |-- ..
 |-- output/
     |-- ..
 |-- accounts.csv
 |-- years.txt
 |-- <year>/
     |-- semesters.txt
     |-- classes/
         |-- classes.txt
         |-- <class>.txt
     |-- <semester>/
         |-- courses.csv
         |-- <course>.csv

Format for accounts.csv file

Account type:

  • 0: Student
  • 1: Staff
id,firstname,lastname,accounttype,day,month,year,socialid,username,password
22127064,Dat,Pham Thanh,0,9,3,2001,01234567890,22127064,password

Format for years.txt file

2019
2020
2021

Format for semesters.txt file

index,start_date,end_date
0,25/12/2003,3/4/2004
1,4/4/2004,10/7/2004
2,11/7/2004,20/11/2004

If the semester wasn’t created, semesters[i] = nullptr, start_date and end_date will be null (once a semester is created, start_date and end_date will never be null):

index,start_date,end_date
0,null,null
1,4/4/2004,10/7/2004
2,11/7/2004,20/11/2004

Format for <year>/classes/classes.txt file

22clc01
22clc02
22clc03

Format for <year>/classes/<class>.txt file

22127064
22127065
22127066

Format for <year>/<semester>/courses.csv file

id,name,teachername,classname,maxstudents,credits,dayofweek,shiftstart,shiftend
csc10002,Ky thuat lap trinh,Dinh Ba Tien,22CLC01,50,4,3,9:30,11:10

Format for <year>/<semester>/<course>.csv file

(Unknown if others can be implemented as variadic.)

studentid,midterms,finals,total,other
22127163,5,3,4,1
22127046,10,10,10,10

Installation

Requires some sort of C++ compiler (obviously) (e.g. g++ or clang++, etc.). Below were instructions for my groupmates and professor to compile the project. But since the source code is not publicly available, this section is of no use to you.

Windows (GNU/MinGW G++ or MSVC)

  1. Make sure g++ or clang++ is installed.
  2. Install pdcurses from the application MinGW Installation Manager. (all packages that have the name mingw32-libpdcurses)
  3. If you want to use g++ to compile, you’re already done!
  4. Install mingw32-make package from MinGW Installation Manager also.
  5. Download CMake from here using Windows XXX Installer, idk.
  6. If when you run cmake and mingw32-make it works, you’re done :)

Windows (Visual Studio ++)

  1. I don’t know I don’t use VS

Unix-based (MacOS, Linux, etc.)

  1. Make sure g++ or clang++ is installed.
  2. Install ncurses via a package manager. (MacOS can install XCode Command Line Tools to get ncurses.)
  3. (Optional) Install cmake and make, via package managers also. (MacOS has cmake and make pre-installed with XCode Command Line Tools too i believe.)
  4. Done! Good job?

Compilation

Using direct compiler (clang, g++)

  1. cd into this directory.
  2. g++ <list_files.cpp> -lncurses (Unix) or g++ <list_files.cpp> -lpdcurses (Windows), same thing with clang++
  3. a.out or a.exe should now be generated if done correctly.

Using direct compiler (VS++)

  1. No clue

Using CMake

  1. cd into this directory.
  2. cmake -G "Unix Makefiles" . (Unix) or cmake -G "MinGW Makefiles" . (Windows).
  3. If correctly done, no errors would be shown.
  4. make (Unix) or mingw32-make (Windows). You should see files being created with green text thingy.
  5. bin/Moodle or bin/Moodle.exe has now been created. Run it :D