MDL-31341 mod_assign: fixup minor coding style issues

This commit is contained in:
Dan Poltawski 2012-08-21 12:16:46 +08:00
parent 94fb9f9fae
commit 3a66d4255d
2 changed files with 7 additions and 6 deletions

View File

@ -64,13 +64,14 @@ function xmldb_assign_upgrade($oldversion) {
// Assign savepoint reached.
upgrade_mod_savepoint(true, 2012071800, 'assign');
}
if ($oldversion < 2012081600) {
// Define field sendlatenotifications to be added to assign
// Define field sendlatenotifications to be added to assign.
$table = new xmldb_table('assign');
$field = new xmldb_field('completionsubmit', XMLDB_TYPE_INTEGER, '2', null, XMLDB_NOTNULL, null, '0', 'timemodified');
// Conditionally launch add field sendlatenotifications
// Conditionally launch add field sendlatenotifications.
if (!$dbman->field_exists($table, $field)) {
$dbman->add_field($table, $field);
}

View File

@ -949,18 +949,18 @@ function assign_user_outline($course, $user, $coursemodule, $assignment) {
* @param bool $type Type of comparison (or/and; can be used as return value if no conditions)
* @return bool True if completed, false if not, $type if conditions not set.
*/
function assign_get_completion_state($course,$cm,$userid,$type) {
function assign_get_completion_state($course, $cm, $userid, $type) {
global $CFG,$DB;
require_once($CFG->dirroot . '/mod/assign/locallib.php');
$assign = new assign(null, $cm, $course);
// If completion option is enabled, evaluate it and return true/false
if($assign->get_instance()->completionsubmit) {
// If completion option is enabled, evaluate it and return true/false.
if ($assign->get_instance()->completionsubmit) {
$submission = $DB->get_record('assign_submission', array('assignment'=>$assign->get_instance()->id, 'userid'=>$userid), '*', IGNORE_MISSING);
return $submission && $submission->status == ASSIGN_SUBMISSION_STATUS_SUBMITTED;
} else {
// Completion option is not enabled so just return $type
// Completion option is not enabled so just return $type.
return $type;
}
}