/** * TODO comment this */ function definition() { global $USER, $CFG; $dbc = new ilp_db(); $mform =& $this->_form; //get all of the installed form element plugins $formelementplugins = $dbc->get_form_element_plugins(); $frmplugins = array('' => get_string('addpromptdots', 'block_ilp')); //if no elements installed pass an empty array if (empty($formelementplugins)) { $formelementplugins = array(); } //append _description to the name field so there description can be picked up from lang file foreach ($formelementplugins as $plg) { $frmplugins[$plg->id] = get_string($plg->name . '_description', 'block_ilp'); } $fieldsettitle = get_string('addfield', 'block_ilp'); //create a new fieldset $mform->addElement('html', '<fieldset id="reportfieldset" class="clearfix ilpfieldset">'); $mform->addElement('html', '<legend class="ftoggler">' . $fieldsettitle . '</legend>'); $mform->addElement('hidden', 'report_id', $this->report_id); $mform->setType('report_id', PARAM_INT); $mform->addElement('select', 'plugin_id', get_string('addfield', 'block_ilp'), $frmplugins); $mform->addRule('plugin_id', null, 'required', null, 'client'); $mform->setType('plugin_id', PARAM_INT); $buttonarray[] =& $mform->createElement('submit', 'submitbutton', get_string('addfield', 'block_ilp')); $mform->addGroup($buttonarray, 'buttonar', '', array(' '), false); //close the fieldset $mform->addElement('html', '</fieldset>'); }
/** * Installs any new plugins */ public function install_new_plugins() { global $CFG; // include the ilp db require_once $CFG->dirroot . '/blocks/ilp/db/ilp_db.php'; // instantiate the ilp db class needed as this function will be called //when not in object context $dbc = new ilp_db(); //call the install new plugins function from the parent class //pass the list of plugins currently installed to it parent::install_new_plugins($dbc->get_dashboard_templates(), $CFG->dirroot . "/blocks/ilp/classes/dashboard/templates"); }
/** * TODO comment this */ function definition() { global $USER, $CFG; // include the assmgr db require_once $CFG->dirroot . '/blocks/ilp/db/ilp_db.php'; $dbc = new ilp_db(); $mform =& $this->_form; //get all of the fields in the current report, they will be returned in order as //no position has been specified $reportfields = $this->dbc->get_report_fields_by_position($this->report_id); $report = $this->dbc->get_report_by_id($this->report_id); $user = $this->dbc->get_user_by_id($this->user_id); $title = "{$report->name} " . get_string('for', 'block_ilp') . " {$user->firstname} {$user->lastname}"; //create a new fieldset $mform->addElement('html', '<fieldset id="reportfieldset" class="clearfix ilpfieldset">'); $mform->addElement('html', '<legend class="ftoggler">' . $title . '</legend>'); $desc = html_entity_decode($report->description); $mform->addElement('html', '<div class="descritivetext">' . $desc . '</div>'); $mform->addElement('hidden', 'entry_id', $this->entry_id); $mform->setType('entry_id', PARAM_INT); $mform->addElement('hidden', 'report_id', $this->report_id); $mform->setType('report_id', PARAM_INT); $mform->addElement('hidden', 'user_id', $this->user_id); $mform->setType('user_id', PARAM_INT); $mform->addElement('hidden', 'course_id', $this->course_id); $mform->setType('course_id', PARAM_INT); if (!empty($reportfields)) { foreach ($reportfields as $field) { //get the plugin record that for the plugin $pluginrecord = $dbc->get_plugin_by_id($field->plugin_id); //take the name field from the plugin as it will be used to call the instantiate the plugin class $classname = $pluginrecord->name; // include the class for the plugin include_once "{$CFG->dirroot}/blocks/ilp/classes/form_elements/plugins/{$classname}.php"; if (!class_exists($classname)) { print_error('noclassforplugin', 'block_ilp', '', $pluginrecord->name); } //instantiate the plugin class $pluginclass = new $classname(); $pluginclass->load($field->id); //call the plugins entry_form function which will add an instance of the plugin //to the form $pluginclass->entry_form($mform); } } $buttonarray[] =& $mform->createElement('submit', 'submitbutton', get_string('submit')); $buttonarray[] =& $mform->createElement('cancel'); $mform->addGroup($buttonarray, 'buttonar', '', array(' '), false); //close the fieldset $mform->addElement('html', '</fieldset>'); }
/** * Carries out functions needed after installation * * @copyright © 2011 University of London Computer Centre * @author http://www.ulcc.ac.uk, http://moodle.ulcc.ac.uk * @license http://www.gnu.org/copyleft/gpl.html GNU Public License * @package ILP * @version 2.0 */ function xmldb_block_ilp_install() { global $USER, $CFG, $SESSION, $PARSER; // include the ilp db require_once $CFG->dirroot . '/blocks/ilp/db/ilp_db.php'; // instantiate the db $dbc = new ilp_db(); //install the various plugins and templates into the database require_once $CFG->dirroot . '/blocks/ilp/classes/form_elements/ilp_element_plugin.php'; //install new plugins ilp_element_plugin::install_new_plugins(); require_once $CFG->dirroot . '/blocks/ilp/classes/dashboard/ilp_dashboard_template.php'; //install new templates ilp_dashboard_template::install_new_plugins(); require_once $CFG->dirroot . '/blocks/ilp/classes/dashboard/ilp_dashboard_plugin.php'; //install new dashboard plugins ilp_dashboard_plugin::install_new_plugins(); require_once $CFG->dirroot . '/blocks/ilp/classes/dashboard/ilp_dashboard_tab.php'; //install new tabs ilp_dashboard_tab::install_new_plugins(); //create relationships betweendashboard plugins and template regions //get the enabled template should be the default temmplate at this stage $enabled_template = $dbc->get_enabled_template(); $regions = $dbc->get_template_regions($enabled_template->id); $region_plugins = array(); //create the association between the plugin and the first region $plugin = $dbc->get_dashboard_plugin_by_name('ilp_dashboard_student_info_plugin'); $rp = new stdClass(); $rp->plugin_id = $plugin->id; $region_plugins[] = $rp; $plugin = $dbc->get_dashboard_plugin_by_name('ilp_dashboard_main_plugin'); $rp = new stdClass(); $rp->plugin_id = $plugin->id; $region_plugins[] = $rp; //loop through the regions and assign the region to a plugin $i = 0; foreach ($regions as $r) { $region_plugins[$i]->region_id = $r->id; //create the record $dbc->create_region_plugin($region_plugins[$i]); $i++; } //create default user status record and subsequent items $statusitem = new stdClass(); $statusitem->selecttype = NULL; $id = $dbc->create_plugin_record('block_ilp_plu_sts', $statusitem); $statusitems = array('red' => '1', 'orange' => '0', 'green' => '2'); foreach ($statusitems as $key => $passfail) { $si = new stdClass(); $si->name = $key; $si->value = $key; $si->passfail = $passfail; $si->parent_id = $id; $dbc->create_plugin_record('block_ilp_plu_sts_items', $si); } }
/** * TODO comment this */ function definition() { global $USER, $CFG; // include the assmgr db require_once $CFG->dirroot . '/blocks/ilp/db/ilp_db.php'; $dbc = new ilp_db(); $mform =& $this->_form; //get all of the fields in the current report, they will be returned in order as //no position has been specified $reportfields = $this->dbc->get_report_fields_by_position($this->report_id); $report = $this->dbc->get_report_by_id($this->report_id); //create a new fieldset $mform->addElement('html', '<fieldset id="reportfieldset" class="clearfix ilpfieldset">'); $mform->addElement('html', '<legend class="ftoggler">' . $report->name . '</legend>'); $desc = html_entity_decode($report->description); $mform->addElement('html', '<div class="descritivetext">' . $desc . '</div>'); foreach ($reportfields as $field) { //get the plugin record that for the plugin $pluginrecord = $dbc->get_plugin_by_id($field->plugin_id); //take the name field from the plugin as it will be used to call the instantiate the plugin class $classname = $pluginrecord->name; // include the class for the plugin include_once "{$CFG->dirroot}/blocks/ilp/classes/form_elements/plugins/{$classname}.php"; if (!class_exists($classname)) { print_error('noclassforplugin', 'block_ilp', '', $pluginrecord->name); } //instantiate the plugin class $pluginclass = new $classname(); $pluginclass->load($field->id); //call the plugins entry_form function which will add an instance of the plugin //to the form $pluginclass->entry_form($mform); } //close the fieldset $mform->addElement('html', '</fieldset>'); }
/** * A PHP magic method that matches on all Moodle 2.x style db method calls * and converts them back to the Moodle 1.x functional syntax before * executing them. * * @param string $method The name of the method being called. * @param array $params The array of parameters passed to the method. * @return mixed The result of the query. */ function __call($method, $params) { // if this is a raw SQL query then we need to add the table prefixes if (preg_match('/_sql$/', $method)) { $params = array_map(array($this, 'addprefix'), $params); } // handle differences in function params switch ($method) { case 'record_exists_sql': case 'count_records_sql': case 'get_records_sql': //unset($params[1]); break; case 'get_field_sql': unset($params[1]); unset($params[2]); break; case 'get_record_select': case 'get_records_select': case 'delete_records_select': case 'update_record': unset($params[2]); break; case 'insert_record': unset($params[3]); break; case 'get_record': case 'get_records': case 'record_exists': case 'delete_records': case 'set_field': case 'get_field': case 'count_records': $params = $this->flatten($params); } // execute the query and return the sanatised result return ilp_db::encode(call_user_func_array($method, $params)); }
* @package ILP * @version 2.0 */ require_once '../configpath.php'; global $USER, $CFG, $SESSION, $PARSER; //include any neccessary files // Meta includes require_once $CFG->dirroot . '/blocks/ilp/admin_actions_includes.php'; //the id of the report that the field will be in $report_id = $PARSER->required_param('report_id', PARAM_INT); //the id of the reportfield used when editing $position = $PARSER->required_param('position', PARAM_INT); //the id of the reportfield used when editing $move = $PARSER->required_param('move', PARAM_INT); // instantiate the db $dbc = new ilp_db(); //change field position $reports = $dbc->get_reports_by_position($position, $move); $movesuc = true; //loop through fields returned if (!empty($reports)) { foreach ($reports as $r) { if ($r->id != $report_id) { //if the field is being moved up all other fields have postion value increased //if the field is being moved down all other fields have postion value decreased //move up = 1 move down = 0 $newposition = empty($move) ? $r->position - 1 : $r->position + 1; } else { //move the field $newposition = !empty($move) ? $r->position - 1 : $r->position + 1; }
*/ require_once '../configpath.php'; global $USER, $CFG, $SESSION, $PARSER, $PAGE; //include any neccessary files // Meta includes require_once $CFG->dirroot . '/blocks/ilp/actions_includes.php'; //get the id of the course that is currently being used $course_id = $PARSER->optional_param('course_id', 0, PARAM_INT); //get the tutor flag $tutor = $PARSER->optional_param('tutor', 0, PARAM_RAW); //get the status_id if set $status_id = $PARSER->optional_param('status_id', 0, PARAM_INT); //get the group if set $group_id = $PARSER->optional_param('group_id', 0, PARAM_INT); // instantiate the db $dbc = new ilp_db(); //check if the any of the users roles in the //current context has the create report capability for this report if (empty($access_viewotherilp) && !empty($course_id)) { //the user doesnt have the capability to create this type of report entry print_error('userdoesnothavecapability', 'block_ilp'); } //check if any tutess exist // setup the navigation breadcrumbs if (!empty($course_id)) { $listurl = "{$CFG->wwwroot}/blocks/ilp/actions/view_studentlist.php?tutor=0&course_id={$course_id}"; } else { $listurl = "{$CFG->wwwroot}/blocks/ilp/actions/view_studentlist.php?tutor=1&course_id=0"; } //add the page title $PAGE->navbar->add(get_string('ilps', 'block_ilp'), $listurl, 'title');
<?php /** * Changes the position of a field in a report * * @copyright © 2011 University of London Computer Centre * @author http://www.ulcc.ac.uk, http://moodle.ulcc.ac.uk * @license http://www.gnu.org/copyleft/gpl.html GNU Public License * @package ILP * @version 2.0 */ require_once '../configpath.php'; global $USER, $CFG, $SESSION, $PARSER; //include any neccessary files // Meta includes require_once $CFG->dirroot . '/blocks/ilp/admin_actions_includes.php'; //the id of the report that the field will be in $report_id = $PARSER->required_param('report_id', PARAM_INT); //the id of the reportfield used when editing $reportfield_id = $PARSER->required_param('reportfield_id', PARAM_INT); // instantiate the db $dbc = new ilp_db(); //change field required //get the field record $reportfield = $dbc->get_report_field_data($reportfield_id); //if the report field is currently required set it to 0 not required and vice versa $reportfield->req = empty($reportfield->req) ? 1 : 0; $resulttext = $dbc->update_report_field($reportfield) ? get_string("fieldreqsuc", 'block_ilp') : get_string("fieldreqerror", 'block_ilp'); $return_url = $CFG->wwwroot . '/blocks/ilp/actions/edit_prompt.php?report_id=' . $report_id; redirect($return_url, $resulttext, ILP_REDIRECT_DELAY);
$comment_id = $PARSER->required_param('comment_id', PARAM_INT); //get the id of the course that is currently being used $course_id = $PARSER->optional_param('course_id', NULL, PARAM_INT); //get the id the comment if one is being edited $selectedtab = $PARSER->optional_param('selectedtab', NULL, PARAM_RAW); //get the id the comment if one is being edited $tabitem = $PARSER->optional_param('tabitem', NULL, PARAM_RAW); // instantiate the db $dbc = new ilp_db(); //get the report $report = $dbc->get_report_by_id($report_id); //if the report is not found throw an error of if the report has a status of disabled if (empty($report) || empty($report->status)) { print_error('reportnotfouund', 'block_ilp'); } //get the entry $entry = $dbc->get_entry_by_id($entry_id); //if the report is not found throw an error of if the report has a status of disabled if (empty($entry)) { print_error('entrynotfouund', 'block_ilp'); } //check if the user has the delete record capability if (empty($access_report_deletecomment)) { //the user doesnt have the capability to create this type of report entry print_error('userdoesnothavedeletecapability', 'block_ilp'); } // instantiate the db $dbc = new ilp_db(); $dbc->delete_comment_by_id($comment_id); $return_url = $CFG->wwwroot . "/blocks/ilp/actions/view_main.php?user_id={$user_id}&course_id={$course_id}&selectedtab={$selectedtab}&tabitem={$tabitem}"; redirect($return_url, get_string('commeentdeleted', 'block_ilp'), ILP_REDIRECT_DELAY);
* @package ILP * @version 2.0 */ require_once '../configpath.php'; global $USER, $CFG, $SESSION, $PARSER; //include any neccessary files // Meta includes require_once $CFG->dirroot . '/blocks/ilp/admin_actions_includes.php'; //the id of the report that the field will be in $report_id = $PARSER->required_param('report_id', PARAM_INT); //the id of the plugin ype the field will be $plugin_id = $PARSER->required_param('plugin_id', PARAM_INT); //the id of the reportfield used when editing $reportfield_id = $PARSER->optional_param('reportfield_id', null, PARAM_INT); // instantiate the db $dbc = new ilp_db(); // setup the navigation breadcrumbs //siteadmin or modules //we need to determine which moodle we are in and give the correct area name $sectionname = stripos($CFG->release, "2.") !== false ? get_string('administrationsite') : get_string('administration'); $PAGE->navbar->add($sectionname, null, 'title'); //plugins or modules //we need to determine which moodle we are in and give the correct area name $sectionname = stripos($CFG->release, "2.") !== false ? get_string('plugins', 'admin') : get_string('managemodules'); $PAGE->navbar->add($sectionname, null, 'title'); $PAGE->navbar->add(get_string('blocks'), null, 'title'); //block name $url = $CFG->wwwroot . "/admin/settings.php?section=blocksettingilp"; $PAGE->navbar->add(get_string('blockname', 'block_ilp'), $url, 'title'); //section name $PAGE->navbar->add(get_string('reportconfiguration', 'block_ilp'), $CFG->wwwroot . "/blocks/ilp/actions/edit_report_configuration.php", 'title');
global $USER, $CFG, $SESSION, $PARSER, $PAGE; //include any neccessary files // Meta includes require_once $CFG->dirroot . '/blocks/ilp/actions_includes.php'; // Include the report permissions file require_once $CFG->dirroot . '/blocks/ilp/report_permissions.php'; //if set get the id of the report $report_id = $PARSER->required_param('report_id', PARAM_INT); //get the id of the course that is currently being used $user_id = $PARSER->required_param('user_id', PARAM_INT); //if set get the id of the report entry to be edited $entry_id = $PARSER->optional_param('entry_id', NULL, PARAM_INT); //get the id of the course that is currently being used $course_id = $PARSER->optional_param('course_id', NULL, PARAM_INT); // instantiate the db $dbc = new ilp_db(); //get the report $report = $dbc->get_report_by_id($report_id); //if the report is not found throw an error of if the report has a status of disabled if (empty($report) || empty($report->status) || !empty($report->deleted)) { print_error('reportnotfouund', 'block_ilp'); } //check if the any of the users roles in the //current context has the create report capability for this report if (empty($access_report_createreports)) { //the user doesnt have the capability to create this type of report entry print_error('userdoesnothavecreatecapability', 'block_ilp'); } if (!empty($entry_id)) { if (empty($access_report_editreports)) { //the user doesnt have the capability to edit this type of report entry
/** * Decodes mixed params. * * @param mixed The encoded object/array/string/etc * @return mixed The decoded version */ static function decode_htmlchars(&$data) { if (is_object($data) || is_array($data)) { foreach ($data as $index => &$datum) { //skip any fields with prefix binary_ if (substr($index, 0, 7) != 'binary_') { $datum = ilp_db::decode_htmlchars($datum); } } return $data; } else { return str_replace(array('"', ''', '<', '>'), array('"', "'", '<', '>'), $data); } }
* @author http://www.ulcc.ac.uk, http://moodle.ulcc.ac.uk * @license http://www.gnu.org/copyleft/gpl.html GNU Public License * @package ILP * @version 2.0 */ require_once '../configpath.php'; global $USER, $CFG, $SESSION, $PARSER, $PAGE; //include any neccessary files // Meta includes require_once $CFG->dirroot . '/blocks/ilp/actions_includes.php'; //get the id of the course that is currently being used $user_id = $PARSER->required_param('user_id', PARAM_INT); //get the id of the course that is currently being used $course_id = $PARSER->optional_param('course_id', NULL, PARAM_INT); // instantiate the db $dbc = new ilp_db(); $plpuser = $dbc->get_user_by_id($user_id); $dashboardurl = $CFG->wwwroot . "/blocks/ilp/actions/view_main.php?user_id={$user_id}&course_id={$course_id}"; $userprofileurl = stripos($CFG->release, "2.") === false ? $CFG->wwwroot . "/user/view.php?id={$user_id}" : $CFG->wwwroot . "/user/profile.php?id={$user_id}"; if ($user_id != $USER->id) { if (!empty($access_viewotherilp) && !empty($course_id)) { $listurl = "{$CFG->wwwroot}/blocks/ilp/actions/view_studentlist.php?tutor=0&course_id={$course_id}"; } else { $listurl = "{$CFG->wwwroot}/blocks/ilp/actions/view_studentlist.php?tutor=1&course_id=0"; } $PAGE->navbar->add(get_string('ilps', 'block_ilp'), $listurl, 'title'); $PAGE->navbar->add(get_string('ilpname', 'block_ilp'), $dashboardurl, 'title'); } else { $PAGE->navbar->add(get_string('myilp', 'block_ilp'), $dashboardurl, 'title'); } // setup the navigation breadcrumbs
* @author http://www.ulcc.ac.uk, http://moodle.ulcc.ac.uk * @license http://www.gnu.org/copyleft/gpl.html GNU Public License * @package ILP * @version 2.0 */ require_once '../configpath.php'; global $USER, $CFG, $SESSION, $PARSER; //include any neccessary files // Meta includes require_once $CFG->dirroot . '/blocks/ilp/admin_actions_includes.php'; //include the report entry preview mform class require_once $CFG->dirroot . '/blocks/ilp/classes/forms/report_entry_preview_mform.php'; //get the id of the report that is currently in use $report_id = $PARSER->required_param('report_id', PARAM_INT); // instantiate the db $dbc = new ilp_db(); // setup the navigation breadcrumbs //siteadmin or modules //we need to determine which moodle we are in and give the correct area name $sectionname = stripos($CFG->release, "2.") !== false ? get_string('administrationsite') : get_string('administration'); $PAGE->navbar->add($sectionname, null, 'title'); //plugins or modules //we need to determine which moodle we are in and give the correct area name $sectionname = stripos($CFG->release, "2.") !== false ? get_string('plugins', 'admin') : get_string('managemodules'); $PAGE->navbar->add($sectionname, null, 'title'); $PAGE->navbar->add(get_string('blocks'), null, 'title'); //block name $url = $CFG->wwwroot . "/admin/settings.php?section=blocksettingilp"; $PAGE->navbar->add(get_string('blockname', 'block_ilp'), $url, 'title'); //section name $PAGE->navbar->add(get_string('reportconfiguration', 'block_ilp'), $CFG->wwwroot . "/blocks/ilp/actions/edit_report_configuration.php", 'title');
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License * @package ILP * @version 2.0 */ //NOTE if icons are not being displayed a likely cause is output in one of the included files (within action_includes.php) check this as //as well other factors //require_once($path_to_config); require_once '../../config.php'; global $USER, $CFG, $SESSION, $PARSER, $DB; //include any neccessary files // Meta includes require_once $CFG->dirroot . '/blocks/ilp/actions_includes.php'; //if set get the id of the report to be edited $report_id = $PARSER->required_param('report_id', PARAM_INT); // instantiate the db $dbc = new ilp_db(); $report = $dbc->get_report_by_id($report_id); if (!empty($report)) { if (!empty($report->binary_icon)) { header("Content-Type: image/jpeg"); //header("Content-Length: 90000"); header("Content-Disposition: attachment; filename=icon.jpeg"); // Print data //we have to use the raw moodle functions at this point and avoid the extra validation carried out by the sql classes //as this breaks the export of reports if (stripos($CFG->release, "2.") !== false) { $generic_report = $DB->get_record('block_ilp_report', array('id' => $report_id)); } else { $generic_report = get_record('block_ilp_report', 'id', $report_id); } echo $generic_report->binary_icon;
/** * Installs any new plugins */ public static function install_new_plugins() { global $CFG; // instantiate the assmgr db $dbc = new ilp_db(); // get all the currently installed evidence resource types $plugins = ilp_records_to_menu($dbc->get_form_element_plugins(), 'id', 'name'); $plugins_directory = $CFG->dirroot . '/blocks/ilp/classes/form_elements/plugins'; // get the folder contents of the resource plugin directory $files = scandir($plugins_directory); foreach ($files as $file) { // look for plugins if (preg_match('/^([a-z_]+)\\.php$/i', $file, $matches)) { if (!in_array($matches[1], $plugins) && substr($matches[1], -5) != 'mform') { // include the class require_once $plugins_directory . '/' . $file; // instantiate the object $class = basename($file, ".php"); $formelementobj = new $class(); // install the plugin $formelementobj->install(); // update the resource_types table $dbc->create_form_element_plugin($formelementobj->get_name(), $formelementobj->get_tablename()); } } } }
require_once $CFG->dirroot . '/blocks/ilp/constants.php'; //if this is moodle 1.9 then require the moodle 2 emulator if (stripos($CFG->release, "2.") === false) { require_once $CFG->dirroot . '/blocks/ilp/db/moodle2_emulator.php'; } //include the access checks file require_once $CFG->dirroot . '/blocks/ilp/db/accesscheck.php'; if ($USER->id != $user_id) { //we only require the viewotherilp capabilty id the user is not a ilp admin if (empty($access_ilp_admin)) { require_capability('block/ilp:viewotherilp', $context); } if (!empty($course_id)) { $currentcoursecontext = get_context_instance(CONTEXT_COURSE, $course_id); if ($context == $currentcoursecontext) { $dbc = new ilp_db(); $userenrolled = $dbc->get_user_by_id($user_id); //check that the user is enrolled on the current course if not then print error $viewilp = true; if (stripos($CFG->release, "2.") === false) { if (!has_capability('moodle/course:view', $context, $userenrolled->id)) { $viewilp = false; } } else { if (!is_enrolled($context, $userenrolled)) { $viewilp = false; } } if (empty($viewilp)) { print_error('usernotenrolled', 'block_ilp'); }
require_once '../configpath.php'; global $USER, $CFG, $SESSION, $PARSER, $PAGE; //include any neccessary files // Meta includes require_once $CFG->dirroot . '/blocks/ilp/actions_includes.php'; // Include the report permissions file require_once $CFG->dirroot . '/blocks/ilp/report_permissions.php'; //if set get the id of the report $report_id = $PARSER->required_param('report_id', PARAM_INT); //get the id of the course that is currently being used $user_id = $PARSER->required_param('user_id', PARAM_INT); //get the id of the course that is currently being used $course_id = $PARSER->optional_param('course_id', NULL, PARAM_INT); $PAGE->set_url($CFG->wwwroot . "/blocks/ilp/actions/edit_reportentry.php", array('report_id' => $report_id, 'user_id' => $user_id, 'course_id' => $course_id)); // instantiate the db $dbc = new ilp_db(); //get the report $report = $dbc->get_report_by_id($report_id); //if the report is not found throw an error of if the report has a status of disabled if (empty($report) || empty($report->status)) { print_error('reportnotfouund', 'block_ilp'); } //check if the any of the users roles in the //current context has the create report capability for this report if (empty($access_report_createreports)) { //the user doesnt have the capability to create this type of report entry print_error('userdoesnothavecreatecapability', 'block_ilp'); } if (!empty($entry_id)) { if (empty($access_report_editreports)) { //the user doesnt have the capability to edit this type of report entry
* * @copyright © 2011 University of London Computer Centre * @author http://www.ulcc.ac.uk, http://moodle.ulcc.ac.uk * @license http://www.gnu.org/copyleft/gpl.html GNU Public License * @package ILP * @version 2.0 */ require_once '../configpath.php'; global $USER, $CFG, $SESSION, $PARSER; //include any neccessary files // Meta includes require_once $CFG->dirroot . '/blocks/ilp/admin_actions_includes.php'; //if set get the id of the report to be edited $report_id = $PARSER->optional_param('report_id', NULL, PARAM_INT); // instantiate the db $dbc = new ilp_db(); //get the report $report = $dbc->get_report_by_id($report_id); //if the report is not found throw an error if (empty($report)) { print_error('reportnotfouund', 'block_ilp'); } //if the report satatus is currently disabled (0) set it to enabled (1) $res = $dbc->set_report_status($report_id, 0); $res = $dbc->delete_report($report_id, 1); //save the changes to the report if (!empty($res)) { $resulttext = get_string('reportdeleted', 'block_ilp'); } else { $resulttext = get_string('reportdeleteerror', 'block_ilp'); }
require_once '../configpath.php'; global $USER, $CFG, $SESSION, $PARSER, $OUTPUT; // Meta includes require_once $CFG->dirroot . '/blocks/ilp/actions_includes.php'; //include the default class require_once $CFG->dirroot . '/blocks/ilp/classes/tables/ilp_ajax_table.class.php'; //get the id of the course that is currently being used if set $course_id = $PARSER->optional_param('course_id', 0, PARAM_INT); //get the tutor flag $tutor = $PARSER->optional_param('tutor', 0, PARAM_INT); //get the status_id if set $status_id = $PARSER->optional_param('status_id', 0, PARAM_INT); //get the group_id if set $group_id = $PARSER->optional_param('group_id', 0, PARAM_INT); // instantiate the db $dbc = new ilp_db(); // set up the flexible table for displaying the portfolios $flextable = new ilp_ajax_table("student_listcourse_id{$course_id}tutor{$tutor}status_id{$status_id}"); $flextable->define_baseurl($CFG->wwwroot . "/blocks/ilp/actions/view_studentlist.php?course_id={$course_id}&tutor={$tutor}&status_id={$status_id}&group_id={$group_id}"); $flextable->define_ajaxurl($CFG->wwwroot . "/blocks/ilp/actions/view_studentlist.ajax.php?course_id={$course_id}&tutor={$tutor}&status_id={$status_id}&group_id={$group_id}"); // set the basic details to dispaly in the table $headers = array(get_string('userpicture', 'block_ilp'), get_string('name', 'block_ilp'), get_string('status', 'block_ilp')); $columns = array('picture', 'fullname', 'u_status'); $headers[] = ''; $columns[] = 'view'; $nosorting = array('picture', 'u_status', 'view'); //we need to check if the mis plugin has been setup if it has we will get the attendance and punctuality figures $attendanceclass = get_config('block_ilp', 'attendplugin'); $misavailable = false; $misattendavailable = false; $mispunctualityavailable = false;
// Meta includes require_once $CFG->dirroot . '/blocks/ilp/actions_includes.php'; //get the id of the user that is currently being used $student_id = $PARSER->required_param('student_id', PARAM_INT); //get the id of the course that is currently being used $course_id = $PARSER->optional_param('course_id', NULL, PARAM_INT); //get the selectedtab param if it exists $selecttedtab = $PARSER->optional_param('selectedtab', NULL, PARAM_RAW); //get the selectedtab param if it exists $tabitem = $PARSER->optional_param('tabitem', NULL, PARAM_RAW); //get the changed status $ajax = $PARSER->required_param('ajax', PARAM_RAW); //get the changed status $status_id = $PARSER->required_param('select_userstatus', PARAM_RAW); // instantiate the db $dbc = new ilp_db(); //retreive the user record from the database $student = $dbc->get_user_by_id($student_id); if (empty($student)) { //trigger error } // $stausitem = $dbc->get_status_item_by_id($status_id); $userstatus = $dbc->get_user_status($student_id); $userstatus->user_modified_id = $USER->id; $userstatus->parent_id = $status_id; if ($dbc->update_userstatus($userstatus)) { if ($ajax == 'false') { $return_url = $CFG->wwwroot . '/blocks/ilp/actions/view_main.php?user_id=' . $student_id . '&course_id=' . $course_id . '&tabitem=' . $tabitem . '&selectedtab=' . $selecttedtab; redirect($return_url, get_string("stausupdated", 'block_ilp'), ILP_REDIRECT_DELAY); } else {
/** * Truncates long strings and adds a tooltip with a longer verison. * * @param string $string The string to truncate * @param int $maxlength The maximum length the string can be. -1 means unlimited, in case you just want a tooltip * @param string $tooltip (optional) tooltip to display. defaults to $string * @param array $special_case (optional) array of characters/entities that if found in string * stop the truncation and deceoding * @return string HTML */ function ilp_limit_length($html, $maxlength, $tooltip = null) { // permit only html tags and quotes so we can parse the tags properly $html = ilp_db::decode_htmlchars(assmgr_db::encode($html)); $printedlength = 0; $position = 0; $tags = array(); $return = null; while ($printedlength < $maxlength && preg_match('{</?([a-z]+)[^>]*>|&#?[a-zA-Z0-9]+;}', $html, $match, PREG_OFFSET_CAPTURE, $position)) { list($tag, $tagPosition) = $match[0]; // print text leading up to the tag $str = substr($html, $position, $tagPosition - $position); if ($printedlength + strlen($str) > $maxlength) { $return .= substr($str, 0, $maxlength - $printedlength); $printedlength = $maxlength; break; } $return .= $str; $printedlength += strlen($str); if ($tag[0] == '&') { // handle the entity $return .= $tag; $printedlength++; } else { // handle the tag $tagName = $match[1][0]; if ($tag[1] == '/') { // this is a closing tag $openingTag = array_pop($tags); assert($openingTag == $tagName); // check that tags are properly nested $return .= $tag; } else { if ($tag[strlen($tag) - 2] == '/') { // self-closing tag $return .= $tag; } else { // opening tag $return .= $tag; $tags[] = $tagName; } } } // continue after the tag $position = $tagPosition + strlen($tag); } // print any remaining text if ($printedlength < $maxlength && $position < strlen($html)) { $return .= substr($html, $position, $maxlength - $printedlength); } // add the ellipsis, if truncated $return .= strip_tags($return) != strip_tags($html) ? '…' : null; // close any open tags while (!empty($tags)) { $return .= sprintf('</%s>', array_pop($tags)); } // don't show a tooltip if it's set to false, or if no truncate has been done if ($tooltip === false || $return == $html && empty($tooltip)) { return $return; } else { // make the tooltip the original string if a specific value was not set if (empty($tooltip)) { $tooltip = $html; } $tooltip = ilp_db::encode($tooltip); // generate the unique id needed for the YUI tooltip $id = 'tootlip' . ilp_uniqueNum(); $script = "<script type='text/javascript'>\r\n //<![CDATA[\r\n new YAHOO.widget.Tooltip('ttA{$id}', {\r\n context:'{$id}',\r\n effect:{effect:YAHOO.widget.ContainerEffect.FADE,duration:0.20}\r\n });\r\n //]]>\r\n </script>"; return "<span id='{$id}' class='tooltip' title='{$tooltip}'>{$return}</span>{$script}"; } }
<?php /** * Global config file for the ILP * * @copyright © 2011 University of London Computer Centre * @author http://www.ulcc.ac.uk, http://moodle.ulcc.ac.uk * @license http://www.gnu.org/copyleft/gpl.html GNU Public License * @package ILP * @version 2.0 */ global $CFG; // include the assmgr db require_once $CFG->dirroot . '/blocks/ilp/db/ilp_db.php'; // instantiate the assmgr db $dbc = new ilp_db(); require_once $CFG->dirroot . '/blocks/ilp/classes/form_elements/ilp_element_plugin.php'; //install new plugins ilp_element_plugin::install_new_plugins(); require_once $CFG->dirroot . '/blocks/ilp/classes/dashboard/ilp_dashboard_template.php'; //install new templates ilp_dashboard_template::install_new_plugins(); require_once $CFG->dirroot . '/blocks/ilp/classes/dashboard/ilp_dashboard_plugin.php'; //install new dashboard plugins ilp_dashboard_plugin::install_new_plugins(); require_once $CFG->dirroot . '/blocks/ilp/classes/dashboard/ilp_dashboard_tab.php'; //install new tabs ilp_dashboard_tab::install_new_plugins(); require_once $CFG->dirroot . '/blocks/ilp/classes/dashboard/ilp_mis_plugin.php'; //install new tabs ilp_mis_plugin::install_new_plugins();
$string['ilp_report'] = "ILP Report"; $string['ilp_report_field'] = "ILP Report Field"; $string['ilp_plugin_element_data'] = "Data"; $string['ilp_user_status_item'] = "ilp user status item"; $string['entrydata'] = "Entry Data"; $string['userstatus'] = "User Status"; //ATENDENCE REPORT $string['attendenceconfiguration'] = "MIS Report Configuration"; $string['mis_configuration_settings'] = "MIS Configuration Settings"; $string['not_applicable'] = "n/a"; //MESSAGE PROVIDER $string['messageprovider:ilp_comment'] = 'New report comment'; global $CFG; // Include ilp db class require_once $CFG->dirroot . '/blocks/ilp/db/ilp_db.php'; $dbc = new ilp_db(); $plugins = $CFG->dirroot . '/blocks/ilp/classes/form_elements/plugins'; // get all the currently installed form element plugins $form_element_plugins = ilp_records_to_menu($dbc->get_form_element_plugins(), 'id', 'name'); //this section gets language strings for all plugins foreach ($form_element_plugins as $plugin_file) { if (file_exists($plugins . '/' . $plugin_file . ".php")) { require_once $plugins . '/' . $plugin_file . ".php"; // instantiate the object $class = basename($plugin_file, ".php"); $resourceobj = new $class(); $method = array($resourceobj, 'language_strings'); //check whether the language string element has been defined if (is_callable($method, true)) { $resourceobj->language_strings($string); }
* @author http://www.ulcc.ac.uk, http://moodle.ulcc.ac.uk * @license http://www.gnu.org/copyleft/gpl.html GNU Public License * @package ILP * @version 2.0 */ require_once '../configpath.php'; global $USER, $CFG, $SESSION, $PARSER; //include any neccessary files // Meta includes require_once $CFG->dirroot . '/blocks/ilp/admin_actions_includes.php'; //include the report form class require_once $CFG->dirroot . '/blocks/ilp/classes/forms/add_prompt_mform.php'; //get the id of the report that is currently in use $report_id = $PARSER->required_param('report_id', PARAM_INT); // instantiate the db $dbc = new ilp_db(); //set the required level of permission needed to view this page // setup the navigation breadcrumbs //siteadmin or modules //we need to determine which moodle we are in and give the correct area name $sectionname = stripos($CFG->release, "2.") !== false ? get_string('administrationsite') : get_string('administration'); $PAGE->navbar->add($sectionname, null, 'title'); //plugins or modules //we need to determine which moodle we are in and give the correct area name $sectionname = stripos($CFG->release, "2.") !== false ? get_string('plugins', 'admin') : get_string('managemodules'); $PAGE->navbar->add($sectionname, null, 'title'); $PAGE->navbar->add(get_string('blocks'), null, 'title'); //block name $url = $CFG->wwwroot . "/admin/settings.php?section=blocksettingilp"; $PAGE->navbar->add(get_string('blockname', 'block_ilp'), $url, 'title'); //section name
* @author http://www.ulcc.ac.uk, http://moodle.ulcc.ac.uk * @license http://www.gnu.org/copyleft/gpl.html GNU Public License * @package ILP * @version 2.0 */ require_once '../configpath.php'; global $USER, $CFG, $SESSION, $PARSER; //include any neccessary files // Meta includes require_once $CFG->dirroot . '/blocks/ilp/admin_actions_includes.php'; //include the report form class require_once $CFG->dirroot . '/blocks/ilp/classes/forms/edit_report_mform.php'; //if set get the id of the report to be edited $report_id = $PARSER->optional_param('report_id', NULL, PARAM_INT); // instantiate the db $dbc = new ilp_db(); //instantiate the edit_report_mform class $mform = new edit_report_mform($report_id); //was the form cancelled? if ($mform->is_cancelled()) { //send the user back $return_url = $CFG->wwwroot . '/blocks/ilp/actions/edit_report_configuration.php'; redirect($return_url, '', ILP_REDIRECT_DELAY); } //was the form submitted? // has the form been submitted? if ($mform->is_submitted()) { // check the validation rules if ($mform->is_validated()) { //get the form data submitted $formdata = $mform->get_data();
$report_id = $PARSER->required_param('report_id', PARAM_INT); //get the id of the user that the comment relates to $user_id = $PARSER->required_param('user_id', PARAM_INT); //if set get the id of the report entry $entry_id = $PARSER->required_param('entry_id', PARAM_INT); //get the id of the course that is currently being used $course_id = $PARSER->optional_param('course_id', NULL, PARAM_INT); //get the id the comment if one is being edited $comment_id = $PARSER->optional_param('comment_id', NULL, PARAM_INT); //get the id the comment if one is being edited $selectedtab = $PARSER->optional_param('selectedtab', NULL, PARAM_RAW); //get the id the comment if one is being edited $tabitem = $PARSER->optional_param('tabitem', NULL, PARAM_RAW); $PAGE->set_url($CFG->wwwroot . "/blocks/ilp/actions/edit_entrycomment.php", array('report_id' => $report_id, 'user_id' => $user_id, 'course_id' => $course_id, 'entry_id' => $entry_id, 'comment_id' => $comment_id, 'selectedtab' => $selectedtab, 'tabitem' => $tabitem)); // instantiate the db $dbc = new ilp_db(); //get the report $report = $dbc->get_report_by_id($report_id); //if the report is not found throw an error of if the report has a status of disabled if (empty($report) || empty($report->status)) { print_error('reportnotfouund', 'block_ilp'); } //get the report entry $entry = $dbc->get_entry_by_id($entry_id); //if the report entry is not found throw an error if (empty($entry)) { print_error('entrynotfouund', 'block_ilp'); } //check if the any of the users roles in the //current context has the create report capability for this report if (empty($comment_id) && empty($access_report_addcomment)) {
} //get the entry $entry = $dbc->get_entry_by_id($entry_id); //if the report is not found throw an error of if the report has a status of disabled if (empty($entry)) { print_error('entrynotfouund', 'block_ilp'); } if (empty($report->frequency)) { //entries can only be deleted from reports that allow multiple entries print_error('entrycannotbedeleted', 'block_ilp'); } //check if the user has the delete record capability if (empty($access_report_deletereports)) { //the user doesnt have the capability to create this type of report entry print_error('userdoesnothavedeletecapability', 'block_ilp'); } // instantiate the db $dbc = new ilp_db(); //get all of the fields in the current report, they will be returned in order as //no position has been specified $reportfields = $dbc->get_report_fields_by_position($report_id); if (!empty($reportfields)) { foreach ($reportfields as $field) { //get the plugin record that for the plugin $pluginrecord = $dbc->get_plugin_by_id($field->plugin_id); $dbc->delete_element_record_by_id($pluginrecord->tablename . '_ent', $field->id); } } $dbc->delete_entry_by_id($entry_id); $return_url = $CFG->wwwroot . "/blocks/ilp/actions/view_main.php?user_id={$user_id}&course_id={$course_id}&selectedtab={$selectedtab}&tabitem={$tabitem}"; redirect($return_url, get_string('entrydeleted', 'block_ilp'), ILP_REDIRECT_DELAY);
* @author http://www.ulcc.ac.uk, http://moodle.ulcc.ac.uk * @license http://www.gnu.org/copyleft/gpl.html GNU Public License * @package ILP * @version 2.0 */ require_once '../configpath.php'; global $USER, $CFG, $SESSION, $PARSER; //include any neccessary files // Meta includes require_once $CFG->dirroot . '/blocks/ilp/admin_actions_includes.php'; //include the report entry preview mform class require_once $CFG->dirroot . '/blocks/ilp/classes/forms/edit_report_permissions_mform.php'; //get the id of the report that is currently in use $report_id = $PARSER->required_param('report_id', PARAM_INT); // instantiate the db $dbc = new ilp_db(); // setup the navigation breadcrumbs //siteadmin or modules //we need to determine which moodle we are in and give the correct area name $sectionname = stripos($CFG->release, "2.") !== false ? get_string('administrationsite') : get_string('administration'); $PAGE->navbar->add($sectionname, null, 'title'); //plugins or modules //we need to determine which moodle we are in and give the correct area name $sectionname = stripos($CFG->release, "2.") !== false ? get_string('plugins', 'admin') : get_string('managemodules'); $PAGE->navbar->add($sectionname, null, 'title'); $PAGE->navbar->add(get_string('blocks'), null, 'title'); //block name $url = $CFG->wwwroot . "/admin/settings.php?section=blocksettingilp"; $PAGE->navbar->add(get_string('blockname', 'block_ilp'), $url, 'title'); //section name $PAGE->navbar->add(get_string('reportconfiguration', 'block_ilp'), $CFG->wwwroot . "/blocks/ilp/actions/edit_report_configuration.php", 'title');