Exemplo n.º 1
0
 public static function ExtractSubmission($data, $singleResult = false, $FileExtension = '', $SubmissionExtension = '', $isResult = true)
 {
     // generates an assoc array of files by using a defined list of
     // its attributes
     $files = DBJson::getObjectsByAttributes($data, File::getDBPrimaryKey(), File::getDBConvert(), $FileExtension);
     // generates an assoc array of submissions by using a defined list of
     // its attributes
     $submissions = DBJson::getObjectsByAttributes($data, Submission::getDBPrimaryKey(), Submission::getDBConvert(), $SubmissionExtension);
     // sets the selectedForGroup attribute
     foreach ($submissions as &$submission) {
         if (isset($submission['selectedForGroup'])) {
             if (isset($submission['id']) && $submission['id'] == $submission['selectedForGroup']) {
                 $submission['selectedForGroup'] = (string) 1;
             } else {
                 unset($submission['selectedForGroup']);
             }
         }
     }
     // concatenates the submissions and the associated files
     $res = DBJson::concatObjectListsSingleResult($data, $submissions, Submission::getDBPrimaryKey(), Submission::getDBConvert()['S_file'], $files, File::getDBPrimaryKey(), $FileExtension, $SubmissionExtension);
     if ($isResult) {
         // to reindex
         $res = array_values($res);
         $res = Submission::decodeSubmission($res, false);
         if ($singleResult == true) {
             // only one object as result
             if (count($res) > 0) {
                 $res = $res[0];
             }
         }
     }
     return $res;
 }
Exemplo n.º 2
0
 public static function ExtractExerciseSheet($data, $singleResult = false, $SheetExtension = '', $SheetFileExtension = '', $SheetSolutionExtension = '', $isResult = true)
 {
     // generates an assoc array of an exercise sheet by using a defined list of its attributes
     $exerciseSheet = DBJson::getObjectsByAttributes($data, ExerciseSheet::getDBPrimaryKey(), ExerciseSheet::getDBConvert(), $SheetExtension);
     // generates an assoc array of an file by using a defined list of its attributes
     $exerciseSheetFile = DBJson::getObjectsByAttributes($data, File::getDBPrimaryKey(), File::getDBConvert(), $SheetFileExtension);
     // generates an assoc array of an file by using a defined list of its attributes
     $sampleSolutions = DBJson::getObjectsByAttributes($data, File::getDBPrimaryKey(), File::getDBConvert(), $SheetSolutionExtension . '2');
     // concatenates the exercise sheet and the associated sample solution
     $res = DBJson::concatObjectListsSingleResult($data, $exerciseSheet, ExerciseSheet::getDBPrimaryKey(), ExerciseSheet::getDBConvert()['F_id_file'], $exerciseSheetFile, File::getDBPrimaryKey(), $SheetFileExtension, $SheetExtension);
     // concatenates the exercise sheet and the associated exercise sheet file
     $res = DBJson::concatObjectListsSingleResult($data, $res, ExerciseSheet::getDBPrimaryKey(), ExerciseSheet::getDBConvert()['F_id_sampleSolution'], $sampleSolutions, File::getDBPrimaryKey(), $SheetSolutionExtension . '2', $SheetExtension);
     if ($isResult) {
         // to reindex
         $res = array_merge($res);
         $res = ExerciseSheet::decodeExerciseSheet($res, false);
         if ($singleResult == true) {
             // only one object as result
             if (count($res) > 0) {
                 $res = $res[0];
             }
         }
     }
     return $res;
 }
Exemplo n.º 3
0
 public static function ExtractCourseStatus($data, $singleResult = false, $UserExtension = '', $CourseStatusExtension = '', $CourseExtension = '', $isResult = true)
 {
     // generates an assoc array of a user by using a defined list of its
     // attributes
     $user = DBJson::getObjectsByAttributes($data, User::getDBPrimaryKey(), User::getDBConvert(), $UserExtension);
     // generates an assoc array of course stats by using a defined list of
     // its attributes
     $courseStatus = DBJson::getObjectsByAttributes($data, CourseStatus::getDBPrimaryKey(), CourseStatus::getDBConvert(), $CourseStatusExtension);
     // generates an assoc array of courses by using a defined list of
     // its attributes
     $courses = DBJson::getObjectsByAttributes($data, Course::getDBPrimaryKey(), Course::getDBConvert(), $CourseExtension);
     // concatenates the course stats and the associated courses
     $res = DBJson::concatObjectListsSingleResult($data, $courseStatus, CourseStatus::getDBPrimaryKey(), CourseStatus::getDBConvert()['CS_course'], $courses, Course::getDBPrimaryKey(), $CourseExtension, $CourseStatusExtension);
     // concatenates the users and the associated course stats
     $res = DBJson::concatResultObjectLists($data, $user, User::getDBPrimaryKey(), User::getDBConvert()['U_courses'], $res, CourseStatus::getDBPrimaryKey(), $CourseStatusExtension, $UserExtension);
     if ($isResult) {
         // to reindex
         // $res = array_merge($res);
         $res = CourseStatus::decodeCourseStatus($res, false);
         if ($singleResult == true) {
             // only one object as result
             if (count($res) > 0) {
                 $res = $res[0];
             }
         }
     }
     return $res;
 }
