Esempio n. 1
0
 /**
  * Export this data so it can be used as the context for a mustache template.
  *
  * @param \renderer_base $output
  * @return \stdClass
  */
 public function export_for_template(\renderer_base $output)
 {
     if ($this->value) {
         $this->displayvalue = $output->pix_icon('i/checked', get_string('yes'));
     } else {
         $this->displayvalue = $output->pix_icon('i/unchecked', get_string('no'));
     }
     return parent::export_for_template($output);
 }
Esempio n. 2
0
 /**
  * Export this data so it can be used as the context for a mustache template.
  *
  * @param \renderer_base $output
  * @return \stdClass
  */
 public function export_for_template(\renderer_base $output)
 {
     if ($this->value) {
         $this->edithint = get_string('disable');
         $this->displayvalue = $output->pix_icon('i/hide', get_string('disable'));
     } else {
         $this->edithint = get_string('enable');
         $this->displayvalue = $output->pix_icon('i/show', get_string('enable'));
     }
     return parent::export_for_template($output);
 }
Esempio n. 3
0
 /**
  * Export this data so it can be used as the context for a mustache template.
  *
  * @param \renderer_base $output
  * @return \stdClass
  */
 public function export_for_template(\renderer_base $output)
 {
     if ($this->value) {
         $this->edithint = get_string('resetflag', 'core_tag');
         $this->displayvalue = $output->pix_icon('i/flagged', $this->edithint) . " ({$this->value})";
     } else {
         $this->edithint = get_string('flagasinappropriate', 'core_tag');
         $this->displayvalue = $output->pix_icon('i/unflagged', $this->edithint);
     }
     return parent::export_for_template($output);
 }
Esempio n. 4
0
 /**
  * Export this data so it can be used as the context for a mustache template.
  *
  * @param \renderer_base $output
  * @return \stdClass
  */
 public function export_for_template(\renderer_base $output)
 {
     if ($this->value) {
         $this->edithint = get_string('settypedefault', 'core_tag');
         $this->displayvalue = $output->pix_icon('i/checked', $this->edithint);
     } else {
         $this->edithint = get_string('settypestandard', 'core_tag');
         $this->displayvalue = $output->pix_icon('i/unchecked', $this->edithint);
     }
     return parent::export_for_template($output);
 }
Esempio n. 5
0
 public function export_for_template(\renderer_base $output)
 {
     global $USER;
     $context = clone $this->notification;
     if ($context->useridto == $USER->id && $context->timeusertodeleted) {
         $context->deleted = true;
     } else {
         $context->deleted = false;
     }
     $context->timecreatedpretty = get_string('ago', 'message', format_time(time() - $context->timecreated));
     $context->text = message_format_message_text($context);
     $context->read = $context->timeread ? true : false;
     $context->shortenedsubject = shorten_text($context->subject, 125);
     if (!empty($context->component) && substr($context->component, 0, 4) == 'mod_') {
         $iconurl = $output->pix_url('icon', $context->component);
     } else {
         $iconurl = $output->pix_url('i/marker', 'core');
     }
     $context->iconurl = $iconurl->out();
     return $context;
 }
Esempio n. 6
0
/**
 * Renders the popup.
 *
 * @param renderer_base $renderer
 * @return string The HTML
 */
function message_popup_render_navbar_output(\renderer_base $renderer)
{
    global $USER, $CFG;
    // Early bail out conditions.
    if (!isloggedin() || isguestuser() || user_not_fully_set_up($USER) || get_user_preferences('auth_forcepasswordchange') || $CFG->sitepolicy && !$USER->policyagreed && !is_siteadmin()) {
        return '';
    }
    $output = '';
    // Add the messages popover.
    if (!empty($CFG->messaging)) {
        $context = ['userid' => $USER->id, 'urls' => ['seeall' => (new moodle_url('/message/index.php'))->out(), 'writeamessage' => (new moodle_url('/message/index.php', ['contactsfirst' => 1]))->out(), 'preferences' => (new moodle_url('/message/edit.php', ['id' => $USER->id]))->out()]];
        $output .= $renderer->render_from_template('message_popup/message_popover', $context);
    }
    // Add the notifications popover.
    $enabled = \core_message\api::is_processor_enabled("popup");
    if ($enabled) {
        $context = ['userid' => $USER->id, 'urls' => ['seeall' => (new moodle_url('/message/output/popup/notifications.php'))->out(), 'preferences' => (new moodle_url('/message/notificationpreferences.php', ['userid' => $USER->id]))->out()]];
        $output .= $renderer->render_from_template('message_popup/notification_popover', $context);
    }
    return $output;
}
Esempio n. 7
0
File: lib.php Progetto: dg711/moodle
/**
 * Renders the popup.
 *
 * @param renderer_base $renderer
 * @return string The HTML
 */
