Course
in package
Course service.
Table of Contents
Properties
- $bulkForm : Bulk|null
- $aclService : AclService
- $bulkExamForm : Bulk
- $bulkSummaryForm : Bulk
- $config : array<string|int, mixed>
- $courseDocumentMapper : CourseDocument
- $courseForm : Course
- $courseMapper : Course
- $storageService : FileStorage
- $tempUploadForm : TempUpload
- $translator : Translator
Methods
- __construct() : mixed
- bulkExamEdit() : bool
- bulkSummaryEdit() : bool
- courseDocumentToFilename() : string
- Get a filename from an exam (or summary).
- deleteCourse() : void
- Delete a course and all its documents.
- deleteDocument() : void
- Delete a course document
- deleteTempExam() : void
- Deletes a temp uploaded exam or summary.
- getAllCourses() : array<string|int, Course>
- Get all courses.
- getBulkExamForm() : Bulk
- Get the bulk exam edit form.
- getBulkSummaryForm() : Bulk
- Get the bulk summary edit form.
- getConfig() : array<string|int, mixed>
- Get the education config, as used by this service.
- getCourse() : Course|null
- Get a course.
- getCourseForm() : Course
- Get the add course form.
- getDocument() : CourseDocument|null
- Get a specific course document.
- getDocumentDownload() : Stream|null
- Get an exam.
- getDocumentsForCourse() : array<string|int, CourseDocument>
- Get all documents of a specific type for a specific course.
- getTempUploadForm() : TempUpload
- Get the Temporary Upload form.
- guessCourseDocumentData() : array{course: string, date: string, language: string}
- Guesses the course code and date based on an exam's filename.
- guessSummaryAuthor() : string
- Guesses the summary author based on a summary's filename.
- saveCourse() : Course
- Save a course.
- searchCourse() : array<string|int, Course>
- Search for a course.
- tempExamUpload() : bool
- tempSummaryUpload() : bool
- updateCourse() : Course
- Update a course.
- bulkEdit() : bool
- Finish the bulk edit.
- getBulkForm() : Bulk
- Get the bulk edit form.
- tempUpload() : bool
- Temporary exam upload.
Properties
$bulkForm
protected
Bulk|null
$bulkForm
= null
$aclService read-only
private
AclService
$aclService
$bulkExamForm read-only
private
Bulk
$bulkExamForm
$bulkSummaryForm read-only
private
Bulk
$bulkSummaryForm
$config read-only
private
array<string|int, mixed>
$config
$courseDocumentMapper read-only
private
CourseDocument
$courseDocumentMapper
$courseForm read-only
private
Course
$courseForm
$courseMapper read-only
private
Course
$courseMapper
$storageService read-only
private
FileStorage
$storageService
$tempUploadForm read-only
private
TempUpload
$tempUploadForm
$translator read-only
private
Translator
$translator
Methods
__construct()
public
__construct(AclService $aclService, Translator $translator, FileStorage $storageService, Course $courseMapper, CourseDocument $courseDocumentMapper, Course $courseForm, TempUpload $tempUploadForm, Bulk $bulkSummaryForm, Bulk $bulkExamForm, array<string|int, mixed> $config) : mixed
Parameters
- $aclService : AclService
- $translator : Translator
- $storageService : FileStorage
- $courseMapper : Course
- $courseDocumentMapper : CourseDocument
- $courseForm : Course
- $tempUploadForm : TempUpload
- $bulkSummaryForm : Bulk
- $bulkExamForm : Bulk
- $config : array<string|int, mixed>
Tags
bulkExamEdit()
public
bulkExamEdit(array<string|int, mixed> $data) : bool
Parameters
- $data : array<string|int, mixed>
Tags
Return values
boolbulkSummaryEdit()
public
bulkSummaryEdit(array<string|int, mixed> $data) : bool
Parameters
- $data : array<string|int, mixed>
Tags
Return values
boolcourseDocumentToFilename()
Get a filename from an exam (or summary).
public
courseDocumentToFilename(CourseDocument $document) : string
Exams will have a filename of the following format:
-exam-
Summaries have the following format:
-
Parameters
- $document : CourseDocument
Return values
string —Filename
deleteCourse()
Delete a course and all its documents.
public
deleteCourse(Course $course) : void
Parameters
- $course : Course
deleteDocument()
Delete a course document
public
deleteDocument(CourseDocument $document) : void
Parameters
- $document : CourseDocument
deleteTempExam()
Deletes a temp uploaded exam or summary.
public
deleteTempExam(string $filename[, string $type = 'exam' ]) : void
Parameters
- $filename : string
-
The file to delete
- $type : string = 'exam'
-
The type to delete (exam/summary)
getAllCourses()
Get all courses.
public
getAllCourses() : array<string|int, Course>
Return values
array<string|int, Course>getBulkExamForm()
Get the bulk exam edit form.
public
getBulkExamForm() : Bulk
Tags
Return values
BulkgetBulkSummaryForm()
Get the bulk summary edit form.
public
getBulkSummaryForm() : Bulk
Tags
Return values
BulkgetConfig()
Get the education config, as used by this service.
public
getConfig([string $key = 'education' ]) : array<string|int, mixed>
Parameters
- $key : string = 'education'
Tags
Return values
array<string|int, mixed>getCourse()
Get a course.
public
getCourse(string $code) : Course|null
Parameters
- $code : string
Return values
Course|nullgetCourseForm()
Get the add course form.
public
getCourseForm([Course|null $course = null ]) : Course
Parameters
- $course : Course|null = null
Tags
Return values
CoursegetDocument()
Get a specific course document.
public
getDocument(int $id) : CourseDocument|null
Parameters
- $id : int
Return values
CourseDocument|nullgetDocumentDownload()
Get an exam.
public
getDocumentDownload(int $id) : Stream|null
Parameters
- $id : int
Return values
Stream|nullgetDocumentsForCourse()
Get all documents of a specific type for a specific course.
public
getDocumentsForCourse(Course $course, string $type) : array<string|int, CourseDocument>
Parameters
- $course : Course
- $type : string
Tags
Return values
array<string|int, CourseDocument>getTempUploadForm()
Get the Temporary Upload form.
public
getTempUploadForm() : TempUpload
Tags
Return values
TempUploadguessCourseDocumentData()
Guesses the course code and date based on an exam's filename.
public
guessCourseDocumentData(string $filename) : array{course: string, date: string, language: string}
Parameters
- $filename : string
Return values
array{course: string, date: string, language: string}guessSummaryAuthor()
Guesses the summary author based on a summary's filename.
public
static guessSummaryAuthor(string $filename) : string
Parameters
- $filename : string
Return values
stringsaveCourse()
Save a course.
public
saveCourse(array<string|int, mixed> $data) : Course
Parameters
- $data : array<string|int, mixed>
Tags
Return values
CoursesearchCourse()
Search for a course.
public
searchCourse(array<string|int, mixed> $data) : array<string|int, Course>
Parameters
- $data : array<string|int, mixed>
Tags
Return values
array<string|int, Course>tempExamUpload()
public
tempExamUpload(Parameters $post, Parameters $files) : bool
Parameters
- $post : Parameters
- $files : Parameters
Return values
booltempSummaryUpload()
public
tempSummaryUpload(Parameters $post, Parameters $files) : bool
Parameters
- $post : Parameters
- $files : Parameters
Return values
boolupdateCourse()
Update a course.
public
updateCourse(Course $course, array<string|int, mixed> $data) : Course
Parameters
- $course : Course
- $data : array<string|int, mixed>
Tags
Return values
CoursebulkEdit()
Finish the bulk edit.
protected
bulkEdit(array<string|int, mixed> $data, string $type) : bool
Parameters
- $data : array<string|int, mixed>
-
POST Data
- $type : string
Tags
Return values
boolgetBulkForm()
Get the bulk edit form.
protected
getBulkForm(string $type) : Bulk
Parameters
- $type : string
Tags
Return values
BulktempUpload()
Temporary exam upload.
protected
tempUpload(array<string|int, mixed> $post, array<string|int, mixed> $files, string $uploadDirectory) : bool
Uploads exams into a temporary folder.
Parameters
- $post : array<string|int, mixed>
-
POST Data
- $files : array<string|int, mixed>
-
FILES Data
- $uploadDirectory : string
-
the directory to place the exam in