Exemplo n.º 4
0
 public static function ExtractInvitation($data, $singleResult = false, $LeaderExtension = '', $MemberExtension = '', $InvitationExtension = '', $isResult = true)
 {
     // generates an assoc array of users by using a defined list of
     // its attributes
     $leader = DBJson::getObjectsByAttributes($data, User::getDBPrimaryKey(), User::getDBConvert(), $LeaderExtension);
     // generates an assoc array of users by using a defined list of
     // its attributes
     $member = DBJson::getObjectsByAttributes($data, User::getDBPrimaryKey(), User::getDBConvert(), $MemberExtension . '2');
     // generates an assoc array of invitations by using a defined list of
     // its attributes
     $invitations = DBJson::getObjectsByAttributes($data, Invitation::getDBPrimaryKey(), Invitation::getDBConvert(), $InvitationExtension);
     // concatenates the invitations and the associated invitation leader
     $res = DBJson::concatObjectListsSingleResult($data, $invitations, Invitation::getDBPrimaryKey(), Invitation::getDBConvert()['U_leader'], $leader, User::getDBPrimaryKey(), $InvitationExtension, $LeaderExtension);
     // concatenates the invitations and the associated invitation member
     $res = DBJson::concatObjectListsSingleResult($data, $res, Invitation::getDBPrimaryKey(), Invitation::getDBConvert()['U_member'], $member, User::getDBPrimaryKey(), $MemberExtension . '2', $InvitationExtension);
     if ($isResult) {
         // to reindex
         $res = array_values($res);
         $res = Invitation::decodeInvitation($res, false);
         if ($singleResult == true) {
             // only one object as result
             if (count($res) > 0) {
                 $res = $res[0];
             }
         }
     }
     return $res;
 }
Exemplo n.º 5
0
 public static function ExtractAttachment($data, $singleResult = false, $FileExtension = '', $AttachmentExtension = '', $isResult = true)
 {
     // generates an assoc array of files by using a defined list of
     // its attributes
     $files = DBJson::getObjectsByAttributes($data, File::getDBPrimaryKey(), File::getDBConvert(), $FileExtension);
     // generates an assoc array of attachments by using a defined list of
     // its attributes
     $attachments = DBJson::getObjectsByAttributes($data, Attachment::getDBPrimaryKey(), Attachment::getDBConvert(), $AttachmentExtension);
     // concatenates the attachments and the associated files
     $res = DBJson::concatObjectListsSingleResult($data, $attachments, Attachment::getDBPrimaryKey(), Attachment::getDBConvert()['F_file'], $files, File::getDBPrimaryKey(), $FileExtension, $AttachmentExtension);
     if ($isResult) {
         // to reindex
         $res = array_values($res);
         $res = Attachment::decodeAttachment($res, false);
         if ($singleResult == true) {
             // only one object as result
             if (count($res) > 0) {
                 $res = $res[0];
             }
         }
     }
     return $res;
 }
