# This patch file was generated by NetBeans IDE # This patch can be applied using context Tools: Apply Diff Patch action on respective folder. # It uses platform neutral UTF-8 encoding. # Above lines and this line are ignored by the patching process. Index: moodle/lib/grade/grade_object.php --- moodle/lib/grade/grade_object.php Base (1.27.2.4) +++ moodle/lib/grade/grade_object.php Locally Modified (Based On 1.27.2.4) @@ -32,7 +32,7 @@ * Array of required table fields, must start with 'id'. * @var array $required_fields */ - var $required_fields = array('id', 'timecreated', 'timemodified'); + var $required_fields = array('id', 'timecreated', 'timemodified', 'hidden'); /** * Array of optional fields with default values - usually long text information that is not always needed. @@ -60,6 +60,12 @@ var $timemodified; /** + * 0 if visible, 1 always hidden or date not visible until + * @var int $hidden + */ + var $hidden = 0; + + /** * Constructor. Optionally (and by default) attempts to fetch corresponding row from DB. * @param array $params an array with required parameters for this grade object. * @param boolean $fetch Whether to fetch corresponding row from DB or not, @@ -345,5 +351,34 @@ } } } + + /** + * Returns the hidden state of this grade_item + * @return boolean hidden state + */ + function is_hidden() { + return ($this->hidden == 1 or ($this->hidden != 0 and $this->hidden > time())); } + + /** + * Check grade hidden status. Uses data from both grade item and grade. + * @return boolean true if hiddenuntil, false if not + */ + function is_hiddenuntil() { + return $this->hidden > 1; + } + + /** + * Check grade item hidden status. + * @return int 0 means visible, 1 hidden always, timestamp hidden until + */ + function get_hidden() { + return $this->hidden; + } + + function set_hidden($hidden, $cascade=false) { + $this->hidden = $hidden; + $this->update(); + } +} ?>