You are here

function opigno_quiz_app_get_course_quiz_weight in Opigno Quiz App 7

Helper function to fetch the weight of a quiz inside a course.

Parameters

int $gid:

int $nid:

Return value

int

2 calls to opigno_quiz_app_get_course_quiz_weight()
opigno_quiz_app_get_course_quizzes in ./opigno_quiz_app.module
Helper function to fetch all course quizzes.
opigno_quiz_app_sort_course_quizzes_form in includes/opigno_quiz_app.pages.inc
Page callback: sort course quizzes.

File

./opigno_quiz_app.module, line 828
Module file. Defines module hooks.

Code

function opigno_quiz_app_get_course_quiz_weight($gid, $nid) {
  $weight = db_select('opigno_quiz_app_quiz_sort', 'w')
    ->fields('w', array(
    'weight',
  ))
    ->condition('w.gid', $gid)
    ->condition('w.quiz_nid', $nid)
    ->execute()
    ->fetchField();
  return empty($weight) ? 0 : $weight;
}