Exemplo n.º 6
0
 public static function ExtractGroup($data, $singleResult = false, $LeaderExtension = '', $MemberExtension = '', $GroupExtension = '', $isResult = true)
 {
     // generates an assoc array of an user by using a defined list of
     // its attributes
     $leader = DBJson::getObjectsByAttributes($data, User::getDBPrimaryKey(), User::getDBConvert(), $LeaderExtension);
     // generates an assoc array of users by using a defined list of
     // its attributes
     $member = DBJson::getObjectsByAttributes($data, User::getDBPrimaryKey(), User::getDBConvert(), $MemberExtension . '2');
     // generates an assoc array of groups by using a defined list of
     // its attributes
     $groups = DBJson::getObjectsByAttributes($data, Group::getDBPrimaryKey(), Group::getDBConvert(), $GroupExtension);
     // concatenates the groups and the associated group leader
     $res = DBJson::concatObjectListsSingleResult($data, $groups, Group::getDBPrimaryKey(), Group::getDBConvert()['U_leader'], $leader, User::getDBPrimaryKey(), $LeaderExtension, $GroupExtension);
     // concatenates the groups and the associated group member
     $res = DBJson::concatResultObjectLists($data, $res, Group::getDBPrimaryKey(), Group::getDBConvert()['U_member'], $member, User::getDBPrimaryKey(), $MemberExtension . '2', $GroupExtension);
     if ($isResult) {
         // to reindex
         $res = array_merge($res);
         $res = Group::decodeGroup($res, false);
         if ($singleResult == true) {
             // only one object as result
             if (count($res) > 0) {
                 $res = $res[0];
             }
         }
     }
     return $res;
 }
Exemplo n.º 7
0
 public static function ExtractProcess($data, $singleResult = false, $ProcessExtension = '', $ComponentExtension = '', $ExerciseExtension = '', $isResult = true)
 {
     // generates an assoc array of processes by using a defined list of
     // its attributes
     $process = DBJson::getObjectsByAttributes($data, Process::getDBPrimaryKey(), Process::getDBConvert(), $ProcessExtension);
     // generates an assoc array of components by using a defined
     // list of its attributes
     $component = DBJson::getObjectsByAttributes($data, Component::getDBPrimaryKey(), Component::getDBConvert(), $ComponentExtension);
     // generates an assoc array of exercises by using a defined
     // list of its attributes
     $exercise = DBJson::getObjectsByAttributes($data, Exercise::getDBPrimaryKey(), Exercise::getDBConvert(), $ExerciseExtension);
     $attachment = Attachment::extractAttachment($data, false, '_PRO1', '_PRO1', false);
     $workFiles = Attachment::extractAttachment($data, false, '_PRO2', '_PRO2', false);
     // concatenates the processes and the associated attachments
     $process = DBJson::concatObjectListResult($data, $process, Process::getDBPrimaryKey(), Process::getDBConvert()['A_attachment'], $attachment, Attachment::getDBPrimaryKey(), '_PRO1', $ProcessExtension);
     // concatenates the processes and the associated attachments
     $process = DBJson::concatObjectListResult($data, $process, Process::getDBPrimaryKey(), Process::getDBConvert()['A_workFiles'], $workFiles, Attachment::getDBPrimaryKey(), '_PRO2', $ProcessExtension);
     // concatenates the processes and the associated components
     $process = DBJson::concatObjectListsSingleResult($data, $process, Process::getDBPrimaryKey(), Process::getDBConvert()['E_exercise'], $exercise, Exercise::getDBPrimaryKey(), $ExerciseExtension, $ProcessExtension);
     $res = DBJson::concatObjectListsSingleResult($data, $process, Process::getDBPrimaryKey(), Process::getDBConvert()['CO_target'], $component, Component::getDBPrimaryKey(), $ComponentExtension, $ProcessExtension);
     if ($isResult) {
         // to reindex
         $res = array_values($res);
         $res = Process::decodeProcess($res, false);
         if ($singleResult == true) {
             // only one object as result
             if (count($res) > 0) {
                 $res = $res[0];
             }
         }
     }
     return $res;
 }
Exemplo n.º 8
0
 public static function ExtractExternalId($data, $singleResult = false, $CourseExtension = '', $ExternalIdExtension = '', $isResult = true)
 {
     // generates an assoc array of courses by using a defined list of
     // its attributes
     $course = DBJson::getObjectsByAttributes($data, Course::getDBPrimaryKey(), Course::getDBConvert(), $CourseExtension);
     // generates an assoc array of external IDs by using a defined list of
     // its attributes
     $externalIds = DBJson::getObjectsByAttributes($data, ExternalId::getDBPrimaryKey(), ExternalId::getDBConvert(), $ExternalIdExtension);
     // concatenates the external IDs and the associated courses
     $res = DBJson::concatObjectListsSingleResult($data, $externalIds, ExternalId::getDBPrimaryKey(), ExternalId::getDBConvert()['EX_course'], $course, Course::getDBPrimaryKey(), $CourseExtension, $ExternalIdExtension);
     if ($isResult) {
         // to reindex
         $res = array_values($res);
         $res = ExternalId::decodeExternalId($res, false);
         if ($singleResult == true) {
             // only one object as result
             if (count($res) > 0) {
                 $res = $res[0];
             }
         }
     }
     return $res;
 }