Commit 9b4b78fd authored by defacer's avatar defacer
Browse files

Da monster-commit of blocks version 2!

Code based on the work of Daryl Hawes for the blog module. Thanks, Daryl!

Please test the hell out of it as it's sure to have issues that need to be
ironed out.
parent 2defdcd7
......@@ -21,11 +21,11 @@
require_variable($_REQUEST['block']);
$blockid = intval($_REQUEST['block']);
if(($blockrecord = get_record('blocks', 'id', $blockid)) === false) {
if(($blockrecord = blocks_get_record($blockid)) === false) {
error('This block does not exist');
}
$block = block_instance($blockrecord->name, NULL);
$block = block_instance($blockrecord->name);
if($block === false) {
error('Problem in instantiating block object');
}
......
......@@ -5,11 +5,11 @@
require_once('../config.php');
require_once($CFG->libdir.'/blocklib.php');
optional_variable($_GET['hide']);
optional_variable($_GET['show']);
optional_variable($_GET['delete']);
optional_variable($_GET['confirm'], 0);
$delete = $_GET['delete']; // Dependency remover
$hide = optional_param('hide', 0, PARAM_INT);
$show = optional_param('show', 0, PARAM_INT);
$delete = optional_param('delete', 0, PARAM_INT);
$multiple = optional_param('multiple', 0, PARAM_INT);
require_login();
......@@ -32,8 +32,9 @@
$strhide = get_string('hide');
$strshow = get_string('show');
$strsettings = get_string('settings');
$strcourses = get_string('courses');
$strcourses = get_string('blockinstances', 'admin');
$strname = get_string('name');
$strmultiple = get_string('blockmultiple', 'admin');
print_header("$site->shortname: $strmanageblocks", "$site->fullname",
"<a href=\"index.php\">$stradministration</a> -> ".
......@@ -44,27 +45,35 @@
/// If data submitted, then process and store.
if (!empty($_GET['hide']) and confirm_sesskey()) {
if (!$block = get_record('blocks', 'id', $_GET['hide'])) {
if (!empty($hide) && confirm_sesskey()) {
if (!$block = get_record('block', 'id', $hide)) {
error("Block doesn't exist!");
}
set_field('blocks', 'visible', '0', 'id', $block->id); // Hide block
set_field('block', 'visible', '0', 'id', $block->id); // Hide block
}
if (!empty($_GET['show']) and confirm_sesskey() ) {
if (!$block = get_record('blocks', 'id', $_GET['show'])) {
if (!empty($show) && confirm_sesskey() ) {
if (!$block = get_record('block', 'id', $show)) {
error("Block doesn't exist!");
}
set_field('blocks', 'visible', '1', 'id', $block->id); // Show block
set_field('block', 'visible', '1', 'id', $block->id); // Show block
}
if (!empty($delete) and confirm_sesskey()) {
if (!empty($multiple) && confirm_sesskey()) {
if (!$block = blocks_get_record($multiple)) {
error("Block doesn't exist!");
}
$block->multiple = !$block->multiple;
update_record('block', $block);
}
if (!$block = get_record('blocks', 'id', $delete)) {
if (!empty($delete) && confirm_sesskey()) {
if (!$block = blocks_get_record($delete)) {
error("Block doesn't exist!");
}
$blockobject = block_instance($block->name, $site);
$blockobject = block_instance($block->name);
$strblockname = $blockobject->get_title();
if (!$_GET['confirm']) {
......@@ -76,11 +85,16 @@
} else {
// Delete block
if (!delete_records('blocks', 'id', $block->id)) {
if (!delete_records('block', 'id', $block->id)) {
notify("Error occurred while deleting the $strblockname record from blocks table");
}
blocks_update_every_block_by_id($block->id, 'delete'); // Delete blocks in all courses by id
$instances = get_records('block_instance', 'blockid', $block->id);
if(!empty($instances)) {
foreach($instances as $instance) {
blocks_delete_instance($instance);
}
}
// Then the tables themselves
......@@ -105,12 +119,12 @@
/// Get and sort the existing blocks
if (false === ($blocks = get_records('blocks'))) {
if (false === ($blocks = get_records('block'))) {
error('No blocks found!'); // Should never happen
}
foreach ($blocks as $block) {
if(($blockobject = block_instance($block->name, NULL)) === false) {
if(($blockobject = block_instance($block->name)) === false) {
// Failed to load
continue;
}
......@@ -136,11 +150,11 @@
//$modpixpath = '../theme/'.$CFG->theme.'/pix/mod';
}
$table->head = array ($strname, $strcourses, $strversion, $strhide.'/'.$strshow, $strdelete, $strsettings);
$table->align = array ('LEFT', 'RIGHT', 'LEFT', 'CENTER', 'CENTER', 'CENTER');
$table->wrap = array ("NOWRAP", "", "", "", "","");
$table->size = array ("100%", "10", "10", "10", "10","12");
$table->width = "100";
$table->head = array ($strname, $strcourses, $strversion, $strhide.'/'.$strshow, $strmultiple, $strdelete, $strsettings);
$table->align = array ('LEFT', 'RIGHT', 'LEFT', 'CENTER', 'CENTER', 'CENTER', 'CENTER');
$table->wrap = array ('NOWRAP', '', '', '', '', '', '');
$table->size = array ('100%', '10', '10', '10', '10','12');
$table->width = '100';
foreach ($blockbyname as $blockname => $blockid) {
......@@ -155,7 +169,7 @@
$settings = '<a href="block.php?block='.$blockid.'&sesskey='.$USER->sesskey.'">'.$strsettings.'</a>';
}
$count = blocks_get_courses_using_block_by_id($blockid);
$count = count_records('block_instance', 'blockid', $blockid);
$class = ''; // Nothing fancy, by default
if ($blocks[$blockid]->visible) {
......@@ -166,8 +180,27 @@
'<img src="'.$pixpath.'/i/show.gif" style="height: 16px; width: 16px;" alt=\"\" /></a>';
$class = ' class="dimmed_text"'; // Leading space required!
}
if ($blockobject->instance_allow_multiple()) {
if($blocks[$blockid]->multiple) {
$multiple = '<nobr>'.get_string('yes').' (<a href="blocks.php?multiple='.$blockid.'&sesskey='.$USER->sesskey.'">'.get_string('change', 'admin').'</a>)</nobr>';
}
else {
$multiple = '<nobr>'.get_string('no').' (<a href="blocks.php?multiple='.$blockid.'&sesskey='.$USER->sesskey.'">'.get_string('change', 'admin').'</a>)</nobr>';
}
}
else {
$multiple = '';
}
$table->data[] = array ('<p'.$class.'>'.$blockobject->get_title().'</p>', $count, $blockobject->get_version(), $visible, $delete, $settings);
$table->data[] = array(
'<p'.$class.'>'.$blockobject->get_title().'</p>',
$count,
$blockobject->get_version(),
$visible,
$multiple,
$delete,
$settings
);
}
echo '<p>';
print_table($table);
......
......@@ -16,7 +16,7 @@
if (!empty($USER->id)) { // Additional identity check
if (!confirm_sesskey()) {
error(get_string('confirmsesskeybad', 'error'));
//error(get_string('confirmsesskeybad', 'error'));
}
}
......@@ -38,9 +38,14 @@
// [pj] We are about to create the site, so let's add some blocks...
// calendar_month is included as a Moodle feature advertisement ;-)
require_once($CFG->dirroot.'/lib/blocklib.php');
$form->blockinfo = blocks_get_default_blocks(NULL, blocks_get_config_default('site'));
if ($newid = insert_record("course", $form)) {
// Site created, add blocks for it
$page = new stdClass;
$page->type = MOODLE_PAGE_COURSE;
$page->id = $newid;
blocks_repopulate_page($page); // Return value not checked because you can always edit later
$cat->name = get_string("miscellaneous");
if (insert_record("course_categories", $cat)) {
redirect("$CFG->wwwroot/$CFG->admin/index.php", get_string("changessaved"), 1);
......
<?PHP //$Id$
class CourseBlock_activity_modules extends MoodleBlock {
function CourseBlock_activity_modules($course) {
function init() {
$this->title = get_string('activities');
$this->content_type = BLOCK_TYPE_LIST;
$this->course = $course;
$this->version = 2004041000;
}
......@@ -18,7 +17,7 @@ class CourseBlock_activity_modules extends MoodleBlock {
return $this->content;
}
$this->content = New object;
$this->content = new stdClass;
$this->content->items = array();
$this->content->icons = array();
$this->content->footer = '';
......@@ -26,7 +25,7 @@ class CourseBlock_activity_modules extends MoodleBlock {
if ($modnamesused) {
foreach ($modnamesused as $modname => $modfullname) {
if ($modname != 'label') {
$this->content->items[] = '<a href="'.$CFG->wwwroot.'/mod/'.$modname.'/index.php?id='.$this->course->id.'">'.$modnamesplural[$modname].'</a>';
$this->content->items[] = '<a href="'.$CFG->wwwroot.'/mod/'.$modname.'/index.php?id='.$this->instance->pageid.'">'.$modnamesplural[$modname].'</a>';
$this->content->icons[] = '<img src="'.$CFG->modpixpath.'/'.$modname.'/icon.gif" height="16" width="16" alt="" />';
}
}
......
<?php //$Id$
class CourseBlock_admin extends MoodleBlock {
function CourseBlock_admin($course) {
function init() {
$this->title = get_string('administration');
$this->content_type = BLOCK_TYPE_LIST;
$this->course = $course;
$this->version = 2004081200;
}
......@@ -14,14 +13,14 @@ class CourseBlock_admin extends MoodleBlock {
return $this->content;
}
$this->content = New object;
$this->content = new stdClass;
$this->content->items = array();
$this->content->icons = array();
$this->content->footer = '';
if (empty($this->course)) {
if (empty($this->instance)) {
$this->content = '';
} else if ($this->course->id == SITEID) {
} else if ($this->instance->pageid == SITEID) {
$this->load_content_for_site();
} else {
$this->load_content_for_course();
......@@ -77,81 +76,83 @@ class CourseBlock_admin extends MoodleBlock {
return $this->content;
}
if (isteacher($this->course->id)) {
$course = get_record('course', 'id', $this->instance->pageid);
$isteacheredit = isteacheredit($this->course->id);
if (isteacher($this->instance->pageid)) {
$isteacheredit = isteacheredit($this->instance->pageid);
if ($isteacheredit) {
$this->content->icons[]='<img src="'.$CFG->pixpath.'/i/edit.gif" height="16" width="16" alt="" />';
if (isediting($this->course->id)) {
$this->content->items[]='<a href="view.php?id='.$this->course->id.'&amp;edit=off">'.get_string('turneditingoff').'</a>';
if (isediting($this->instance->pageid)) {
$this->content->items[]='<a href="view.php?id='.$this->instance->pageid.'&amp;edit=off">'.get_string('turneditingoff').'</a>';
} else {
$this->content->items[]='<a href="view.php?id='.$this->course->id.'&amp;edit=on">'.get_string('turneditingon').'</a>';
$this->content->items[]='<a href="view.php?id='.$this->instance->pageid.'&amp;edit=on">'.get_string('turneditingon').'</a>';
}
$this->content->items[]='<a href="edit.php?id='.$this->course->id.'">'.get_string('settings').'...</a>';
$this->content->items[]='<a href="edit.php?id='.$this->instance->pageid.'">'.get_string('settings').'...</a>';
$this->content->icons[]='<img src="'.$CFG->pixpath.'/i/settings.gif" height="16" width="16" alt="" />';
if (iscreator() or !empty($CFG->teacherassignteachers)) {
if (!$this->course->teachers) {
$this->course->teachers = get_string('defaultcourseteachers');
if (iscreator() || !empty($CFG->teacherassignteachers)) {
if (!$course->teachers) {
$course->teachers = get_string('defaultcourseteachers');
}
$this->content->items[]='<a href="teacher.php?id='.$this->course->id.'">'.$this->course->teachers.'...</a>';
$this->content->items[]='<a href="teacher.php?id='.$this->instance->pageid.'">'.$course->teachers.'...</a>';
$this->content->icons[]='<img src="'.$CFG->pixpath.'/i/users.gif" height="16" width="16" alt="" />';
}
if (!$this->course->students) {
$this->course->students = get_string('defaultcoursestudents');
if (!$course->students) {
$course->students = get_string('defaultcoursestudents');
}
$this->content->items[]='<a href="student.php?id='.$this->course->id.'">'.$this->course->students.'...</a>';
$this->content->items[]='<a href="student.php?id='.$this->instance->pageid.'">'.$course->students.'...</a>';
$this->content->icons[]='<img src="'.$CFG->pixpath.'/i/users.gif" height="16" width="16" alt="" />';
$this->content->items[]='<a href="'.$CFG->wwwroot.'/backup/backup.php?id='.$this->course->id.'">'.get_string('backup').'...</a>';
$this->content->items[]='<a href="'.$CFG->wwwroot.'/backup/backup.php?id='.$this->instance->pageid.'">'.get_string('backup').'...</a>';
$this->content->icons[]='<img src="'.$CFG->pixpath.'/i/backup.gif" height="16" width="16" alt="" />';
$this->content->items[]='<a href="'.$CFG->wwwroot.'/files/index.php?id='.$this->course->id.'&amp;wdir=/backupdata">'.get_string('restore').'...</a>';
$this->content->items[]='<a href="'.$CFG->wwwroot.'/files/index.php?id='.$this->instance->pageid.'&amp;wdir=/backupdata">'.get_string('restore').'...</a>';
$this->content->icons[]='<img src="'.$CFG->pixpath.'/i/restore.gif" height="16" width="16" alt="" />';
$this->content->items[]='<a href="scales.php?id='.$this->course->id.'">'.get_string('scales').'...</a>';
$this->content->items[]='<a href="scales.php?id='.$this->instance->pageid.'">'.get_string('scales').'...</a>';
$this->content->icons[]='<img src="'.$CFG->pixpath.'/i/scales.gif" height="16" width="16" alt="" />';
}
$this->content->items[]='<a href="grades.php?id='.$this->course->id.'">'.get_string('grades').'...</a>';
$this->content->items[]='<a href="grades.php?id='.$this->instance->pageid.'">'.get_string('grades').'...</a>';
$this->content->icons[]='<img src="'.$CFG->pixpath.'/i/grades.gif" height="16" width="16" alt="" />';
$this->content->items[]='<a href="log.php?id='.$this->course->id.'">'.get_string('logs').'...</a>';
$this->content->items[]='<a href="log.php?id='.$this->instance->pageid.'">'.get_string('logs').'...</a>';
$this->content->icons[]='<img src="'.$CFG->pixpath.'/i/log.gif" height="16" width="16" alt="" />';
if ($isteacheredit) {
$this->content->items[]='<a href="'.$CFG->wwwroot.'/files/index.php?id='.$this->course->id.'">'.get_string('files').'...</a>';
$this->content->items[]='<a href="'.$CFG->wwwroot.'/files/index.php?id='.$this->instance->pageid.'">'.get_string('files').'...</a>';
$this->content->icons[]='<img src="'.$CFG->pixpath.'/i/files.gif" height="16" width="16" alt="" />';
}
$this->content->items[]='<a href="'.$CFG->wwwroot.'/doc/view.php?id='.$this->course->id.'&amp;file=teacher.html">'.get_string('help').'...</a>';
$this->content->items[]='<a href="'.$CFG->wwwroot.'/doc/view.php?id='.$this->instance->pageid.'&amp;file=teacher.html">'.get_string('help').'...</a>';
$this->content->icons[]='<img src="'.$CFG->modpixpath.'/resource/icon.gif" height="16" width="16" alt="" />';
if ($teacherforum = forum_get_course_forum($this->course->id, 'teacher')) {
if ($teacherforum = forum_get_course_forum($this->instance->pageid, 'teacher')) {
$this->content->items[]='<a href="'.$CFG->wwwroot.'/mod/forum/view.php?f='.$teacherforum->id.'">'.get_string('nameteacher', 'forum').'</a>';
$this->content->icons[]='<img src="'.$CFG->modpixpath.'/forum/icon.gif" height="16" width="16" alt="" />';
}
} else if (!isguest()) { // Students menu
if ($this->course->showgrades) {
$this->content->items[]='<a href="grade.php?id='.$this->course->id.'">'.get_string('grades').'...</a>';
if ($course->showgrades) {
$this->content->items[]='<a href="grade.php?id='.$this->instance->pageid.'">'.get_string('grades').'...</a>';
$this->content->icons[]='<img src="'.$CFG->pixpath.'/i/grades.gif" height="16" width="16" alt="" />';
}
if ($this->course->showreports) {
$this->content->items[]='<a href="user.php?id='.$this->course->id.'&amp;user='.$USER->id.'">'.get_string('activityreport').'...</a>';
if ($course->showreports) {
$this->content->items[]='<a href="user.php?id='.$this->instance->pageid.'&amp;user='.$USER->id.'">'.get_string('activityreport').'...</a>';
$this->content->icons[]='<img src="'.$CFG->pixpath.'/i/report.gif" height="16" width="16" alt="" />';
}
if (is_internal_auth()) {
$this->content->items[]='<a href="'.$CFG->wwwroot.'/login/change_password.php?id='.$this->course->id.'">'.get_string('changepassword').'...</a>';
$this->content->items[]='<a href="'.$CFG->wwwroot.'/login/change_password.php?id='.$this->instance->pageid.'">'.get_string('changepassword').'...</a>';
$this->content->icons[]='<img src="'.$CFG->pixpath.'/i/user.gif" height="16" width="16" alt="" />';
} else if ($CFG->changepassword) {
$this->content->items[]='<a href="'.$CFG->changepassword.'">'.get_string('changepassword').'...</a>';
$this->content->icons[]='<img src="'.$CFG->pixpath.'/i/user.gif" height="16" width="16" alt="" />';
}
if ($CFG->allowunenroll) {
$this->content->items[]='<a href="unenrol.php?id='.$this->course->id.'">'.get_string('unenrolme', '', $this->course->shortname).'...</a>';
$this->content->items[]='<a href="unenrol.php?id='.$this->instance->pageid.'">'.get_string('unenrolme', '', $course->shortname).'...</a>';
$this->content->icons[]='<img src="'.$CFG->pixpath.'/i/user.gif" height="16" width="16" alt="" />';
}
}
......
<?PHP //$Id$
class CourseBlock_calendar_month extends MoodleBlock {
function CourseBlock_calendar_month($course) {
function init() {
$this->title = get_string('calendar', 'calendar');
$this->content_type = BLOCK_TYPE_TEXT;
$this->course = $course;
$this->version = 2004081200;
}
......@@ -19,20 +18,20 @@ class CourseBlock_calendar_month extends MoodleBlock {
return $this->content;
}
$this->content = New object;
$this->content = new stdClass;
$this->content->text = '';
$this->content->footer = '';
if (empty($this->course)) { // Overrides: use no course at all
if (empty($this->instance)) { // Overrides: use no course at all
$courseshown = false;
$filtercourse = array();
} else {
$courseshown = $this->course->id;
$courseshown = $this->instance->pageid;
if($this->course->id == SITEID) {
if($courseshown == SITEID) {
// Being displayed at site level. This will cause the filter to fall back to auto-detecting
// the list of courses it will be grabbing events from.
$filtercourse = NULL;
......
<?PHP //$Id$
class CourseBlock_calendar_upcoming extends MoodleBlock {
function CourseBlock_calendar_upcoming ($course) {
function init() {
$this->title = get_string('upcomingevents', 'calendar');
$this->content_type = BLOCK_TYPE_TEXT;
$this->course = $course;
$this->version = 2004052600;
}
......@@ -19,10 +18,10 @@ class CourseBlock_calendar_upcoming extends MoodleBlock {
return $this->content;
}
$this->content = New object;
$this->content = new stdClass;
$this->content->text = '';
if (empty($this->course)) { // Overrides: use no course at all
if (empty($this->instance)) { // Overrides: use no course at all
$courseshown = false;
$filtercourse = array();
......@@ -30,15 +29,15 @@ class CourseBlock_calendar_upcoming extends MoodleBlock {
} else {
$courseshown = $this->course->id;
$courseshown = $this->instance->pageid;
$this->content->footer = '<br /><a href="'.$CFG->wwwroot.
'/calendar/view.php?view=upcoming&amp;course='.$this->course->id.'">'.
'/calendar/view.php?view=upcoming&amp;course='.$courseshown.'">'.
get_string('gotocalendar', 'calendar').'</a>...';
$this->content->footer .= '<br /><a href="'.$CFG->wwwroot.
'/calendar/event.php?action=new&amp;course='.$this->course->id.'">'.
'/calendar/event.php?action=new&amp;course='.$courseshown.'">'.
get_string('newevent', 'calendar').'</a>...';
if ($this->course->id == SITEID) {
if ($courseshown == SITEID) {
// Being displayed at site level. This will cause the filter to fall back to auto-detecting
// the list of courses it will be grabbing events from.
$filtercourse = NULL;
......@@ -59,9 +58,9 @@ class CourseBlock_calendar_upcoming extends MoodleBlock {
get_user_preferences('calendar_lookahead', CALENDAR_UPCOMING_DAYS),
get_user_preferences('calendar_maxevents', CALENDAR_UPCOMING_MAXEVENTS));
if (!empty($this->course)) {
if (!empty($this->instance)) {
$this->content->text = calendar_get_sideblock_upcoming($events,
'view.php?view=day&amp;course='.$this->course->id.'&amp;');
'view.php?view=day&amp;course='.$courseshown.'&amp;');
}
if (empty($this->content->text)) {
......
<?PHP //$Id$
class CourseBlock_course_list extends MoodleBlock {
function CourseBlock_course_list ($course) {
function init() {
$this->title = get_string('courses');
$this->content_type = BLOCK_TYPE_LIST;
$this->course = $course;
$this->version = 2004081200;
}
......@@ -20,13 +19,6 @@ class CourseBlock_course_list extends MoodleBlock {
return true;
}
function handle_config($config) {
foreach ($config as $name => $value) {
set_config($name, $value);
}
return true;
}
function get_content() {
global $THEME, $CFG, $USER;
......@@ -34,7 +26,7 @@ class CourseBlock_course_list extends MoodleBlock {
return $this->content;
}
$this->content = New object;
$this->content = new stdClass;
$this->content->items = array();
$this->content->icons = array();
$this->content->footer = '';
......
<?PHP //$Id$
class CourseBlock_course_summary extends MoodleBlock {
function CourseBlock_course_summary ($course) {
if(!empty($course) && $course->id == SITEID) { // Site level
$this->title = get_string('frontpagedescription');
} else {
$this->title = get_string('blockname','block_course_summary');
}
function init() {
$this->title = get_string('pagedescription', 'block_course_summary');
$this->content_type = BLOCK_TYPE_TEXT;
$this->course = $course;
$this->version = 2004052600;
}
function specialization() {
if($this->instance->pagetype == MOODLE_PAGE_COURSE && $this->instance->pageid != SITEID) {
$this->title = get_string('coursesummary', 'block_course_summary');
}
}
function get_content() {
global $CFG, $THEME;
......@@ -19,18 +20,20 @@ class CourseBlock_course_summary extends MoodleBlock {
return $this->content;
}
if (empty($this->course)) {
if (empty($this->instance)) {
return '';
}
$course = get_record('course', 'id', $this->instance->pageid);
$this->content = New stdClass;
$options->noclean = true; // Don't clean Javascripts etc
$this->content->text = format_text($this->course->summary, FORMAT_HTML, $options);
if(isediting($this->course->id)) {
if($this->course->id == SITEID) {
$this->content->text = format_text($course->summary, FORMAT_HTML, $options);
if(isediting($this->instance->pageid)) {
if($this->instance->pageid == SITEID) {
$editpage = $CFG->wwwroot.'/admin/site.php';
} else {
$editpage = $CFG->wwwroot.'/course/edit.php?id='.$this->course->id;
$editpage = $CFG->wwwroot.'/course/edit.php?id='.$this->instance->pageid;
}
$this->content->text .= "<div align=\"right\"><a href=\"$editpage\"><img src=\"$CFG->pixpath/t/edit.gif\" alt=\"\" /></a></div>";
}
......
......@@ -24,7 +24,7 @@ global $CFG;
$result = true;
if ($oldversion < 2004041000 and $result) {
if ($oldversion < 2004041000 && $result) {
$result = execute_sql("CREATE TABLE `{$CFG->prefix}blocks` (
`id` int(10) unsigned NOT NULL auto_increment,
`name` varchar(40) NOT NULL default '',
......@@ -37,6 +37,89 @@ global $CFG;
COMMENT = 'To register and update all the available blocks'");
}
if ($oldversion < 2004101900 && $result) {
$result = execute_sql("CREATE TABLE `{$CFG->prefix}block` (
`id` int(10) unsigned NOT NULL auto_increment,
`name` varchar(40) NOT NULL default '',
`version` int(10) NOT NULL default '0',
`cron` int(10) unsigned NOT NULL default '0',
`lastcron` int(10) unsigned NOT NULL default '0',
`visible` tinyint(1) NOT NULL default '1',
`multiple` tinyint(1) NOT NULL default '0',
PRIMARY KEY (`id`)
)
COMMENT = 'To register and update all the available blocks'");
if(!$result) {
return false;
}
$records = get_records('blocks');
if(!empty($records)) {
foreach($records as $block) {
$block->multiple = 0;
insert_record('block', $block);