/**
  * form definition
  */
 public function definition()
 {
     $mform =& $this->_form;
     $mform->addElement('header', 'header', get_string('heading:info', 'block_coupon'));
     if (!($strinfo = get_config('block_coupon', 'info_coupon_cohorts'))) {
         $strinfo = get_string('missing_config_info', 'block_coupon');
     }
     $mform->addElement('static', 'info', '', $strinfo);
     $mform->addElement('header', 'header', get_string('heading:input_cohorts', 'block_coupon'));
     // First we'll get some useful info.
     $cohorts = helper::get_cohort_menu();
     // And create data for multiselect.
     $arrcohortselect = array();
     foreach ($cohorts as $cohort) {
         $arrcohortselect[$cohort->id] = $cohort->name;
     }
     $attributes = array('size' => min(20, count($arrcohortselect)));
     // Cohort id.
     $selectcohorts =& $mform->addElement('select', 'coupon_cohorts', get_string('label:coupon_cohorts', 'block_coupon'), $arrcohortselect, $attributes);
     $selectcohorts->setMultiple(true);
     $mform->addRule('coupon_cohorts', get_string('error:required', 'block_coupon'), 'required', null, 'client');
     $mform->addHelpButton('coupon_cohorts', 'label:coupon_cohorts', 'block_coupon');
     $this->add_action_buttons(true, get_string('button:next', 'block_coupon'));
 }