$limitfrom = $param_displaystart; $limitnum = $param_displaylength; } else { $limitfrom = (isset($DB) and is_callable(array($DB, 'get_records_sql'))) ? 0 : ''; $limitnum = (isset($DB) and is_callable(array($DB, 'get_records_sql'))) ? 0 : ''; } $sQuery .= $sWhere; $cResult = (isset($DB) and is_callable(array($DB, 'get_records_sql'))) ? $DB->get_records_sql($sQuery, array()) : get_records_sql($sQuery); $iTotal = count($cResult); $sQuery .= $sOrder . $sLimit; $rResult = (isset($DB) and is_callable(array($DB, 'get_records_sql'))) ? $DB->get_records_sql($sQuery, array(), $limitfrom, $limitnum) : get_records_sql($sQuery, $limitfrom, $limitnum); $iFilteredTotal = $iTotal; //count( $rResult ); $param_echo = optional_param('sEcho', 0, PARAM_INT); // echo $output = array("sEcho" => $param_echo, "iTotalRecords" => $iTotal, "iTotalDisplayRecords" => $iFilteredTotal, "aaData" => array()); $rResult = !is_array($rResult) ? array() : $rResult; $i = 0; foreach ($rResult as $result) { // 'cs.fullname', 'tu.name', 'fl.filename', 'us.firstname', 'us.lastname', 'us.email', 'fl.timecreated' $row = array(); $row[] = '<input type="checkbox" id="userlinks_' . $i . '" name="userlinks[]" value="' . $result->id . '" />'; $row[] = $result->turnitin_uid == 0 ? '' : $result->turnitin_uid; $row[] = ' '; $row[] = !is_null($result->firstname) ? '<a href="' . $CFG->wwwroot . '/user/view.php?id=' . $result->userid . '">' . $result->lastname . ', ' . $result->firstname . '</a> (' . $result->email . ')' : get_string('nonmoodleuser', 'turnitintool'); $row[] = $result->turnitin_utp == 1 ? turnitintool_pseudoemail($result->email) : '-'; $row[] = ' '; $output['aaData'][] = $row; $i++; } echo json_encode($output);
/** * The constructor for the class, Calls the startsession() method if we are using sessions * * @param int $iUid The User ID passed in the class creation call * @param string $iUfn The User First Name passed in the class creation call * @param string $iUln The User Last Name passed in the class creation call * @param string $iUem The User Email passed in the class creation call * @param int $iUtp The User Type passed in the class creation call * @param object $iLoaderBar The Loader Bar object passed in the class creation call (may be NULL if no loaderbar is to be used) * @param boolean $iUseSession Determines whether we start a session for this call (set to false for SSO calls) */ function __construct($iUid, $iUfn, $iUln, $iUem, $iUtp, &$iLoaderBar) { global $CFG; $this->callback = false; $this->apiurl = $CFG->turnitin_apiurl; $this->accountid = $CFG->turnitin_account_id; $this->uid = $iUid; // Convert the email, firstname and lastname to psuedos for students if the option is set in config // Unless the user is already logged as a tutor then use real details if (isset($CFG->turnitin_enablepseudo) and $CFG->turnitin_enablepseudo == 1 and $iUtp == 1 and !turnitintool_istutor($iUem)) { $iUfn = turnitintool_pseudofirstname(); $iUln = turnitintool_pseudolastname($iUem); $iUem = turnitintool_pseudoemail($iUem); } $this->ufn = $iUfn; $this->uln = $iUln; $this->uem = $iUem; $this->utp = $iUtp; $this->loaderbar =& $iLoaderBar; }
$table->rows[0]->cells = $cells; array_multisort($lastname, SORT_ASC, $userarray); $i = 0; foreach ($userarray as $user) { unset($cells); $cells[0]->class = 'cell c0 iconcell'; $cells[0]->data = '<input type="checkbox" id="userlinks_' . $i . '" name="userlinks[]" value="' . $user->linkid . '" />'; $cells[1]->class = 'cell c1 markscell'; $cells[1]->data = $user->turnitin_uid > 0 ? $user->turnitin_uid : null; $cells[2]->class = 'cell c2'; $cells[2]->data = !empty($user->firstname) ? '<a href="' . $CFG->wwwroot . '/user/view.php?id=' . $user->id . '">' : ''; $cells[2]->data .= $user->lastname . ', ' . $user->firstname; $cells[2]->data .= !empty($user->firstname) ? '</a>' : ''; $cells[2]->data .= ' (' . $user->email . ')'; $cells[3]->class = 'cell c3'; $cells[3]->data = $user->turnitin_utp == 1 ? turnitintool_pseudoemail($user->email) : '-'; $i++; $table->rows[$i]->class = 'row r' . ($i % 2 ? 0 : 1); $table->rows[$i]->cells = $cells; } turnitintool_print_table($table); } echo '</div><input style="margin-top: 7px;" name="unlink" value="Unlink Users" type="submit" /> <input style="margin-top: 7px;" name="relink" value="Relink Users" type="submit" /></form> '; turnitintool_box_end(); echo '</div>'; turnitintool_footer(); } else { if (!is_null($param_do) and ($param_do == "commslog" or $param_do == "activitylog")) { $logsdir = $CFG->dataroot . "/temp/turnitintool/logs/"; $savefile = $param_do . '_' . $param_filedate . '.log';