예제 #1
0
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
/**
 * Displays help via AJAX call.
 *
 * @copyright 2014 Mark Nelson <*****@*****.**>
 * @package tool_monitor
 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 */
define('NO_MOODLE_COOKIES', true);
define('AJAX_SCRIPT', true);
require_once '../../../config.php';
$type = required_param('type', PARAM_ALPHA);
$id = required_param('id', PARAM_INT);
$lang = optional_param('lang', 'en', PARAM_LANG);
// We don't actually modify the session here as we have NO_MOODLE_COOKIES set.
$SESSION->lang = $lang;
$PAGE->set_url('/admin/tool/monitor/help_ajax.php');
if ($type == 'rule') {
    $item = \tool_monitor\rule_manager::get_rule($id);
} else {
    // Must be a subscription.
    $item = \tool_monitor\subscription_manager::get_subscription($id);
}
if ($item->courseid) {
    $PAGE->set_context(context_course::instance($item->courseid));
} else {
    // Must be system context.
    $PAGE->set_context(context_system::instance());
}
echo json_encode(tool_monitor\output\helpicon\renderable::get_help_string_parameters($type, $id, true));
예제 #2
0
require_once '../../../config.php';
$type = required_param('type', PARAM_ALPHA);
$id = required_param('id', PARAM_INT);
$lang = optional_param('lang', 'en', PARAM_LANG);
// We don't actually modify the session here as we have NO_MOODLE_COOKIES set.
$SESSION->lang = $lang;
$PAGE->set_url('/admin/tool/monitor/help.php');
$PAGE->set_pagelayout('popup');
if ($type == 'rule') {
    $item = \tool_monitor\rule_manager::get_rule($id);
} else {
    // Must be a subscription.
    $item = \tool_monitor\subscription_manager::get_subscription($id);
}
if ($item->courseid) {
    $PAGE->set_context(context_course::instance($item->courseid));
} else {
    // Must be system context.
    $PAGE->set_context(context_system::instance());
}
// Get the help string data.
$data = tool_monitor\output\helpicon\renderable::get_help_string_parameters($type, $id);
echo $OUTPUT->header();
if (!empty($data->heading)) {
    echo $OUTPUT->heading($data->heading, 1, 'helpheading');
}
echo $data->text;
if (isset($data->completedoclink)) {
    echo $data->completedoclink;
}
echo $OUTPUT->footer();