public function get_csswww()
 {
     global $CFG;
     if (!$this->theme_essential_lte_ie9()) {
         if (right_to_left()) {
             $moodlecss = 'essential-rtl.css';
         } else {
             $moodlecss = 'essential.css';
         }
         $syscontext = context_system::instance();
         $itemid = theme_get_revision();
         $url = moodle_url::make_file_url("{$CFG->wwwroot}/pluginfile.php", "/{$syscontext->id}/theme_essential/style/{$itemid}/{$moodlecss}");
         $url = preg_replace('|^https?://|i', '//', $url->out(false));
         return '<link rel="stylesheet" href="' . $url . '">';
     } else {
         if (right_to_left()) {
             $moodlecssone = 'essential-rtl_ie9-blessed1.css';
             $moodlecsstwo = 'essential-rtl_ie9.css';
         } else {
             $moodlecssone = 'essential_ie9-blessed1.css';
             $moodlecsstwo = 'essential_ie9.css';
         }
         $syscontext = context_system::instance();
         $itemid = theme_get_revision();
         $urlone = moodle_url::make_file_url("{$CFG->wwwroot}/pluginfile.php", "/{$syscontext->id}/theme_essential/style/{$itemid}/{$moodlecssone}");
         $urlone = preg_replace('|^https?://|i', '//', $urlone->out(false));
         $urltwo = moodle_url::make_file_url("{$CFG->wwwroot}/pluginfile.php", "/{$syscontext->id}/theme_essential/style/{$itemid}/{$moodlecsstwo}");
         $urltwo = preg_replace('|^https?://|i', '//', $urltwo->out(false));
         return '<link rel="stylesheet" href="' . $urlone . '"><link rel="stylesheet" href="' . $urltwo . '">';
     }
 }
 protected function get_nav_links_content($course, $sections, $sectionno, $buffer = 0)
 {
     // FIXME: This is really evil and should by using the navigation API.
     $course = \course_get_format($course)->get_course();
     $left = 'left';
     $right = 'right';
     if (\right_to_left()) {
         $temp = $left;
         $left = $right;
         $right = $temp;
     }
     $previousarrow = '<span aria-hidden="true" class="fa fa-chevron-circle-' . $left . '"></span>';
     $nextarrow = '<span aria-hidden="true" class="fa fa-chevron-circle-' . $right . '"></span>';
     $canviewhidden = \has_capability('moodle/course:viewhiddensections', \context_course::instance($course->id)) or !$course->hiddensections;
     $links = array('previous' => '', 'next' => '');
     $back = $sectionno - 1;
     while ($back > $buffer and empty($links['previous'])) {
         if ($canviewhidden || $sections[$back]->uservisible) {
             $params = array('id' => 'previous_section');
             if (!$sections[$back]->visible) {
                 $params['class'] = 'dimmed_text';
             }
             $previouslink = \html_writer::start_tag('div', array('class' => 'nav_icon'));
             $previouslink .= $previousarrow;
             $previouslink .= \html_writer::end_tag('div');
             $previouslink .= \html_writer::start_tag('span', array('class' => 'text'));
             $previouslink .= \html_writer::start_tag('span', array('class' => 'nav_guide'));
             $previouslink .= \get_string('previoussection', 'theme_essential');
             $previouslink .= \html_writer::end_tag('span');
             $previouslink .= \html_writer::empty_tag('br');
             $previouslink .= \get_section_name($course, $sections[$back]);
             $previouslink .= \html_writer::end_tag('span');
             $links['previous'] = \html_writer::link(course_get_url($course, $back), $previouslink, $params);
         }
         $back--;
     }
     $forward = $sectionno + 1;
     while ($forward <= $course->numsections and empty($links['next'])) {
         if ($canviewhidden || $sections[$forward]->uservisible) {
             $params = array('id' => 'next_section');
             if (!$sections[$forward]->visible) {
                 $params['class'] = 'dimmed_text';
             }
             $nextlink = \html_writer::start_tag('div', array('class' => 'nav_icon'));
             $nextlink .= $nextarrow;
             $nextlink .= \html_writer::end_tag('div');
             $nextlink .= \html_writer::start_tag('span', array('class' => 'text'));
             $nextlink .= \html_writer::start_tag('span', array('class' => 'nav_guide'));
             $nextlink .= \get_string('nextsection', 'theme_essential');
             $nextlink .= \html_writer::end_tag('span');
             $nextlink .= \html_writer::empty_tag('br');
             $nextlink .= \get_section_name($course, $sections[$forward]);
             $nextlink .= \html_writer::end_tag('span');
             $links['next'] = \html_writer::link(course_get_url($course, $forward), $nextlink, $params);
         }
         $forward++;
     }
     return $links;
 }
 function get_content()
 {
     global $CFG, $WS, $USER;
     if (empty($WS->dfwiki)) {
         $this->content->text = get_string('block_warning', 'wiki');
         return $this->content;
     }
     //         $this->content->footer = '<br />'
     //             . helpbutton('ranking', $this->title, 'wiki', true, false, '', true)
     //             . $this->title;
     // dfwiki-block || course-block
     if ($this->instance->pagetype == 'mod-wiki-view') {
         $dir = $CFG->wwwroot . '/mod/wiki/view.php?id=' . $WS->cm->id;
     } else {
         $dir = $CFG->wwwroot . '/course/view.php?id=' . $WS->cm->course;
     }
     if (!empty($WS->dfwiki) && $WS->dfwiki->votemode == 0) {
         $this->content->text = get_string('vote_warning', 'wiki');
         return $this->content;
     }
     $vote = optional_param('Vote', NULL, PARAM_ALPHA);
     $wikimanager = wiki_manager_get_instance();
     if ($WS->dfwiki->votemode == 1 and $vote == 'Vote') {
         $wikimanager->vote_page($WS->dfwiki->id, $WS->page, $WS->pagedata->version, $USER->username);
     }
     $ranking = $wikimanager->get_vote_ranking($WS->dfwiki->id);
     $this->content = new stdClass();
     if (!$ranking) {
         $this->content->text = get_string('nopages', 'wiki');
         $this->content->footer = '';
         return $this->content;
     }
     if (right_to_left()) {
         // rtl support for table cell alignment (nadavkav patch)
         $alignmentleft = 'right';
         $alignmentright = 'left';
     } else {
         $alignmentleft = 'left';
         $alignmentright = 'right';
     }
     $text = '<table border="0" width="100" cellpadding="0" cellspacing="0">' . '<tr><th>' . get_string('page') . '</th><th>' . get_string('votes', 'wiki') . '</th></tr>';
     $n_rows = 0;
     foreach ($ranking as $row) {
         $text .= '<tr><td align="' . $alignmentleft . '">' . '<a href="' . $dir . '&amp;page=' . urlencode($row->pagename) . '">' . $this->trim_string($row->pagename, 20) . '</a></td>' . '<td align="center">' . $row->votes . '</td></tr>';
         // Show only the first 5 rows.
         if (++$n_rows == 5) {
             break;
         }
     }
     $text .= '</table>';
     $this->content->text = $text;
     $this->content->footer = '&nbsp;';
     return $this->content;
 }
    function get_content()
    {
        global $CFG, $WS;
        if ($this->content !== NULL) {
            return $this->content;
        }
        //If we are out of a dfwiki activity or in a different
        //dfwiki format course and we want to create a block:
        if (empty($WS->dfwiki)) {
            $this->content->text = get_string('block_warning', 'wiki');
            return $this->content;
        }
        $this->content = new stdClass();
        $this->content->items = array();
        $this->content->icons = array();
        //$this->content->footer = '<br />'.helpbutton ('updated', get_string('block_updated', 'wiki'), 'wiki', true, false, '', true).get_string('block_updated', 'wiki');
        $ead = wiki_manager_get_instance();
        $pages = $ead->get_wiki_most_uptodate_pages(10);
        // dfwiki-block || course-block
        $dir = "";
        if ($this->instance->pagetype == "mod-wiki-view") {
            $dir = $CFG->wwwroot . '/mod/wiki/view.php?id=' . $WS->cm->id;
        } else {
            $dir = $CFG->wwwroot . '/course/view.php?id=' . $WS->cm->course;
        }
        // rtl / ltr CSS alignment support (nadavkav)
        if (right_to_left()) {
            $nwikialignment = 'nwikirightnow';
        } else {
            $nwikialignment = 'nwikileftnow';
        }
        if (count($pages) != 0) {
            $text = '<table border="0" cellpadding="0" cellspacing="0">';
            $i = 1;
            foreach ($pages as $page) {
                $pageinfo = wiki_page_last_version($page);
                $brs = strlen($page) > 12 ? '<br />&nbsp;&nbsp;&nbsp;' : '';
                $text .= '<tr>
					<td class="' . $nwikialignment . '">
						' . $i . '- <a href="' . $dir . '&amp;page=' . urlencode($page) . '" title="' . $page . '">' . $this->trim_string($page, 40) . '</a>' . $brs . '
						&nbsp;-&nbsp;<small>(' . strftime('%d %b %y', $pageinfo->lastmodified) . ')</small>
						' . wiki_get_user_info($pageinfo->author, 40, false) . '
					</td>
					</tr>';
                $i++;
            }
            $text .= '</table>';
        } else {
            $text = get_string('nopages', 'wiki');
        }
        $this->content->text = $text;
        return $this->content;
    }
 /**
  * Constructor method, calls the parent constructor - MDL-21097
  *
  * @param moodle_page $page
  * @param string $target one of rendering target constants
  */
 public function __construct(moodle_page $page, $target)
 {
     parent::__construct($page, $target);
     $this->togglelib = new topcoll_togglelib();
     $this->courseformat = course_get_format($page->course);
     // Needed for collapsed topics settings retrieval.
     /* Since format_topcoll_renderer::section_edit_controls() only displays the 'Set current section' control when editing
        mode is on we need to be sure that the link 'Turn editing mode on' is available for a user who does not have any
        other managing capability. */
     $page->set_other_editing_capability('moodle/course:setcurrentsection');
     global $PAGE;
     $this->userisediting = $PAGE->user_is_editing();
     $this->tctoggleiconsize = clean_param(get_config('format_topcoll', 'defaulttoggleiconsize'), PARAM_TEXT);
     $this->rtl = right_to_left();
 }
 function checklist_class($cmid = 'staticonly', $userid = 0, $checklist = NULL, $cm = NULL, $course = NULL)
 {
     global $COURSE;
     if ($cmid == 'staticonly') {
         //use static functions only!
         return;
     }
     $this->userid = $userid;
     global $CFG;
     if (right_to_left()) {
         // rtl support for table cell alignment (nadavkav patch)
         $alignleft = 'right';
         $alignright = 'left';
     } else {
         $alignleft = 'left';
         $alignright = 'right';
     }
     if ($cm) {
         $this->cm = $cm;
     } else {
         if (!($this->cm = get_coursemodule_from_id('checklist', $cmid))) {
             error('Course Module ID was incorrect');
         }
     }
     $this->context = get_context_instance(CONTEXT_MODULE, $this->cm->id);
     if ($course) {
         $this->course = $course;
     } else {
         if ($this->cm->course == $COURSE->id) {
             $this->course = $COURSE;
         } else {
             if (!($this->course = get_record('course', 'id', $this->cm->course))) {
                 error('Course is misconfigured');
             }
         }
     }
     if ($checklist) {
         $this->checklist = $checklist;
     } else {
         if (!($this->checklist = get_record('checklist', 'id', $this->cm->instance))) {
             error('assignment ID was incorrect');
         }
     }
     $this->strchecklist = get_string('modulename', 'checklist');
     $this->strchecklists = get_string('modulenameplural', 'checklist');
     $this->pagetitle = strip_tags($this->course->shortname . ': ' . $this->strchecklist . ': ' . format_string($this->checklist->name, true));
     $this->get_items();
 }
 public function get_other_values(renderer_base $output)
 {
     $values = array();
     $values['autostart'] = $this->comment->get_autostart();
     $values['canpost'] = $this->comment->can_post();
     $values['canview'] = $this->comment->can_view();
     $values['collapsediconurl'] = $output->pix_url(right_to_left() ? 't/collapsed_rtl' : 't/collapsed')->out(false);
     $values['count'] = $this->comment->count();
     $values['displaycancel'] = $this->comment->get_displaycancel();
     $values['displaytotalcount'] = $this->comment->get_displaytotalcount();
     $values['fullwidth'] = $this->comment->get_fullwidth();
     $values['linktext'] = $this->comment->get_linktext();
     $values['notoggle'] = $this->comment->get_notoggle();
     $values['template'] = $this->comment->get_template();
     $values['canpostorhascomments'] = $values['canpost'] || $values['canview'] && $values['count'] > 0;
     return $values;
 }
