/** * Render the element in html. * * This function is used to render the element when we are using the * drag and drop interface to position it. */ public function render_html() { $code = customcert_generate_code(); return parent::render_html_content($code); }
} // Create the button to download the customcert. $linkname = get_string('getcustomcert', 'customcert'); $link = new moodle_url('/mod/customcert/view.php', array('id' => $cm->id, 'action' => 'download')); $downloadbutton = new single_button($link, $linkname); $downloadbutton->add_action(new popup_action('click', $link, 'customcertpopup', array('height' => 600, 'width' => 800))); $downloadbutton = html_writer::tag('div', $OUTPUT->render($downloadbutton), array('style' => 'text-align:center')); // Output all the page data. echo $OUTPUT->header(); groups_print_activity_menu($cm, $pageurl); echo $reportlink; echo $intro; echo $issuelist; echo $downloadbutton; echo $OUTPUT->footer($course); exit; } else { // Output to pdf // Create new customcert issue record if one does not already exist. if (!$DB->record_exists('customcert_issues', array('userid' => $USER->id, 'customcertid' => $customcert->id))) { $customcertissue = new stdClass(); $customcertissue->customcertid = $customcert->id; $customcertissue->userid = $USER->id; $customcertissue->code = customcert_generate_code(); $customcertissue->timecreated = time(); // Insert the record into the database. $DB->insert_record('customcert_issues', $customcertissue); } // Now we want to generate the PDF. customcert_generate_pdf($customcert); }