Fixed a table name
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<XMLDB PATH="mod/workshop/db" VERSION="20091008" COMMENT="XMLDB file for workshop Rubric grading strategy"
|
||||
<XMLDB PATH="mod/workshop/db" VERSION="20091009" COMMENT="XMLDB file for workshop Rubric grading strategy"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:noNamespaceSchemaLocation="../../../lib/xmldb/xmldb.xsd"
|
||||
>
|
||||
@@ -17,7 +17,7 @@
|
||||
<KEY NAME="workshop_fk" TYPE="foreign" FIELDS="workshopid" REFTABLE="workshop" REFFIELDS="id" PREVIOUS="primary"/>
|
||||
</KEYS>
|
||||
</TABLE>
|
||||
<TABLE NAME="workshopform_rubric_levels" COMMENT="The definition of rubric rating scales" PREVIOUS="workshopform_rubric" NEXT="workshopforms_rubric_config">
|
||||
<TABLE NAME="workshopform_rubric_levels" COMMENT="The definition of rubric rating scales" PREVIOUS="workshopform_rubric" NEXT="workshopform_rubric_config">
|
||||
<FIELDS>
|
||||
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" NEXT="dimensionid"/>
|
||||
<FIELD NAME="dimensionid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="false" COMMENT="Which criterion this level is part of" PREVIOUS="id" NEXT="grade"/>
|
||||
@@ -30,7 +30,7 @@
|
||||
<KEY NAME="dimension_fk" TYPE="foreign" FIELDS="dimensionid" REFTABLE="workshopform_rubric" REFFIELDS="id" PREVIOUS="primary"/>
|
||||
</KEYS>
|
||||
</TABLE>
|
||||
<TABLE NAME="workshopforms_rubric_config" COMMENT="Configuration table for the Rubric grading strategy" PREVIOUS="workshopform_rubric_levels">
|
||||
<TABLE NAME="workshopform_rubric_config" COMMENT="Configuration table for the Rubric grading strategy" PREVIOUS="workshopform_rubric_levels">
|
||||
<FIELDS>
|
||||
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" NEXT="workshopid"/>
|
||||
<FIELD NAME="workshopid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="false" COMMENT="The id of workshop this configuartion applies for" PREVIOUS="id" NEXT="layout"/>
|
||||
@@ -38,7 +38,7 @@
|
||||
</FIELDS>
|
||||
<KEYS>
|
||||
<KEY NAME="primary" TYPE="primary" FIELDS="id" NEXT="uqfk_workshop"/>
|
||||
<KEY NAME="uqfk_workshop" TYPE="foreign-unique" FIELDS="workshopid" REFTABLE="workshop" REFFIELDS="id" PREVIOUS="primary"/>
|
||||
<KEY NAME="uqfk_workshop" TYPE="unique" FIELDS="workshopid" PREVIOUS="primary"/>
|
||||
</KEYS>
|
||||
</TABLE>
|
||||
</TABLES>
|
||||
|
||||
@@ -48,6 +48,12 @@ class workshop_rubric_strategy implements workshop_strategy {
|
||||
/** @var array options for dimension description fields */
|
||||
protected $descriptionopts;
|
||||
|
||||
/** @var array options for level definition fields */
|
||||
protected $definitionopts;
|
||||
|
||||
/** @var object rubric configuration */
|
||||
protected $config;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
@@ -57,8 +63,10 @@ class workshop_rubric_strategy implements workshop_strategy {
|
||||
public function __construct(workshop $workshop) {
|
||||
$this->workshop = $workshop;
|
||||
$this->dimensions = $this->load_fields();
|
||||
$this->config = $this->load_config();
|
||||
$this->descriptionopts = array('trusttext' => true, 'subdirs' => false, 'maxfiles' => -1);
|
||||
$this->definitionopts = array('trusttext' => true, 'subdirs' => false, 'maxfiles' => -1);
|
||||
print_object($this->config); die(); // DONOTCOMMIT
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -344,22 +352,46 @@ class workshop_rubric_strategy implements workshop_strategy {
|
||||
|
||||
$sql = 'SELECT r.id AS rid, l.id AS lid, *
|
||||
FROM {workshopform_rubric} r
|
||||
LEFT JOIN {workshopform_rubric_levels} l ON (l.dimensionid = r.id}
|
||||
LEFT JOIN {workshopform_rubric_levels} l ON (l.dimensionid = r.id)
|
||||
WHERE r.workshopid = :workshopid
|
||||
ORDER BY r.sort, l.grade';
|
||||
$params = array('workshopid' => $this->workshop->id);
|
||||
|
||||
$rs = $DB->get_recordset_sql($sql, $param);
|
||||
$rs = $DB->get_recordset_sql($sql, $params);
|
||||
$fields = array();
|
||||
foreach ($rs as $record) {
|
||||
// if (!isset($fields
|
||||
print_object($record); die(); // DONOTCOMMIT
|
||||
if (!isset($fields[$record->rid])) {
|
||||
$fields[$record->rid] = new stdClass();
|
||||
$fields[$record->rid]->id = $record->rid;
|
||||
$fields[$record->rid]->sort = $record->sort;
|
||||
$fields[$record->rid]->description = $record->description;
|
||||
$fields[$record->rid]->descriptionformat = $record->descriptionformat;
|
||||
$fields[$record->rid]->levels = array();
|
||||
}
|
||||
$fields[$record->rid]->levels[$record->lid] = new stdClass();
|
||||
$fields[$record->rid]->levels[$record->lid]->id = $record->lid;
|
||||
$fields[$record->rid]->levels[$record->lid]->grade = $record->grade;
|
||||
$fields[$record->rid]->levels[$record->lid]->definition = $record->definition;
|
||||
$fields[$record->rid]->levels[$record->lid]->definitionformat = $record->definitionformat;
|
||||
}
|
||||
$rs->close();
|
||||
|
||||
return $fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the configuration for the current rubric strategy
|
||||
*
|
||||
* @return object
|
||||
*/
|
||||
protected function load_config() {
|
||||
global $DB;
|
||||
|
||||
if (!$config = $DB->get_record('workshopform_rubric_config', array('workshopid' => $this->workshop->id), 'layout')) {
|
||||
$config = (object)array('layout' => 'list');
|
||||
}
|
||||
return $config;
|
||||
}
|
||||
|
||||
/**
|
||||
* Maps the dimension data from DB to the form fields
|
||||
*
|
||||
|
||||
@@ -28,5 +28,5 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2009100801;
|
||||
$plugin->version = 2009100900;
|
||||
$plugin->requires = 2009100600; // Requires this Moodle version
|
||||
|
||||
Reference in New Issue
Block a user