Пример #8
0
/**
 * Callback function called from question_list() function (which is called from showbank())
 * Displays action icon as first action for each question.
 */
function module_specific_actions($pageurl, $questionid, $cmid, $canuse)
{
    global $CFG;
    if ($canuse) {
        // for RTL languages: switch right and left arrows /****/
        if (right_to_left()) {
            $movearrow = 'removeright.gif';
        } else {
            $movearrow = 'moveleft.gif';
        }
        $straddtoquiz = get_string("addtoquiz", "quiz");
        $out = "<a title=\"{$straddtoquiz}\" href=\"edit.php?" . $pageurl->get_query_string() . "&amp;addquestion={$questionid}&amp;sesskey=" . sesskey() . "\"><img\n                  src=\"{$CFG->pixpath}/t/{$movearrow}\" alt=\"{$straddtoquiz}\" /></a>&nbsp;";
        return $out;
    } else {
        return '';
    }
}
Пример #9
0
 public function navbar()
 {
     $items = $this->page->navbar->get_items();
     if (right_to_left()) {
         $dividericon = 'fa-angle-left';
     } else {
         $dividericon = 'fa-angle-right';
     }
     $divider = html_writer::tag('span', html_writer::start_tag('i', array('class' => 'fa ' . $dividericon . ' fa-lg')) . html_writer::end_tag('i'), array('class' => 'divider'));
     $breadcrumbs = array();
     foreach ($items as $item) {
         $item->hideicon = true;
         $breadcrumbs[] = $this->render($item);
     }
     $list_items = html_writer::start_tag('li') . implode("{$divider}" . html_writer::end_tag('li') . html_writer::start_tag('li'), $breadcrumbs) . html_writer::end_tag('li');
     $title = html_writer::tag('span', get_string('pagepath'), array('class' => 'accesshide'));
     return $title . html_writer::tag('ul', "{$list_items}", array('class' => 'breadcrumb'));
 }
