public function user_can_rate($userid = null) {
        if (empty($userid)) {
            global $USER;
            $userid = $USER->id;
        }
        // You can't rate your item.
        if ($this->itemuserid == $userid) {
            return false;
        }
        // You can't rate if you don't have the system cap.
        if (!$this->settings->permissions->rate) {
            return false;
        }
        // You can't rate if you don't have the plugin cap.
        if (!$this->settings->pluginpermissions->rate) {
            return false;
        }

        // You can't rate if the item was outside of the assessment times.
        $timestart = $this->settings->assesstimestart;
        $timefinish = $this->settings->assesstimefinish;
        $timecreated = $this->itemtimecreated;
        if (!empty($timestart) && !empty($timefinish) && ($timecreated < $timestart || $timecreated > $timefinish)) {
            return false;
        }
        return true;
    }
public function user_can_rate($userid = null) {
        if (empty($userid)) {
            global $USER;
            $userid = $USER->id;
        }
        // You can't rate your item.
        if ($this->itemuserid == $userid) {
            return false;
        }
        // You can't rate if you don't have the system cap.
        if (!$this->settings->permissions->rate) {
            return false;
        }
        // You can't rate if you don't have the plugin cap.
        if (!$this->settings->pluginpermissions->rate) {
            return false;
        }

        // You can't rate if the item was outside of the assessment times.
        $timestart = $this->settings->assesstimestart;
        $timefinish = $this->settings->assesstimefinish;
        $timecreated = $this->itemtimecreated;
        if (!empty($timestart) && !empty($timefinish) && ($timecreated < $timestart || $timecreated > $timefinish)) {
            return false;
        }
        return true;
    }
public function user_can_rate ( $ userid = null ) { if ( empty ( $ userid ) ) { global $ USER ; $ userid = $ USER -> id ; } // You can't rate your item. if ( $ this -> itemuserid == $ userid ) { return false ; } // You can't rate if you don't have the system cap. if ( ! $ this -> settings -> permissions -> rate ) { return false ; } // You can't rate if you don't have the plugin cap. if ( ! $ this -> settings -> pluginpermissions -> rate ) { return false ; } // You can't rate if the item was outside of the assessment times. $ timestart = $ this -> settings -> assesstimestart ; $ timefinish = $ this -> settings -> assesstimefinish ; $ timecreated = $ this -> itemtimecreated ; if ( ! empty ( $ timestart ) && ! empty ( $ timefinish ) && ( $ timecreated < $ timestart || $ timecreated > $ timefinish ) ) { return false ; } return true ; }
Returns true if the user is able to rate this rating object

@param int $userid Current user assumed if left empty
@return bool true if the user is able to rate this rating object
Returns true if the user is able to rate this rating object