Changeset 8cddd1e in iPeer


Ignore:
Timestamp:
2013-08-07T16:07:37-07:00 (4 years ago)
Author:
Compass <pan.luo@…>
Branches:
3.1.x, dev, master
Children:
4d5a23c
Parents:
d01e64b
git-author:
mwytang <michael.tang@…> (07/11/2013 04:24:01 PM)
git-committer:
Compass <pan.luo@…> (08/07/2013 04:07:37 PM)
Message:

Modified courses/edit for instructor in no faculties

When instructors are created with no faculties, their list of
available instructors is empty. This causes a problem when the
course is edited (Eg. change the title). Since the list of instructors
would be empty, the list of selected instructors would also be empty.
This will cause the list of instructors in the course to be removed.

I have now fixed the problem by appending the course's instructors
to the beginning of the list of available instructors whether
the instructors are in the same faculties or not.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • app/controllers/courses_controller.php

    rd01e64b r8cddd1e  
    186186     * Set all the necessary variables for the Add and Edit form elements.
    187187     *
     188     * @params mixed $courseId courseId - default null (eg. add)
     189     *
    188190     * @return void
    189191     * */
    190     public function _initFormEnv() {
     192    public function _initFormEnv($courseId = 0) {
    191193        // set the list of departments
    192194        if (User::hasPermission('functions/user/superadmin')) {
     
    220222
    221223        $this->set('departments', $departments);
     224       
     225        $currentProf = $this->User->getInstructorsByCourse($courseId);
     226        $currentProf = Set::combine($currentProf, '{n}.User.id', '{n}.User.full_name');
     227        $instructorList = $currentProf + array_diff($instructorList, $currentProf);
    222228
    223229        // set the list of instructors
     
    264270    public function edit($courseId)
    265271    {
    266         $this->_initFormEnv();
     272        $this->_initFormEnv($courseId);
    267273
    268274        $course = $this->Course->getAccessibleCourseById($courseId, User::get('id'), User::getCourseFilterPermission(), array('Instructor', 'Department'));
Note: See TracChangeset for help on using the changeset viewer.