Proyectos de Subversion Moodle

Rev

Rev 1 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 1 Rev 1441
Línea 16... Línea 16...
16
 
16
 
Línea 17... Línea 17...
17
declare(strict_types=1);
17
declare(strict_types=1);
Línea -... Línea 18...
-
 
18
 
18
 
19
namespace core_course\reportbuilder\datasource;
19
namespace core_course\reportbuilder\datasource;
20
 
20
 
21
use core_cohort\reportbuilder\local\entities\cohort;
21
use core_course\reportbuilder\local\entities\course_category;
22
use core_course\reportbuilder\local\entities\course_category;
22
use core_course\reportbuilder\local\entities\access;
23
use core_course\reportbuilder\local\entities\access;
Línea 111... Línea 112...
111
            ->add_join("
112
            ->add_join("
112
                LEFT JOIN ({$groupsinnerselect}) {$groups}
113
                LEFT JOIN ({$groupsinnerselect}) {$groups}
113
                       ON {$groups}.courseid = {$course}.id AND {$groups}.userid = {$user}.id")
114
                       ON {$groups}.courseid = {$course}.id AND {$groups}.userid = {$user}.id")
114
        );
115
        );
Línea -... Línea 116...
-
 
116
 
-
 
117
        // Join cohort entity.
-
 
118
        $cohortentity = new cohort();
-
 
119
        $cohortalias = $cohortentity->get_table_alias('cohort');
-
 
120
        $cohortmemberalias = database::generate_alias();
-
 
121
        $this->add_entity($cohortentity
-
 
122
            ->add_joins($userentity->get_joins())
-
 
123
            ->add_joins([
-
 
124
                "LEFT JOIN {cohort_members} {$cohortmemberalias} ON {$cohortmemberalias}.userid = {$user}.id",
-
 
125
                "LEFT JOIN {cohort} {$cohortalias} ON {$cohortalias}.id = {$cohortmemberalias}.cohortid",
-
 
126
            ])
-
 
127
        );
115
 
128
 
116
        // Join completion entity.
129
        // Join completion entity.
117
        $completionentity = (new completion())
130
        $completionentity = (new completion())
118
            ->set_table_aliases([
131
            ->set_table_aliases([
119
                'course' => $course,
132
                'course' => $course,
120
                'user' => $user,
133
                'user' => $user,
121
            ]);
134
            ]);
122
        $completion = $completionentity->get_table_alias('course_completion');
135
        $completion = $completionentity->get_table_alias('course_completions');
123
        $this->add_entity($completionentity
136
        $this->add_entity($completionentity
124
            ->add_joins($userentity->get_joins())
137
            ->add_joins($userentity->get_joins())
125
            ->add_join("
138
            ->add_join("
126
                LEFT JOIN {course_completions} {$completion}
139
                LEFT JOIN {course_completions} {$completion}
Línea 136... Línea 149...
136
            ->add_join("
149
            ->add_join("
137
                LEFT JOIN {user_lastaccess} {$lastaccess}
150
                LEFT JOIN {user_lastaccess} {$lastaccess}
138
                       ON {$lastaccess}.userid = {$user}.id AND {$lastaccess}.courseid = {$course}.id"));
151
                       ON {$lastaccess}.userid = {$user}.id AND {$lastaccess}.courseid = {$course}.id"));
Línea 139... Línea 152...
139
 
152
 
140
        // Add all entities columns/filters/conditions.
153
        // Add all entities columns/filters/conditions.
-
 
154
        $this->add_all_from_entities([
-
 
155
            $courseentity->get_entity_name(),
-
 
156
            $coursecatentity->get_entity_name(),
-
 
157
            $enrolmententity->get_entity_name(),
-
 
158
            $enrolentity->get_entity_name(),
-
 
159
            $userentity->get_entity_name(),
-
 
160
            $roleentity->get_entity_name(),
-
 
161
            $groupentity->get_entity_name(),
-
 
162
        ]);
-
 
163
 
-
 
164
        $this->add_all_from_entity($cohortentity->get_entity_name(), ['name', 'idnumber', 'description', 'customfield*'],
-
 
165
            ['cohortselect', 'name', 'idnumber', 'customfield*'], ['cohortselect', 'name', 'idnumber', 'customfield*']);
-
 
166
 
-
 
167
        $this->add_all_from_entities([
-
 
168
            $completionentity->get_entity_name(),
-
 
169
            $accessentity->get_entity_name(),
141
        $this->add_all_from_entities();
170
        ]);
Línea 142... Línea 171...
142
    }
171
    }
143
 
172
 
144
    /**
173
    /**