Пример #1
0
 /**
  * block contents
  *
  * @return object
  */
 public function get_content()
 {
     global $CFG, $COURSE, $USER, $PAGE;
     if ($this->content !== NULL) {
         return $this->content;
     }
     if ($COURSE->id == SITEID) {
         $context = context_system::instance();
     } else {
         $context = context_course::instance($COURSE->id);
     }
     $this->content = new stdClass();
     $this->content->text = '';
     $this->content->footer = '';
     $mymoodle = 0;
     if (strcmp('my-index', $PAGE->pagetype) == 0) {
         $mymoodle = 1;
     }
     if (has_capability('block/enrolsurvey:edit', $context)) {
         $editpage = get_string('editpage', 'block_enrolsurvey');
         $this->content->text .= "<a\nhref=\"{$CFG->wwwroot}/blocks/enrolsurvey/edit_survey.php?id={$this->instance->id}&courseid={$COURSE->id}&mymoodle={$mymoodle}\">{$editpage}</a><br\n/>";
     }
     if (has_capability('block/enrolsurvey:take', $context) && cm_get_crlmuserid($USER->id) !== false) {
         // MUST have ELIS user record to take survey!
         if (!empty($this->config->force_user) && !is_survey_taken($USER->id, $this->instance->id)) {
             redirect("{$CFG->wwwroot}/blocks/enrolsurvey/survey.php?id={$this->instance->id}");
         }
         $takepage = get_string('takepage', 'block_enrolsurvey');
         $this->content->text .= "<a\nhref=\"{$CFG->wwwroot}/blocks/enrolsurvey/survey.php?id={$this->instance->id}&courseid={$COURSE->id}&mymoodle={$mymoodle}\">{$takepage}</a><br\n/>";
     }
     // $this->content->text .= "<br/> crontime = {$this->config->cron_time}";
     return $this->content;
 }
Пример #2
0
 /**
  * block contents
  *
  * @return object
  */
 public function get_content()
 {
     global $CFG, $COURSE, $USER;
     if ($this->content !== NULL) {
         return $this->content;
     }
     if ($COURSE->id == SITEID) {
         $context = get_context_instance(CONTEXT_SYSTEM);
     } else {
         $context = get_context_instance(CONTEXT_COURSE, $COURSE->id);
     }
     $this->content = new stdClass();
     $this->content->text = '';
     $this->content->footer = '';
     if (has_capability('block/enrol_survey:edit', $context)) {
         $editpage = get_string('editpage', 'block_enrol_survey');
         $this->content->text .= "<a href={$CFG->wwwroot}/blocks/enrol_survey/edit_survey.php?id={$this->instance->id}>{$editpage}</a><br />";
     }
     if (has_capability('block/enrol_survey:take', $context) && cm_get_crlmuserid($USER->id) !== false) {
         // MUST have ELIS user record to take survey! see: survey.php
         if (!empty($this->config->force_user) && !is_survey_taken($USER->id, $this->instance->id)) {
             redirect("{$CFG->wwwroot}/blocks/enrol_survey/survey.php?id={$this->instance->id}");
         }
         $takepage = get_string('takepage', 'block_enrol_survey');
         $this->content->text .= "<a href={$CFG->wwwroot}/blocks/enrol_survey/survey.php?id={$this->instance->id}>{$takepage}</a><br />";
     }
     return $this->content;
 }
Пример #3
0
                            $dataobj->fieldid = $id;
                            $dataobj->data = $fd;
                            insert_record('user_info_data', $dataobj);
                        }
                    }
                }
            } else {
                $incomplete = true;
            }
        }
        $u->update();
        $usernew = get_record('user', 'id', $USER->id);
        foreach ((array) $usernew as $variable => $value) {
            $USER->{$variable} = $value;
        }
        if (!is_survey_taken($USER->id, $instanceid) && empty($incomplete)) {
            $dataobject = new object();
            $dataobject->blockinstanceid = $instanceid;
            $dataobject->userid = $USER->id;
            insert_record('block_enrol_survey_taken', $dataobject);
        }
        if (!empty($formdata->save_exit)) {
            redirect($CFG->wwwroot . '/course/view.php?id=' . $COURSE->id);
        }
    }
}
$toform = array();
$u = new user(cm_get_crlmuserid($USER->id));
$toform = get_object_vars($u);
$customdata = get_records('user_info_data', 'userid', $USER->id);
if (!empty($customdata)) {