function message_popup_render_navbar_output(\renderer_base $renderer)
{
    global $USER, $DB, $CFG;
    // Early bail out conditions.
    if (!isloggedin() || isguestuser() || user_not_fully_set_up($USER) || get_user_preferences('auth_forcepasswordchange')) {
        return '';
    }
    $output = '';
    // Add the messages popover.
    if (!empty($CFG->messaging)) {
        $context = ['userid' => $USER->id, 'urls' => ['preferences' => (new moodle_url('/message/edit.php', ['id' => $USER->id]))->out()]];
        $output .= $renderer->render_from_template('message_popup/message_popover', $context);
    }
    // Add the notifications popover.
    $processor = $DB->get_record('message_processors', array('name' => 'popup'));
    if ($processor && $processor->enabled) {
        $context = ['userid' => $USER->id, 'urls' => ['preferences' => (new moodle_url('/message/notificationpreferences.php', ['userid' => $USER->id]))->out()]];
        $output .= $renderer->render_from_template('message_popup/notification_popover', $context);
    }
    return $output;
}
Esempio n. 8
0
/**
 * Returns an object containing HTML for the areas affected by settings.
 *
 * Do not add Clean specific logic in here, child themes should be able to
 * rely on that function just by declaring settings with similar names.
 *
 * @param renderer_base $output Pass in $OUTPUT.
 * @param moodle_page $page Pass in $PAGE.
 * @return stdClass An object with the following properties:
 *      - navbarclass A CSS class to use on the navbar. By default ''.
 *      - heading HTML to use for the heading. A logo if one is selected or the default heading.
 *      - footnote HTML to use as a footnote. By default ''.
 */
function theme_cleanhc_get_html_for_settings(renderer_base $output, moodle_page $page)
{
    global $CFG;
    $return = new stdClass();
    $return->navbarclass = '';
    if (!empty($page->theme->settings->invert)) {
        $return->navbarclass .= ' navbar-inverse';
    }
    if (!empty($page->theme->settings->logo)) {
        $return->heading = html_writer::tag('div', '', array('class' => 'logo'));
    } else {
        $return->heading = $output->page_heading();
    }
    $return->footnote = '';
    if (!empty($page->theme->settings->footnote)) {
        $return->footnote = '<div class="footnote text-center">' . format_text($page->theme->settings->footnote) . '</div>';
    }
    return $return;
}
Esempio n. 9
0
 /**
  * Export context for use in mustache templates
  *
  * @see templatable::export_for_template()
  * @param renderer_base $output
  * @return array
  */
 public function export_for_template(\renderer_base $output)
 {
     $data = array('id' => $this->id, 'permalink' => clean_param($this->permalink, PARAM_URL), 'datepublished' => $output->format_published_date($this->timestamp), 'link' => clean_param($this->link, PARAM_URL));
     // If the item does not have a title, create one from the description.
     $title = $this->title;
     if (!$title) {
         $title = strip_tags($this->description);
         $title = \core_text::substr($title, 0, 20) . '...';
     }
     // Allow the renderer to format the title and description.
     $data['title'] = $output->format_title($title);
     $data['description'] = $this->showdescription ? $output->format_description($this->description) : null;
     return $data;
 }
 /**
  * Returns an array of properties suitable for generating a quickforms element
  * @param backup_task|null $task
  * @return array (element, name, label, options, attributes)
  */
 public function get_element_properties(base_task $task = null, renderer_base $output = null)
 {
     // name, label, text, attributes
     $icon = $this->get_icon();
     $label = $this->get_label($task);
     if (!empty($icon)) {
         $label .= $output->render($icon);
     }
     // name, label, options, attributes
     return $this->apply_options(array('element' => 'select', 'name' => self::NAME_PREFIX . $this->name, 'label' => $label, 'options' => $this->values, 'attributes' => $this->attributes));
 }
Esempio n. 11
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)
 {
     $attributes = $this->attributes;
     $attributes['src'] = $output->pix_url($this->pix, $this->component);
     $templatecontext = array();
     foreach ($attributes as $name => $value) {
         $templatecontext[] = array('name' => $name, 'value' => $value);
     }
     $data = array('attributes' => $templatecontext);
     return $data;
 }
Esempio n. 12
0
    /**
     * Export for template.
     *
     * @param renderer_base $output The renderer.
     * @return stdClass
     */
    public function export_for_template(renderer_base $output) {
        $data = new stdClass();
        $attributes = $this->attributes;

        if (empty($attributes['id'])) {
            $attributes['id'] = html_writer::random_id('action_link');
        }
        $data->id = $attributes['id'];
        unset($attributes['id']);

        $data->disabled = !empty($attributes['disabled']);
        unset($attributes['disabled']);

        $data->text = $this->text instanceof renderable ? $output->render($this->text) : (string) $this->text;
        $data->url = $this->url ? $this->url->out(false) : '';
        $data->icon = $this->icon ? $this->icon->export_for_template($output) : null;
        $data->classes = isset($attributes['class']) ? $attributes['class'] : '';
        unset($attributes['class']);

        $data->attributes = array_map(function($key, $value) {
            return [
                'name' => $key,
                'value' => $value
            ];
        }, array_keys($attributes), $attributes);

        $data->actions = array_map(function($action) use ($output) {
            return $action->export_for_template($output);
        }, !empty($this->actions) ? $this->actions : []);
        $data->hasactions = !empty($this->actions);

        return $data;
    }
