Skip to content

Commit

Permalink
The "Add" block is now called "Blocks" ... other block admin stuff can
Browse files Browse the repository at this point in the history
go in this block later.
  • Loading branch information
moodler committed Apr 27, 2004
1 parent 5bb18f6 commit c598d27
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 12 deletions.
2 changes: 1 addition & 1 deletion course/format/social/format.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
if(block_have_active($rightblocks) || $editing) {
echo '<td style="vertical-align: top; width: '.$preferred_width_right.'px;">';
if ($editing && !empty($missingblocks)) {
block_print_add_block($course->id, $missingblocks);
block_print_blocks_admin($course->id, $missingblocks);
}
print_course_blocks($course, $rightblocks, BLOCK_RIGHT);
print_spacer(1, 120, true);
Expand Down
2 changes: 1 addition & 1 deletion course/format/topics/format.php
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@
if(block_have_active($rightblocks) || $editing) {
echo '<td style="vertical-align: top; width: '.$preferred_width_right.'px;">';
if ($editing && !empty($missingblocks)) {
block_print_add_block($course->id, $missingblocks);
block_print_blocks_admin($course->id, $missingblocks);
}
print_course_blocks($course, $rightblocks, BLOCK_RIGHT);
print_spacer(1, 120, true);
Expand Down
2 changes: 1 addition & 1 deletion course/format/weeks/format.php
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@
if(block_have_active($rightblocks) || $editing) {
echo '<td style="vertical-align: top; width: '.$preferred_width_right.'px;">';
if ($editing && !empty($missingblocks)) {
block_print_add_block($course->id, $missingblocks);
block_print_blocks_admin($course->id, $missingblocks);
}
print_course_blocks($course, $rightblocks, BLOCK_RIGHT);
print_spacer(1, 120, true);
Expand Down
1 change: 1 addition & 0 deletions lang/en/moodle.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@
$string['backupuserfileshelp'] = 'Choose whether user files (eg profile images) should be included in automated backups';
$string['backupusershelp'] = 'Select whether you want to include all the users in the server or only the needed users for each course';
$string['backupversion'] = 'Backup Version';
$string['blocks'] = 'Blocks';
$string['blocksetup'] = 'Setting up block tables';
$string['blocksuccess'] = '$a tables have been set up correctly';
$string['bycourseorder'] = 'By course order';
Expand Down
20 changes: 11 additions & 9 deletions lib/blocklib.php
Original file line number Diff line number Diff line change
Expand Up @@ -312,23 +312,25 @@ function block_find($blockid, $leftblocks, $rightblocks) {
return false;
}

//This function prints the add_block popup as necessary
function block_print_add_block($courseid, $missingblocks) {
//This function prints the block to admin blocks as necessary
function block_print_blocks_admin($courseid, $missingblocks) {
if (isediting($courseid)) {
$title = get_string('add');
if(!empty($missingblocks)) {
$strblocks = get_string('blocks');
$stradd = get_string('add');
if (!empty($missingblocks)) {
$blockdata = get_records_list('blocks', 'id', implode(',', $missingblocks));
if($blockdata !== false) {
foreach($blockdata as $block) {
if ($blockdata !== false) {
foreach ($blockdata as $block) {
$blockobject = block_instance($block->name, NULL);
if($blockobject === false) {
if ($blockobject === false) {
continue;
}
$menu[$block->id] = $blockobject->get_title();
}
$content = popup_form('view.php?id='.$courseid.'&amp;blockaction=add&amp;blockid=',$menu,'add_block','','choose','','',true);
$content = popup_form('view.php?id='.$courseid.'&amp;blockaction=add&amp;blockid=',
$menu, 'add_block', '', "$stradd...", '', '', true);
$content = '<div align="center">'.$content.'</div>';
print_side_block($title, $content, NULL, NULL, NULL);
print_side_block($strblocks, $content, NULL, NULL, NULL);
}
}
}
Expand Down

0 comments on commit c598d27

Please sign in to comment.