public static function find_ltiservice_gradebookservice_for_lineitem($lineitemid) {
        global $DB;

        if (!$lineitemid) {
            return false;
        }
        $gradeitem = $DB->get_record('grade_items', array('id' => $lineitemid));
        if ($gradeitem) {
            $gbs = $DB->get_record('ltiservice_gradebookservices',
                    array('gradeitemid' => $gradeitem->id, 'courseid' => $gradeitem->courseid));
            if ($gbs) {
                return $gbs;
            } else {
                return false;
            }
        } else {
            return false;
        }
    }
public static function find_ltiservice_gradebookservice_for_lineitem($lineitemid) {
        global $DB;

        if (!$lineitemid) {
            return false;
        }
        $gradeitem = $DB->get_record('grade_items', array('id' => $lineitemid));
        if ($gradeitem) {
            $gbs = $DB->get_record('ltiservice_gradebookservices',
                    array('gradeitemid' => $gradeitem->id, 'courseid' => $gradeitem->courseid));
            if ($gbs) {
                return $gbs;
            } else {
                return false;
            }
        } else {
            return false;
        }
    }
public static function find_ltiservice_gradebookservice_for_lineitem ( $ lineitemid ) { global $ DB ; if ( ! $ lineitemid ) { return false ; } $ gradeitem = $ DB -> get_record ( 'grade_items' , array ( 'id' => $ lineitemid ) ) ; if ( $ gradeitem ) { $ gbs = $ DB -> get_record ( 'ltiservice_gradebookservices' , array ( 'gradeitemid' => $ gradeitem -> id , 'courseid' => $ gradeitem -> courseid ) ) ; if ( $ gbs ) { return $ gbs ; } else { return false ; } } else { return false ; } }
Find the right element in the ltiservice_gradebookservice table for a lineitem

@param string $lineitemid            The lineitem
@return object|bool gradebookservice id or false if none
Find the right element in the ltiservice_gradebookservice table for a lineitem