Esempio n. 13
0
/**
 * Returns the html for the <footer> of the document.
 *
 * @param renderer_base $output Pass in $OUTPUT.
 * @param moodle_page $page Pass in $PAGE.
 * @return string The html.
 */
function theme_ws_html_footer(renderer_base $output, moodle_page $page)
{
    global $CFG;
    return '
	<footer id="page-footer">
		<div id="course-footer">' . $output->course_footer() . '</div>
		<p class="helplink">' . $output->page_doc_link() . '</p>
		' . $output->login_info() . '
		' . $output->home_link() . '
		' . $output->standard_footer_html() . '
	</footer>
';
}
Esempio n. 14
0
/**
 * Returns an object containing HTML for the areas affected by settings.
 *
 * Do not add Clean specific logic in here, child themes should be able to
 * rely on that function just by declaring settings with similar names.
 *
 * @param renderer_base $output Pass in $OUTPUT.
 * @param moodle_page $page Pass in $PAGE.
 * @return stdClass An object with the following properties:
 *      - navbarclass A CSS class to use on the navbar. By default ''.
 *      - heading HTML to use for the heading. A logo if one is selected or the default heading.
 *      - footnote HTML to use as a footnote. By default ''.
 */
function theme_clean_get_html_for_settings(renderer_base $output, moodle_page $page) {
    global $CFG,$USER;
    $return = new stdClass;

    $return->navbarclass = '';
    if (!empty($page->theme->settings->invert)) {
        $return->navbarclass .= ' navbar-inverse';
    }

    if(isloggedin()){
        $display_blocks = html_writer::empty_tag('img', array('src' => $CFG->wwwroot.'/theme/clean/pix/block_slider.jpg', 'class' => 'display_blocks'));
		
    }else{
        $display_blocks = '';
    }
    if (!empty($page->theme->settings->logo)) {
        $return->heading = $display_blocks.html_writer::link($CFG->wwwroot, '', array('title' => get_string('home'), 'class' => 'logo'));
    } else {
        $return->heading = $display_blocks.$output->page_heading();
    }

    $return->footnote = '';
    if (!empty($page->theme->settings->footnote)) {
        $return->footnote = '<div class="footnote text-center">'.format_text($page->theme->settings->footnote).'</div>';
    }
    
    //added code for disclaimer and browser support by rajesh
    $return->browsersupport = '';
    if (!empty($page->theme->settings->browsersupport)) {
        $return->browsersupport = '<div>'.format_text($page->theme->settings->browsersupport).'</div>';
    } else {
        $return->browsersupport = '';
    }

     $return->disclaimer = '';
    if (!empty($page->theme->settings->disclaimer)) {
        $return->disclaimer = '<div>'.format_text($page->theme->settings->disclaimer).'</div>';
    } else {
        $return->disclaimer = '';
    }
    /*code change ends here*/

    return $return;
}
Esempio n. 15
0
 /**
  * Return the safe config values that get set for javascript in "M.cfg".
  *
  * @since 2.9
  * @return array List of safe config values that are available to javascript.
  */
 public function get_config_for_javascript(moodle_page $page, renderer_base $renderer)
 {
     global $CFG;
     if (empty($this->M_cfg)) {
         // JavaScript should always work with $CFG->httpswwwroot rather than $CFG->wwwroot.
         // Otherwise, in some situations, users will get warnings about insecure content
         // on secure pages from their web browser.
         $this->M_cfg = array('wwwroot' => $CFG->httpswwwroot, 'sesskey' => sesskey(), 'loadingicon' => $renderer->pix_url('i/loading_small', 'moodle')->out(false), 'themerev' => theme_get_revision(), 'slasharguments' => (int) (!empty($CFG->slasharguments)), 'theme' => $page->theme->name, 'jsrev' => $this->get_jsrev(), 'admin' => $CFG->admin, 'svgicons' => $page->theme->use_svg_icons());
         if ($CFG->debugdeveloper) {
             $this->M_cfg['developerdebug'] = true;
         }
         if (defined('BEHAT_SITE_RUNNING')) {
             $this->M_cfg['behatsiterunning'] = true;
         }
     }
     return $this->M_cfg;
 }
 /**
  * Generates and returns HTML code to display information about the rubric editor.
  *
  * @param string $message The message to print out
  * @param string $classes The classes for the returned div
  * @return string The HTML to output.
  */
 public function notification($message, $classes = 'notifyproblem')
 {
     return html_writer::tag('div', clean_text($message), array('class' => renderer_base::prepare_classes($classes)));
 }
Esempio n. 17
0
/**
 * Returns an object containing HTML for the areas affected by settings.
 *
 * Do not add theme specific logic in here, child themes should be able to
 * rely on that function just by declaring settings with similar names.
 *
 * @param renderer_base $output Pass in $OUTPUT.
 * @param moodle_page $page Pass in $PAGE.
 * @return stdClass An object with the following properties:
 *      - navbarclass A CSS class to use on the navbar. By default ''.
 *      - heading HTML to use for the heading. A logo if one is selected or the default heading.
 *      - footnote HTML to use as a footnote. By default ''.
 */
