fwrite ($bf,full_tag("NAME",4,false,$resource->name));
fwrite ($bf,full_tag("TYPE",4,false,$resource->type));
fwrite ($bf,full_tag("REFERENCE",4,false,$resource->reference));
- fwrite ($bf,full_tag("SUMMARY",4,false,$resource->summary));
+ fwrite ($bf,full_tag("SUMMARY",4,false,$resource->intro));
fwrite ($bf,full_tag("ALLTEXT",4,false,$resource->alltext));
fwrite ($bf,full_tag("POPUP",4,false,$resource->popup));
fwrite ($bf,full_tag("OPTIONS",4,false,$resource->options));
<?xml version="1.0" encoding="UTF-8" ?>
-<XMLDB PATH="mod/resource/db" VERSION="20070120" COMMENT="XMLDB file for Moodle mod/resource"
+<XMLDB PATH="mod/resource/db" VERSION="20090420" COMMENT="XMLDB file for Moodle mod/resource"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../../lib/xmldb/xmldb.xsd"
>
<FIELD NAME="course" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="id" NEXT="name"/>
<FIELD NAME="name" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="course" NEXT="type"/>
<FIELD NAME="type" TYPE="char" LENGTH="30" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="name" NEXT="reference"/>
- <FIELD NAME="reference" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="type" NEXT="summary"/>
- <FIELD NAME="summary" TYPE="text" LENGTH="small" NOTNULL="false" SEQUENCE="false" ENUM="false" PREVIOUS="reference" NEXT="alltext"/>
- <FIELD NAME="alltext" TYPE="text" LENGTH="medium" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="summary" NEXT="popup"/>
+ <FIELD NAME="reference" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="type" NEXT="intro"/>
+ <FIELD NAME="intro" TYPE="text" LENGTH="small" NOTNULL="false" SEQUENCE="false" ENUM="false" PREVIOUS="reference" NEXT="introformat"/>
+ <FIELD NAME="introformat" TYPE="int" LENGTH="4" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="intro" NEXT="alltext"/>
+ <FIELD NAME="alltext" TYPE="text" LENGTH="medium" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="introformat" NEXT="popup"/>
<FIELD NAME="popup" TYPE="text" LENGTH="small" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="alltext" NEXT="options"/>
<FIELD NAME="options" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="popup" NEXT="timemodified"/>
<FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="options"/>
</FIELDS>
<KEYS>
- <KEY NAME="primary" TYPE="primary" FIELDS="id" />
+ <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
</KEYS>
<INDEXES>
<INDEX NAME="course" UNIQUE="false" FIELDS="course"/>
</INDEXES>
</TABLE>
</TABLES>
-</XMLDB>
+</XMLDB>
\ No newline at end of file
//===== 1.9.0 upgrade line ======//
+ if ($result && $oldversion < 2009042000) {
+
+ /// Rename field summary on table resource to intro
+ $table = new xmldb_table('resource');
+ $field = new xmldb_field('summary', XMLDB_TYPE_TEXT, 'small', null, null, null, null, null, null, 'reference');
+
+ /// Launch rename field summary
+ $dbman->rename_field($table, $field, 'intro');
+
+ /// resource savepoint reached
+ upgrade_mod_savepoint($result, 2009042000, 'resource');
+ }
+
+ if ($result && $oldversion < 2009042001) {
+
+ /// Define field introformat to be added to resource
+ $table = new xmldb_table('resource');
+ $field = new xmldb_field('introformat', XMLDB_TYPE_INTEGER, '4', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'intro');
+
+ /// Launch add field introformat
+ $dbman->add_field($table, $field);
+
+ /// set format to current
+ $DB->set_field('resource', 'introformat', FORMAT_MOODLE, array());
+
+ /// resource savepoint reached
+ upgrade_mod_savepoint($result, 2009042001, 'resource');
+ }
+
return $result;
}
$currentsection = "";
$options->para = false;
+ $options->noclean = true;
foreach ($resources as $resource) {
if ($course->format == "weeks" or $course->format == "topics") {
$printsection = "";
if (!$resource->visible) { // Show dimmed if the mod is hidden
$table->data[] = array ($printsection,
"<a class=\"dimmed\" $extra href=\"view.php?id=$resource->coursemodule\">".format_string($resource->name,true)."</a>",
- format_text($resource->summary, FORMAT_MOODLE, $options) );
+ format_text($resource->intro, $resource->introformat, $options) );
} else { //Show normal if the mod is visible
$table->data[] = array ($printsection,
"<a $extra href=\"view.php?id=$resource->coursemodule\">".format_string($resource->name,true)."</a>",
- format_text($resource->summary, FORMAT_MOODLE, $options) );
+ format_text($resource->intro, $resource->introformat, $options) );
}
}
}
$mform->addRule('name', null, 'required', null, 'client');
- $mform->addElement('htmleditor', 'summary', get_string('summary'));
- $mform->setType('summary', PARAM_RAW);
- $mform->setHelpButton('summary', array('summary', get_string('summary'), 'resource'));
+ $mform->addElement('htmleditor', 'intro', get_string('summary'));
+ $mform->setType('intro', PARAM_RAW);
+ $mform->setHelpButton('intro', array('summary', get_string('summary'), 'resource'));
// summary should be optional again MDL-9485
//$mform->addRule('summary', get_string('required'), 'required', null, 'client');
$resource->name = backup_todb($info['MOD']['#']['NAME']['0']['#']);
$resource->type = $info['MOD']['#']['TYPE']['0']['#'];
$resource->reference = backup_todb($info['MOD']['#']['REFERENCE']['0']['#']);
- $resource->summary = backup_todb($info['MOD']['#']['SUMMARY']['0']['#']);
+ $resource->intro = backup_todb($info['MOD']['#']['SUMMARY']['0']['#']);
$resource->alltext = backup_todb($info['MOD']['#']['ALLTEXT']['0']['#']);
$resource->popup = backup_todb($info['MOD']['#']['POPUP']['0']['#']);
$resource->options = backup_todb($info['MOD']['#']['OPTIONS']['0']['#']);
global $CFG, $DB;
$status = true;
- if ($resources = $DB->get_records('resource', array('course'=>$restore->course_id), '', "id, alltext, summary, reference")) {
+ if ($resources = $DB->get_records('resource', array('course'=>$restore->course_id), '', "id, alltext, intro, reference")) {
$i = 0; //Counter to send some output to the browser to avoid timeouts
foreach ($resources as $resource) {
//Increment counter
$i++;
$content1 = $resource->alltext;
- $content2 = $resource->summary;
+ $content2 = $resource->intro;
$content3 = $resource->reference;
$result1 = restore_decode_content_links_worker($content1,$restore);
$result2 = restore_decode_content_links_worker($content2,$restore);
if ($result1 != $content1 || $result2 != $content2 || $result3 != $content3) {
//Update record
$resource->alltext = $result1;
- $resource->summary = $result2;
+ $resource->intro = $result2;
$resource->reference = $result3;
$status = $DB->update_record("resource",$resource);
if (debugging()) {
navmenu($course, $cm));
- if (trim(strip_tags($resource->summary))) {
- print_simple_box(format_text($resource->summary, FORMAT_MOODLE, $formatoptions, $course->id), "center");
+ if (trim(strip_tags($resource->intro))) {
+ print_simple_box(format_text($resource->intro, $resource->introformat, $formatoptions, $course->id), "center");
print_spacer(10,10);
}
echo "\n-->\n";
echo '</script>';
- if (trim(strip_tags($resource->summary))) {
- print_simple_box(format_text($resource->summary, FORMAT_MOODLE, $formatoptions), "center");
+ if (trim(strip_tags($resource->intro))) {
+ print_simple_box(format_text($resource->intro, $resource->introformat, $formatoptions, $course->id), "center");
}
$link = "<a href=\"$CFG->wwwroot/mod/resource/view.php?inpopup=true&id={$cm->id}\" "
function resizeEmbeddedHtml() {
//calculate new embedded html height size
';
- if (!empty($resource->summary)) {
+ if (!empty($resource->intro)) {
echo' objectheight = YAHOO.util.Dom.getViewportHeight() - 230;
';
}
</script>
';
- ///print the summary
- if (!empty($resource->summary)) {
- print_simple_box(format_text($resource->summary, FORMAT_MOODLE, $formatoptions, $course->id), "center");
+ ///print the intro
+ if (!empty($resource->intro)) {
+ print_simple_box(format_text($resource->intro, $resource->introformat, $formatoptions, $course->id), "center");
}
echo "</body></html>";
exit;
$options = new object();
$options->para = false;
- echo '<div class="summary">'.format_text($resource->summary, FORMAT_HTML, $options).'</div>';
+ $options->noclean = true;
+ echo '<div class="summary">'.format_text($resource->intro, $resource->introformat, $options).'</div>';
if (!empty($localpath)) { // Show some help
echo '<div class="mdl-right helplink">';
link_to_popup_window ('/mod/resource/type/file/localpath.php', get_string('localfile', 'resource'),
echo '</div>';
}
- if (trim($resource->summary)) {
- print_simple_box(format_text($resource->summary, FORMAT_MOODLE, $formatoptions, $course->id), "center");
+ if (trim($resource->intro)) {
+ print_simple_box(format_text($resource->intro, $resource->introformat, $formatoptions, $course->id), "center");
}
if ($inpopup) {
echo "\n//]]>\n";
echo '</script>';
- if (trim(strip_tags($resource->summary))) {
- print_simple_box(format_text($resource->summary, FORMAT_MOODLE, $formatoptions, $course->id), "center clearfix");
+ if (trim(strip_tags($resource->intro))) {
+ print_simple_box(format_text($resource->intro, $resource->introformat, $formatoptions, $course->id), "center");
}
$link = "<a href=\"$CFG->wwwroot/mod/resource/view.php?inpopup=true&id={$cm->id}\" onclick=\"this.target='resource{$resource->id}'; return openpopup('/mod/resource/view.php?inpopup=true&id={$cm->id}', 'resource{$resource->id}','{$resource->popup}');\">".format_string($resource->name,true)."</a>";
echo "\n-->\n";
echo '</script>';
- if (trim(strip_tags($resource->summary))) {
- print_simple_box(format_text($resource->summary, FORMAT_MOODLE, $formatoptions), "center");
+ if (trim(strip_tags($resource->intro))) {
+ print_simple_box(format_text($resource->intro, $resource->introformat, $formatoptions, $course->id), "center");
}
$link = "<a href=\"$CFG->wwwroot/mod/resource/view.php?inpopup=true&id={$cm->id}\" target=\"resource{$resource->id}\" onclick=\"return openpopup('/mod/resource/view.php?inpopup=true&id={$cm->id}', 'resource{$resource->id}','{$resource->popup}');\">".format_string($resource->name,true)."</a>";
echo "\n-->\n";
echo '</script>';
- if (trim(strip_tags($resource->summary))) {
+ if (trim(strip_tags($resource->intro))) {
$formatoptions->noclean = true;
- print_simple_box(format_text($resource->summary, FORMAT_MOODLE, $formatoptions), "center");
+ print_simple_box(format_text($resource->intro, $resource->introformat, $formatoptions, $course->id), "center");
}
$link = "<a href=\"$CFG->wwwroot/mod/resource/view.php?inpopup=true&id={$cm->id}\" target=\"resource{$resource->id}\" onclick=\"return openpopup('/mod/resource/view.php?inpopup=true&id={$cm->id}', 'resource{$resource->id}','{$resource->popup}');\">".format_string($resource->name,true)."</a>";
print_header($pagetitle, $course->fullname, $navigation, "", "", true,
update_module_button($cm->id, $course->id, $this->strresource), navmenu($course, $cm, "parent"));
- echo '<div class="summary">'.format_text($resource->summary, FORMAT_HTML, $formatoptions).'</div>';
+ echo '<div class="summary">'.format_text($resource->intro, $resource->introformat, $formatoptions).'</div>';
if (!empty($localpath)) { // Show some help
echo '<div class="mdl-right helplink">';
link_to_popup_window ('/mod/resource/type/file/localpath.php', get_string('localfile', 'resource'), get_string('localfilehelp','resource'), 400, 500, get_string('localfilehelp', 'resource'));
echo "\n//]]>\n";
echo '</script>';
- if (trim(strip_tags($resource->summary))) {
- print_simple_box(format_text($resource->summary, FORMAT_MOODLE, $formatoptions, $course->id), "center");
+ if (trim(strip_tags($resource->intro))) {
+ print_simple_box(format_text($resource->intro, $resource->introformat, $formatoptions, $course->id), "center");
}
$link = "<a href=\"$CFG->wwwroot/mod/resource/view.php?inpopup=true&id={$cm->id}\" onclick=\"this.target='resource{$resource->id}'; return openpopup('/mod/resource/view.php?inpopup=true&id={$cm->id}', 'resource{$resource->id}','{$resource->popup}');\">".format_string($resource->name,true)."</a>";
// This fragment is called by /admin/index.php
////////////////////////////////////////////////////////////////////////////////
-$module->version = 2008081100;
-$module->requires = 2008080701; // Requires this Moodle version
+$module->version = 2009042001;
+$module->requires = 2009041700; // Requires this Moodle version
$module->cron = 0;
?>