You are here

function CourseObjectAccessGrade::optionsForm in Course 7

Same name and namespace in other branches
  1. 6 plugins/course/access/grade.inc \CourseObjectAccessGrade::optionsForm()
  2. 7.2 plugins/course_object_access/grade.inc \CourseObjectAccessGrade::optionsForm()

File

plugins/course_object_access/grade.inc, line 91

Class

CourseObjectAccessGrade

Code

function optionsForm(&$form, &$form_state) {
  $config = $this
    ->getOptions();
  $form['#description'] = t('The user will not be able to access this object unless the course grade is within the set range.');
  $form['course_grade_range'] = array(
    '#type' => 'container',
  );
  $form['course_grade_range']['low'] = array(
    '#title' => t('Percentage low'),
    '#type' => 'textfield',
    '#size' => 4,
    '#default_value' => isset($config['course_grade_range']['low']) ? $config['course_grade_range']['low'] : '',
  );
  $form['course_grade_range']['high'] = array(
    '#title' => t('Percentage high'),
    '#type' => 'textfield',
    '#size' => 4,
    '#default_value' => isset($config['course_grade_range']['high']) ? $config['course_grade_range']['high'] : '',
  );
  $options = $this
    ->getObjectOptions();
  $options[0] = '(this course)';
  $form['conditional_object'] = array(
    '#title' => t('Grade to check'),
    '#type' => 'select',
    '#options' => $options,
    '#description' => t('This grade will be checked.'),
    '#default_value' => $config['conditional_object'],
  );
  $form['course_grade_hidden'] = array(
    '#title' => t('Hide until grade met'),
    '#description' => t('The user will not see this object until the grade is met.'),
    '#type' => 'checkbox',
    '#default_value' => $config['course_grade_hidden'],
  );
  return $form;
}