コード例 #1
0
ファイル: renderable.php プロジェクト: HuiChangZhai/moodle
 /**
  * Returns the string to display for the help icon.
  *
  * @param string $type the type we are displaying the help icon for (either rule or subscription).
  * @param int $id the id of the type.
  * @param boolean $ajax Whether this help is called from an AJAX script.
  *      This is used to influence text formatting and determines which format to output the doclink in.
  * @return string|object|array $a An object, string or number that can be used within translation strings
  */
 public static function get_help_string_parameters($type, $id, $ajax = false)
 {
     if ($type == 'rule') {
         $rule = \tool_monitor\rule_manager::get_rule($id);
         $langstring = new \stdClass();
         $langstring->eventname = $rule->get_event_name();
         $langstring->eventcomponent = $rule->get_plugin_name();
         $langstring->frequency = $rule->frequency;
         $langstring->minutes = $rule->timewindow / MINSECS;
         return get_formatted_help_string('rulehelp', 'tool_monitor', $ajax, $langstring);
     }
     // Must be a subscription.
     $sub = \tool_monitor\subscription_manager::get_subscription($id);
     $langstring = new \stdClass();
     $langstring->eventname = $sub->get_event_name();
     $langstring->moduleinstance = $sub->get_instance_name();
     $langstring->frequency = $sub->frequency;
     $langstring->minutes = $sub->timewindow / MINSECS;
     return get_formatted_help_string('subhelp', 'tool_monitor', $ajax, $langstring);
 }
コード例 #2
0
ファイル: help.php プロジェクト: evltuma/moodle
 * the help icon.
 *
 * @copyright 2002 onwards Martin Dougiamas
 * @package   core
 * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 */
define('NO_MOODLE_COOKIES', true);
require_once __DIR__ . '/config.php';
$identifier = required_param('identifier', PARAM_STRINGID);
$component = required_param('component', PARAM_COMPONENT);
$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('/help.php');
$PAGE->set_pagelayout('popup');
$PAGE->set_context(context_system::instance());
$data = get_formatted_help_string($identifier, $component, false);
if (!empty($data->heading)) {
    $PAGE->set_title($data->heading);
} else {
    $PAGE->set_title(get_string('help'));
}
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();
コード例 #3
0
    /**
     * Export this data so it can be used as the context for a mustache template.
     *
     * @param renderer_base $output Used to do a final render of any components that need to be rendered for export.
     * @return array
     */
    public function export_for_template(renderer_base $output) {
        global $CFG;

        $title = get_string($this->identifier, $this->component);

        if (empty($this->linktext)) {
            $alt = get_string('helpprefix2', '', trim($title, ". \t"));
        } else {
            $alt = get_string('helpwiththis');
        }

        $data = get_formatted_help_string($this->identifier, $this->component, false);

        $data->alt = $alt;
        $data->icon = (new pix_icon('help', $alt, 'core', ['class' => 'iconhelp']))->export_for_template($output);
        $data->linktext = $this->linktext;
        $data->title = get_string('helpprefix2', '', trim($title, ". \t"));
        $data->url = (new moodle_url($CFG->httpswwwroot . '/help.php', [
            'component' => $this->component,
            'identifier' => $this->identifier,
            'lang' => current_language()
        ]))->out(false);

        $data->ltr = !right_to_left();
        return $data;
    }