function theme_morecandy_get_html_for_settings(renderer_base $output, moodle_page $page)
{
    global $CFG, $SITE;
    $return = new stdClass();
    $return->branding = '';
    if (empty($page->theme->settings->brandicon)) {
        $return->branding = format_string($SITE->shortname, true, array('context' => context_course::instance(SITEID)));
    }
    if (!empty($page->theme->settings->logo)) {
        $return->heading = '<div class="logo"></div>';
    } else {
        $return->heading = $output->page_heading();
    }
    $return->welcomenote = '';
    if (!empty($page->theme->settings->welcomenote)) {
        $return->welcomenote = '<div class="row-fluid">' . format_text($page->theme->settings->welcomenote) . '</div>';
    }
    $return->footnote = '';
    if (!empty($page->theme->settings->footnote)) {
        $return->footnote = '<div class="footnote text-center">' . format_text($page->theme->settings->footnote) . '</div>';
    }
    return $return;
}
Esempio n. 18
0
/**
 * Returns an object containing HTML for the areas affected by settings.
 *
 * @param renderer_base $output Pass in $OUTPUT.
 * @param moodle_page $page Pass in $PAGE.
 * @return stdClass An object with the following properties:
 *      - navbarclass A CSS class to use on the navbar. By default ''.
 *      - heading HTML to use for the heading. A logo if one is selected or the default heading.
 *      - footnote HTML to use as a footnote. By default ''.
 */
function theme_warwickclean_get_html_for_settings(renderer_base $output, moodle_page $page)
{
    global $CFG;
    $return = new stdClass();
    $return->navbarclass = '';
    if (!empty($page->theme->settings->invert)) {
        $return->navbarclass .= ' navbar-inverse';
    }
    if (!empty($page->theme->settings->logo)) {
        $return->heading = html_writer::link($CFG->wwwroot, '', array('title' => get_string('home'), 'class' => 'logo'));
    } else {
        $return->heading = $output->page_heading();
    }
    $return->footnote = '';
    if (!empty($page->theme->settings->footnote)) {
        $return->footnote = '<div class="footnote text-center">' . $page->theme->settings->footnote . '</div>';
    }
    $return->warningcolor = '';
    if (!empty($page->theme->settings->warningcolor)) {
        $return->warningcolor = $page->theme->settings->warningcolor;
    }
    $return->warningmessage = '';
    if (!empty($page->theme->settings->warningmessage)) {
        //$return->warningmessage = '<div class="warning-message text-center mdl_alert_'.$return->warningcolor.'">'.$page->theme->settings->warningmessage.'</div>';
        $return->warningmessage = html_writer::tag('div', $page->theme->settings->warningmessage, array('class' => 'warning-message text-center mdl_alert_' . $return->warningcolor));
    }
    return $return;
}
Esempio n. 19
0
 public function notification($message, $classes = 'notifyproblem')
 {
     $classes = renderer_base::prepare_classes($classes);
     $classes = str_replace(array('notifyproblem', 'notifysuccess', 'notifymessage', 'redirectmessage'), array('alert alert-danger', 'alert alert-success', 'alert alert-info', 'alert alert-block alert-info'), $classes);
     return parent::notification($message, $classes);
 }
Esempio n. 20
0
/**
 * Returns an object containing HTML for the areas affected by settings.
 *
 * Do not add mmcmonkwearmouth specific logic in here, child themes should be able to
 * rely on that function just by declaring settings with similar names.
 *
 * @param renderer_base $output Pass in $OUTPUT.
 * @param moodle_page $page Pass in $PAGE.
 * @return stdClass An object with the following properties:
 *      - navbarclass A CSS class to use on the navbar. By default ''.
 *      - heading HTML to use for the heading. A logo if one is selected or the default heading.
 *      - footnote HTML to use as a footnote. By default ''.
 */
function theme_mmcmonkwearmouth_get_html_for_settings(renderer_base $output, moodle_page $page)
{
    global $CFG;
    $toReturn = new stdClass();
    $toReturn->navbarclass = '';
    if (!empty($page->theme->settings->logo)) {
        $toReturn->heading = html_writer::link($CFG->wwwroot, html_writer::img($output->pix_url('logo', 'theme'), 'logo', array('title' => get_string('home'), 'class' => 'logo')) . html_writer::tag('h3', 'Monkwearmouth Academy'));
    } else {
        $toReturn->heading = $output->page_heading();
    }
    $toReturn->footnote = '';
    if (!empty($page->theme->settings->footnote)) {
        $toReturn->footnote = '<div class="footnote text-center">' . format_text($page->theme->settings->footnote) . '</div>';
    }
    return $toReturn;
}
Esempio n. 21
0
 /**
  * Footer output
  *
  * @return void
  */
 public function print_footer()
 {
     echo $this->output->footer();
 }
Esempio n. 22
0
 /**
  * Outputs the opening section of a container.
  *
  * @param string $classes A space-separated list of CSS classes
  * @param string $id An optional ID
  * @return string the HTML to output.
  */
 public function container_start($classes = null, $id = null) {
     $this->opencontainers->push('container', html_writer::end_tag('div'));
     return html_writer::start_tag('div', array('id' => $id,
             'class' => renderer_base::prepare_classes($classes)));
 }
