/** * Get all html <meta> * * @author Neil Carpenter * @returns Array * */ function nc_get_meta($id) { $post_type = get_post_type($id); $meta = array(); $meta['title'] = _get_title($id, $post_type); $meta['keywords'] = _get_keywords($id, $post_type); $meta['description'] = _get_description($id, $post_type); $meta['url'] = _get_url($id, $post_type); $meta['image'] = _get_image($id, $post_type); return $meta; }
function _make_block_topics() { global $OUTPUT, $course, $sections, $editing, $has_cap_update, $has_cap_vishidsect, $mods, $modnames, $modnamesused, $str_edit_summary, $url_pic_edit; $summaryformatoptions = new stdClass(); $summaryformatoptions->noclean = true; $summaryformatoptions->overflowdiv = true; $str_hidden_topic = get_string('hidden_topic', 'format_grid'); if ($editing && $has_cap_update) { $str_move_up = get_string('moveup'); $str_move_down = get_string('movedown'); $str_topic_hide = get_string('hidefromothers', 'format_grid'); $str_topic_show = get_string('showfromothers', 'format_grid'); $url_pic_move_up = $OUTPUT->pix_url('t/up'); $url_pic_move_down = $OUTPUT->pix_url('t/down'); $url_pic_topic_hide = $OUTPUT->pix_url('i/hide'); $url_pic_topic_show = $OUTPUT->pix_url('i/show'); } for ($section = 1; $section <= $course->numsections; $section++) { if (empty($sections[$section])) { //Section should have been created in the icons section above. If it's empty then its an error. throw new coding_exception('Error, section ' . $section . ' not found!'); } $thissection = $sections[$section]; if (!$has_cap_vishidsect && !$thissection->visible && $course->hiddensections) { continue; } $sectionstyle = 'section main'; if (!$thissection->visible) { $sectionstyle .= ' hidden'; } $sectionstyle .= ' grid_section'; echo html_writer::start_tag('li', array('id' => 'section-' . $section, 'class' => $sectionstyle)); // Note, 'right side' is BEFORE content. echo html_writer::tag('div', ' ', array('class' => 'left side')); echo html_writer::start_tag('div', array('class' => 'right side')); if ($editing && $has_cap_update) { // Show the hide/show eye if ($thissection->visible) { $op_topic_visible = 'hide'; $str_topic_visible_text = $str_topic_hide; $url_pic_topic_visible = $url_pic_topic_hide; } else { $op_topic_visible = 'show'; $str_topic_visible_text = $str_topic_show; $url_pic_topic_visible = $url_pic_topic_show; } echo html_writer::link(new moodle_url('/course/view.php#section-' . $section, array('id' => $course->id, $op_topic_visible => $section, 'sesskey' => sesskey())), html_writer::empty_tag('img', array('src' => $url_pic_topic_visible, 'class' => 'icon ' . $op_topic_visible, 'alt' => $str_topic_visible_text)), array('title' => $str_topic_visible_text, 'class' => 'editing_showhide')); // Add a arrow to move section up if ($section > 1) { echo _move_section_arrow($section, $course, -1, 'up', $str_move_up, $url_pic_move_up, 'moveup'); } // Add a arrow to move section down if ($section < $course->numsections) { echo _move_section_arrow($section, $course, -1, 'down', $str_move_down, $url_pic_move_down, 'movedown'); } } echo html_writer::end_tag('div'); echo html_writer::start_tag('div', array('class' => 'content')); if ($has_cap_vishidsect || $thissection->visible) { //if visible if (!empty($thissection->name)) { echo format_text($OUTPUT->heading($thissection->name, 3, 'sectionname'), FORMAT_HTML); } echo html_writer::start_tag('div', array('class' => 'summary')); $coursecontext = get_context_instance(CONTEXT_COURSE, $course->id); $summarytext = file_rewrite_pluginfile_urls($thissection->summary, 'pluginfile.php', $coursecontext->id, 'course', 'section', $thissection->id); echo format_text($summarytext, FORMAT_HTML, $summaryformatoptions); if ($editing && $has_cap_update) { echo html_writer::link(new moodle_url('editsection.php', array('id' => $thissection->id)), html_writer::empty_tag('img', array('src' => $url_pic_edit, 'alt' => $str_edit_summary, 'class' => 'icon edit')), array('title' => $str_edit_summary)); } echo html_writer::end_tag('div'); print_section($course, $thissection, $mods, $modnamesused); if ($editing) { print_section_add_menus($course, $section, $modnames); } } else { $str_title = _get_title($thissection->summary); echo html_writer::tag('h2', $str_title); echo html_writer::tag('p', $str_hidden_topic); } echo html_writer::end_tag('div'); echo html_writer::end_tag('li'); } }