Пример #10
0
 /**
  * Display the authorised user selector
  *
  * @param stdClass $options It contains alloweduserselector, potentialuserselector and serviceid
  * @return string html
  */
 public function admin_authorised_user_selector(&$options)
 {
     global $CFG;
     $formcontent = html_writer::empty_tag('input', array('name' => 'sesskey', 'value' => sesskey(), 'type' => 'hidden'));
     $table = new html_table();
     $table->size = array('45%', '10%', '45%');
     $table->attributes['class'] = 'roleassigntable generaltable generalbox boxaligncenter';
     $table->summary = '';
     $table->cellspacing = 0;
     $table->cellpadding = 0;
     // LTR/RTL support, for drawing button arrows in the right direction
     if (right_to_left()) {
         $addarrow = '▶';
         $removearrow = '◀';
     } else {
         $addarrow = '◀';
         $removearrow = '▶';
     }
     //create the add and remove button
     $addinput = html_writer::empty_tag('input', array('name' => 'add', 'id' => 'add', 'type' => 'submit', 'value' => $addarrow . ' ' . get_string('add'), 'title' => get_string('add')));
     $addbutton = html_writer::tag('div', $addinput, array('id' => 'addcontrols'));
     $removeinput = html_writer::empty_tag('input', array('name' => 'remove', 'id' => 'remove', 'type' => 'submit', 'value' => $removearrow . ' ' . get_string('remove'), 'title' => get_string('remove')));
     $removebutton = html_writer::tag('div', $removeinput, array('id' => 'removecontrols'));
     //create the three cells
     $label = html_writer::tag('label', get_string('serviceusers', 'webservice'), array('for' => 'removeselect'));
     $label = html_writer::tag('p', $label);
     $authoriseduserscell = new html_table_cell($label . $options->alloweduserselector->display(true));
     $authoriseduserscell->id = 'existingcell';
     $buttonscell = new html_table_cell($addbutton . html_writer::empty_tag('br') . $removebutton);
     $buttonscell->id = 'buttonscell';
     $label = html_writer::tag('label', get_string('potusers', 'webservice'), array('for' => 'addselect'));
     $label = html_writer::tag('p', $label);
     $otheruserscell = new html_table_cell($label . $options->potentialuserselector->display(true));
     $otheruserscell->id = 'potentialcell';
     $cells = array($authoriseduserscell, $buttonscell, $otheruserscell);
     $row = new html_table_row($cells);
     $table->data[] = $row;
     $formcontent .= html_writer::table($table);
     $formcontent = html_writer::tag('div', $formcontent);
     $actionurl = new moodle_url('/' . $CFG->admin . '/webservice/service_users.php', array('id' => $options->serviceid));
     $html = html_writer::tag('form', $formcontent, array('id' => 'assignform', 'action' => $actionurl, 'method' => 'post'));
     return $html;
 }
 function init()
 {
     global $CFG, $WS;
     $this->title = get_string('block_index_current', 'wiki') . helpbutton('index_current', get_string('block_index_current', 'wiki'), 'wiki', true, false, '', true);
     $this->version = 2004081200;
     //initiates images array
     if (isset($WS->dfcourse)) {
         $imgclass = 'wiki_folding_co';
     } else {
         $imgclass = 'wiki_folding';
     }
     if (right_to_left()) {
         $squaredir = 'left';
     } else {
         $squaredir = 'right';
     }
     // rtl support (nadavkav patch)
     $this->images = array('plus' => '<img src="' . $CFG->wwwroot . '/mod/wiki/images/plus.gif" class="' . $imgclass . '" alt="" />', 'minus' => '<img src="' . $CFG->wwwroot . '/mod/wiki/images/minus.gif" class="' . $imgclass . '" alt="" />', 'square' => '<img src="' . $CFG->wwwroot . '/mod/wiki/images/square-' . $squaredir . '.png" alt="" />');
 }
Пример #12
0
 function _createElements()
 {
     $this->_elements = array();
     for ($i = 1; $i <= 31; $i++) {
         $days[$i] = $i;
     }
     for ($i = 1; $i <= 12; $i++) {
         $months[$i] = userdate(gmmktime(12, 0, 0, $i, 15, 2000), "%B");
     }
     for ($i = $this->_options['startyear']; $i <= $this->_options['stopyear']; $i++) {
         $years[$i] = $i;
     }
     for ($i = 0; $i <= 23; $i++) {
         $hours[$i] = sprintf("%02d", $i);
     }
     for ($i = 0; $i < 60; $i += $this->_options['step']) {
         $minutes[$i] = sprintf("%02d", $i);
     }
     $this->_elements[] =& MoodleQuickForm::createElement('select', 'day', get_string('day', 'form'), $days, $this->getAttributes(), true);
     $this->_elements[] =& MoodleQuickForm::createElement('select', 'month', get_string('month', 'form'), $months, $this->getAttributes(), true);
     $this->_elements[] =& MoodleQuickForm::createElement('select', 'year', get_string('year', 'form'), $years, $this->getAttributes(), true);
     if (right_to_left()) {
         // Switch order of elements for Right-to-Left
         $this->_elements[] =& MoodleQuickForm::createElement('select', 'minute', get_string('minute', 'form'), $minutes, $this->getAttributes(), true);
         $this->_elements[] =& MoodleQuickForm::createElement('select', 'hour', get_string('hour', 'form'), $hours, $this->getAttributes(), true);
     } else {
         $this->_elements[] =& MoodleQuickForm::createElement('select', 'hour', get_string('hour', 'form'), $hours, $this->getAttributes(), true);
         $this->_elements[] =& MoodleQuickForm::createElement('select', 'minute', get_string('minute', 'form'), $minutes, $this->getAttributes(), true);
     }
     // If optional we add a checkbox which the user can use to turn if on
     if ($this->_options['optional']) {
         $this->_elements[] =& MoodleQuickForm::createElement('checkbox', 'off', null, get_string('disable'), $this->getAttributes(), true);
     }
     foreach ($this->_elements as $element) {
         if (method_exists($element, 'setHiddenLabel')) {
             $element->setHiddenLabel(true);
         }
     }
 }
Пример #13
0
 /**
  * Renders a custom menu node as part of a submenu
  *
  * The custom menu this method override the render_custom_menu_item function
  * in outputrenderers.php
  *
  * @see render_custom_menu()
  *
  * @staticvar int $submenucount
  * @param custom_menu_item $menunode
  * @return string
  */
 protected function render_custom_menu_item(custom_menu_item $menunode)
 {
     if (!right_to_left()) {
         // Keep YUI3 navmenu for LTR UI
         parent::render_custom_menu_item($menunode);
     }
     // Required to ensure we get unique trackable id's
     static $submenucount = 0;
     $content = html_writer::start_tag('li');
     if ($menunode->has_children()) {
         // If the child has menus render it as a sub menu
         $submenucount++;
         if ($menunode->get_url() !== null) {
             $url = $menunode->get_url();
         } else {
             $url = '#cm_submenu_' . $submenucount;
         }
         $content .= html_writer::start_tag('span', array('class' => 'customitem'));
         $content .= html_writer::link($url, $menunode->get_text(), array('title' => $menunode->get_title()));
         $content .= html_writer::end_tag('span');
         $content .= html_writer::start_tag('ul');
         foreach ($menunode->get_children() as $menunode) {
             $content .= $this->render_custom_menu_item($menunode);
         }
         $content .= html_writer::end_tag('ul');
     } else {
         // The node doesn't have children so produce a final menuitem
         if ($menunode->get_url() !== null) {
             $url = $menunode->get_url();
         } else {
             $url = '#';
         }
         $content .= html_writer::link($url, $menunode->get_text(), array('title' => $menunode->get_title()));
     }
     $content .= html_writer::end_tag('li');
     // Return the sub menu
     return $content;
 }
Пример #14
0
    static public function get_csswww() {
        global $CFG;

        if (!self::lte_ie9()) {
            if (\right_to_left()) {
                $moodlecss = 'essential-rtl.css';
            } else {
                $moodlecss = 'essential.css';
            }

            $syscontext = \context_system::instance();
            $itemid = \theme_get_revision();
            $url = \moodle_url::make_file_url("$CFG->wwwroot/pluginfile.php",
                            "/$syscontext->id/theme_essential/style/$itemid/$moodlecss");
            $url = preg_replace('|^https?://|i', '//', $url->out(false));
            return '<link rel="stylesheet" href="' . $url . '">';
        } else {
            if (\right_to_left()) {
                $moodlecssone = 'essential-rtl_ie9-blessed1.css';
                $moodlecsstwo = 'essential-rtl_ie9.css';
            } else {
                $moodlecssone = 'essential_ie9-blessed1.css';
                $moodlecsstwo = 'essential_ie9.css';
            }

            $syscontext = \context_system::instance();
            $itemid = \theme_get_revision();
            $urlone = \moodle_url::make_file_url("$CFG->wwwroot/pluginfile.php",
                            "/$syscontext->id/theme_essential/style/$itemid/$moodlecssone");
            $urlone = preg_replace('|^https?://|i', '//', $urlone->out(false));
            $urltwo = \moodle_url::make_file_url("$CFG->wwwroot/pluginfile.php",
                            "/$syscontext->id/theme_essential/style/$itemid/$moodlecsstwo");
            $urltwo = preg_replace('|^https?://|i', '//', $urltwo->out(false));
            return '<link rel="stylesheet" href="'.$urlone . '"><link rel="stylesheet" href="'.$urltwo.'">';
        }
    }
