Courses 16 Customizations

From courses15 (php settings are on server not specific to an instance of moodle)

PHP Settings

Set max_input_vars = 5000 (default is 1000, 5000 may not be completely necessary, but works)

With a limit of 1000, manual backups may fail for complex courses since the number of options when making a backup is proportional to the number of topics, quizzes, assignments, etc.  1000 failed for Bob Hall's 435/635 course.

CAS Auth

COURSES16 is Moodle 2.9 (June 12, 2015 version).  The CAS code changed so different changes will be needed

To increase the reliability of the login process, we are using the UIN rather than the NetID from the CAS payload. To make this happen, the following changes were made to the CAS module.

auth/cas/CAS/CAS/Client.php

Beginning around line 2805 within validateCAS20
// CEHD Customization. Changed "user" to "tamuEduPersonUIN"
Original
  if ( $success_elements->item(0)->getElementsByTagName("user")->length == 0) {
  and
     $this->_setUser(trim($success_elements->item(0)->getElementsByTagName("user")->item(0)->nodeValue));

Modified To
  if ( $success_elements->item(0)->getElementsByTagName("tamuEduPersonUIN")->length == 0) {
  and
       $this->_setUser(trim($success_elements->item(0)->getElementsByTagName("tamuEduPersonUIN")->item(0)->nodeValue));

The service to be sent to CAS is being constructed on the fly and is including the alternate ports we used on the backend.  This breaks CAS.  We have to disable this functionality.

(Changed from _getServerURL in courses15)

In the function _getClientUrl (in Client.php), comment out the section that adds a port number if a non-standard one is being used.

// CEHD Customization
// We are running the backends on alternate ports which is confusion this function.
/*
            if ( ($this->_isHttps() && $server_port!=443)
                || (!$this->_isHttps() && $server_port!=80)
            ) {
                $server_url .= ':';
                $server_url .= $server_port;
            }
*/

LDAP Fix

Moodle's CAS plugin presumes the existence of an LDAP server to check against.  The only consequence of this we have found is that it prevents the changing the username of a CAS user (since it assumes the user is in a LDAP DB and hence shouldn't be changed through Moodle).  This hack prevents that check so username changes can be performed.  Note.  There is little reason for the username to change (since we are using the UIN rather than Net ID-- see above -- but it is handy for testing purposes to be able to change the username=uin of a user.

To allow changing the username of a CAS user, comment out the check in auth/ldap/auth.php

function user_update($olduser, $newuser) {
global $USER;
// CEHD. CAS builds on the LDAP library. But, there is no reason to disallow username changes for CAS users in our case.
//
// if (isset($olduser->username) and isset($newuser->username) and $olduser->username != $newuser->username) {
// error_log($this->errorlogtag.get_string('renamingnotallowed', 'auth_ldap'));
// return false;
// }

CAS Language Update

Replace the language strings in auth/cas/lang/en/auth_cas.php for accessCAS and accessNOCAS with

  • $string['accesCAS'] = 'Login for Texas A&M Students, Faculty and Staff';
    $string['accesNOCAS'] = 'Login for others';
     

Add IP Address to Quiz Attempts Report

moodle/mod/quiz/report/attemptreport_table.php

Changed function base_sql (function begins at approx line 387)

Appended the IP address to the SELECT list

// CEHD Customization to display IP address on quiz attempts report
$fields .= ', log.ip as ipaddress';
 

Joined the Log table (where the IP address is stored) to the query

        // CEHD Customization
//                     quiza.quiz=log.info
        $from .= " LEFT JOIN {logstore_standard_log} log ON (
                     log.userid=u.id
                     AND component='mod_quiz'
                     AND action='submitted'
                     AND target='attempt'
                     AND log.timecreated BETWEEN quiza.timefinish-3 AND quiza.timefinish+3
                  )";

// END CEHD Customization

We have seen a pretty large discrepancy between the quiz attempt time and the log time so have had to use a big time cushion.

moodle/mod/quiz/report/attemptreport.php

Altered function add_time_columns (function begins at approx line 217)

Added these lines to display the IP address in the table just prior to the time start/finish columns

$columns[] = 'ipaddress';   // CEHD Customization
$headers[] = "IP Address";  // CEHD Customization

Certificate Module

The Backup/Restore process does not translate userids between system.  A single line was missing from the restore script (mod/certificate/backup/moodle2/restore_certificate_stepslib.php) -- see below.

    protected function process_certificate_issue($data) {
        global $DB;

        $data = (object)$data;
        $oldid = $data->id;

        $data->certificateid = $this->get_new_parentid('certificate');
        $data->timecreated = $this->apply_date_offset($data->timecreated);

        // CEHD Customization.  this line is needed to allow the the userid to be translated properly between sites
        $data->userid = $this->get_mappingid('user', $data->userid);

        $newitemid = $DB->insert_record('certificate_issues', $data);
        $this->set_mapping('certificate_issue', $oldid, $newitemid);
    }

 

Taxonomy: