in locallib.php [132:175]
public function get_form_elements($submission, MoodleQuickForm $mform, stdClass $data) {
global $USER;
// Check to see if one note is disabled site wide.
if (get_config('local_o365', 'onenote')) {
return true;
}
if ($this->get_config('maxfilesubmissions') <= 0) {
return false;
}
try {
$onenoteapi = \local_onenote\api\base::getinstance();
} catch (\Exception $e) {
$html = '<div>'.$e->getMessage().'</div>';
$mform->addElement('html', $html);
return false;
}
$cmid = $this->assignment->get_course_module()->id;
$isstudent = $onenoteapi->is_student($cmid, $USER->id);
if (!$isstudent) {
return false;
}
$o = '<hr/><b>' . get_string('onenoteactions', 'assignsubmission_onenote') . '</b>';
if ($onenoteapi->is_logged_in()) {
// Show a button to open the OneNote page.
$o .= $onenoteapi->render_action_button(get_string('workonthis', 'assignsubmission_onenote'),
$this->assignment->get_course_module()->id, false, false,
$submission ? $submission->userid : null, $submission ? $submission->id : null, null);
$o .= '<br/><p>' . get_string('workonthishelp', 'assignsubmission_onenote') . '</p>';
} else {
$o .= $onenoteapi->render_signin_widget();
$o .= '<br/><br/><p>' . get_string('signinhelp1', 'assignsubmission_onenote') . '</p>';
}
$o .= '<hr/>';
$mform->addElement('html', $o);
return true;
}