Commit bb3edb74 authored by Francois Marier's avatar Francois Marier
Browse files
parents c7ec474f e113fb45
......@@ -32,6 +32,21 @@ class PluginBlocktypeFolder extends PluginBlocktype {
return get_string('title', 'blocktype.file/folder');
}
/**
* Optional method. If exists, allows this class to decide the title for
* all blockinstances of this type
*/
public static function get_instance_title(BlockInstance $bi) {
$configdata = $bi->get('configdata');
if (!empty($configdata['artefactid'])) {
require_once(get_config('docroot') . 'artefact/lib.php');
$folder = artefact_instance_from_id($configdata['artefactid']);
return $folder->get('title');
}
return '';
}
public static function get_description() {
return get_string('description', 'blocktype.file/folder');
}
......@@ -44,6 +59,7 @@ class PluginBlocktypeFolder extends PluginBlocktype {
require_once(get_config('docroot') . 'artefact/lib.php');
$configdata = $instance->get('configdata');
$configdata['viewid'] = $instance->get('view');
$configdata['hidetitle'] = true;
// This can be either an image or profileicon. They both implement
// render_self
......@@ -72,7 +88,7 @@ class PluginBlocktypeFolder extends PluginBlocktype {
return array(
'name' => 'artefactid',
'type' => 'artefactchooser',
'title' => get_string('folder'),
'title' => get_string('folder', 'artefact.file'),
'defaultvalue' => $default,
'rules' => array(
'required' => true,
......
......@@ -743,6 +743,7 @@ class ArtefactTypeFolder extends ArtefactTypeFileBase {
$smarty->assign('title', $this->get('title'));
$smarty->assign('description', $this->get('description'));
$smarty->assign('viewid', $options['viewid']);
$smarty->assign('hidetitle', isset($options['hidetitle']) ? $options['hidetitle'] : false);
if ($childrecords = $this->folder_contents()) {
$this->add_to_render_path($options);
......
<div>
<h3>{$title|escape}</h3>
{if !$hidetitle}<h3>{$title|escape}</h3>{/if}
<div>{$description|escape}</div>
<div>
{if (isset($children))}
......
......@@ -167,12 +167,10 @@ function upgrade_template_migration() {
}
else if ($view->template == 'PPAE') {
if (!empty($viewcolumns[0]['tpl_label1'])) {
log_debug('tpl_label1 is not empty, assuming it is a wysiwyg and updating its content');
upgrade_template_update_wysiwyg($viewcolumns, 0, 'tpl_label1', null, '<h4>' . $ppae_text[0] . '</h4>' . upgrade_template_get_wysiwyg_content($viewcolumns, 0, 'tpl_label1'));
}
if (!empty($viewcolumns[0]['tpl_label2']) || !empty($viewcolumns[0]['tpl_label3']) || !empty($viewcolumns[0]['tpl_label4']) || !empty($viewcolumns[0]['tpl_label5'])) {
// mash it all into the first one and unset the rest
log_debug('assuming tpl_label2 is a wysiwyg');
$label2_text = '<h4>' . $ppae_text[1] . '</h4>'
. upgrade_template_get_wysiwyg_content($viewcolumns, 0, 'tpl_label2') . '<br>'
. upgrade_template_get_wysiwyg_content($viewcolumns, 0, 'tpl_label3') . '<br>'
......@@ -672,7 +670,7 @@ function upgrade_template_convert_block_to_blockinstance($block, $view) {
}
else if ($block->artefacttype == 'folder') {
$bi = new BlockInstance(0, array(
'title' => '',
'title' => $block->title,
'blocktype' => 'folder',
'configdata' => serialize(array('artefactid' => $block->artefact)),
'view' => $view->id,
......
......@@ -357,8 +357,8 @@ function xmldb_core_upgrade($oldversion=0) {
require_once(get_config('docroot') . 'lib/db/templatemigration.php');
upgrade_template_migration();
// TODO - enable this again
//execute_sql('ALTER TABLE {view_artefact} ALTER block SET NOT NULL');
delete_records_select('view_artefact', 'block IS NULL');
execute_sql('ALTER TABLE {view_artefact} ALTER block SET NOT NULL');
$table = new XMLDBTable('view_artefact');
$field = new XMLDBField('oldblock');
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment