Merge branch 'wip-MDL-35876-master' of git://github.com/phalacee/moodle
Conflicts: lib/upgrade.txt
This commit is contained in:
+18
-4
@@ -1218,13 +1218,20 @@ class core_renderer extends renderer_base {
|
||||
*/
|
||||
public function blocks_for_region($region) {
|
||||
$blockcontents = $this->page->blocks->get_content_for_region($region, $this);
|
||||
|
||||
$blocks = $this->page->blocks->get_blocks_for_region($region);
|
||||
$lastblock = null;
|
||||
$zones = array();
|
||||
foreach ($blocks as $block) {
|
||||
$zones[] = $block->title;
|
||||
}
|
||||
$output = '';
|
||||
|
||||
foreach ($blockcontents as $bc) {
|
||||
if ($bc instanceof block_contents) {
|
||||
$output .= $this->block($bc, $region);
|
||||
$lastblock = $bc->title;
|
||||
} else if ($bc instanceof block_move_target) {
|
||||
$output .= $this->block_move_target($bc);
|
||||
$output .= $this->block_move_target($bc, $zones, $lastblock);
|
||||
} else {
|
||||
throw new coding_exception('Unexpected type of thing (' . get_class($bc) . ') found in list of block contents.');
|
||||
}
|
||||
@@ -1236,10 +1243,17 @@ class core_renderer extends renderer_base {
|
||||
* Output a place where the block that is currently being moved can be dropped.
|
||||
*
|
||||
* @param block_move_target $target with the necessary details.
|
||||
* @param array $zones array of areas where the block can be moved to
|
||||
* @param string $previous the block located before the area currently being rendered.
|
||||
* @return string the HTML to be output.
|
||||
*/
|
||||
public function block_move_target($target) {
|
||||
return html_writer::tag('a', html_writer::tag('span', $target->text, array('class' => 'accesshide')), array('href' => $target->url, 'class' => 'blockmovetarget'));
|
||||
public function block_move_target($target, $zones, $previous) {
|
||||
if ($previous == null) {
|
||||
$position = get_string('moveblockbefore', 'block', $zones[0]);
|
||||
} else {
|
||||
$position = get_string('moveblockafter', 'block', $previous);
|
||||
}
|
||||
return html_writer::tag('a', html_writer::tag('span', $position, array('class' => 'accesshide')), array('href' => $target->url, 'class' => 'blockmovetarget'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user