$promoteinfo = $DB->get_record("reader_levels", array("userid" => $USER->id, "readerid" => $reader->id)); $allowdifficultysql = ""; if ($leveldata['onthislevel'] > 0) { $allowdifficultysql .= $leveldata['studentlevel'] . ","; } if ($leveldata['onprevlevel'] > 0 && $leveldata['studentlevel'] - 1 >= 0) { $allowdifficultysql .= $leveldata['studentlevel'] - 1 . ","; } if ($leveldata['onnextlevel'] > 0) { $allowdifficultysql .= $leveldata['studentlevel'] + 1 . ","; } $allowdifficultysql = substr($allowdifficultysql, 0, -1); if (isset($_SESSION['SESSION']->reader_teacherview) && $_SESSION['SESSION']->reader_teacherview == "teacherview" || $reader->levelcheck == 0) { $allowdifficultysql = '0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15'; } if (list($attemptdata, $summaryattemptdata) = reader_get_student_attempts($USER->id, $reader, true, true)) { foreach ($attemptdata as $attemptdata_) { reader_set_attempt_result($attemptdata_['id'], $reader); //insert result $alreadyansweredbooksid[] = $attemptdata_['quizid']; if (!empty($attemptdata_['sametitle'])) { $alreadyansweredbookssametitle[] = $attemptdata_['sametitle']; } } } $publishers = $DB->get_records("reader_publisher", NULL, "publisher"); foreach ($publishers as $publisher_) { $publisherform["id=" . $id . "&publisher=" . $publisher_->publisher] = $publisher_->publisher; } foreach ($publisherform as $key => $value) { $needtousepublisher = false;
foreach ($attempts as $attempt) { if (strtolower($attempt->passed) == "true") { $bookdata = $DB->get_record("reader_publisher", array("id" => $attempt->quizid)); $data['totalwordsthisterm'] += $bookdata->words; } } } if ($attempts = $DB->get_records_sql("SELECT * FROM {reader_attempts} WHERE userid= ? ", array($coursestudent->id))) { foreach ($attempts as $attempt) { if (strtolower($attempt->passed) == "true") { $bookdata = $DB->get_record("reader_publisher", array("id" => $attempt->quizid)); $data['totalwordsallterms'] += $bookdata->words; } } } if ($attemptdata = reader_get_student_attempts($coursestudent->id, $reader)) { if (has_capability('mod/reader:viewstudentreaderscreens', $contextmodule)) { $link = reader_fullname_link_viewasstudent($coursestudent, "grid={$grid}&book={$book}&searchtext={$searchtext}&page={$page}&sort={$sort}&orderby={$orderby}"); } else { $link = reader_fullname_link_t($coursestudent); } $table->data[] = array(html_writer::empty_tag('input', array('type' => 'checkbox', 'name' => 'noqstudents[]', 'value' => $coursestudent->id)), $picture, reader_user_link_t($coursestudent), $link, $attemptdata[1]['currentlevel'], $data['totalwordsthisterm'], $data['totalwordsallterms']); } else { if (has_capability('mod/reader:viewstudentreaderscreens', $contextmodule)) { $link = reader_fullname_link_viewasstudent($coursestudent); } else { $link = reader_fullname_link_t($coursestudent); } $table->data[] = array(html_writer::empty_tag('input', array('type' => 'checkbox', 'name' => 'noqstudents[]', 'value' => $coursestudent->id)), $picture, reader_user_link_t($coursestudent), $link, $attemptdata[1]['currentlevel'], 0, 0); } }