Пример #15
0
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
/**
 * The two column layout.
 *
 * @package   theme_ent90
 * @copyright 2013 Moodle, moodle.org
 * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 */
// Get the HTML for the settings bits.
$html = theme_ent90_get_html_for_settings($OUTPUT, $PAGE);
$left = !right_to_left();
// To know if to add 'pull-right' and 'desktop-first-column' classes in the layout for LTR.
echo $OUTPUT->doctype();
?>
<html <?php 
echo $OUTPUT->htmlattributes();
?>
>
<head>
    <title><?php 
echo $OUTPUT->page_title();
?>
</title>
    <link rel="shortcut icon" href="<?php 
echo $OUTPUT->favicon();
?>
Пример #16
0
$PAGE->navbar->add($strfeedbacks, $feedback_url);
$PAGE->navbar->add(format_string($feedback->name));
$PAGE->set_title(format_string($feedback->name));
$PAGE->set_heading(format_string($course->fullname));
echo $OUTPUT->header();
/// Print the main part of the page
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////
echo $OUTPUT->heading(format_text($feedback->name));
$feedbackitems = $DB->get_records('feedback_item', array('feedback' => $feedback->id), 'position');
echo $OUTPUT->box_start('generalbox boxaligncenter boxwidthwide');
echo $OUTPUT->continue_button('view.php?id=' . $id);
if (is_array($feedbackitems)) {
    $itemnr = 0;
    $align = right_to_left() ? 'right' : 'left';
    echo $OUTPUT->box_start('feedback_items printview');
    //check, if there exists required-elements
    $params = array('feedback' => $feedback->id, 'required' => 1);
    $countreq = $DB->count_records('feedback_item', $params);
    if ($countreq > 0) {
        echo '<span class="feedback_required_mark">(*)';
        echo get_string('items_are_required', 'feedback');
        echo '</span>';
    }
    //print the inserted items
    $itempos = 0;
    foreach ($feedbackitems as $feedbackitem) {
        echo $OUTPUT->box_start('feedback_item_box_' . $align);
        $itempos++;
        //Items without value only are labels
Пример #17
0
 *
 * DO NOT MODIFY THIS THEME!
 * COPY IT FIRST, THEN RENAME THE COPY AND MODIFY IT INSTEAD.
 *
 * For full information about creating Moodle themes, see:
 * http://docs.moodle.org/dev/Themes_2.0
 *
 * @package   theme_clean
 * @copyright 2013 Moodle, moodle.org
 * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 */

// Get the HTML for the settings bits.
$html = theme_clean_get_html_for_settings($OUTPUT, $PAGE);

if (right_to_left()) {
    $regionbsid = 'region-bs-main-and-post';
} else {
    $regionbsid = 'region-bs-main-and-pre';
}

echo $OUTPUT->doctype() ?>
<html <?php echo $OUTPUT->htmlattributes(); ?>>
<head>
	<?php
	$PAGE->requires->jquery();
	?>
    <title><?php echo $OUTPUT->page_title(); ?></title>
    <link rel="shortcut icon" href="<?php echo $OUTPUT->favicon(); ?>" />
    <link href='https://www.google.com/fonts#UsePlace:use/Collection:Open+Sans:400,600' rel='stylesheet' type='text/css'>
    <!--[if IE]>
Пример #18
0
 /**
  * print the item at the complete-page of feedback
  *
  * @global object
  * @param object $item
  * @param string $value
  * @return void
  */
 function print_item_show_value($item, $value = '')
 {
     global $OUTPUT;
     $info = $this->get_info($item);
     $align = right_to_left() ? 'right' : 'left';
     $presentation = explode(FEEDBACK_MULTICHOICE_LINE_SEP, $info->presentation);
     //test if required and no value is set so we have to mark this item
     //we have to differ check and the other subtypes
     if ($info->subtype == 'c') {
         if (is_array($value)) {
             $values = $value;
         } else {
             $values = explode(FEEDBACK_MULTICHOICE_LINE_SEP, $value);
         }
         $requiredmark = $item->required == 1 ? '<span class="feedback_required_mark">*</span>' : '';
     } else {
         $requiredmark = $item->required == 1 ? '<span class="feedback_required_mark">*</span>' : '';
     }
     //print the question and label
     echo '<div class="feedback_item_label_' . $align . '">';
     echo '(' . $item->label . ') ';
     echo format_text($item->name . $requiredmark, true, false, false);
     echo '</div>';
     //print the presentation
     echo '<div class="feedback_item_presentation_' . $align . '">';
     $index = 1;
     if ($info->subtype == 'c') {
         echo $OUTPUT->box_start('generalbox boxalign' . $align);
         foreach ($presentation as $pres) {
             foreach ($values as $val) {
                 if ($val == $index) {
                     echo '<div class="feedback_item_multianswer">';
                     echo text_to_html($pres, true, false, false);
                     echo '</div>';
                     break;
                 }
             }
             $index++;
         }
         echo $OUTPUT->box_end();
     } else {
         foreach ($presentation as $pres) {
             if ($value == $index) {
                 echo $OUTPUT->box_start('generalbox boxalign' . $align);
                 echo text_to_html($pres, true, false, false);
                 echo $OUTPUT->box_end();
                 break;
             }
             $index++;
         }
     }
     echo '</div>';
 }
Пример #19
0
/**
 * Prints installation page header, we can no use weblib yet in installer.
 *
 * @global object
 * @param array $config
 * @param string $stagename
 * @param string $heading
 * @param string $stagetext
 * @return void
 */
function install_print_header($config, $stagename, $heading, $stagetext)
{
    global $CFG;
    @header('Content-Type: text/html; charset=UTF-8');
    @header('Cache-Control: no-store, no-cache, must-revalidate');
    @header('Cache-Control: post-check=0, pre-check=0', false);
    @header('Pragma: no-cache');
    @header('Expires: Mon, 20 Aug 1969 09:23:00 GMT');
    @header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
    echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">';
    echo '<html dir="' . (right_to_left() ? 'rtl' : 'ltr') . '">
          <head>
          <link rel="shortcut icon" href="theme/standard/pix/favicon.ico" />';
    echo '<link rel="stylesheet" type="text/css" href="' . $CFG->wwwroot . '/install/css.php" />
          <title>' . get_string('installation', 'install') . ' - Moodle ' . $CFG->target_release . '</title>
          <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
          <meta http-equiv="pragma" content="no-cache" />
          <meta http-equiv="expires" content="0" />';
    echo '</head><body class="notloggedin">
            <div id="page" class="stage' . $config->stage . '">
                <div id="page-header">
                    <div id="header" class=" clearfix">
                        <h1 class="headermain">' . get_string('installation', 'install') . '</h1>
                        <div class="headermenu">&nbsp;</div>
                    </div>
                    <div class="navbar clearfix">
                        <div class="breadcrumb">
                            <ul><li class="first">' . $stagename . '</li></ul>
                        </div>
                        <div class="navbutton">&nbsp;</div>
                    </div>
                </div>
          <!-- END OF HEADER -->
          <div id="installdiv">';
    echo '<h2>' . $heading . '</h2>';
    if ($stagetext !== '') {
        echo '<div class="stage generalbox box">';
        echo $stagetext;
        echo '</div>';
    }
    // main
    echo '<form id="installform" method="post" action="install.php"><fieldset>';
    foreach ($config as $name => $value) {
        echo '<input type="hidden" name="' . $name . '" value="' . s($value) . '" />';
    }
}
Пример #20
0
 /**
  * Returns an array of minipulations or false if there are none to make.
  *
  * @since Moodle 2.5.1 2.6
  * @return bool|array
  */
 protected function magic_get_blockmanipulations()
 {
     if (!right_to_left()) {
         return false;
     }
     if (is_null($this->_theme)) {
         $this->initialise_theme_and_output();
     }
     return $this->_theme->blockrtlmanipulations;
 }
Пример #21
0
/**
 * Produces the editing buttons for a module
 *
 * @global core_renderer $OUTPUT
 * @staticvar type $str
 * @param stdClass $mod The module to produce editing buttons for
 * @param bool $absolute_ignored ignored - all links are absolute
 * @param bool $moveselect If true a move seleciton process is used (default true)
 * @param int $indent The current indenting
 * @param int $section The section to link back to
 * @return string XHTML for the editing buttons
 */
function make_editing_buttons(stdClass $mod, $absolute_ignored = true, $moveselect = true, $indent = -1, $section = -1)
{
    global $CFG, $OUTPUT;
    static $str;
    $coursecontext = get_context_instance(CONTEXT_COURSE, $mod->course);
    $modcontext = get_context_instance(CONTEXT_MODULE, $mod->id);
    $editcaps = array('moodle/course:manageactivities', 'moodle/course:activityvisibility', 'moodle/role:assign');
    $dupecaps = array('moodle/backup:backuptargetimport', 'moodle/restore:restoretargetimport');
    // no permission to edit anything
    if (!has_any_capability($editcaps, $modcontext) and !has_all_capabilities($dupecaps, $coursecontext)) {
        return false;
    }
    $hasmanageactivities = has_capability('moodle/course:manageactivities', $modcontext);
    if (!isset($str)) {
        $str = new stdClass();
        $str->assign = get_string("assignroles", 'role');
        $str->delete = get_string("delete");
        $str->move = get_string("move");
        $str->moveup = get_string("moveup");
        $str->movedown = get_string("movedown");
        $str->moveright = get_string("moveright");
        $str->moveleft = get_string("moveleft");
        $str->update = get_string("update");
        $str->duplicate = get_string("duplicate");
        $str->hide = get_string("hide");
        $str->show = get_string("show");
        $str->groupsnone = get_string('clicktochangeinbrackets', 'moodle', get_string("groupsnone"));
        $str->groupsseparate = get_string('clicktochangeinbrackets', 'moodle', get_string("groupsseparate"));
        $str->groupsvisible = get_string('clicktochangeinbrackets', 'moodle', get_string("groupsvisible"));
        $str->forcedgroupsnone = get_string('forcedmodeinbrackets', 'moodle', get_string("groupsnone"));
        $str->forcedgroupsseparate = get_string('forcedmodeinbrackets', 'moodle', get_string("groupsseparate"));
        $str->forcedgroupsvisible = get_string('forcedmodeinbrackets', 'moodle', get_string("groupsvisible"));
    }
    $baseurl = new moodle_url('/course/mod.php', array('sesskey' => sesskey()));
    if ($section >= 0) {
        $baseurl->param('sr', $section);
    }
    $actions = array();
    // leftright
    if ($hasmanageactivities) {
        if (right_to_left()) {
            // Exchange arrows on RTL
            $rightarrow = 't/left';
            $leftarrow = 't/right';
        } else {
            $rightarrow = 't/right';
            $leftarrow = 't/left';
        }
        if ($indent > 0) {
            $actions[] = new action_link(new moodle_url($baseurl, array('id' => $mod->id, 'indent' => '-1')), new pix_icon($leftarrow, $str->moveleft, 'moodle', array('class' => 'iconsmall')), null, array('class' => 'editing_moveleft', 'title' => $str->moveleft));
        }
        if ($indent >= 0) {
            $actions[] = new action_link(new moodle_url($baseurl, array('id' => $mod->id, 'indent' => '1')), new pix_icon($rightarrow, $str->moveright, 'moodle', array('class' => 'iconsmall')), null, array('class' => 'editing_moveright', 'title' => $str->moveright));
        }
    }
    // move
    if ($hasmanageactivities) {
        if ($moveselect) {
            $actions[] = new action_link(new moodle_url($baseurl, array('copy' => $mod->id)), new pix_icon('t/move', $str->move, 'moodle', array('class' => 'iconsmall')), null, array('class' => 'editing_move', 'title' => $str->move));
        } else {
            $actions[] = new action_link(new moodle_url($baseurl, array('id' => $mod->id, 'move' => '-1')), new pix_icon('t/up', $str->moveup, 'moodle', array('class' => 'iconsmall')), null, array('class' => 'editing_moveup', 'title' => $str->moveup));
            $actions[] = new action_link(new moodle_url($baseurl, array('id' => $mod->id, 'move' => '1')), new pix_icon('t/down', $str->movedown, 'moodle', array('class' => 'iconsmall')), null, array('class' => 'editing_movedown', 'title' => $str->movedown));
        }
    }
    // Update
    if ($hasmanageactivities) {
        $actions[] = new action_link(new moodle_url($baseurl, array('update' => $mod->id)), new pix_icon('t/edit', $str->update, 'moodle', array('class' => 'iconsmall')), null, array('class' => 'editing_update', 'title' => $str->update));
    }
    // Duplicate (require both target import caps to be able to duplicate, see modduplicate.php)
    if (has_all_capabilities($dupecaps, $coursecontext)) {
        $actions[] = new action_link(new moodle_url($baseurl, array('duplicate' => $mod->id)), new pix_icon('t/copy', $str->duplicate, 'moodle', array('class' => 'iconsmall')), null, array('class' => 'editing_duplicate', 'title' => $str->duplicate));
    }
    // Delete
    if ($hasmanageactivities) {
        $actions[] = new action_link(new moodle_url($baseurl, array('delete' => $mod->id)), new pix_icon('t/delete', $str->delete, 'moodle', array('class' => 'iconsmall')), null, array('class' => 'editing_delete', 'title' => $str->delete));
    }
    // hideshow
    if (has_capability('moodle/course:activityvisibility', $modcontext)) {
        if ($mod->visible) {
            $actions[] = new action_link(new moodle_url($baseurl, array('hide' => $mod->id)), new pix_icon('t/hide', $str->hide, 'moodle', array('class' => 'iconsmall')), null, array('class' => 'editing_hide', 'title' => $str->hide));
        } else {
            $actions[] = new action_link(new moodle_url($baseurl, array('show' => $mod->id)), new pix_icon('t/show', $str->show, 'moodle', array('class' => 'iconsmall')), null, array('class' => 'editing_show', 'title' => $str->show));
        }
    }
    // groupmode
    if ($hasmanageactivities and $mod->groupmode !== false) {
        if ($mod->groupmode == SEPARATEGROUPS) {
            $groupmode = 0;
            $grouptitle = $str->groupsseparate;
            $forcedgrouptitle = $str->forcedgroupsseparate;
            $groupclass = 'editing_groupsseparate';
            $groupimage = 't/groups';
        } else {
            if ($mod->groupmode == VISIBLEGROUPS) {
                $groupmode = 1;
                $grouptitle = $str->groupsvisible;
                $forcedgrouptitle = $str->forcedgroupsvisible;
                $groupclass = 'editing_groupsvisible';
                $groupimage = 't/groupv';
            } else {
                $groupmode = 2;
                $grouptitle = $str->groupsnone;
                $forcedgrouptitle = $str->forcedgroupsnone;
                $groupclass = 'editing_groupsnone';
                $groupimage = 't/groupn';
            }
        }
        if ($mod->groupmodelink) {
            $actions[] = new action_link(new moodle_url($baseurl, array('id' => $mod->id, 'groupmode' => $groupmode)), new pix_icon($groupimage, $grouptitle, 'moodle', array('class' => 'iconsmall')), null, array('class' => $groupclass, 'title' => $grouptitle));
        } else {
            $actions[] = new pix_icon($groupimage, $forcedgrouptitle, 'moodle', array('title' => $forcedgrouptitle, 'class' => 'iconsmall'));
        }
    }
    // Assign
    if (has_capability('moodle/role:assign', $modcontext)) {
        $actions[] = new action_link(new moodle_url('/' . $CFG->admin . '/roles/assign.php', array('contextid' => $modcontext->id)), new pix_icon('i/roles', $str->assign, 'moodle', array('class' => 'iconsmall')), null, array('class' => 'editing_assign', 'title' => $str->assign));
    }
    $output = html_writer::start_tag('span', array('class' => 'commands'));
    foreach ($actions as $action) {
        if ($action instanceof renderable) {
            $output .= $OUTPUT->render($action);
        } else {
            $output .= $action;
        }
    }
    $output .= html_writer::end_tag('span');
    return $output;
}
 /**
  * print the item at the complete-page of feedback
  *
  * @global object
  * @param object $item
  * @param string $value
  * @return void
  */
 function print_item_show_value($item, $value = '')
 {
     global $OUTPUT;
     $align = right_to_left() ? 'right' : 'left';
     $info = $this->get_info($item);
     $lines = explode(FEEDBACK_MULTICHOICERATED_LINE_SEP, $info->presentation);
     $requiredmark = $item->required == 1 ? '<span class="feedback_required_mark">*</span>' : '';
     //print the question and label
     echo '<div class="feedback_item_label_' . $align . '">';
     echo '(' . $item->label . ') ';
     echo format_text($item->name . $requiredmark, true, false, false);
     echo '</div>';
     //print the presentation
     echo '<div class="feedback_item_presentation_' . $align . '">';
     $index = 1;
     foreach ($lines as $line) {
         if ($value == $index) {
             $item_value = explode(FEEDBACK_MULTICHOICERATED_VALUE_SEP, $line);
             echo $OUTPUT->box_start('generalbox boxalign' . $align);
             echo text_to_html($item_value[1], true, false, false);
             echo $OUTPUT->box_end();
             break;
         }
         $index++;
     }
     echo '</div>';
 }
Пример #23
0
 /**
  * print the item at the complete-page of feedback
  *
  * @global object
  * @param object $item
  * @param string $value
  * @return void
  */
 function print_item_show_value($item, $value = '')
 {
     global $DB;
     $align = right_to_left() ? 'right' : 'left';
     $cmid = 0;
     $feedbackid = $item->feedback;
     if ($feedbackid > 0) {
         $feedback = $DB->get_record('feedback', array('id' => $feedbackid));
         if ($cm = get_coursemodule_from_instance("feedback", $feedback->id, $feedback->course)) {
             $cmid = $cm->id;
         }
     }
     $requiredmark = '<span class="feedback_required_mark">*</span>';
     //print the question and label
     echo '<div class="feedback_item_label_' . $align . '">';
     echo '(' . $item->label . ') ';
     echo format_text($item->name . $requiredmark, true, false, false);
     echo '</div>';
 }
Пример #24
0
 protected function display_content($question, $rowclasses) {
     if (!question_has_capability_on($question, 'use')) {
         return;
     }
     // For RTL languages: switch right and left arrows.
     if (right_to_left()) {
         $movearrow = 't/removeright';
     } else {
         $movearrow = 't/moveleft';
     }
     $this->print_icon($movearrow, $this->stradd, $this->qbank->add_to_quiz_url($question->id));
 }
Пример #25
0
/**
 * Returns swapped left<=>right if in RTL environment.
 * part of RTL support
 *
 * @param string $align align to check
 * @return string
 */
function fix_align_rtl($align)
{
    if (!right_to_left()) {
        return $align;
    }
    if ($align == 'left') {
        return 'right';
    }
    if ($align == 'right') {
        return 'left';
    }
    return $align;
}
Пример #26
0
 /**
  * print the item at the complete-page of feedback
  *
  * @global object
  * @param object $item
  * @param string $value
  * @return void
  */
 public function print_item_show_value($item, $value = '')
 {
     global $OUTPUT;
     $align = right_to_left() ? 'right' : 'left';
     $strrequiredmark = '<img class="req" title="' . get_string('requiredelement', 'form') . '" alt="' . get_string('requiredelement', 'form') . '" src="' . $OUTPUT->pix_url('req') . '" />';
     $presentation = explode("|", $item->presentation);
     $requiredmark = $item->required == 1 ? $strrequiredmark : '';
     //print the question and label
     echo '<div class="feedback_item_label_' . $align . '">';
     echo '(' . $item->label . ') ';
     echo format_text($item->name . $requiredmark, true, false, false);
     echo '</div>';
     //print the presentation
     echo $OUTPUT->box_start('generalbox boxalign' . $align);
     echo $value ? str_replace("\n", '<br />', $value) : '&nbsp;';
     echo $OUTPUT->box_end();
 }
 /**
  * This will create date group element constisting of day, month and year.
  *
  * @access private
  */
 function _createElements()
 {
     global $OUTPUT;
     $this->_elements = array();
     for ($i = 1; $i <= 31; $i++) {
         $days[$i] = $i;
     }
     for ($i = 1; $i <= 12; $i++) {
         $months[$i] = userdate(gmmktime(12, 0, 0, $i, 15, 2000), "%B");
     }
     for ($i = $this->_options['startyear']; $i <= $this->_options['stopyear']; $i++) {
         $years[$i] = $i;
     }
     for ($i = 0; $i <= 23; $i++) {
         $hours[$i] = sprintf("%02d", $i);
     }
     for ($i = 0; $i < 60; $i += $this->_options['step']) {
         $minutes[$i] = sprintf("%02d", $i);
     }
     // E_STRICT creating elements without forms is nasty because it internally uses $this
     $this->_elements[] = @MoodleQuickForm::createElement('select', 'day', get_string('day', 'form'), $days, $this->getAttributes(), true);
     $this->_elements[] = @MoodleQuickForm::createElement('select', 'month', get_string('month', 'form'), $months, $this->getAttributes(), true);
     $this->_elements[] = @MoodleQuickForm::createElement('select', 'year', get_string('year', 'form'), $years, $this->getAttributes(), true);
     if (right_to_left()) {
         // Switch order of elements for Right-to-Left
         $this->_elements[] = @MoodleQuickForm::createElement('select', 'minute', get_string('minute', 'form'), $minutes, $this->getAttributes(), true);
         $this->_elements[] = @MoodleQuickForm::createElement('select', 'hour', get_string('hour', 'form'), $hours, $this->getAttributes(), true);
     } else {
         $this->_elements[] = @MoodleQuickForm::createElement('select', 'hour', get_string('hour', 'form'), $hours, $this->getAttributes(), true);
         $this->_elements[] = @MoodleQuickForm::createElement('select', 'minute', get_string('minute', 'form'), $minutes, $this->getAttributes(), true);
     }
     $image = $OUTPUT->pix_icon('i/calendar', get_string('calendar', 'calendar'), 'moodle');
     $this->_elements[] = @MoodleQuickForm::createElement('link', 'calendar', null, '#', $image, array('class' => 'visibleifjs'));
     // If optional we add a checkbox which the user can use to turn if on
     if ($this->_options['optional']) {
         $this->_elements[] = @MoodleQuickForm::createElement('checkbox', 'enabled', null, get_string('enable'), $this->getAttributes(), true);
     }
     foreach ($this->_elements as $element) {
         if (method_exists($element, 'setHiddenLabel')) {
             $element->setHiddenLabel(true);
         }
     }
 }
Пример #28
0
/**
 * Returns the list of all editing actions that current user can perform on the module
 *
 * @param cm_info $mod The module to produce editing buttons for
 * @param int $indent The current indenting (default -1 means no move left-right actions)
 * @param int $sr The section to link back to (used for creating the links)
 * @return array array of action_link or pix_icon objects
 */
function course_get_cm_edit_actions(cm_info $mod, $indent = -1, $sr = null)
{
    global $COURSE, $SITE;
    static $str;
    $coursecontext = context_course::instance($mod->course);
    $modcontext = context_module::instance($mod->id);
    $editcaps = array('moodle/course:manageactivities', 'moodle/course:activityvisibility', 'moodle/role:assign');
    $dupecaps = array('moodle/backup:backuptargetimport', 'moodle/restore:restoretargetimport');
    // No permission to edit anything.
    if (!has_any_capability($editcaps, $modcontext) and !has_all_capabilities($dupecaps, $coursecontext)) {
        return array();
    }
    $hasmanageactivities = has_capability('moodle/course:manageactivities', $modcontext);
    if (!isset($str)) {
        $str = get_strings(array('delete', 'move', 'moveright', 'moveleft', 'editsettings', 'duplicate', 'hide', 'show'), 'moodle');
        $str->assign = get_string('assignroles', 'role');
        $str->groupsnone = get_string('clicktochangeinbrackets', 'moodle', get_string("groupsnone"));
        $str->groupsseparate = get_string('clicktochangeinbrackets', 'moodle', get_string("groupsseparate"));
        $str->groupsvisible = get_string('clicktochangeinbrackets', 'moodle', get_string("groupsvisible"));
    }
    $baseurl = new moodle_url('/course/mod.php', array('sesskey' => sesskey()));
    if ($sr !== null) {
        $baseurl->param('sr', $sr);
    }
    $actions = array();
    // Update.
    if ($hasmanageactivities) {
        $actions['update'] = new action_menu_link_secondary(new moodle_url($baseurl, array('update' => $mod->id)), new pix_icon('t/edit', $str->editsettings, 'moodle', array('class' => 'iconsmall', 'title' => '')), $str->editsettings, array('class' => 'editing_update', 'data-action' => 'update'));
    }
    // Indent.
    if ($hasmanageactivities && $indent >= 0) {
        $indentlimits = new stdClass();
        $indentlimits->min = 0;
        $indentlimits->max = 16;
        if (right_to_left()) {
            // Exchange arrows on RTL
            $rightarrow = 't/left';
            $leftarrow = 't/right';
        } else {
            $rightarrow = 't/right';
            $leftarrow = 't/left';
        }
        if ($indent >= $indentlimits->max) {
            $enabledclass = 'hidden';
        } else {
            $enabledclass = '';
        }
        $actions['moveright'] = new action_menu_link_secondary(new moodle_url($baseurl, array('id' => $mod->id, 'indent' => '1')), new pix_icon($rightarrow, $str->moveright, 'moodle', array('class' => 'iconsmall', 'title' => '')), $str->moveright, array('class' => 'editing_moveright ' . $enabledclass, 'data-action' => 'moveright', 'data-keepopen' => true));
        if ($indent <= $indentlimits->min) {
            $enabledclass = 'hidden';
        } else {
            $enabledclass = '';
        }
        $actions['moveleft'] = new action_menu_link_secondary(new moodle_url($baseurl, array('id' => $mod->id, 'indent' => '-1')), new pix_icon($leftarrow, $str->moveleft, 'moodle', array('class' => 'iconsmall', 'title' => '')), $str->moveleft, array('class' => 'editing_moveleft ' . $enabledclass, 'data-action' => 'moveleft', 'data-keepopen' => true));
    }
    // Hide/Show.
    if (has_capability('moodle/course:activityvisibility', $modcontext)) {
        if ($mod->visible) {
            $actions['hide'] = new action_menu_link_secondary(new moodle_url($baseurl, array('hide' => $mod->id)), new pix_icon('t/hide', $str->hide, 'moodle', array('class' => 'iconsmall', 'title' => '')), $str->hide, array('class' => 'editing_hide', 'data-action' => 'hide'));
        } else {
            $actions['show'] = new action_menu_link_secondary(new moodle_url($baseurl, array('show' => $mod->id)), new pix_icon('t/show', $str->show, 'moodle', array('class' => 'iconsmall', 'title' => '')), $str->show, array('class' => 'editing_show', 'data-action' => 'show'));
        }
    }
    // Duplicate (require both target import caps to be able to duplicate and backup2 support, see modduplicate.php)
    // Note that restoring on front page is never allowed.
    if ($mod->course != SITEID && has_all_capabilities($dupecaps, $coursecontext) && plugin_supports('mod', $mod->modname, FEATURE_BACKUP_MOODLE2)) {
        $actions['duplicate'] = new action_menu_link_secondary(new moodle_url($baseurl, array('duplicate' => $mod->id)), new pix_icon('t/copy', $str->duplicate, 'moodle', array('class' => 'iconsmall', 'title' => '')), $str->duplicate, array('class' => 'editing_duplicate', 'data-action' => 'duplicate', 'data-sr' => $sr));
    }
    // Groupmode.
    if ($hasmanageactivities && !$mod->coursegroupmodeforce) {
        if (plugin_supports('mod', $mod->modname, FEATURE_GROUPS, 0)) {
            if ($mod->effectivegroupmode == SEPARATEGROUPS) {
                $nextgroupmode = VISIBLEGROUPS;
                $grouptitle = $str->groupsseparate;
                $actionname = 'groupsseparate';
                $groupimage = 'i/groups';
            } else {
                if ($mod->effectivegroupmode == VISIBLEGROUPS) {
                    $nextgroupmode = NOGROUPS;
                    $grouptitle = $str->groupsvisible;
                    $actionname = 'groupsvisible';
                    $groupimage = 'i/groupv';
                } else {
                    $nextgroupmode = SEPARATEGROUPS;
                    $grouptitle = $str->groupsnone;
                    $actionname = 'groupsnone';
                    $groupimage = 'i/groupn';
                }
            }
            $actions[$actionname] = new action_menu_link_primary(new moodle_url($baseurl, array('id' => $mod->id, 'groupmode' => $nextgroupmode)), new pix_icon($groupimage, null, 'moodle', array('class' => 'iconsmall')), $grouptitle, array('class' => 'editing_' . $actionname, 'data-action' => $actionname, 'data-nextgroupmode' => $nextgroupmode, 'aria-live' => 'assertive'));
        } else {
            $actions['nogroupsupport'] = new action_menu_filler();
        }
    }
    // Assign.
    if (has_capability('moodle/role:assign', $modcontext)) {
        $actions['assign'] = new action_menu_link_secondary(new moodle_url('/admin/roles/assign.php', array('contextid' => $modcontext->id)), new pix_icon('t/assignroles', $str->assign, 'moodle', array('class' => 'iconsmall', 'title' => '')), $str->assign, array('class' => 'editing_assign', 'data-action' => 'assignroles'));
    }
    // Delete.
    if ($hasmanageactivities) {
        $actions['delete'] = new action_menu_link_secondary(new moodle_url($baseurl, array('delete' => $mod->id)), new pix_icon('t/delete', $str->delete, 'moodle', array('class' => 'iconsmall', 'title' => '')), $str->delete, array('class' => 'editing_delete', 'data-action' => 'delete'));
    }
    return $actions;
}
Пример #29
0
				<?php 
echo $coursecontentheader;
?>
            	<?php 
echo $OUTPUT->main_content();
?>
            	<?php 
echo $coursecontentfooter;
?>
			</div>
		</section>
		<?php 
if ($showsidepre) {
    ?>
			<aside id="region-pre" class="large-3 <?php 
    if (!right_to_left()) {
        echo "pull-9";
    }
    ?>
 columns block-region">
				<div class="region-content section-container accordion">
					<?php 
    echo $OUTPUT->blocks_for_region('side-pre');
    ?>
				</div>
			</aside>
		<?php 
}
?>
	</div>
	</div>
Пример #30
0
/**
 * Get control options for Calendar
 *
 * @param string $type of calendar
 * @param array $data calendar information
 * @return string $content return available control for the calender in html
 */
function calendar_top_controls($type, $data)
{
    global $PAGE;
    // Get the calendar type we are using.
    $calendartype = \core_calendar\type_factory::get_calendar_instance();
    $content = '';
    // Ensure course id passed if relevant.
    $courseid = '';
    if (!empty($data['id'])) {
        $courseid = '&amp;course=' . $data['id'];
    }
    // If we are passing a month and year then we need to convert this to a timestamp to
    // support multiple calendars. No where in core should these be passed, this logic
    // here is for third party plugins that may use this function.
    if (!empty($data['m']) && !empty($date['y'])) {
        if (!isset($data['d'])) {
            $data['d'] = 1;
        }
        if (!checkdate($data['m'], $data['d'], $data['y'])) {
            $time = time();
        } else {
            $time = make_timestamp($data['y'], $data['m'], $data['d']);
        }
    } else {
        if (!empty($data['time'])) {
            $time = $data['time'];
        } else {
            $time = time();
        }
    }
    // Get the date for the calendar type.
    $date = $calendartype->timestamp_to_date_array($time);
    $urlbase = $PAGE->url;
    // We need to get the previous and next months in certain cases.
    if ($type == 'frontpage' || $type == 'course' || $type == 'month') {
        $prevmonth = calendar_sub_month($date['mon'], $date['year']);
        $prevmonthtime = $calendartype->convert_to_gregorian($prevmonth[1], $prevmonth[0], 1);
        $prevmonthtime = make_timestamp($prevmonthtime['year'], $prevmonthtime['month'], $prevmonthtime['day'], $prevmonthtime['hour'], $prevmonthtime['minute']);
        $nextmonth = calendar_add_month($date['mon'], $date['year']);
        $nextmonthtime = $calendartype->convert_to_gregorian($nextmonth[1], $nextmonth[0], 1);
        $nextmonthtime = make_timestamp($nextmonthtime['year'], $nextmonthtime['month'], $nextmonthtime['day'], $nextmonthtime['hour'], $nextmonthtime['minute']);
    }
    switch ($type) {
        case 'frontpage':
            $prevlink = calendar_get_link_previous(get_string('monthprev', 'access'), $urlbase, false, false, false, true, $prevmonthtime);
            $nextlink = calendar_get_link_next(get_string('monthnext', 'access'), $urlbase, false, false, false, true, $nextmonthtime);
            $calendarlink = calendar_get_link_href(new moodle_url(CALENDAR_URL . 'view.php', array('view' => 'month')), false, false, false, $time);
            if (!empty($data['id'])) {
                $calendarlink->param('course', $data['id']);
            }
            if (right_to_left()) {
                $left = $nextlink;
                $right = $prevlink;
            } else {
                $left = $prevlink;
                $right = $nextlink;
            }
            $content .= html_writer::start_tag('div', array('class' => 'calendar-controls'));
            $content .= $left . '<span class="hide"> | </span>';
            $content .= html_writer::tag('span', html_writer::link($calendarlink, userdate($time, get_string('strftimemonthyear')), array('title' => get_string('monththis', 'calendar'))), array('class' => 'current'));
            $content .= '<span class="hide"> | </span>' . $right;
            $content .= "<span class=\"clearer\"><!-- --></span>\n";
            $content .= html_writer::end_tag('div');
            break;
        case 'course':
            $prevlink = calendar_get_link_previous(get_string('monthprev', 'access'), $urlbase, false, false, false, true, $prevmonthtime);
            $nextlink = calendar_get_link_next(get_string('monthnext', 'access'), $urlbase, false, false, false, true, $nextmonthtime);
            $calendarlink = calendar_get_link_href(new moodle_url(CALENDAR_URL . 'view.php', array('view' => 'month')), false, false, false, $time);
            if (!empty($data['id'])) {
                $calendarlink->param('course', $data['id']);
            }
            if (right_to_left()) {
                $left = $nextlink;
                $right = $prevlink;
            } else {
                $left = $prevlink;
                $right = $nextlink;
            }
            $content .= html_writer::start_tag('div', array('class' => 'calendar-controls'));
            $content .= $left . '<span class="hide"> | </span>';
            $content .= html_writer::tag('span', html_writer::link($calendarlink, userdate($time, get_string('strftimemonthyear')), array('title' => get_string('monththis', 'calendar'))), array('class' => 'current'));
            $content .= '<span class="hide"> | </span>' . $right;
            $content .= "<span class=\"clearer\"><!-- --></span>";
            $content .= html_writer::end_tag('div');
            break;
        case 'upcoming':
            $calendarlink = calendar_get_link_href(new moodle_url(CALENDAR_URL . 'view.php', array('view' => 'upcoming')), false, false, false, $time);
            if (!empty($data['id'])) {
                $calendarlink->param('course', $data['id']);
            }
            $calendarlink = html_writer::link($calendarlink, userdate($time, get_string('strftimemonthyear')));
            $content .= html_writer::tag('div', $calendarlink, array('class' => 'centered'));
            break;
        case 'display':
            $calendarlink = calendar_get_link_href(new moodle_url(CALENDAR_URL . 'view.php', array('view' => 'month')), false, false, false, $time);
            if (!empty($data['id'])) {
                $calendarlink->param('course', $data['id']);
            }
            $calendarlink = html_writer::link($calendarlink, userdate($time, get_string('strftimemonthyear')));
            $content .= html_writer::tag('h3', $calendarlink);
            break;
        case 'month':
            $prevlink = calendar_get_link_previous(userdate($prevmonthtime, get_string('strftimemonthyear')), 'view.php?view=month' . $courseid . '&amp;', false, false, false, false, $prevmonthtime);
            $nextlink = calendar_get_link_next(userdate($nextmonthtime, get_string('strftimemonthyear')), 'view.php?view=month' . $courseid . '&amp;', false, false, false, false, $nextmonthtime);
            if (right_to_left()) {
                $left = $nextlink;
                $right = $prevlink;
            } else {
                $left = $prevlink;
                $right = $nextlink;
            }
            $content .= html_writer::start_tag('div', array('class' => 'calendar-controls'));
            $content .= $left . '<span class="hide"> | </span><h1 class="current">' . userdate($time, get_string('strftimemonthyear')) . "</h1>";
            $content .= '<span class="hide"> | </span>' . $right;
            $content .= '<span class="clearer"><!-- --></span>';
            $content .= html_writer::end_tag('div') . "\n";
            break;
        case 'day':
            $days = calendar_get_days();
            $prevtimestamp = $time - DAYSECS;
            $nexttimestamp = $time + DAYSECS;
            $prevdate = $calendartype->timestamp_to_date_array($prevtimestamp);
            $nextdate = $calendartype->timestamp_to_date_array($nexttimestamp);
            $prevname = $days[$prevdate['wday']]['fullname'];
            $nextname = $days[$nextdate['wday']]['fullname'];
            $prevlink = calendar_get_link_previous($prevname, 'view.php?view=day' . $courseid . '&amp;', false, false, false, false, $prevtimestamp);
            $nextlink = calendar_get_link_next($nextname, 'view.php?view=day' . $courseid . '&amp;', false, false, false, false, $nexttimestamp);
            if (right_to_left()) {
                $left = $nextlink;
                $right = $prevlink;
            } else {
                $left = $prevlink;
                $right = $nextlink;
            }
            $content .= html_writer::start_tag('div', array('class' => 'calendar-controls'));
            $content .= $left;
            $content .= '<span class="hide"> | </span><span class="current">' . userdate($time, get_string('strftimedaydate')) . '</span>';
            $content .= '<span class="hide"> | </span>' . $right;
            $content .= "<span class=\"clearer\"><!-- --></span>";
            $content .= html_writer::end_tag('div') . "\n";
            break;
    }
    return $content;
}