Esempio n. 23
0
 /**
  * Renders a notification
  *
  * @param string $message
  * @param string $classes
  * @return string
  */
 public function notification($message, $classes = 'notifyproblem') {
     return html_writer::tag('div', clean_text($message), array('data-role'=>'none', 'data-icon'=>'alert', 'data-theme'=>'d', 'class' => renderer_base::prepare_classes($classes)));
 }
 /**
  * Generate any HTML that needs to go at the start of the <body> tag.
  *
  * Normally, this method is called automatically by the code that prints the
  * <head> tag. You should not normally need to call it in your own code.
  *
  * @param renderer_base $renderer
  * @return string the HTML code to go at the start of the <body> tag.
  */
 public function get_top_of_body_code(renderer_base $renderer)
 {
     // First the skip links.
     $output = $renderer->render_skip_links($this->skiplinks);
     // YUI3 JS needs to be loaded early in the body. It should be cached well by the browser.
     $output .= $this->get_yui3lib_headcode();
     // Add hacked jQuery support, it is not intended for standard Moodle distribution!
     $output .= $this->get_jquery_headcode();
     // Link our main JS file, all core stuff should be there.
     $output .= html_writer::script('', $this->js_fix_url('/lib/javascript-static.js'));
     // All the other linked things from HEAD - there should be as few as possible.
     if ($this->jsincludes['head']) {
         foreach ($this->jsincludes['head'] as $url) {
             $output .= html_writer::script('', $url);
         }
     }
     // Then the clever trick for hiding of things not needed when JS works.
     $output .= html_writer::script("document.body.className += ' jsenabled';") . "\n";
     $this->topofbodydone = true;
     return $output;
 }
Esempio n. 25
0
/**
 * Returns an object containing HTML for the areas affected by settings.
 *
 * Do not add Clean specific logic in here, child themes should be able to
 * rely on that function just by declaring settings with similar names.
 *
 * @param renderer_base $output Pass in $OUTPUT.
 * @param moodle_page $page Pass in $PAGE.
 * @return stdClass An object with the following properties:
 *      - navbarclass A CSS class to use on the navbar. By default ''.
 *      - heading HTML to use for the heading. A logo if one is selected or the default heading.
 *      - footnote HTML to use as a footnote. By default ''.
 */
function theme_clean_get_html_for_settings(renderer_base $output, moodle_page $page)
{
    global $CFG;
    $return = new stdClass();
    $return->navbarclass = '';
    if (!empty($page->theme->settings->invert)) {
        $return->navbarclass .= ' navbar-inverse';
    }
    // Only display the logo on the front page and login page, if one is defined.
    if (!empty($page->theme->settings->logo) && ($page->pagelayout == 'frontpage' || $page->pagelayout == 'login')) {
        $return->heading = html_writer::tag('div', '', array('class' => 'logo'));
    } else {
        $return->heading = $output->page_heading();
    }
    $return->footnote = '';
    if (!empty($page->theme->settings->footnote)) {
        $return->footnote = '<div class="footnote text-center">' . format_text($page->theme->settings->footnote) . '</div>';
    }
    return $return;
}
Esempio n. 26
0
/**
 * Returns an object containing HTML for the areas affected by settings.
 *
 * @param renderer_base $output Pass in $OUTPUT.
 * @param moodle_page $page Pass in $PAGE.
 * @return stdClass An object with the following properties:
 *      - navbarclass A CSS class to use on the navbar. By default ''.
 *      - heading HTML to use for the heading. A logo if one is selected or the default heading.
 *      - footnote HTML to use as a footnote. By default ''.
 */
