. /** * Contains class used to prepare a verification result for display. * * @package mod_customcert * @copyright 2017 Mark Nelson * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ namespace mod_customcert\output; defined('MOODLE_INTERNAL') || die(); use renderable; use templatable; /** * Class to prepare a verification result for display. * * @package mod_customcert * @copyright 2017 Mark Nelson * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class verify_certificate_result implements templatable, renderable { /** * @var string The URL to the user's profile. */ public $userprofileurl; /** * @var string The user's fullname. */ public $userfullname; /** * @var string The URL to the course page. */ public $courseurl; /** * @var string The course's fullname. */ public $coursefullname; /** * @var string The certificate's name. */ public $certificatename; /** * Constructor. * * @param \stdClass $result */ public function __construct($result) { $this->userprofileurl = new \moodle_url('/user/view.php', array('id' => $result->userid, 'course' => $result->courseid)); $this->userfullname = fullname($result); $this->courseurl = new \moodle_url('/course/view.php', array('id' => $result->courseid)); $this->coursefullname = $result->coursefullname; $this->certificatename = $result->certificatename; } public function export_for_template(\renderer_base $output) { $result = new \stdClass(); $result->userprofileurl = $this->userprofileurl; $result->userfullname = $this->userfullname; $result->coursefullname = $this->coursefullname; $result->courseurl = $this->courseurl; $result->certificatename = $this->certificatename; return $result; } }