/** * Print the section which contains the post form (i. e. section number 2) * * @global object $this->output * @param object $course * @param object $sectioninfo * @param moodle_form $postform * @param int id of post when editing a post (0 for new post) */ protected function print_postform_section($course, $sectioninfo, $postform, $postid) { global $USER; $o = ''; // ... usually this is section 2, because activities on time line are required to be in section 1. if (isset($sectioninfo[FORMAT_SOCIALWALL_POSTFORMSECTION])) { $thissection = $sectioninfo[FORMAT_SOCIALWALL_POSTFORMSECTION]; $o .= html_writer::start_tag('li', array('id' => 'section-' . $thissection->section, 'class' => 'section main clearfix', 'role' => 'region', 'aria-label' => get_section_name($course, $thissection))); $o .= html_writer::start_tag('div', array('class' => 'content')); $url = new moodle_url('/course/format/socialwall/pages/editnotification.php', array('courseid' => $course->id)); $linktext = $this->output->pix_icon('i/settings', get_string('editnotification', 'format_socialwall')) . " " . get_string('editnotification', 'format_socialwall'); $linkparams = array('class' => 'pf-notificationsetting', 'id' => 'pfnotificationsetting_' . $course->id); $o .= html_writer::link($url, $linktext, $linkparams); $o .= html_writer::tag('div', '', array('class' => 'clearfix')); $o .= $postform->render(); // Render prepared attaches section. if ($USER->editing) { $o .= html_writer::tag('div', '', array('class' => 'clearfix')); $thissection = $sectioninfo[FORMAT_SOCIALWALL_POSTFORMSECTION]; $o .= html_writer::start_div('attachactivies'); $o .= get_string('attachactivities', 'format_socialwall'); if (!empty($thissection->sequence)) { $o .= html_writer::empty_tag('br') . get_string('attachedactivities', 'format_socialwall'); } $o .= $this->courserenderer->course_section_cm_list($course, $thissection, 0); $o .= $this->courserenderer->course_section_add_cm_control($course, FORMAT_SOCIALWALL_POSTFORMSECTION, 0); $o .= html_writer::end_div(); } // Render the recent attaches section, when user is editing or updating; if ($USER->editing or $postid > 0) { $content = ''; // Check, whether there are recent activities attached. $cache = cache::make('format_socialwall', 'attachedrecentactivities'); if (!($attachedrecentactivities = $cache->get($course->id . '_' . $postid))) { $attachedrecentactivities = array(); } // Add recent postform list is necessary as a target for js popup dialog, even there are no recentactivities. $content .= $this->render_postform_recent_activities($course, $postid, $attachedrecentactivities); if ($USER->editing) { $l = $this->output->pix_icon('t/add', get_string('addrecentactivity', 'format_socialwall')); $l .= " " . get_string('addrecentactivity', 'format_socialwall'); $c = html_writer::tag('span', $l, array('id' => 'tl-addrecentactivity-text')); $c .= html_writer::link('#', '', array('style' => 'display:none', 'id' => 'tl-addrecentactivity-link')); $content .= html_writer::tag('div', $c, array('id' => 'tl-addrecentactitity-wrapper')); } if ($USER->editing or count($attachedrecentactivities) > 0) { // Show attached existing activities here. $content = get_string('attachedrecentactivities', 'format_socialwall') . $content; $o .= html_writer::tag('div', $content, array('class' => 'attachactivies')); } } $o .= $this->section_footer(); } if ($USER->editing) { $o .= html_writer::tag('div', $this->render_postform_recent_activities_form($course, $postid), array('style' => 'display:none')); } echo $o; }
/** print the section which contains the post form (i. e. section number 2) * * @global record $USER * @global record $PAGE * @global object $OUTPUT * @param record $course * @param object $sectioninfo * @param moodle_form $postform */ protected function print_postform_section($course, $sectioninfo, $postform) { global $USER, $PAGE, $OUTPUT; $o = ''; // ... usually this is section 2, because activities on time line are required to be in section 1. if (isset($sectioninfo[FORMAT_SOCIALWALL_POSTFORMSECTION])) { $thissection = $sectioninfo[FORMAT_SOCIALWALL_POSTFORMSECTION]; $o .= html_writer::start_tag('li', array('id' => 'section-' . $thissection->section, 'class' => 'section main clearfix', 'role' => 'region', 'aria-label' => get_section_name($course, $thissection))); $o .= html_writer::start_tag('div', array('class' => 'content')); $url = new moodle_url('/course/format/socialwall/pages/editnotification.php', array('courseid' => $course->id)); $linktext = $OUTPUT->pix_icon('i/settings', get_string('editnotification', 'format_socialwall')) . " " . get_string('editnotification', 'format_socialwall'); $linkparams = array('class' => 'pf-notificationsetting', 'id' => 'pfnotificationsetting_' . $course->id); $o .= html_writer::link($url, $linktext, $linkparams); $o .= html_writer::tag('div', '', array('class' => 'clearfix')); $o .= $postform->render(); if ($PAGE->user_allowed_editing()) { $o .= html_writer::tag('div', '', array('class' => 'clearfix')); $thissection = $sectioninfo[FORMAT_SOCIALWALL_POSTFORMSECTION]; if (empty($thissection->sequence)) { if ($USER->editing) { $o .= html_writer::start_div('attachactivies'); $o .= get_string('attachactivities', 'format_socialwall'); } else { $o .= html_writer::start_div(''); } } else { if ($USER->editing) { $o .= html_writer::start_div('attachactivies'); $o .= get_string('attachactivities', 'format_socialwall'); $o .= html_writer::empty_tag('br') . get_string('attachedactivities', 'format_socialwall'); } else { $o .= html_writer::start_div(''); $o .= get_string('attachedactivities', 'format_socialwall'); } } $o .= $this->courserenderer->course_section_cm_list($course, $thissection, 0); $o .= $this->courserenderer->course_section_add_cm_control($course, FORMAT_SOCIALWALL_POSTFORMSECTION, 0); $o .= html_writer::end_div(); } $o .= $this->section_footer(); } echo $o; }