function theme_iomad_get_html_for_settings(renderer_base $output, moodle_page $page)
{
    global $CFG, $USER, $DB;
    $return = new stdClass();
    $return->navbarclass = '';
    if (!empty($page->theme->settings->invert)) {
        $return->navbarclass .= ' navbar-inverse';
    }
    // get logos
    $theme = $page->theme;
    $logo = $theme->setting_file_url('logo', 'logo');
    if (empty($logo)) {
        $logo = $CFG->wwwroot . '/theme/iomad/pix/iomad_logo.png';
    }
    $clientlogo = '';
    $companycss = '';
    if ($companyid = iomad::is_company_user()) {
        $context = context_system::instance();
        if ($files = $DB->get_records('files', array('contextid' => $context->id, 'component' => 'theme_iomad', 'filearea' => 'companylogo', 'itemid' => $companyid))) {
            foreach ($files as $file) {
                if ($file->filename != '.') {
                    $clientlogo = $CFG->wwwroot . "/pluginfile.php/{$context->id}/theme_iomad/companylogo/{$companyid}/{$file->filename}";
                }
            }
        }
        company_user::load_company();
        $companycss = ".header, .navbar { background: [[company:bgcolor_header]]; }\n                       .block .content { background: [[company:bgcolor_content]]; }";
        foreach ($USER->company as $key => $value) {
            if (isset($value)) {
                $companycss = preg_replace("/\\[\\[company:{$key}\\]\\]/", $value, $companycss);
            }
        }
    }
    $return->heading = '<div id="sitelogo">' . '<a href="' . $CFG->wwwroot . '" ><img src="' . $logo . '" /></a></div>';
    $return->heading .= '<div id="siteheading">' . $output->page_heading() . '</div>';
    if ($clientlogo) {
        $return->heading .= '<div id="clientlogo">' . '<a href="' . $CFG->wwwroot . '" ><img src="' . $clientlogo . '" /></a></div>';
    }
    $return->footnote = '';
    if (!empty($page->theme->settings->footnote)) {
        $return->footnote = '<div class="footnote text-center">' . $page->theme->settings->footnote . '</div>';
    }
    $return->companycss = $companycss;
    return $return;
}
Esempio n. 27
0
File: lib.php Progetto: JOANMM/bcu
function theme_bcu_get_html_for_settings(renderer_base $output, moodle_page $page)
{
    global $CFG;
    $return = new stdClass();
    $return->navbarclass = '';
    if (!empty($page->theme->settings->invert)) {
        $return->navbarclass .= ' navbar-inverse';
    }
    if (!empty($page->theme->settings->logo)) {
        $return->heading = html_writer::link($CFG->wwwroot, '', array('title' => get_string('home'), 'class' => 'logo'));
    } else {
        $return->heading = $output->page_heading();
    }
    $return->footnote = '';
    if (!empty($page->theme->settings->footnote)) {
        $return->footnote = '<div class="footnote">' . $page->theme->settings->footnote . '</div>';
    }
    return $return;
}
Esempio n. 28
0
/**
 * Returns an object containing HTML for the areas affected by settings.
 *
 * Do not add roshnilite specific logic in here, child themes should be able to
 * rely on that function just by declaring settings with similar names.
 *
 * @param renderer_base $output Pass in $OUTPUT.
 * @param moodle_page $page Pass in $PAGE.
 * @return stdClass An object with the following properties:
 *      - navbarclass A CSS class to use on the navbar. By default ''.
 *      - heading HTML to use for the heading. A logo if one is selected or the default heading.
 *      - footnote HTML to use as a footnote. By default ''.
 */
