fixing messed up property_exists() regression - sorrrry
This commit is contained in:
@@ -457,7 +457,7 @@ if ($formdata = $mform->is_cancelled()) {
|
||||
}
|
||||
}
|
||||
}
|
||||
if ((property_exists($column, $existinguser) and property_exists($column, $user)) or in_array($column, $PRF_FIELDS)) {
|
||||
if ((property_exists($existinguser, $column) and property_exists($user, $column)) or in_array($column, $PRF_FIELDS)) {
|
||||
if ($updatetype == 3 and $existinguser->$column !== '') {
|
||||
//missing == non-empty only
|
||||
continue;
|
||||
|
||||
+1
-1
@@ -521,7 +521,7 @@ if ($mform->is_cancelled()) {
|
||||
foreach($outcomes as $outcome) {
|
||||
$elname = 'outcome_'.$outcome->id;
|
||||
|
||||
if (property_exists($elname, $fromform) and $fromform->$elname) {
|
||||
if (property_exists($fromform, $elname) and $fromform->$elname) {
|
||||
// so we have a request for new outcome grade item?
|
||||
if ($items) {
|
||||
foreach($items as $item) {
|
||||
|
||||
@@ -142,7 +142,7 @@ if (!$edit) {
|
||||
$gradelettername = 'gradeletter'.$i;
|
||||
$gradeboundaryname = 'gradeboundary'.$i;
|
||||
|
||||
if (property_exists($gradeboundaryname, $data) and $data->$gradeboundaryname != -1) {
|
||||
if (property_exists($data, $gradeboundaryname) and $data->$gradeboundaryname != -1) {
|
||||
$letter = trim($data->$gradelettername);
|
||||
if ($letter == '') {
|
||||
continue;
|
||||
|
||||
@@ -155,7 +155,7 @@ if ($mform->is_cancelled()) {
|
||||
|
||||
$convert = array('grademax', 'grademin', 'gradepass', 'multfactor', 'plusfactor', 'aggregationcoef');
|
||||
foreach ($convert as $param) {
|
||||
if (property_exists($param, $itemdata)) {
|
||||
if (property_exists($itemdata, $param)) {
|
||||
$itemdata->$param = unformat_float($itemdata->$param);
|
||||
}
|
||||
}
|
||||
@@ -184,7 +184,7 @@ if ($mform->is_cancelled()) {
|
||||
}
|
||||
|
||||
// Handle null decimals value - must be done before update!
|
||||
if (!property_exists('decimals', $itemdata) or $itemdata->decimals < 0) {
|
||||
if (!property_exists($itemdata, 'decimals') or $itemdata->decimals < 0) {
|
||||
$grade_item->decimals = null;
|
||||
}
|
||||
|
||||
|
||||
@@ -186,7 +186,7 @@ if ($mform->is_cancelled()) {
|
||||
}
|
||||
|
||||
// the overriding of feedback is tricky - we have to care about external items only
|
||||
if (!property_exists('feedback', $data) or $data->feedback == $data->oldfeedback) {
|
||||
if (!property_exists($data, 'feedback') or $data->feedback == $data->oldfeedback) {
|
||||
$data->feedback = $old_grade_grade->feedback;
|
||||
$data->feedbackformat = $old_grade_grade->feedbackformat;
|
||||
}
|
||||
|
||||
@@ -125,7 +125,7 @@ if ($mform->is_cancelled()) {
|
||||
|
||||
$convert = array('grademax', 'grademin', 'gradepass', 'multfactor', 'plusfactor', 'aggregationcoef');
|
||||
foreach ($convert as $param) {
|
||||
if (property_exists($param, $data)) {
|
||||
if (property_exists($data, $param)) {
|
||||
$data->$param = unformat_float($data->$param);
|
||||
}
|
||||
}
|
||||
@@ -135,7 +135,7 @@ if ($mform->is_cancelled()) {
|
||||
$grade_item->outcomeid = null;
|
||||
|
||||
// Handle null decimals value
|
||||
if (!property_exists('decimals', $data) or $data->decimals < 0) {
|
||||
if (!property_exists($data, 'decimals') or $data->decimals < 0) {
|
||||
$grade_item->decimals = null;
|
||||
}
|
||||
|
||||
|
||||
@@ -107,7 +107,7 @@ if ($data = $mform->get_data()) {
|
||||
$data->aggregationcoef = 0;
|
||||
}
|
||||
|
||||
if (property_exists('calculation', $data)) {
|
||||
if (property_exists($data, 'calculation')) {
|
||||
$data->calculation = grade_item::normalize_formula($data->calculation, $course->id);
|
||||
}
|
||||
|
||||
@@ -123,7 +123,7 @@ if ($data = $mform->get_data()) {
|
||||
|
||||
$convert = array('gradepass', 'aggregationcoef');
|
||||
foreach ($convert as $param) {
|
||||
if (property_exists($param, $data)) {
|
||||
if (property_exists($data, $param)) {
|
||||
$data->$param = unformat_float($data->$param);
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -691,7 +691,7 @@ class grade_plugin_return {
|
||||
|
||||
} else {
|
||||
foreach ($params as $key=>$value) {
|
||||
if (property_exists($key, $this)) {
|
||||
if (property_exists($this, $key)) {
|
||||
$this->$key = $value;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -86,7 +86,7 @@ abstract class data_object {
|
||||
public function load_optional_fields() {
|
||||
global $DB;
|
||||
foreach ($this->optional_fields as $field=>$default) {
|
||||
if (property_exists($field, $this)) {
|
||||
if (property_exists($this, $field)) {
|
||||
continue;
|
||||
}
|
||||
if (empty($this->id)) {
|
||||
|
||||
@@ -170,7 +170,7 @@ class workshop {
|
||||
*/
|
||||
public function __construct(stdclass $dbrecord, stdclass $cm, stdclass $course, stdclass $context=null) {
|
||||
foreach ($dbrecord as $field => $value) {
|
||||
if (property_exists('workshop', $field)) {
|
||||
if (property_exists($field, 'workshop')) {
|
||||
$this->{$field} = $value;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user