コード例 #1
0
 /**
  * Definition for the form
  */
 function definition()
 {
     // Create form
     $mform = $this->_form;
     $category = $this->_customdata['category'];
     $role = $this->_customdata['role'];
     $course = $this->_customdata['course'];
     $active = $this->_customdata['active'];
     $mform->addElement('header', 'selectprocess', get_string('formdescription', 'report_jemena'));
     // The category
     $mform->addElement('select', 'category', get_string('processarea', 'report_jemena'), jemena_get_categories());
     $mform->setType('category', PARAM_INT);
     $mform->setDefault('category', $category);
     // The role
     $mform->addElement('select', 'role', get_string('role', 'report_jemena'), jemena_get_meta_courses());
     $mform->setType('role', PARAM_INT);
     $mform->setDefault('role', $role);
     // Add line break
     $mform->addElement('html', '<hr />');
     // The course
     $mform->addElement('select', 'course', get_string('course', 'report_jemena'), jemena_get_meta_linked_courses($category, $role, true));
     $mform->setType('course', PARAM_INT);
     $mform->setDefault('course', $course);
     // Active/inactive
     $mform->addElement('select', 'userstatus', get_string('userstatus', 'report_jemena'), jemena_get_user_status());
     $mform->setType('userstatus', PARAM_INT);
     $mform->setDefault('active', $active);
     // The completion date from
     $mform->addElement('date_selector', 'completiondatefrom', get_string('completiondatefrom', 'report_jemena'), array('optional' => true));
     $mform->setType('completiondatefrom', PARAM_INT);
     // The completion date to
     $mform->addElement('date_selector', 'completiondateto', get_string('completiondateto', 'report_jemena'), array('optional' => true));
     $mform->setType('completiondateto', PARAM_INT);
     // Add the submit and reset buttons
     $buttons = array();
     $buttons[] =& $mform->createElement('submit', 'submit', get_string('search', 'report_jemena'), 'asd');
     $buttons[] =& $mform->createElement('submit', 'reset', get_string('reset', 'report_jemena'));
     $mform->addGroup($buttons, 'buttons', '', '', true);
 }
コード例 #2
0
<?php

/**
 * Handles AJAX requests
 *
 * @copyright Jemena
 * @author    Mark Nelson <*****@*****.**>, Pukunui Technology
 * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 */
require_once '../../config.php';
require_once $CFG->dirroot . '/report/jemena/lib.php';
$category = required_param('category', PARAM_INT);
$role = required_param('role', PARAM_INT);
echo json_encode(jemena_get_meta_linked_courses($category, $role, false, true));
コード例 #3
0
 $row->cells[] = $cell;
 // Create the cell
 $cell = new html_table_cell();
 $cell->header = true;
 $cell->text = "<strong>" . get_string('traineescompleted', 'report_jemena') . "</strong>";
 $row->cells[] = $cell;
 // Create the cell
 $cell = new html_table_cell();
 $cell->header = true;
 $cell->text = "<strong>" . get_string('percentcompleted', 'report_jemena') . "</strong>";
 $row->cells[] = $cell;
 // Finally - add the headers cells to the row
 $table->data[] = $row;
 // Loop through the courses
 if (!$data->course) {
     if ($courses = jemena_get_meta_linked_courses($data->category, $data->role)) {
         foreach ($courses as $c) {
             // Get statistics
             $stats = jemena_get_course_statistics($c->id, $role, $datefrom, $dateto, false, $userstatus);
             if ($stats->traineesenrolled == 0) {
                 $percentage = 0;
             } else {
                 $percentage = $stats->traineescompleted / $stats->traineesenrolled * 100;
             }
             // Fill the table
             $row = new html_table_row();
             // Add new html cell
             $cell = new html_table_cell();
             $cell->style = 'text-align:center';
             $cell->text = $c->categoryname;
             $row->cells[] = $cell;
コード例 #4
0
            // Get the statistics
            $businessunit = jemena_get_custom_field($u->id, 'SAP Job');
            $sapjob = jemena_get_custom_field($u->id, 'Business Unit');
            //$completionstats = jemena_get_course_completion_stats($u->id, $course->id, $format);
            // if (!$role) {
            // $rolename = $u->courseshortname;
            // }
            $grade = jemena_get_course_grade($u->id, $course->id);
            $completedinfo = jemena_get_completed_date($u->timecompleted, $datefrom, $dateto, $strcompleted, $format);
            $completed = $completedinfo->completed;
            $timecompleted = $completedinfo->timecompleted;
            $csvdata[] = $u->firstname . "," . $u->lastname . "," . $u->department . "," . $businessunit . "," . $sapjob . "," . $course->categoryname . "," . $course->shortname . "," . $grade . "," . $completed . "," . $timecompleted . "\n";
        }
    }
} else {
    if ($courses = jemena_get_meta_linked_courses($category, $role)) {
        // Loop through courses
        foreach ($courses as $c) {
            if ($users = jemena_get_users($c->id, $role, $datefrom, $dateto, $userstatus)) {
                // Loop through users
                foreach ($users as $u) {
                    // Get the statistics
                    $businessunit = jemena_get_custom_field($u->id, 'SAP Job');
                    $sapjob = jemena_get_custom_field($u->id, 'Business Unit');
                    //$completionstats = jemena_get_course_completion_stats($u->id, $c->id, $format);
                    // if (!$role) {
                    // $rolename = $u->courseshortname;
                    // }
                    $grade = jemena_get_course_grade($u->id, $c->id);
                    $completedinfo = jemena_get_completed_date($u->timecompleted, $datefrom, $dateto, $strcompleted, $format);
                    $completed = $completedinfo->completed;