function theme_roshnilite_get_html_for_settings(renderer_base $output, moodle_page $page) {
    global $CFG, $USER;
    $return = new stdClass;

    $return->navbarclass = '';
    if (!empty($page->theme->settings->invert)) {
        $return->navbarclass .= ' navbar-inverse';
    }

    if (!empty($page->theme->settings->logo)) {
        $return->heading = html_writer::tag('div', '', array('class' => 'logo'));
    } else {
        $return->heading = $output->page_heading();
    }

    $return->footnote = '';
    if (!empty($page->theme->settings->footnote)) {
        $return->footnote = '<div class="footnote text-center">'.format_text($page->theme->settings->footnote).'</div>';
    }
    /*-----------------------for contact*--------------------------*/
    if (!empty($page->theme->settings->addressfontawesomeicon)) {
        $return->addressfontawesomeicon = $page->theme->settings->addressfontawesomeicon;
    }
    if (!empty($page->theme->settings->emailfontawesomeicon)) {
        $return->emailfontawesomeicon = $page->theme->settings->emailfontawesomeicon;
    }
    if (!empty($page->theme->settings->phonefontawesomeicon)) {
        $return->phonefontawesomeicon = $page->theme->settings->phonefontawesomeicon;
    }
    if (!empty($page->theme->settings->address)) {
        $return->address = $page->theme->settings->address;
    }
    if (!empty($page->theme->settings->phone)) {
        $return->phone = $page->theme->settings->phone;
    }
    if (!empty($page->theme->settings->email)) {
        $return->email = $page->theme->settings->email;
    }
    /*-----------------------for social contact*--------------------------*/
    if (!empty($page->theme->settings->socialheading)) {
        $return->socialheading = $page->theme->settings->socialheading;
    }
    if (!empty($page->theme->settings->masonrysubheading)) {
        $return->masonrysubheading = $page->theme->settings->masonrysubheading;
    }
    if (!empty($page->theme->settings->socialfontawesomeicon1)) {
        $return->socialfontawesomeicon1 = $page->theme->settings->socialfontawesomeicon1;
    }
    if (!empty($page->theme->settings->socialicon1)) {
        $return->socialicon1 = $page->theme->settings->socialicon1;
    }
    if (!empty($page->theme->settings->socialfontawesomeicon2)) {
        $return->socialfontawesomeicon2 = $page->theme->settings->socialfontawesomeicon2;
    }
    if (!empty($page->theme->settings->socialicon2)) {
        $return->socialicon2 = $page->theme->settings->socialicon2;
    }
    if (!empty($page->theme->settings->socialfontawesomeicon3)) {
        $return->socialfontawesomeicon3 = $page->theme->settings->socialfontawesomeicon3;
    }
    if (!empty($page->theme->settings->socialicon3)) {
        $return->socialicon3 = $page->theme->settings->socialicon3;
    }
    if (!empty($page->theme->settings->socialfontawesomeicon4)) {
        $return->socialfontawesomeicon4 = $page->theme->settings->socialfontawesomeicon4;
    }
    if (!empty($page->theme->settings->socialicon4)) {
        $return->socialicon4 = $page->theme->settings->socialicon4;
    }
    /*--------------------for masonry--------------------------------*/
    if (!empty($page->theme->settings->masonryheading)) {
        $return->masonryheading = $page->theme->settings->masonryheading;
    }
    if (!empty($page->theme->settings->masonrysubheading)) {
        $return->masonrysubheading = $page->theme->settings->masonrysubheading;
    }
    if (!empty($page->theme->settings->masonrytext1)) {
        $return->masonrytext1 = $page->theme->settings->masonrytext1;
    }
    if (!empty($page->theme->settings->masonrysubtext1)) {
        $return->masonrysubtext1 = $page->theme->settings->masonrysubtext1;
    }
    if (!empty($page->theme->settings->masonryrurl1)) {
        $return->masonryurl1 = $page->theme->settings->masonryrurl1;
    }

    if (!empty($page->theme->settings->masonrytext2)) {
        $return->masonrytext2 = $page->theme->settings->masonrytext2;
    }
    if (!empty($page->theme->settings->masonrysubtext2)) {
        $return->masonrysubtext2 = $page->theme->settings->masonrysubtext2;
    }
    if (!empty($page->theme->settings->masonryrurl2)) {
        $return->masonryurl2 = $page->theme->settings->masonryrurl2;
    }

    if (!empty($page->theme->settings->masonrytext3)) {
        $return->masonrytext3 = $page->theme->settings->masonrytext3;
    }
    if (!empty($page->theme->settings->masonrysubtext3)) {
        $return->masonrysubtext3 = $page->theme->settings->masonrysubtext3;
    }
    if (!empty($page->theme->settings->masonryrurl3)) {
        $return->masonryurl3 = $page->theme->settings->masonryrurl3;
    }

    if (!empty($page->theme->settings->masonrytext4)) {
        $return->masonrytext4 = $page->theme->settings->masonrytext4;
    }
    if (!empty($page->theme->settings->masonrysubtext4)) {
        $return->masonrysubtext4 = $page->theme->settings->masonrysubtext4;
    }
    if (!empty($page->theme->settings->masonryrurl4)) {
        $return->masonryurl4 = $page->theme->settings->masonryrurl4;
    }

    if (!empty($page->theme->settings->masonrytext5)) {
        $return->masonrytext5 = $page->theme->settings->masonrytext5;
    }
    if (!empty($page->theme->settings->masonrysubtext5)) {
        $return->masonrysubtext5 = $page->theme->settings->masonrysubtext5;
    }
    if (!empty($page->theme->settings->masonryrurl5)) {
        $return->masonryurl5 = $page->theme->settings->masonryrurl5;
    }

    if (!empty($page->theme->settings->masonrytext6)) {
        $return->masonrytext6 = $page->theme->settings->masonrytext6;
    }
    if (!empty($page->theme->settings->masonrysubtext6)) {
        $return->masonrysubtext6 = $page->theme->settings->masonrysubtext6;
    }
    if (!empty($page->theme->settings->masonryrurl6)) {
        $return->masonryurl6 = $page->theme->settings->masonryrurl6;
    }

    if (!empty($page->theme->settings->masonrytext7)) {
        $return->masonrytext7 = $page->theme->settings->masonrytext7;
    }
    if (!empty($page->theme->settings->masonrysubtext7)) {
        $return->masonrysubtext7 = $page->theme->settings->masonrysubtext7;
    }
    if (!empty($page->theme->settings->masonryrurl7)) {
        $return->masonryurl7 = $page->theme->settings->masonryrurl7;
    }

    if (!empty($page->theme->settings->masonrytext8)) {
        $return->masonrytext8 = $page->theme->settings->masonrytext8;
    }
    if (!empty($page->theme->settings->masonrysubtext8)) {
        $return->masonrysubtext8 = $page->theme->settings->masonrysubtext8;
    }
    if (!empty($page->theme->settings->masonryrurl8)) {
        $return->masonryurl8 = $page->theme->settings->masonryrurl8;
    }

    /*-------------------------for first slider-----------------------------*/
    if (!empty($page->theme->settings->slidertext1)) {
        $return->slidertext1 = $page->theme->settings->slidertext1;
    }
    if (!empty($page->theme->settings->sliderbuttontext1)) {
        $return->sliderbuttontext1 = $page->theme->settings->sliderbuttontext1;
    }
    if (!empty($page->theme->settings->sliderurl1)) {
        $return->sliderurl1 = $page->theme->settings->sliderurl1;
    }

    if (!empty($page->theme->settings->slidertext2)) {
        $return->slidertext2 = $page->theme->settings->slidertext2;
    }
    if (!empty($page->theme->settings->sliderbuttontext2)) {
        $return->sliderbuttontext2 = $page->theme->settings->sliderbuttontext2;
    }
    if (!empty($page->theme->settings->sliderurl2)) {
        $return->sliderurl2 = $page->theme->settings->sliderurl2;
    }

    if (!empty($page->theme->settings->slidertext3)) {
        $return->slidertext3 = $page->theme->settings->slidertext3;
    }
    if (!empty($page->theme->settings->sliderbuttontext3)) {
        $return->sliderbuttontext3 = $page->theme->settings->sliderbuttontext3;
    }
    if (!empty($page->theme->settings->sliderurl3)) {
        $return->sliderurl3 = $page->theme->settings->sliderurl3;
    }

    if (!empty($page->theme->settings->slidertext4)) {
        $return->slidertext4 = $page->theme->settings->slidertext4;
    }
    if (!empty($page->theme->settings->sliderbuttontext4)) {
        $return->sliderbuttontext4 = $page->theme->settings->sliderbuttontext4;
    }
    if (!empty($page->theme->settings->sliderurl4)) {
        $return->sliderurl4 = $page->theme->settings->sliderurl4;
    }

    if (!empty($page->theme->settings->slidertext5)) {
        $return->slidertext5 = $page->theme->settings->slidertext5;
    }
    if (!empty($page->theme->settings->sliderbuttontext5)) {
        $return->sliderbuttontext5 = $page->theme->settings->sliderbuttontext5;
    }
    if (!empty($page->theme->settings->sliderurl5)) {
        $return->sliderurl5 = $page->theme->settings->sliderurl5;
    }
    if (!empty($page->theme->settings->slidertext6)) {
        $return->slidertext6 = $page->theme->settings->slidertext6;
    }
    if (!empty($page->theme->settings->sliderbuttontext6)) {
        $return->sliderbuttontext6 = $page->theme->settings->sliderbuttontext6;
    }
    if (!empty($page->theme->settings->sliderurl6)) {
        $return->sliderurl6 = $page->theme->settings->sliderurl6;
    }
    /*--------------------------about site---------------------------------*/
    if (!empty($page->theme->settings->aboutsiteheading)) {
        $return->aboutsiteheading = $page->theme->settings->aboutsiteheading;
    }
    if (!empty($page->theme->settings->aboutsitesubheading)) {
        $return->aboutsitesubheading = $page->theme->settings->aboutsitesubheading;
    }

    if (!empty($page->theme->settings->aboutsitename1)) {
        $return->aboutsitename1 = $page->theme->settings->aboutsitename1;
    }
    if (!empty($page->theme->settings->aboutsitetext1)) {
        $return->aboutsitetext1 = $page->theme->settings->aboutsitetext1;
    }
    if (!empty($page->theme->settings->aboutsiteurl1)) {
        $return->aboutsiteurl1 = $page->theme->settings->aboutsiteurl1;
    } else {
        $return->aboutsiteurl1 = $CFG->wwwroot.'/mod/forum/user.php?id='.$USER->id;
    }

    if (!empty($page->theme->settings->aboutsitename2)) {
        $return->aboutsitename2 = $page->theme->settings->aboutsitename2;
    }
    if (!empty($page->theme->settings->aboutsitetext2)) {
        $return->aboutsitetext2 = $page->theme->settings->aboutsitetext2;
    }
    if (!empty($page->theme->settings->aboutsiteurl2)) {
        $return->aboutsiteurl2 = $page->theme->settings->aboutsiteurl2;
    } else {
        $return->aboutsiteurl2 = $CFG->wwwroot.'/course/index.php';
    }

    if (!empty($page->theme->settings->aboutsitename3)) {
        $return->aboutsitename3 = $page->theme->settings->aboutsitename3;
    }
    if (!empty($page->theme->settings->aboutsitetext3)) {
        $return->aboutsitetext3 = $page->theme->settings->aboutsitetext3;
    }
    if (!empty($page->theme->settings->aboutsiteurl3)) {
        $return->aboutsiteurl3 = $page->theme->settings->aboutsiteurl3;
    } else {
        $return->aboutsiteurl3 = $CFG->wwwroot.'/blog/index.php?userid='.$USER->id;
    }

    if (!empty($page->theme->settings->aboutsitename4)) {
        $return->aboutsitename4 = $page->theme->settings->aboutsitename4;
    }
    if (!empty($page->theme->settings->aboutsitetext4)) {
        $return->aboutsitetext4 = $page->theme->settings->aboutsitetext4;
    }
    if (!empty($page->theme->settings->aboutsiteurl4)) {
        $return->aboutsiteurl4 = $page->theme->settings->aboutsiteurl4;
    } else {
        $return->aboutsiteurl4 = $CFG->wwwroot.'/calendar/view.php';
    }
    return $return;
}
Esempio n. 29
0
/**
 * Output a standard heading block
 *
 * @deprecated
 * @param string $heading The text to write into the heading
 * @param string $class An additional Class Attr to use for the heading
 * @param bool $return If set to true output is returned rather than echoed, default false
 * @return string|void HTML String if return=true nothing otherwise
 */
function print_heading_block($heading, $class='', $return=false) {
    global $OUTPUT;
    debugging('print_heading_with_block() has been deprecated. Please change your code to use $OUTPUT->heading().');
    $output = $OUTPUT->heading($heading, 2, 'headingblock header ' . renderer_base::prepare_classes($class));
    if ($return) {
        return $output;
    } else {
        echo $output;
    }
}
Esempio n. 30
0
 /**
  * Renders this element
  *
  * @param renderer_base $output typically, the renderer that's calling this function
  * @return string
  */
 public function render(\renderer_base $output)
 {
     return $output->render_from_template('core/inplace_editable', $this->export_for_template($output));
 }