$assignment->id = $returnid;
if ($assignment->timedue) {
- $event = new object();
+ $event = new stdClass();
$event->name = $assignment->name;
$event->description = format_module_intro('assignment', $assignment, $assignment->coursemodule);
$event->courseid = $assignment->course;
$DB->update_record('assignment', $assignment);
if ($assignment->timedue) {
- $event = new object();
+ $event = new stdClass();
if ($event->id = $DB->get_field('event', 'id', array('modulename'=>'assignment', 'instance'=>$assignment->id))) {
$calendarevent = calendar_event::load($event->id);
$calendarevent->update($event);
} else {
- $event = new object();
+ $event = new stdClass();
$event->name = $assignment->name;
$event->description = format_module_intro('assignment', $assignment, $assignment->coursemodule);
$event->courseid = $assignment->course;
* @return object The submission
*/
function prepare_new_submission($userid, $teachermodified=false) {
- $submission = new Object;
+ $submission = new stdClass();
$submission->assignment = $this->assignment->id;
$submission->userid = $userid;
$submission->timecreated = time();
$strsubmitted = get_string('submitted', 'assignment');
foreach ($teachers as $teacher) {
- $info = new object();
+ $info = new stdClass();
$info->username = fullname($user, true);
$info->assignment = format_string($this->assignment->name,true);
$info->url = $CFG->wwwroot.'/mod/assignment/submissions.php?id='.$this->cm->id;
$posttext = $this->email_teachers_text($info);
$posthtml = ($teacher->mailformat == 1) ? $this->email_teachers_html($info) : '';
- $eventdata = new object();
+ $eventdata = new stdClass();
$eventdata->modulename = 'assignment';
$eventdata->userfrom = $user;
$eventdata->userto = $teacher;
*/
function user_outline($grade) {
- $result = new object();
+ $result = new stdClass();
$result->info = get_string('grade').': '.$grade->str_long_grade;
$result->time = $grade->dategraded;
return $result;
$strassignments = get_string("modulenameplural", "assignment");
$strassignment = get_string("modulename", "assignment");
- $assignmentinfo = new object();
+ $assignmentinfo = new stdClass();
$assignmentinfo->teacher = fullname($teacher);
$assignmentinfo->assignment = format_string($submission->name,true);
$assignmentinfo->url = "$CFG->wwwroot/mod/assignment/view.php?id=$mod->id";
$posthtml = "";
}
- $eventdata = new object();
+ $eventdata = new stdClass();
$eventdata->modulename = 'assignment';
$eventdata->userfrom = $teacher;
$eventdata->userto = $user;
foreach ($assignments as $assignment) {
$cm = get_coursemodule_from_id('assignment', $assignment->id);
- $event = new object();
+ $event = new stdClass();
$event->name = $assignment->name;
$event->description = format_module_intro('assignment', $assignment, $cm->id);
$event->timestart = $assignment->timedue;
$aname = format_string($cm->name,true);
foreach ($show as $submission) {
- $tmpactivity = new object();
+ $tmpactivity = new stdClass();
$tmpactivity->type = 'assignment';
$tmpactivity->cmid = $cm->id;
if ($result = $ass->get_coursemodule_info($coursemodule)) {
return $result;
} else {
- $info = new object();
+ $info = new stdClass();
$info->name = $assignment->name;
return $info;
}
global $CFG;
$types = array();
- $type = new object();
+ $type = new stdClass();
$type->modclass = MOD_CLASS_ACTIVITY;
$type->type = "assignment_group_start";
$type->typestr = '--'.get_string('modulenameplural', 'assignment');
$standardassignments = array('upload','online','uploadsingle','offline');
foreach ($standardassignments as $assignmenttype) {
- $type = new object();
+ $type = new stdClass();
$type->modclass = MOD_CLASS_ACTIVITY;
$type->type = "assignment&type=$assignmenttype";
$type->typestr = get_string("type$assignmenttype", 'assignment');
continue;
}
if (!in_array($assignmenttype, $standardassignments)) {
- $type = new object();
+ $type = new stdClass();
$type->modclass = MOD_CLASS_ACTIVITY;
$type->type = "assignment&type=$assignmenttype";
$type->typestr = get_string("type$assignmenttype", 'assignment_'.$assignmenttype);
}
}
- $type = new object();
+ $type = new stdClass();
$type->modclass = MOD_CLASS_ACTIVITY;
$type->type = "assignment_group_end";
$type->typestr = '--';
}
function prepare_new_submission($userid) {
- $submission = new Object;
+ $submission = new stdClass();
$submission->assignment = $this->assignment->id;
$submission->userid = $userid;
$submission->timecreated = time(); // needed for offline assignments
// prepare form and process submitted data
$editoroptions = array('noclean'=>false, 'maxfiles'=>EDITOR_UNLIMITED_FILES, 'maxbytes'=>$this->course->maxbytes);
- $data = new object();
+ $data = new stdClass();
$data->id = $this->cm->id;
$data->edit = 1;
if ($submission) {
$submission = $this->get_submission($USER->id, true);
- $update = new object();
+ $update = new stdClass();
$update->id = $submission->id;
$update->data1 = $data->text;
$update->data2 = $data->textformat;
$mform = new mod_assignment_upload_notes_form();
- $defaults = new object();
+ $defaults = new stdClass();
$defaults->id = $this->cm->id;
if ($submission = $this->get_submission($USER->id)) {
if ($data = $mform->get_data() and $action == 'savenotes') {
$submission = $this->get_submission($USER->id, true); // get or create submission
- $updated = new object();
+ $updated = new stdClass();
$updated->id = $submission->id;
$updated->timemodified = time();
$updated->data1 = $data->text;
$submission = $this->get_submission($USER->id, true); //create new submission if needed
$fs->delete_area_files($this->context->id, 'mod_assignment', 'submission', $submission->id);
$formdata = file_postupdate_standard_filemanager($formdata, 'files', $options, $this->context, 'mod_assignment', 'submission', $submission->id);
- $updates = new object();
+ $updates = new stdClass();
$updates->id = $submission->id;
$updates->timemodified = time();
$DB->update_record('assignment_submissions', $updates);
// send files to event system
$files = $fs->get_area_files($this->context->id, 'mod_assignment', 'submission', $submission->id);
// Let Moodle know that assessable files were uploaded (eg for plagiarism detection)
- $eventdata = new object();
+ $eventdata = new stdClass();
$eventdata->modulename = 'assignment';
$eventdata->cmid = $this->cm->id;
$eventdata->itemid = $submission->id;
die;
}
}
- $updated = new object();
+ $updated = new stdClass();
$updated->id = $submission->id;
$updated->data2 = ASSIGNMENT_STATUS_SUBMITTED;
$updated->timemodified = time();
$this->email_teachers($submission);
// Trigger assessable_files_done event to show files are complete
- $eventdata = new object();
+ $eventdata = new stdClass();
$eventdata->modulename = 'assignment';
$eventdata->cmid = $this->cm->id;
$eventdata->itemid = $submission->id;
redirect($returnurl); // probably closed already
}
- $updated = new object();
+ $updated = new stdClass();
$updated->id = $submission->id;
$updated->data2 = ASSIGNMENT_STATUS_CLOSED;
and $this->can_unfinalize($submission)
and confirm_sesskey()) {
- $updated = new object();
+ $updated = new stdClass();
$updated->id = $submission->id;
$updated->data2 = '';
$DB->update_record('assignment_submissions', $updated);
$contextid = required_param('contextid', PARAM_INT);
$id = optional_param('id', null, PARAM_INT);
-$formdata = new object();
+$formdata = new stdClass();
$formdata->userid = required_param('userid', PARAM_INT);
$formdata->offset = optional_param('offset', null, PARAM_INT);
$formdata->forcerefresh = optional_param('forcerefresh', null, PARAM_INT);
}
echo $output;
}
-
+
function can_manage_responsefiles() {
if (has_capability('mod/assignment:grade', $this->context)) {
return true;
$file = $mform->save_stored_file('assignment_file', $this->context->id, 'mod_assignment', 'submission',
$submission->id, '/', $newfilename);
- $updates = new object(); //just enough data for updating the submission
+ $updates = new stdClass(); //just enough data for updating the submission
$updates->timemodified = time();
$updates->numfiles = 1;
$updates->id = $submission->id;
$this->email_teachers($submission);
// Let Moodle know that an assessable file was uploaded (eg for plagiarism detection)
- $eventdata = new object();
+ $eventdata = new stdClass();
$eventdata->modulename = 'assignment';
$eventdata->cmid = $this->cm->id;
$eventdata->itemid = $submission->id;
if ($USER->id != $submission->userid and !has_capability('mod/assignment:grade', $this->context)) {
return false;
}
-
+
$relativepath = implode('/', $args);
$fullpath = '/'.$this->context->id.'/mod_assignment/'.$filearea.'/'.$submissionid.'/'.$relativepath;
$contextid = required_param('contextid', PARAM_INT);
$id = optional_param('id', null, PARAM_INT);
-$formdata = new object();
+$formdata = new stdClass();
$formdata->userid = required_param('userid', PARAM_INT);
$formdata->offset = optional_param('offset', null, PARAM_INT);
$formdata->forcerefresh = optional_param('forcerefresh', null, PARAM_INT);
}
if (!empty($chat_message)) {
- $message = new object();
+ $message = new stdClass();
$message->chatid = $chatuser->chatid;
$message->userid = $chatuser->userid;
$message->groupid = $chatuser->groupid;
} else if (empty($refresh) and data_submitted() and confirm_sesskey()) {
if ($message!='') {
- $newmessage = new object();
+ $newmessage = new stdClass();
$newmessage->chatid = $chat->id;
$newmessage->userid = $USER->id;
$newmessage->groupid = $groupid;
echo '<h2>'.get_string('messages', 'chat').'</h2>';
$allmessages = array();
-$options = new object();
+$options = new stdClass();
$options->para = false;
$options->newlines = true;
if (!empty($chat_message)) {
- $message = new object();
+ $message = new stdClass();
$message->chatid = $chatuser->chatid;
$message->userid = $chatuser->userid;
$message->groupid = $chatuser->groupid;
$DB->update_record("chat", $chat);
- $event = new object();
+ $event = new stdClass();
if ($event->id = $DB->get_field('event', 'id', array('modulename'=>'chat', 'instance'=>$chat->id))) {
foreach ($chats as $chat) {
$cm = get_coursemodule_from_id('chat', $chat->id);
- $event = new object();
+ $event = new stdClass();
$event->name = $chat->name;
$event->description = format_module_intro('chat', $chat, $cm->id);
$event->timestart = $chat->chattime;
$DB->update_record('chat_users', $chatuser);
} else {
- $chatuser = new object();
+ $chatuser = new stdClass();
$chatuser->chatid = $chatid;
$chatuser->userid = $USER->id;
$chatuser->groupid = $groupid;
if ($version == 'sockets') {
// do not send 'enter' message, chatd will do it
} else {
- $message = new object();
+ $message = new stdClass();
$message->chatid = $chatuser->chatid;
$message->userid = $chatuser->userid;
$message->groupid = $groupid;
if ($oldusers = $DB->get_records_select('chat_users', $query, $params) ) {
$DB->delete_records_select('chat_users', $query, $params);
foreach ($oldusers as $olduser) {
- $message = new object();
+ $message = new stdClass();
$message->chatid = $olduser->chatid;
$message->userid = $olduser->userid;
$message->groupid = $olduser->groupid;
}
$DB->update_record("chat", $chat);
- $event = new object(); // Update calendar too
+ $event = new stdClass(); // Update calendar too
$cond = "modulename='chat' AND instance = :chatid AND timestart <> :chattime";
$params = array('chattime'=>$chat->chattime, 'chatid'=>$chatid);
function chat_format_message_manually($message, $courseid, $sender, $currentuser, $chat_lastrow=NULL) {
global $CFG, $USER, $OUTPUT;
- $output = new object();
+ $output = new stdClass();
$output->beep = false; // by default
$output->refreshusers = false; // by default
/// Parse the text to clean and filter it
- $options = new object();
+ $options = new stdClass();
$options->para = false;
$text = format_text($text, FORMAT_MOODLE, $options, $courseid);
static $users; // Cache user lookups
- $result = new object();
+ $result = new stdClass();
if (file_exists($CFG->dirroot . '/mod/chat/gui_ajax/theme/'.$theme.'/config.php')) {
include($CFG->dirroot . '/mod/chat/gui_ajax/theme/'.$theme.'/config.php');
$text = $message->message;
/// Parse the text to clean and filter it
- $options = new object();
+ $options = new stdClass();
$options->para = false;
$text = format_text($text, FORMAT_MOODLE, $options, $courseid);
function choice_user_outline($course, $user, $mod, $choice) {
global $DB;
if ($answer = $DB->get_record('choice_answers', array('choiceid' => $choice->id, 'userid' => $user->id))) {
- $result = new object();
+ $result = new stdClass();
$result->info = "'".format_string(choice_get_option_text($choice, $answer->optionid))."'";
$result->time = $answer->timemodified;
return $result;
function choice_user_complete($course, $user, $mod, $choice) {
global $DB;
if ($answer = $DB->get_record('choice_answers', array("choiceid" => $choice->id, "userid" => $user->id))) {
- $result = new object();
+ $result = new stdClass();
$result->info = "'".format_string(choice_get_option_text($choice, $answer->optionid))."'";
$result->time = $answer->timemodified;
echo get_string("answered", "choice").": $result->info. ".get_string("updated", '', userdate($result->time));
foreach ($choice->option as $key => $value) {
$value = trim($value);
if (isset($value) && $value <> '') {
- $option = new object();
+ $option = new stdClass();
$option->text = $value;
$option->choiceid = $choice->id;
if (isset($choice->limit[$key])) {
//update, delete or insert answers
foreach ($choice->option as $key => $value) {
$value = trim($value);
- $option = new object();
+ $option = new stdClass();
$option->text = $value;
$option->choiceid = $choice->id;
if (isset($choice->limit[$key])) {
AND (d.requiredentries > 0 OR d.requiredentriestoview > 0)
ORDER BY c.fullname, d.name");
if (!empty($databases)) {
- $a = new object();
+ $a = new stdClass();
$a->text = '';
foreach($databases as $database) {
$a->text .= $database->fullname." - " .$database->name. " (course id: ".$database->course." - database id: ".$database->id.")<br/>";
$mform->addElement('advcheckbox', 'field_'.$field->field->id, '<div title="' . s($field->field->description) . '">' . $field->field->name . '</div>', ' (' . $field->name() . ')', array('group'=>1));
$mform->setDefault('field_'.$field->field->id, 1);
} else {
- $a = new object;
+ $a = new stdClass();
$a->fieldtype = $field->name();
$mform->addElement('static', 'unsupported'.$field->field->id, $field->field->name, get_string('unsupportedexport', 'data', $a));
}
// Update the default sort field
if ($fid == $data->defaultsort) {
- $rec = new object();
+ $rec = new stdClass();
$rec->id = $data->id;
$rec->defaultsort = 0;
$rec->defaultsortdir = 0;
case 'sort': // Set the default sort parameters
if (confirm_sesskey()) {
- $rec = new object();
+ $rec = new stdClass();
$rec->id = $data->id;
$rec->defaultsort = $defaultsort;
$rec->defaultsortdir = $defaultsortdir;
function update_content($recordid, $value, $name='') {
global $DB;
- $content = new object();
+ $content = new stdClass();
$content->fieldid = $this->field->id;
$content->recordid = $recordid;
$content->content = $this->format_data_field_checkbox_content($value);
if ($this->day and $this->month and $this->year) { // All of them have been collected now
- $content = new object;
+ $content = new stdClass();
$content->fieldid = $this->field->id;
$content->recordid = $recordid;
$content->content = make_timestamp($this->year, $this->month, $this->day, 12, 0, 0, 0, false);
if (!$content = $DB->get_record('data_content', array('fieldid'=>$this->field->id, 'recordid'=>$recordid))) {
// Quickly make one now!
- $content = new object();
+ $content = new stdClass();
$content->fieldid = $this->field->id;
$content->recordid = $recordid;
$id = $DB->insert_record('data_content', $content);
function update_content($recordid, $value, $name='') {
global $DB;
- $content = new object;
+ $content = new stdClass();
$content->fieldid = $this->field->id;
$content->recordid = $recordid;
$value = trim($value);
echo data_latlong_kml_top();
if($rid) { // List one single item
- $pm = new object();
+ $pm = new stdClass();
$pm->name = data_latlong_kml_get_item_name($content, $field);
$pm->description = "<a href='$CFG->wwwroot/mod/data/view.php?d=$d&rid=$rid'>Item #$rid</a> in Moodle data activity";
$pm->long = $content->content1;
function update_content($recordid, $value, $name='') {
global $DB;
- $content = new object;
+ $content = new stdClass();
$content->fieldid = $this->field->id;
$content->recordid = $recordid;
$content->content = $this->format_data_field_multimenu_content($value);
function update_content($recordid, $value, $name='') {
global $DB;
- $content = new object;
+ $content = new stdClass();
$content->fieldid = $this->field->id;
$content->recordid = $recordid;
$value = trim($value);
if (!$content = $DB->get_record('data_content', array('fieldid'=>$this->field->id, 'recordid'=>$recordid))) {
// Quickly make one now!
- $content = new object();
+ $content = new stdClass();
$content->fieldid = $this->field->id;
$content->recordid = $recordid;
$id = $DB->insert_record('data_content', $content);
function update_content($recordid, $value, $name='') {
global $DB;
- $content = new object;
+ $content = new stdClass();
$content->fieldid = $this->field->id;
$content->recordid = $recordid;
function update_content($recordid, $value, $name='') {
global $DB;
- $content = new object;
+ $content = new stdClass();
$content->fieldid = $this->field->id;
$content->recordid = $recordid;
$names = explode('_', $name);
// Insert new data_content fields with NULL contents:
foreach ($fields as $field) {
- $content = new object();
+ $content = new stdClass();
$content->recordid = $recordid;
$content->fieldid = $field->id;
$DB->insert_record('data_content', $content);
foreach ($record as $key => $value) {
$name = $fieldnames[$key];
$field = $fields[$name];
- $content = new object();
+ $content = new stdClass();
$content->fieldid = $field->id;
$content->recordid = $recordid;
if ($field->type == 'textarea') {
array_push($table->align, 'center');
}
-$options = new object();
+$options = new stdClass();
$options->noclean = true;
$currentsection = "";
if (empty($this->data->id)) {
echo $OUTPUT->notification('Programmer error: dataid not defined in field class');
}
- $this->field = new object;
+ $this->field = new stdClass();
$this->field->id = 0;
$this->field->dataid = $this->data->id;
$this->field->type = $this->type;
if ($content = $DB->get_record('data_content', array('fieldid'=>$this->field->id, 'recordid'=>$recordid))) {
if (isset($content->content)) {
- $options = new object();
+ $options = new stdClass();
if ($this->field->param1 == '1') { // We are autolinking this field, so disable linking within us
//$content->content = '<span class="nolink">'.$content->content.'</span>';
//$content->content1 = FORMAT_HTML;
function update_content($recordid, $value, $name=''){
global $DB;
- $content = new object();
+ $content = new stdClass();
$content->fieldid = $this->field->id;
$content->recordid = $recordid;
$content->content = clean_param($value, PARAM_NOTAGS);
}
if ($update) {
- $newdata = new object();
+ $newdata = new stdClass();
$newdata->id = $data->id;
$newdata->{$template} = $str;
$DB->update_record('data', $newdata);
$idpart = '';
}
- $newdata = new object();
+ $newdata = new stdClass();
$newdata->id = $data->id;
$newdata->singletemplate = str_ireplace('[['.$searchfieldname.']]',
$prestring.$newfieldname.$poststring, $data->singletemplate);
function data_append_new_field_to_templates($data, $newfieldname) {
global $DB;
- $newdata = new object();
+ $newdata = new stdClass();
$newdata->id = $data->id;
$change = false;
$cm = get_coursemodule_from_instance('data', $data->id);
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
- $record = new object();
+ $record = new stdClass();
$record->userid = $USER->id;
$record->dataid = $data->id;
$record->groupid = $groupid;
if ($countrecords = $DB->count_records('data_records', array('dataid'=>$data->id, 'userid'=>$user->id))) {
- $result = new object();
+ $result = new stdClass();
$result->info = get_string('numrecords', 'data', $countrecords);
$lastrecord = $DB->get_record_sql('SELECT id,timemodified FROM {data_records}
WHERE dataid = ? AND userid = ?
}
return $result;
} else if ($grade) {
- $result = new object();
+ $result = new stdClass();
$result->info = get_string('grade') . ': ' . $grade->str_long_grade;
$result->time = $grade->dategraded;
return $result;
data_grade_item_update($data, $grades);
} else if ($userid and $nullifnone) {
- $grade = new object();
+ $grade = new stdClass();
$grade->userid = $userid;
$grade->rawgrade = NULL;
data_grade_item_update($data, $grade);
// actual replacement of the tags
$newtext = preg_replace($patterns, $replacement, $data->asearchtemplate);
- $options = new object();
+ $options = new stdClass();
$options->para=false;
$options->noclean=true;
echo '<tr><td>';
foreach ($dirs as $dir) {
$fulldir = $CFG->dirroot.'/mod/data/preset/'.$dir;
if (is_directory_a_preset($fulldir)) {
- $preset = new object;
+ $preset = new stdClass();
$preset->path = $fulldir;
$preset->userid = 0;
$preset->shortname = $dir;
$resettemplate = false;
if (($mytemplate = data_submitted()) && confirm_sesskey()) {
- $newtemplate = new object();
+ $newtemplate = new stdClass();
$newtemplate->id = $data->id;
$newtemplate->{$mode} = $mytemplate->template;
}
}
if (!empty($val)) {
- $search_array[$field->id] = new object();
+ $search_array[$field->id] = new stdClass();
list($search_array[$field->id]->sql, $search_array[$field->id]->params) = $searchfield->generate_sql('c'.$field->id, $val);
$search_array[$field->id]->data = $val;
$vals[] = $val;
$ln = isset($search_array[DATA_LASTNAME]) ? $search_array[DATA_LASTNAME]->data : '';
}
if (!empty($fn)) {
- $search_array[DATA_FIRSTNAME] = new object();
+ $search_array[DATA_FIRSTNAME] = new stdClass();
$search_array[DATA_FIRSTNAME]->sql = '';
$search_array[DATA_FIRSTNAME]->params = array();
$search_array[DATA_FIRSTNAME]->field = 'u.firstname';
unset($search_array[DATA_FIRSTNAME]);
}
if (!empty($ln)) {
- $search_array[DATA_LASTNAME] = new object();
+ $search_array[DATA_LASTNAME] = new stdClass();
$search_array[DATA_LASTNAME]->sql = '';
$search_array[DATA_FIRSTNAME]->params = array();
$search_array[DATA_LASTNAME]->field = 'u.lastname';
}*/
if ($data->intro and empty($page) and empty($record) and $mode != 'single') {
- $options = new object();
+ $options = new stdClass();
$options->noclean = true;
echo $OUTPUT->box(format_module_intro('data', $data, $cm->id), 'generalbox', 'intro');
}
if ($approve && confirm_sesskey() && $approvecap) {
if ($approverecord = $DB->get_record('data_records', array('id'=>$approve))) { // Need to check this is valid
if ($approverecord->dataid == $data->id) { // Must be from this database
- $newrecord = new object();
+ $newrecord = new stdClass();
$newrecord->id = $approverecord->id;
$newrecord->approved = 1;
$DB->update_record('data_records', $newrecord);
if (empty($records)) {
if ($maxcount){
- $a = new object();
+ $a = new stdClass();
$a->max = $maxcount;
$a->reseturl = "view.php?id=$cm->id&mode=$mode&search=&advanced=0";
echo $OUTPUT->notification(get_string('foundnorecords','data', $a));
} else { // We have some records to print
if ($maxcount != $totalcount) {
- $a = new object();
+ $a = new stdClass();
$a->num = $totalcount;
$a->max = $maxcount;
$a->reseturl = "view.php?id=$cm->id&mode=$mode&search=&advanced=0";
//buffering any output
//this prevents some output before the excel-header will be send
ob_start();
-$fstring = new object();
+$fstring = new stdClass();
$fstring->bold = get_string('bold', 'feedback');
$fstring->page = get_string('page', 'feedback');
$fstring->of = get_string('of', 'feedback');
// $workbook->setVersion(8);
//creating the needed formats
-$xlsFormats = new object();
+$xlsFormats = new stdClass();
$xlsFormats->head1 = $workbook->add_format(array(
'bold'=>1,
'size'=>12));
var $feedbackdata;
function definition() {
- $this->feedbackdata = new object();
+ $this->feedbackdata = new stdClass();
//this function can not be called, because not all data are available at this time
//I use set_form_elements instead
}
feedback_send_email_anonym($cm, $feedback, $course, $userid);
}
//tracking the submit
- $tracking = new object();
+ $tracking = new stdClass();
$tracking->userid = $USER->id;
$tracking->feedback = $feedback->id;
$tracking->completed = $new_completed_id;
$itemnr = $DB->count_records_select('feedback_item', 'feedback = ? AND hasvalue = 1 AND position < ?', array($feedback->id, $startposition));
$lastbreakposition = 0;
$align = right_to_left() ? 'right' : 'left';
-
+
foreach($feedbackitems as $feedbackitem){
if(!isset($startitem)) {
//avoid showing double pagebreaks
}
$startitem = $feedbackitem;
}
-
+
if($feedbackitem->dependitem > 0) {
//chech if the conditions are ok
if(!isset($feedbackcompletedtmp->id) OR !feedback_compare_item_value($feedbackcompletedtmp->id, $feedbackitem->dependitem, $feedbackitem->dependvalue, true)) {
continue;
}
}
-
+
if($feedbackitem->dependitem > 0) {
$dependstyle = ' feedback_complete_depend';
}else {
$dependstyle = '';
}
-
+
echo $OUTPUT->box_start('feedback_item_box_'.$align.$dependstyle);
$value = '';
//get the value
echo '</fieldset>';
echo '</form>';
echo $OUTPUT->box_end();
-
+
echo $OUTPUT->box_start('feedback_complete_cancel');
if($courseid) {
echo '<form action="'.$CFG->wwwroot.'/course/view.php?id='.$courseid.'" method="post" onsubmit=" ">';
var $feedbackdata;
function definition() {
- $this->feedbackdata = new object();
+ $this->feedbackdata = new stdClass();
//this function can not be called, because not all data are available at this time
//I use set_form_elements instead
}
$elementgroup[] =& $mform->createElement('static', 'templatenamelabel', get_string('name', 'feedback'));
$elementgroup[] =& $mform->createElement('text', 'templatename', get_string('name', 'feedback'), array('size'=>'40', 'maxlength'=>'200'));
-
+
//public templates are currently deactivated
// if(has_capability('mod/feedback:createpublictemplate', $this->feedbackdata->context)) {
// $elementgroup[] =& $mform->createElement('checkbox', 'ispublic', get_string('public', 'feedback'), get_string('public', 'feedback'));
if (! $feedback = $DB->get_record("feedback", array("id"=>$cm->instance))) {
print_error('invalidcoursemodule');
}
-
+
if (!$context = get_context_instance(CONTEXT_MODULE, $cm->id)) {
print_error('badcontext');
}
/// Print the page header
$strfeedbacks = get_string("modulenameplural", "feedback");
$strfeedback = get_string("modulename", "feedback");
-
+
$PAGE->set_heading(format_string($course->fullname));
$PAGE->set_title(format_string($feedback->name));
echo $OUTPUT->header();
-
+
/// print the tabs
include('tabs.php');
}
echo $OUTPUT->box_end();
}
-
+
$mform->display();
-
+
// echo $OUTPUT->container_start('mdl-align');
// echo $OUTPUT->single_button(new moodle_url('edit.php', array('id'=>$id, 'do_show'=>'templates')), get_string('cancel'));
// echo $OUTPUT->container_end();
global $CFG, $DB;
feedback_load_feedback_items();
-
+
$deleteolditems = optional_param('deleteolditems', 0, PARAM_INT);
- $error = new object();
+ $error = new stdClass();
$error->stat = true;
$error->msg = array();
}
$itemobj = new $itemclass();
- $newitem = new object();
+ $newitem = new stdClass();
$newitem->feedback = $feedbackid;
$newitem->template = 0;
$newitem->typ = $typ;
$newitem->presentation = 'd>>>>>'.$newitem->presentation;
break;
}
-
+
if(isset($item['#']['DEPENDITEM'][0]['#'])) {
$newitem->dependitem = intval($item['#']['DEPENDITEM'][0]['#']);
}else {
$newitem->dependvalue = '';
}
$olditemid = intval($item['#']['ITEMID'][0]['#']);
-
+
if($typ != 'pagebreak') {
$newitem->hasvalue = $itemobj->get_hasvalue();
}else {
$newitem->required = intval($item['@']['REQUIRED']);
$newitem->position = $position;
$newid = $DB->insert_record('feedback_item', $newitem);
-
+
$itembackup[$olditemid] = $newid;
if($newitem->dependitem) {
$dependitemsmap[$newid] = $newitem->dependitem;
$newitem = $DB->get_record('feedback_item', array('id'=>$key));
$newitem->dependitem = $itembackup[$newitem->dependitem];
$DB->update_record('feedback_item', $newitem);
- }
-
+ }
+
return $error;
}
$properties = array();
for($x = 0; $x < $factorX; $x++) {
for($y = 0; $y < $factorY; $y++) {
- $propobj = new object();
+ $propobj = new stdClass();
$propobj->x = intval($x / $scale);
$propobj->y = intval($y / $scale);
$propobj->red = get_random_color($col_el[0], $col_el[1]);
$checkchar = '';
for($i = 0; $i < $charcount; $i++) {
$colnum = rand(1,2);
- $textcol = new object();
+ $textcol = new stdClass();
$textcol->red = get_random_color(${'col_text'.$colnum}[0], ${'col_text'.$colnum}[1]);
$textcol->green = get_random_color(${'col_text'.$colnum}[0], ${'col_text'.$colnum}[1]);
$textcol->blue = get_random_color(${'col_text'.$colnum}[0], ${'col_text'.$colnum}[1]);
$values = feedback_get_group_values($item, $groupid, $courseid);
if($values) {
$data = array();
- $datavalue = new object();
+ $datavalue = new stdClass();
foreach($values as $value) {
switch($presentation) {
function get_presentation($data) {
// $context = get_context_instance(CONTEXT_MODULE, $data->cmid);
- // $presentation = new object();
+ // $presentation = new stdClass();
// $presentation->id = null;
// $presentation->definition = '';
// $presentation->format = FORMAT_HTML;
$context = get_context_instance(CONTEXT_MODULE, $item->cmid);
$item = file_postupdate_standard_editor($item, 'presentation', $this->presentationoptions, $context, 'mod_feedback', 'item', $item->id);
- // $item = new object();
+ // $item = new stdClass();
// $item->id = $data->id
$DB->update_record('feedback_item', $item);
return $item->id;
var $commonparams;
var $item_form;
var $item;
-
+
function init() {
}
}
//the elements for position dropdownlist
$positionlist = array_slice(range(0,$i_formselect_last),1,$i_formselect_last,true);
-
+
$item->presentation = empty($item->presentation) ? '' : $item->presentation;
$info = $this->get_info($item);
$item->ignoreempty = $this->ignoreempty($item);
$item->hidenoselect = $this->hidenoselect($item);
-
+
//all items for dependitem
$feedbackitems = feedback_get_depend_candidates_for_item($feedback, $item);
$commonparams = array('cmid'=>$cm->id,
function show_editform() {
$this->item_form->display();
}
-
+
function is_cancelled() {
return $this->item_form->is_cancelled();
}
function save_item() {
global $DB;
-
+
if(!$item = $this->item_form->get_data()) {
return false;
}
-
+
if(isset($item->clone_item) AND $item->clone_item) {
$item->id = ''; //to clone this item
$item->position++;
}
-
- $this->set_ignoreempty($item, $item->ignoreempty);
+
+ $this->set_ignoreempty($item, $item->ignoreempty);
$this->set_hidenoselect($item, $item->hidenoselect);
$item->hasvalue = $this->get_hasvalue();
}else {
$DB->update_record('feedback_item', $item);
}
-
+
return $DB->get_record('feedback_item', array('id'=>$item->id));
}
$rowOffset +=3 ;
return $rowOffset;
}
-
- /**
+
+ /**
* print the item at the edit-page of feedback
*
* @global object
//test if required and no value is set so we have to mark this item
//we have to differ check and the other subtypes
$requiredmark = ($item->required == 1) ? '<span class="feedback_required_mark">*</span>' : '';
-
+
//print the question and label
echo '<div class="feedback_item_label_'.$align.'">';
echo '('.$item->label.') ';
}
}
echo '</div>';
-
+
//print the presentation
echo '<div class="feedback_item_presentation_'.$align.'">';
$index = 1;
}else {
$hv = 'v';
}
-
+
if($info->subtype == 'r' AND !$this->hidenoselect($item)) {
//print the "not_selected" item on radiobuttons
?>
echo '</ul>';
echo '</div>';
}
-
- /**
+
+ /**
* print the item at the complete-page of feedback
*
* @global object
//print the presentation
echo '<div class="feedback_item_presentation_'.$align.$highlight.'">';
-
+
echo '<ul>';
if($info->horizontal) {
$hv = 'h';
echo '</div>';
}
- /**
+ /**
* print the item at the complete-page of feedback
*
* @global object
}else {
$requiredmark = ($item->required == 1)?'<span class="feedback_required_mark">*</span>':'';
}
-
+
//print the question and label
echo '<div class="feedback_item_label_'.$align.'">';
echo '('.$item->label.') ';
echo format_text($item->name . $requiredmark, true, false, false);
echo '</div>';
-
+
//print the presentation
echo '<div class="feedback_item_presentation_'.$align.'">';
$index = 1;
$vallist = $data;
return trim($this->item_arrayToString($vallist));
}
-
+
//compares the dbvalue with the dependvalue
//dbvalue is the number of one selection
//dependvalue is the presentation of one selection
}else {
$dbvalues = explode(FEEDBACK_MULTICHOICE_LINE_SEP, $dbvalue);
}
-
+
$info = $this->get_info($item);
$presentation = explode (FEEDBACK_MULTICHOICE_LINE_SEP, $info->presentation);
$index = 1;
}
return false;
}
-
+
function get_presentation($data) {
$present = str_replace("\n", FEEDBACK_MULTICHOICE_LINE_SEP, trim($data->itemvalues));
if(!isset($data->subtype)) {
function get_info($item) {
$presentation = empty($item->presentation) ? '' : $item->presentation;
- $info = new object();
+ $info = new stdClass();
//check the subtype of the multichoice
//it can be check(c), radio(r) or dropdown(d)
$info->subtype = '';
function print_item_radio($presentation, $item, $value, $info, $align) {
$index = 1;
$checked = '';
-
+
if($info->horizontal) {
$hv = 'h';
}else {
}else {
$values = explode(FEEDBACK_MULTICHOICE_LINE_SEP, $value);
}
-
+
if($info->horizontal) {
$hv = 'h';
}else {
}else {
$hv = 'v';
}
-
+
?>
<li class="feedback_item_select_<?php echo $hv.'_'.$align;?>">
<select name="<?php echo $item->typ .'_' . $item->id;?>" size="1">
</li>
<?php
}
-
+
function set_ignoreempty($item, $ignoreempty=true) {
$item->options = str_replace(FEEDBACK_MULTICHOICE_IGNOREEMPTY, '', $item->options);
if($ignoreempty) {
$item->options .= FEEDBACK_MULTICHOICE_IGNOREEMPTY;
}
}
-
+
function ignoreempty($item) {
if(strstr($item->options, FEEDBACK_MULTICHOICE_IGNOREEMPTY)) {
return true;
}
return false;
}
-
+
function set_hidenoselect($item, $hidenoselect=true) {
$item->options = str_replace(FEEDBACK_MULTICHOICE_HIDENOSELECT, '', $item->options);
if($hidenoselect) {
$item->options .= FEEDBACK_MULTICHOICE_HIDENOSELECT;
}
}
-
+
function hidenoselect($item) {
if(strstr($item->options, FEEDBACK_MULTICHOICE_HIDENOSELECT)) {
return true;
}
return false;
}
-
-
+
+
function can_switch_require() {
return true;
}
var $commonparams;
var $item_form;
var $item;
-
+
function init() {
}
}
//the elements for position dropdownlist
$positionlist = array_slice(range(0,$i_formselect_last),1,$i_formselect_last,true);
-
+
$item->presentation = empty($item->presentation) ? '' : $item->presentation;
$info = $this->get_info($item);
-
+
$item->ignoreempty = $this->ignoreempty($item);
$item->hidenoselect = $this->hidenoselect($item);
function show_editform() {
$this->item_form->display();
}
-
+
function is_cancelled() {
return $this->item_form->is_cancelled();
}
function save_item() {
global $DB;
-
+
if(!$item = $this->item_form->get_data()) {
return false;
}
-
+
if(isset($item->clone_item) AND $item->clone_item) {
$item->id = ''; //to clone this item
$item->position++;
}
-
- $this->set_ignoreempty($item, $item->ignoreempty);
+
+ $this->set_ignoreempty($item, $item->ignoreempty);
$this->set_hidenoselect($item, $item->hidenoselect);
-
+
$item->hasvalue = $this->get_hasvalue();
if(!$item->id) {
$item->id = $DB->insert_record('feedback_item', $item);
}else {
$DB->update_record('feedback_item', $item);
}
-
+
return $DB->get_record('feedback_item', array('id'=>$item->id));
}
$rowOffset +=2 ;
return $rowOffset;
}
-
- /**
+
+ /**
* print the item at the edit-page of feedback
*
* @global object
*/
function print_item_preview($item) {
global $OUTPUT, $DB;
-
+
$align = right_to_left() ? 'right' : 'left';
$info = $this->get_info($item);
}
}
echo '</div>';
-
+
//print the presentation
echo '<div class="feedback_item_presentation_'.$align.'">';
switch($info->subtype) {
}
echo '</div>';
}
-
- /**
+
+ /**
* print the item at the complete-page of feedback
*
* @global object
}else {
$highlight = '';
}
-
+
//print the question and label
echo '<div class="feedback_item_label_'.$align.$highlight.'">';
echo format_text($item->name.$requiredmark, true, false, false);
echo '</div>';
-
+
//print the presentation
echo '<div class="feedback_item_presentation_'.$align.$highlight.'">';
switch($info->subtype) {
echo '</div>';
}
- /**
+ /**
* print the item at the complete-page of feedback
*
* @global object
$lines = explode (FEEDBACK_MULTICHOICERATED_LINE_SEP, $info->presentation);
$requiredmark = ($item->required == 1)?'<span class="feedback_required_mark">*</span>':'';
-
+
//print the question and label
echo '<div class="feedback_item_label_'.$align.'">';
echo '('.$item->label.') ';
echo format_text($item->name . $requiredmark, true, false, false);
echo '</div>';
-
+
//print the presentation
echo '<div class="feedback_item_presentation_'.$align.'">';
$index = 1;
}else {
$dbvalues = explode(FEEDBACK_MULTICHOICERATED_LINE_SEP, $dbvalue);
}
-
+
$info = $this->get_info($item);
$presentation = explode (FEEDBACK_MULTICHOICERATED_LINE_SEP, $info->presentation);
$index = 1;
function get_info($item) {
$presentation = empty($item->presentation) ? '' : $item->presentation;
- $info = new object();
+ $info = new stdClass();
//check the subtype of the multichoice
//it can be check(c), radio(r) or dropdown(d)
$info->subtype = '';
$info->presentation = '';
$info->horizontal = false;
-
+
@list($info->subtype, $info->presentation) = explode(FEEDBACK_MULTICHOICERATED_TYPE_SEP, $item->presentation);
if(!isset($info->subtype)) {
function print_item_radio($item, $value, $info, $align, $showrating, $lines) {
$index = 1;
$checked = '';
-
+
if($info->horizontal) {
$hv = 'h';
}else {
$radio_value = explode(FEEDBACK_MULTICHOICERATED_VALUE_SEP, $line);
$inputname = $item->typ . '_' . $item->id;
$inputid = $inputname.'_'.$index;
- ?>
+ ?>
<li class="feedback_item_radio_<?php echo $hv.'_'.$align;?>">
<span class="feedback_item_radio_<?php echo $hv.'_'.$align;?>">
<input type="radio" name="<?php echo $inputname;?>" id="<?php echo $inputid;?>" value="<?php echo $index;?>" <?php echo $checked;?> />
$item->options .= FEEDBACK_MULTICHOICERATED_IGNOREEMPTY;
}
}
-
+
function ignoreempty($item) {
if(strstr($item->options, FEEDBACK_MULTICHOICERATED_IGNOREEMPTY)) {
return true;
}
return false;
}
-
+
function set_hidenoselect($item, $hidenoselect=true) {
$item->options = str_replace(FEEDBACK_MULTICHOICERATED_HIDENOSELECT, '', $item->options);
if($hidenoselect) {
$item->options .= FEEDBACK_MULTICHOICERATED_HIDENOSELECT;
}
}
-
+
function hidenoselect($item) {
if(strstr($item->options, FEEDBACK_MULTICHOICERATED_HIDENOSELECT)) {
return true;
}
return false;
}
-
+
function can_switch_require() {
return true;
}
}
}
- $tmpactivity = new object();
+ $tmpactivity = new stdClass();
$tmpactivity->type = 'feedback';
$tmpactivity->cmid = $cm->id;
function feedback_create_template($courseid, $name, $ispublic = 0) {
global $DB;
- $templ = new object();
+ $templ = new stdClass();
$templ->course = $courseid;
$templ->name = $name;
$templ->ispublic = $ispublic;
//copy all included files to the feedback_template filearea
if ($itemfiles = $fs->get_area_files($f_context->id, 'mod_feedback', 'item', $item->id, "id", false)) {
foreach($itemfiles as $ifile) {
- $file_record = new object();
+ $file_record = new stdClass();
$file_record->contextid = $c_context->id;
$file_record->component = 'mod_feedback';
$file_record->filearea = 'template';
//TODO: moving the files to the new items
if ($templatefiles = $fs->get_area_files($c_context->id, 'mod_feedback', 'template', $t_item->id, "id", false)) {
foreach($templatefiles as $tfile) {
- $file_record = new object();
+ $file_record = new stdClass();
$file_record->contextid = $f_context->id;
$file_record->component = 'mod_feedback';
$file_record->filearea = 'item';
function feedback_create_item($data) {
global $DB;
- $item = new object;
+ $item = new stdClass();
$item->feedback = $data->feedbackid;
$item->template=0;
global $DB;
//first we create a completedtmp
- $tmpcpl = new object();
+ $tmpcpl = new stdClass();
foreach($feedbackcompleted as $key => $value) {
$tmpcpl->{$key} = $value;
}
return false;
}
- $item = new object();
+ $item = new stdClass();
$item->feedback = $feedbackid;
$item->template=0;
$tmpstr = $tmp ? 'tmp' : '';
//first we create a new completed record
- $completed = new object();
+ $completed = new stdClass();
$completed->feedback = $feedbackid;
$completed->userid = $usrid;
$completed->guestid = $guestid;
if(is_null($itemvalue)) {
continue;
}
- $value = new object();
+ $value = new stdClass();
$value->item = $item->id;
$value->completed = $completed->id;
$value->course_id = $courseid;
continue;
}
- $newvalue = new object();
+ $newvalue = new stdClass();
$newvalue->item = $item->id;
$newvalue->completed = $completed->id;
$newvalue->course_id = $courseid;
$printusername = $feedback->anonymous == FEEDBACK_ANONYMOUS_NO ? fullname($user) : get_string('anonymous_user', 'feedback');
foreach ($teachers as $teacher) {
- $info = new object();
+ $info = new stdClass();
$info->username = $printusername;
$info->feedback = format_string($feedback->name,true);
$info->url = $CFG->wwwroot.'/mod/feedback/show_entries.php?id='.$cm->id.'&userid='.$userid.'&do_show=showentries';
$posthtml = ($teacher->mailformat == 1) ? feedback_send_email_html($info, $course, $cm) : '';
if($feedback->anonymous == FEEDBACK_ANONYMOUS_NO) {
- $eventdata = new object();
+ $eventdata = new stdClass();
$eventdata->name = 'feedback';
$eventdata->component = 'mod';
$eventdata->userfrom = $user;
$eventdata->smallmessage = '';
message_send($eventdata);
}else {
- $eventdata = new object();
+ $eventdata = new stdClass();
$eventdata->name = 'feedback';
$eventdata->component = 'mod';
$eventdata->userfrom = $teacher;
$printusername = get_string('anonymous_user', 'feedback');
foreach ($teachers as $teacher) {
- $info = new object();
+ $info = new stdClass();
$info->username = $printusername;
$info->feedback = format_string($feedback->name,true);
$info->url = $CFG->wwwroot.'/mod/feedback/show_entries_anonym.php?id='.$cm->id;
$posttext = feedback_send_email_text($info, $course);
$posthtml = ($teacher->mailformat == 1) ? feedback_send_email_html($info, $course, $cm) : '';
- $eventdata = new object();
+ $eventdata = new stdClass();
$eventdata->name = 'feedback';
$eventdata->component = 'mod';
$eventdata->userfrom = $teacher;
global $SESSION;
if (!empty($SESSION)) {
if (!isset($SESSION->feedback) OR !is_object($SESSION->feedback)) {
- $SESSION->feedback = new object();
+ $SESSION->feedback = new stdClass();
}
}
}
\ No newline at end of file
if(is_array($messageuser)) {
foreach ($messageuser as $userid) {
$senduser = $DB->get_record('user', array('id'=>$userid));
- $eventdata = new object();
+ $eventdata = new stdClass();
$eventdata->name = 'feedback';
$eventdata->component = 'mod';
$eventdata->userfrom = $USER;
$introformat = FORMAT_MOODLE;
}
- $folder = new object();
+ $folder = new stdClass();
$folder->course = $candidate->course;
$folder->name = $candidate->name;
$folder->intro = $intro;
$PAGE->set_heading($course->fullname);
$PAGE->set_activity_record($folder);
-$data = new object();
+$data = new stdClass();
$data->id = $cm->id;
$options = array('subdirs'=>1, 'maxbytes'=>$CFG->maxbytes, 'maxfiles'=>-1, 'accepted_types'=>'*', 'return_types'=>FILE_INTERNAL);
file_prepare_standard_filemanager($data, 'files', $options, $context, 'mod_folder', 'content', 0);
$numviews = count($logs);
$lastlog = array_pop($logs);
- $result = new object();
+ $result = new stdClass();
$result->info = get_string('numviews', '', $numviews);
$result->time = $lastlog->time;
}
$searchform = forum_search_form($course);
-
+
if ($parent != $discussion->firstpost) {
$PAGE->navbar->add(format_string($post->subject));
}
require_once($CFG->libdir.'/portfoliolib.php');
$button = new portfolio_add_button();
$button->set_callback_options('forum_portfolio_caller', array('discussionid' => $discussion->id), '/mod/forum/locallib.php');
- $button->render();
- echo '</div>';
+ $button->render();
+ echo '</div>';
}
if ($forum->type != 'single'
echo "</div>";
if (!empty($forum->blockafter) && !empty($forum->blockperiod)) {
- $a = new object();
+ $a = new stdClass();
$a->blockafter = $forum->blockafter;
$a->blockperiod = get_string('secondstotime'.$forum->blockperiod);
echo $OUTPUT->notification(get_string('thisforumisthrottled','forum',$a));
$modcontext = get_context_instance(CONTEXT_MODULE, $forum->coursemodule);
if ($forum->type == 'single') { // Create related discussion.
- $discussion = new object();
+ $discussion = new stdClass();
$discussion->course = $forum->course;
$discussion->forum = $forum->id;
$discussion->name = $forum->name;
$discussion = array_pop($discussions);
} else {
// try to recover by creating initial discussion - MDL-16262
- $discussion = new object();
+ $discussion = new stdClass();
$discussion->course = $forum->course;
$discussion->forum = $forum->id;
$discussion->name = $forum->name;
// reset the caches
foreach ($coursemodules as $forumid=>$unused) {
- $coursemodules[$forumid]->cache = new object();
+ $coursemodules[$forumid]->cache = new stdClass();
$coursemodules[$forumid]->cache->caps = array();
unset($coursemodules[$forumid]->uservisible);
}
// Does the user want this post in a digest? If so postpone it for now.
if ($userto->maildigest > 0) {
// This user wants the mails to be in digest form
- $queue = new object();
+ $queue = new stdClass();
$queue->userid = $userto->id;
$queue->discussionid = $discussion->id;
$queue->postid = $post->id;
mtrace('Sending ', '');
- $eventdata = new object();
+ $eventdata = new stdClass();
$eventdata->component = 'mod_forum';
$eventdata->name = 'posts';
$eventdata->userfrom = $userfrom;
$postsubject = get_string('digestmailsubject', 'forum', format_string($site->shortname, true));
- $headerdata = new object();
+ $headerdata = new stdClass();
$headerdata->sitename = format_string($site->fullname, true);
$headerdata->userprefs = $CFG->wwwroot.'/user/edit.php?id='.$userid.'&course='.$site->id;
if ($userto->maildigest == 2) {
// Subjects only
- $by = new object();
+ $by = new stdClass();
$by->name = fullname($userfrom);
$by->date = userdate($post->modified);
$posttext .= "\n".format_string($post->subject,true).' '.get_string("bynameondate", "forum", $by);
$count = forum_count_user_posts($forum->id, $user->id);
if ($count && $count->postcount > 0) {
- $result = new object();
+ $result = new stdClass();
$result->info = get_string("numposts", "forum", $count->postcount);
$result->time = $count->lastpost;
if ($grade) {
}
return $result;
} else if ($grade) {
- $result = new object();
+ $result = new stdClass();
$result->info = get_string('grade') . ': ' . $grade->str_long_grade;
$result->time = $grade->dategraded;
return $result;
forum_grade_item_update($forum, $grades);
} else if ($userid and $nullifnone) {
- $grade = new object();
+ $grade = new stdClass();
$grade->userid = $userid;
$grade->rawgrade = NULL;
forum_grade_item_update($forum, $grade);
echo $OUTPUT->notification("Could not find forum module!!");
return false;
}
- $mod = new object();
+ $mod = new stdClass();
$mod->course = $courseid;
$mod->module = $module->id;
$mod->instance = $forum->id;
}
// format the post body
- $options = new object();
+ $options = new stdClass();
$options->para = true;
$formattedtext = format_text($post->message, $post->messageformat, $options, $course->id);
$output .= '<div class="subject">'.format_string($post->subject).'</div>';
$fullname = fullname($userfrom, $viewfullnames);
- $by = new object();
+ $by = new stdClass();
$by->name = '<a href="'.$CFG->wwwroot.'/user/view.php?id='.$userfrom->id.'&course='.$course->id.'">'.$fullname.'</a>';
$by->date = userdate($post->modified, '', $userto->timezone);
$output .= '<div class="author">'.get_string('bynameondate', 'forum', $by).'</div>';
// caching
if (!isset($cm->cache)) {
- $cm->cache = new object();
+ $cm->cache = new stdClass();
}
if (!isset($cm->cache->caps)) {
echo '<table cellspacing="0" class="forumpost'.$read_style.'">';
// Picture
- $postuser = new object();
+ $postuser = new stdClass();
$postuser->id = $post->userid;
$postuser->firstname = $post->firstname;
$postuser->lastname = $post->lastname;
echo '<div class="author">';
$fullname = fullname($postuser, $cm->cache->caps['moodle/site:viewfullnames']);
- $by = new object();
+ $by = new stdClass();
$by->name = '<a href="'.$CFG->wwwroot.'/user/view.php?id='.
$post->userid.'&course='.$course->id.'">'.$fullname.'</a>';
$by->date = userdate($post->modified);
echo '</div>';
}
- $options = new object();
+ $options = new stdClass();
$options->para = false;
$options->trusted = $post->messagetrust;
if ($link and (strlen(strip_tags($post->message)) > $CFG->forum_longpost)) {
echo "</td>\n";
// Picture
- $postuser = new object;
+ $postuser = new stdClass();
$postuser->id = $post->userid;
$postuser->firstname = $post->firstname;
$postuser->lastname = $post->lastname;
echo '<td class="lastpost">';
$usedate = (empty($post->timemodified)) ? $post->modified : $post->timemodified; // Just in case
$parenturl = (empty($post->lastpostid)) ? '' : '&parent='.$post->lastpostid;
- $usermodified = new object();
+ $usermodified = new stdClass();
$usermodified->id = $post->usermodified;
$usermodified->firstname = $post->umfirstname;
$usermodified->lastname = $post->umlastname;
foreach ($posts as $post) {
if ($oldfiles = $fs->get_area_files($oldcontext->id, 'mod_forum', 'attachment', $post->id, "id", false)) {
foreach ($oldfiles as $oldfile) {
- $file_record = new object();
+ $file_record = new stdClass();
$file_record->contextid = $newcontext->id;
$fs->create_file_from_storedfile($file_record, $oldfile);
}
$forum = $DB->get_record('forum', array('id'=>$discussion->forum));
$cm = get_coursemodule_from_instance('forum', $forum->id);
- $post = new object();
+ $post = new stdClass();
$post->discussion = 0;
$post->parent = 0;
$post->userid = $userid;
return true;
}
- $sub = new object();
+ $sub = new stdClass();
$sub->userid = $userid;
$sub->forum = $forumid;
}
}
- $info = new object();
+ $info = new stdClass();
$info->name = fullname($USER);
$info->forum = format_string($forum->name);
}
// $cm holds general cache for forum functions
- $cm->cache = new object();
+ $cm->cache = new stdClass();
$cm->cache->groups = groups_get_all_groups($course->id, 0, $cm->groupingid);
$cm->cache->usersgroups = array();
echo "</div>\n";
continue;
}
- $by = new object();
+ $by = new stdClass();
$by->name = fullname($post, $canviewfullnames);
$by->date = userdate($post->modified);
$aname = format_string($cm->name,true);
foreach ($printposts as $post) {
- $tmpactivity = new object();
+ $tmpactivity = new stdClass();
$tmpactivity->type = 'forum';
$tmpactivity->cmid = $cm->id;
$tmpactivity->sectionnum = $cm->sectionnum;
$tmpactivity->timestamp = $post->modified;
- $tmpactivity->content = new object();
+ $tmpactivity->content = new stdClass();
$tmpactivity->content->id = $post->id;
$tmpactivity->content->discussion = $post->discussion;
$tmpactivity->content->subject = format_string($post->subject);
$tmpactivity->content->parent = $post->parent;
- $tmpactivity->user = new object();
+ $tmpactivity->user = new stdClass();
$tmpactivity->user->id = $post->userid;
$tmpactivity->user->firstname = $post->firstname;
$tmpactivity->user->lastname = $post->lastname;
}
if (!$DB->record_exists('forum_track_prefs', array('userid' => $userid, 'forumid' => $forumid))) {
- $track_prefs = new object();
+ $track_prefs = new stdClass();
$track_prefs->userid = $userid;
$track_prefs->forumid = $forumid;
$DB->insert_record('forum_track_prefs', $track_prefs);
// Lets go find the last post
if (($lastposts = $DB->get_records_sql($sql, array($discussionid), 0, 1))) {
$lastpost = reset($lastposts);
- $discussionobject = new Object;
+ $discussionobject = new stdClass();
$discussionobject->id = $discussionid;
$discussionobject->usermodified = $lastpost->userid;
$discussionobject->timemodified = $lastpost->modified;
.' ON p.discussion = d.id WHERE d.forum = ?'
.' AND p.userid = ? AND p.created > ?', array($forum->id, $USER->id, $timeafter));
- $a = new object();
+ $a = new stdClass();
$a->blockafter = $forum->blockafter;
$a->numposts = $numposts;
$a->blockperiod = get_string('secondstotime'.$forum->blockperiod);
} else {
// Create a course module for the forum and assign it to
// section 0 in the course.
- $mod = new object;
+ $mod = new stdClass();
$mod->course = $forum->course;
$mod->module = $forummodid;
$mod->instance = $forum->id;
$post->author = $users[$post->userid];
$viewfullnames = true;
// format the post body
- $options = new object();
+ $options = new stdClass();
$options->para = true;
$format = $this->get('exporter')->get('format');
$formattedtext = format_text($post->message, $post->messageformat, $options, $this->get('course')->id);
$output .= '<div class="subject">'.format_string($post->subject).'</div>';
$fullname = fullname($users[$post->userid], $viewfullnames);
- $by = new object();
+ $by = new stdClass();
$by->name = $fullname;
$by->date = userdate($post->modified, '', $this->user->timezone);
$output .= '<div class="author">'.get_string('bynameondate', 'forum', $by).'</div>';
exit;
}
-$info = new object();
+$info = new stdClass();
$info->name = fullname($user);
$info->forum = format_string($forum->name);
// Load up the $post variable.
- $post = new object();
+ $post = new stdClass();
$post->course = $course->id;
$post->forum = $forum->id;
$post->discussion = 0; // ie discussion # not defined yet
// Load up the $post variable.
- $post = new object();
+ $post = new stdClass();
$post->course = $course->id;
$post->forum = $forum->id;
$post->discussion = $parent->discussion;
if (!empty($name) && confirm_sesskey()) { // User has confirmed the prune
- $newdiscussion = new object();
+ $newdiscussion = new stdClass();
$newdiscussion->course = $discussion->course;
$newdiscussion->forum = $discussion->forum;
$newdiscussion->name = $name;
$newid = $DB->insert_record('forum_discussions', $newdiscussion);
- $newpost = new object();
+ $newpost = new stdClass();
$newpost->id = $post->id;
$newpost->parent = 0;
$newpost->subject = $name;
//fix for bug #4314
if (!$realpost = $DB->get_record('forum_posts', array('id' => $fromform->id))) {
- $realpost = new object;
+ $realpost = new stdClass();
$realpost->userid = -1;
}
if (empty($discussion->name)) {
if (empty($discussion)) {
- $discussion = new object;
+ $discussion = new stdClass();
}
$discussion->name = $forum->name;
}
$isdiscussion = false;
}
- $formatoptions = new object;
+ $formatoptions = new stdClass();
$items = array();
foreach ($recs as $rec) {
- $item = new object();
- $user = new object();
+ $item = new stdClass();
+ $user = new stdClass();
$item->title = format_string($rec->discussionname);
$user->firstname = $rec->userfirstname;
$user->lastname = $rec->userlastname;
$PAGE->navbar->add(get_string('advancedsearch', 'forum'));
$PAGE->set_title($strsearch);
- $PAGE->set_heading($course->fullname);
+ $PAGE->set_heading($course->fullname);
echo $OUTPUT->header();
forum_print_big_search_form($course);
$PAGE->navbar->add(s($search, true));
if (!$posts = forum_search_posts($searchterms, $course->id, $page*$perpage, $perpage, $totalcount)) {
$PAGE->set_title($strsearchresults);
- $PAGE->set_heading($course->fullname);
+ $PAGE->set_heading($course->fullname);
echo $OUTPUT->header();
echo $OUTPUT->heading(get_string("nopostscontaining", "forum", $search));
// will do it for us later.
$missing_terms = "";
- $options = new object();
+ $options = new stdClass();
$options->trusted = $post->messagetrust;
$message = highlight($strippedsearch,
format_text($post->message, $post->messageformat, $options, $course->id),
redirect($returnto);
}
-$info = new object();
+$info = new stdClass();
$info->name = fullname($USER);
$info->forum = format_string($forum->name);
if (forum_tp_is_tracked($forum) ) {
$ratings = null;
if ($forum->assessed) {
if ($scale = make_grades_menu($forum->scale)) {
- $ratings =new object();
+ $ratings =new stdClass();
$ratings->scale = $scale;
$ratings->assesstimestart = $forum->assesstimestart;
$ratings->assesstimefinish = $forum->assesstimefinish;
require_capability('mod/glossary:approve', $context);
if (!$entry->approved and confirm_sesskey()) {
- $newentry = new object();
+ $newentry = new stdClass();
$newentry->id = $entry->id;
$newentry->approved = 1;
$newentry->timemodified = time(); // wee need this date here to speed up recent activity, TODO: use timestamp in approved field instead in 2.0
if ($oldfiles = $fs->get_area_files($context->id, 'mod_glossary', 'attachment', $entry->id)) {
foreach ($oldfiles as $oldfile) {
- $file_record = new object();
+ $file_record = new stdClass();
$file_record->contextid = $newcontext->id;
$fs->create_file_from_storedfile($file_record, $oldfile);
}
} else { // new entry
require_capability('mod/glossary:write', $context);
// note: guest user does not have any write capability
- $entry = new object();
+ $entry = new stdClass();
$entry->id = null;
}
// TODO: this deletes cats from both both main and secondary glossary :-(
if (!empty($categories) and array_search(0, $categories) === false) {
foreach ($categories as $catid) {
- $newcategory = new object();
+ $newcategory = new stdClass();
$newcategory->entryid = $entry->id;
$newcategory->categoryid = $catid;
$DB->insert_record('glossary_entries_categories', $newcategory, false);
foreach ($aliases as $alias) {
$alias = trim($alias);
if ($alias !== '') {
- $newalias = new object();
+ $newalias = new stdClass();
$newalias->entryid = $entry->id;
$newalias->alias = $alias;
$DB->insert_record('glossary_alias', $newalias, false);
if ( $action == "edit" ) {
if ( $confirm ) {
$action = "";
- $cat = new object();
+ $cat = new stdClass();
$cat->id = $hook;
$cat->name = $name;
$cat->usedynalink = $usedynalink;
} else {
$action = "";
- $cat = new object();
+ $cat = new stdClass();
$cat->name = $name;
$cat->usedynalink = $usedynalink;
$cat->glossaryid = $glossary->id;
if ($oldfiles = $fs->get_area_files($context->id, 'mod_glossary', 'attachment', $entry->id)) {
foreach ($oldfiles as $oldfile) {
- $file_record = new object();
+ $file_record = new stdClass();
$file_record->contextid = $maincontext->id;
$fs->create_file_from_storedfile($file_record, $oldfile);
}
//Use this code to show author's name
//Comments: Configuration not supported
$fullname = fullname($user);
- $by = new object();
+ $by = new stdClass();
$by->name = '<a href="'.$CFG->wwwroot.'/user/view.php?id='.$user->id.'&course='.$course->id.'">'.$fullname.'</a>';
$by->date = userdate($entry->timemodified);
echo '<span class="author">'.get_string('bynameondate', 'forum', $by).'</span>' . '<br />';
echo '</div>';
$fullname = fullname($user);
- $by = new object();
+ $by = new stdClass();
$by->name = '<a href="'.$CFG->wwwroot.'/user/view.php?id='.$user->id.'&course='.$course->id.'">'.$fullname.'</a>';
$by->date = userdate($entry->timemodified);
echo '<span class="author">'.get_string('bynameondate', 'forum', $by).'</span>';
echo '</div>';
$fullname = fullname($user);
- $by = new object();
+ $by = new stdClass();
$by->name = '<a href="'.$CFG->wwwroot.'/user/view.php?id='.$user->id.'&course='.$course->id.'">'.$fullname.'</a>';
$by->date = userdate($entry->timemodified);
echo '<span class="author">'.get_string('bynameondate', 'forum', $by).'</span>';
$aliasname = $xmlalias['#']['NAME'][0]['#'];
if (!empty($aliasname)) {
- $newalias = new object();
+ $newalias = new stdClass();
$newalias->entryid = $newentry->id;
$newalias->alias = trim($aliasname);
$newalias->id = $DB->insert_record("glossary_alias",$newalias);
for($k = 0; $k < sizeof($xmlcats); $k++) {
$xmlcat = $xmlcats[$k];
- $newcat = new object();
+ $newcat = new stdClass();
$newcat->name = $xmlcat['#']['NAME'][0]['#'];
$newcat->usedynalink = $xmlcat['#']['USEDYNALINK'][0]['#'];
if ( !$category = $DB->get_record("glossary_categories", array("glossaryid"=>$glossary->id,"name"=>$newcat->name))) {
// Create the category if it does not exist
- $category = new object();
+ $category = new stdClass();
$category->name = $newcat->name;
$category->glossaryid = $glossary->id;
$category->id = $DB->insert_record("glossary_categories",$category);
}
if ( $category ) {
// inserting the new relation
- $entrycat = new object();
+ $entrycat = new stdClass();
$entrycat->entryid = $newentry->id;
$entrycat->categoryid = $category->id;
$DB->insert_record("glossary_entries_categories",$entrycat);
$newcontext = get_context_instance(CONTEXT_MODULE, $entry->sourcecmid);
if ($oldfiles = $fs->get_area_files($context->id, 'mod_glossary', 'attachment', $entry->id)) {
foreach ($oldfiles as $oldfile) {
- $file_record = new object();
+ $file_record = new stdClass();
$file_record->contextid = $newcontext->id;
$fs->create_file_from_storedfile($file_record, $oldfile);
}
}
if ($entries = glossary_get_user_entries($glossary->id, $user->id)) {
- $result = new object();
+ $result = new stdClass();
$result->info = count($entries) . ' ' . get_string("entries", "glossary");
$lastentry = array_pop($entries);
}
return $result;
} else if ($grade) {
- $result = new object();
+ $result = new stdClass();
$result->info = get_string('grade') . ': ' . $grade->str_long_grade;
$result->time = $grade->dategraded;
return $result;
glossary_grade_item_update($glossary, $grades);
} else if ($userid and $nullifnone) {
- $grade = new object();
+ $grade = new stdClass();
$grade->userid = $userid;
$grade->rawgrade = NULL;
glossary_grade_item_update($glossary, $grade);
//If the format doesn't exist in the table
if (!$rec = $DB->get_record('glossary_formats', array('name'=>$format))) {
//Insert the record in glossary_formats
- $gf = new object();
+ $gf = new stdClass();
$gf->name = $format;
$gf->popupformatname = $format;
$gf->visible = 1;
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
$definition = file_rewrite_pluginfile_urls($definition, 'pluginfile.php', $context->id, 'mod_glossary', 'entry', $entry->id);
- $options = new object();
+ $options = new stdClass();
$options->para = false;
$options->trusted = $entry->definitiontrust;
$definition = format_text($definition, $entry->definitionformat, $options);
*/
function glossary_print_entry_concept($entry, $return=false) {
global $OUTPUT;
- $options = new object();
+ $options = new stdClass();
$options->para = false;
$text = format_text($OUTPUT->heading('<span class="nolink">' . $entry->concept . '</span>', 3, 'nolink'), FORMAT_MOODLE, $options);
if (!empty($entry->highlight)) {
}
}
- $options = new object();
+ $options = new stdClass();
$options->para = false;
$options->trusted = $entry->definitiontrust;
global $OUTPUT, $DB;
$entry = clone $entry;
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
- $options = new object();
+ $options = new stdClass();
$options->para = false;
$options->trusted = $entry->definitiontrust;
$options->context = $context;
}
$items = array();
-
- $formatoptions = new object;
+
+ $formatoptions = new stdClass();
$formatoptions->trusttext = true;
foreach ($recs as $rec) {
- $item = new object();
- $user = new object();
+ $item = new stdClass();
+ $user = new stdClass();
$item->title = $rec->entryconcept;
if ($glossary->rsstype == 1) {//With author
$user->firstname = $rec->userfirstname;
$user->lastname = $rec->userlastname;
-
+
$item->author = fullname($user);
}
$introformat = FORMAT_MOODLE;
}
- $imscp = new object();
+ $imscp = new stdClass();
$imscp->course = $candidate->course;
$imscp->name = $candidate->name;
$imscp->intro = $intro;
$numviews = count($logs);
$lastlog = array_pop($logs);
- $result = new object();
+ $result = new stdClass();
$result->info = get_string('numviews', '', $numviews);
$result->time = $lastlog->time;
$label->name = "label{$label->id}";
$DB->set_field('label', 'name', $label->name, array('id'=>$label->id));
}
- $info = new object();
+ $info = new stdClass();
// no filtering hre because this info is cached and filtered later
$info->extra = format_module_intro('label', $label, $coursemodule->id, false);
$info->name = $label->name;
if ($canmanage) {
// This is the warning msg for teachers to inform them that cluster and unseen does not work while logged in as a teacher
if(lesson_display_teacher_warning($lesson)) {
- $warningvars = new object();
+ $warningvars = new stdClass();
$warningvars->cluster = get_string("clusterjump", "lesson");
$warningvars->unseen = get_string("unseenpageinbranch", "lesson");
$lesson->add_message(get_string("teacherjumpwarning", "lesson", $warningvars));
$gradeinfo = lesson_grade($lesson, $attempt->retry, $attempt->userid);
// Set and update
- $updategrade = new object();
+ $updategrade = new stdClass();
$updategrade->id = $grade->id;
$updategrade->grade = $gradeinfo->grade;
$DB->update_record('lesson_grades', $updategrade);
// Subject
$subject = get_string('essayemailsubject', 'lesson', format_string($pages[$attempt->pageid]->title,true));
- $eventdata = new object();
+ $eventdata = new stdClass();
$eventdata->modulename = 'lesson';
$eventdata->userfrom = $USER;
$eventdata->userto = $users[$attempt->userid];
$manager = lesson_page_type_manager::get($lesson);
$timenow = time();
- $result = new object();
+ $result = new stdClass();
switch ($question->qtype) {
case LESSON_PAGE_SHORTANSWER:
$branchtable = new stdClass;
// all pages have this info
- $page = new object();
+ $page = new stdClass();
$page->lessonid = $lessonid;
$page->prevpageid = 0;
$page->nextpageid = 0;
$page->timemodified = 0;
// all answers are the same
- $answer = new object();
+ $answer = new stdClass();
$answer->lessonid = $lessonid;
$answer->jumpto = LESSON_NEXTPAGE;
$answer->grade = 0;
require_once("$CFG->libdir/gradelib.php");
$grades = grade_get_grades($course->id, 'mod', 'lesson', $lesson->id, $user->id);
- $return = new object();
+ $return = new stdClass();
if (empty($grades->items[0]->grades)) {
$return->info = get_string("no")." ".get_string("attempts", "lesson");
} else {
lesson_grade_item_update($lesson, $grades);
} else if ($userid and $nullifnone) {
- $grade = new object();
+ $grade = new stdClass();
$grade->userid = $userid;
$grade->rawgrade = NULL;
lesson_grade_item_update($lesson, $grade);
public function check_answer() {
global $CFG, $PAGE;
- $formattextdefoptions = new object();
+ $formattextdefoptions = new stdClass();
$formattextdefoptions->noclean = true;
$formattextdefoptions->para = false;
global $DB, $CFG, $PAGE;
$result = parent::check_answer();
- $formattextdefoptions = new object();
+ $formattextdefoptions = new stdClass();
$formattextdefoptions->noclean = true;
$formattextdefoptions->para = false;
}
public function check_answer() {
global $DB, $CFG;
- $formattextdefoptions = new object();
+ $formattextdefoptions = new stdClass();
$formattextdefoptions->noclean = true;
$formattextdefoptions->para = false;
public function display_answers(html_table $table) {
$answers = $this->get_answers();
- $options = new object();
+ $options = new stdClass();
$options->noclean = true;
$options->para = false;
$i = 1;
public function report_answers($answerpage, $answerdata, $useranswer, $pagestats, &$i, &$n) {
$answers = $this->get_answers();
- $formattextdefoptions = new object(); //I'll use it widely in this page
+ $formattextdefoptions = new stdClass(); //I'll use it widely in this page
$formattextdefoptions->para = false;
$formattextdefoptions->noclean = true;
foreach ($answers as $answer) {
$mform->addElement('header', 'pageheader', $OUTPUT->box($contents, 'contents'));
- $options = new object();
+ $options = new stdClass();
$options->para = false;
$options->noclean = true;
$a->total = $lesson->grade;
$lessoncontent .= $lessonoutput->paragraph(get_string("yourcurrentgradeisoutof", "lesson", $a), 'center');
- $grade = new object();
+ $grade = new stdClass();
$grade->lessonid = $lesson->id;
$grade->userid = $USER->id;
$grade->grade = $gradeinfo->grade;
} else {
if ($lesson->timed) {
if ($outoftime == 'normal') {
- $grade = new object();;
+ $grade = new stdClass();;
$grade->lessonid = $lesson->id;
$grade->userid = $USER->id;
$grade->grade = 0;
$introformat = FORMAT_MOODLE;
}
- $page = new object();
+ $page = new stdClass();
$page->course = $candidate->course;
$page->name = $candidate->name;
$page->intro = $intro;
$numviews = count($logs);
$lastlog = array_pop($logs);
- $result = new object();
+ $result = new stdClass();
$result->info = get_string('numviews', '', $numviews);
$result->time = $lastlog->time;
return NULL;
}
- $info = new object();
+ $info = new stdClass();
$info->name = $page->name;
if ($page->display != RESOURCELIB_DISPLAY_POPUP) {
/// Work out a nice title.
$student = $DB->get_record('user', array('id' => $this->get_userid()));
- $a = new object();
+ $a = new stdClass();
$a->fullname = fullname($student, true);
$a->attempt = $this->get_attempt_number();
function xmldb_quiz_install() {
global $DB;
- $record = new object();
+ $record = new stdClass();
$record->name = 'overview';
$record->displayorder = '10000';
$DB->insert_record('quiz_report', $record);
- $record = new object();
+ $record = new stdClass();
$record->name = 'responses';
$record->displayorder = '9000';
$DB->insert_record('quiz_report', $record);
- $record = new object();
+ $record = new stdClass();
$record->name = 'grading';
$record->displayorder = '6000';
$DB->insert_record('quiz_report', $record);
}
if ($oldversion < 2008062001) {
- $reporttoinsert = new object();
+ $reporttoinsert = new stdClass();
$reporttoinsert->name = 'overview';
$reporttoinsert->displayorder = 10000;
$DB->insert_record('quiz_report', $reporttoinsert);
- $reporttoinsert = new object();
+ $reporttoinsert = new stdClass();
$reporttoinsert->name = 'responses';
$reporttoinsert->displayorder = 9000;
$DB->insert_record('quiz_report', $reporttoinsert);
- $reporttoinsert = new object();
+ $reporttoinsert = new stdClass();
$reporttoinsert->name = 'regrade';
$reporttoinsert->displayorder = 7000;
$DB->insert_record('quiz_report', $reporttoinsert);
- $reporttoinsert = new object();
+ $reporttoinsert = new stdClass();
$reporttoinsert->name = 'grading';
$reporttoinsert->displayorder = 6000;
$DB->insert_record('quiz_report', $reporttoinsert);
quiz_grade_item_update($quiz, $grades);
} else if ($userid and $nullifnone) {
- $grade = new object();
+ $grade = new stdClass();
$grade->userid = $userid;
$grade->rawgrade = NULL;
quiz_grade_item_update($quiz, $grade);
$body = get_string('emailconfirmbody', 'quiz', $a);
// send email and analyse result
- $eventdata = new object();
+ $eventdata = new stdClass();
$eventdata->modulename = 'quiz';
$eventdata->userfrom = get_admin();
$eventdata->userto = $USER;
$body = get_string('emailnotifybody', 'quiz', $a);
// send email and analyse result
- $eventdata = new object();
+ $eventdata = new stdClass();
$eventdata->modulename = 'quiz';
$eventdata->userfrom = $USER;
$eventdata->userto = $recipient;
}
else {
// new override
- $data = new object();
+ $data = new stdClass();
}
// merge quiz defaults with data
$accessmanager->clear_password_access();
/// Trigger event
-$eventdata = new object();
+$eventdata = new stdClass();
$eventdata->component = 'mod_quiz';
$eventdata->course = $attemptobj->get_courseid();
$eventdata->quiz = $attemptobj->get_quizid();
}
$qmenu = array();
foreach ($gradeableqs as $qid => $questionformenu){
- $a= new object();
+ $a= new stdClass();
$a->number = $gradeableqs[$qid]->number;
$a->name = $gradeableqs[$qid]->name;
$a->gradedattempts =$qattempts[$qid]->gradedattempts;
if (!$questionid){
return true;
}
- $a= new object();
+ $a= new stdClass();
$a->number = $question->number;
$a->name = $question->name;
$a->gradedattempts =$qattempts[$question->id]->gradedattempts;
} else if ($userid){
echo $OUTPUT->heading(get_string('gradinguser','quiz_grading', $fullname), 3);
} else if ($attemptid){
- $a = new object();
+ $a = new stdClass();
$a->fullname = $fullname;
$a->attempt = $firstattempt->attempt;
echo $OUTPUT->heading(get_string('gradingattempt','quiz_grading', $a), 3);
$gradedclass = 'main';
$gradedstring = '';
}
- $a = new object();
+ $a = new stdClass();
$a->fullname = fullname($attempt, true);
$a->attempt = $attempt->attempt;
function col_picture($attempt){
global $COURSE, $OUTPUT;
- $user = new object();
+ $user = new stdClass();
$user->id = $attempt->userid;
$user->lastname = $attempt->lastname;
$user->firstname = $attempt->firstname;
if (!$this->_customdata['currentgroup']){
$studentsstring = get_string('participants');
} else {
- $a = new object();
+ $a = new stdClass();
$a->coursestudent = get_string('participants');
$a->groupname = groups_get_group_name($this->_customdata['currentgroup']);
if (20 < strlen($a->groupname)){
echo '<div class="quizattemptcounts">' . $strattemptnum . '</div>';
}
}
-
+
if (!$nostudents || ($attemptsmode == QUIZ_REPORT_ATTEMPTS_ALL)) {
// Construct the SQL
$table->set_count_sql("SELECT COUNT(1) FROM $from WHERE $where", $params);
- $sqlobject = new object;
+ $sqlobject = new stdClass();
$sqlobject->from = $from;
$sqlobject->where = $where;
$sqlobject->params = $params;
if (has_capability('mod/quiz:regrade', $this->context)) {
$countregradeneeded = $this->count_regrade_all_needed($quiz, $groupstudents);
if ($currentgroup) {
- $a= new object();
+ $a= new stdClass();
$a->groupname = groups_get_group_name($currentgroup);
$a->coursestudents = get_string('participants');
$a->countregradeneeded = $countregradeneeded;
$changed = regrade_question_in_attempt($question, $attempt, $quiz, true, $dry);
$attemptsdone++;
- $a = new object();
+ $a = new stdClass();
$a->done = $attemptsdone;
$a->todo = $attemptstodo;
$apb->update($attemptsdone, $attemptstodo, get_string('attemptprogress', 'quiz_overview', $a));
}
$qsdone++;
if (isset($qpb)) {
- $a = new object();
+ $a = new stdClass();
$a->done = $qsdone;
$a->todo = $qstodo;
$qpb->update($qsdone, $qstodo, get_string('qprogress', 'quiz_overview', $a));
}
if (!empty($apb)) {
$attemptsdone++;
- $a = new object();
+ $a = new stdClass();
$a->done = $attemptsdone;
$a->todo = $attemptstodo;
$apb->update($attemptsdone, $attemptstodo, get_string('attemptprogress', 'quiz_overview', $a));
function col_picture($attempt){
global $COURSE, $OUTPUT;
- $user = new object();
+ $user = new stdClass();
$user->id = $attempt->userid;
$user->lastname = $attempt->lastname;
$user->firstname = $attempt->firstname;
if (!$this->_customdata['currentgroup']){
$studentsstring = get_string('participants');
} else {
- $a = new object();
+ $a = new stdClass();
$a->coursestudent = get_string('participants');
$a->groupname = groups_get_group_name($this->_customdata['currentgroup']);
if (20 < strlen($a->groupname)){
public static $includecoverage = array('mod/quiz/report/reportlib.php');
function test_quiz_report_index_by_keys() {
$datum = array();
- $object = new object();
+ $object = new stdClass();
$object->qid = 3;
$object->aid = 101;
$object->response = '';
function xmldb_quiz_statistics_install() {
global $DB;
- $record = new object();
+ $record = new stdClass();
$record->name = 'statistics';
$record->displayorder = 8000;
$record->cron = 18000;
$this->questions = $questions;
}
function stats_init_object(){
- $statsinit = new object();
+ $statsinit = new stdClass();
$statsinit->s = 0;
$statsinit->totalgrades = 0;
$statsinit->totalothergrades = 0;
uasort($responses[$subqid][$aid], array('quiz_statistics_report', 'sort_answers'));
}
if (isset($responses[$subqid]['0'])){
- $wildcardresponse = new object();
+ $wildcardresponse = new stdClass();
$wildcardresponse->answer = '*';
$wildcardresponse->credit = 0;
$teacherresponses[$subqid][0] = $wildcardresponse;
}
uasort($tresponsesforsubq, array('quiz_statistics_report', 'sort_response_details'));
foreach ($tresponsesforsubq as $aid => $teacherresponse){
- $teacherresponserow = new object();
+ $teacherresponserow = new stdClass();
$teacherresponserow->response = $teacherresponse->answer;
$teacherresponserow->rcount = 0;
$teacherresponserow->subq = $subq;
$sql = 'SELECT COUNT(1) ' .
'FROM ' .$fromqa.' '.
'WHERE ' .$whereqa.' AND qa.timefinish > :time';
- $a = new object();
+ $a = new stdClass();
$a->lastcalculated = format_time(time() - $quizstats->timemodified);
if (!$a->count = $DB->count_records_sql($sql, array('time'=>$quizstats->timemodified)+$qaparams)){
$a->count = 0;
$usingattemptsstring = '';
} else {
$firstattempt = $attempttotals[1];
- $allattempts = new object();
+ $allattempts = new stdClass();
$allattempts->countrecs = $firstattempt->countrecs +
(isset($attempttotals[0])?$attempttotals[0]->countrecs:0);
$allattempts->total = $firstattempt->total +
} else {
$s = 0;
}
- $quizstats = new object();
+ $quizstats = new stdClass();
if ($s == 0){
$quizstats->firstattemptscount = 0;
$quizstats->allattemptscount = 0;
while (NULL !== ($line = array_shift($filecontents))) {
$data = $this->get_fields_from_csv($line);
$arraykey = reset($data);
- $object = new object();
+ $object = new stdClass();
foreach ($keys as $key) {
$value = array_shift($data);
if ($value !== NULL){
//Iterate over questions
for($i = 0; $i < sizeof($questions); $i++) {
- $question = new object;
+ $question = new stdClass();
$que_info = $questions[$i];
//traverse_xmlize($que_info); //Debug
//print_object ($GLOBALS['traverse_array']); //Debug
$multianswer->answers = implode(",",$ansarr);
//Build the new question structure
- $question = new object;
+ $question = new stdClass();
$question->category = $parentquestion->category;
$question->parent = $parentquestion->id;
$question->name = $parentquestion->name;
if ($status) {
ksort($createdquestions);
- $multianswerdb = new object;
+ $multianswerdb = new stdClass();
$multianswerdb->question = $parentquestion->id;
$multianswerdb->sequence = implode(",",$createdquestions);
$mid = $DB->insert_record('question_multianswer', $multianswerdb);
save_question_session($question, $states[$i]);
}
/// Trigger event
-$eventdata = new object();
+$eventdata = new stdClass();
$eventdata->component = 'mod_quiz';
$eventdata->course = $quizobj->get_courseid();
$eventdata->quiz = $quizobj->get_quizid();
// public site files
$path = $matches[2];
- $resource = new object();
+ $resource = new stdClass();
$resource->id = $candidate->oldid;
$resource->tobemigrated = 0;
$resource->mainfile = $path;
// current course files
$path = $matches[2];
- $resource = new object();
+ $resource = new stdClass();
$resource->id = $candidate->oldid;
$resource->tobemigrated = 0;
$resource->mainfile = $path;
preg_match("/^[^?#]+/", $path, $matches);
$parts = $matches[0];
- $resource = new object();
+ $resource = new stdClass();
$resource->id = $candidate->oldid;
$resource->tobemigrated = 0;
$resource->mainfile = $path;
$numviews = count($logs);
$lastlog = array_pop($logs);
- $result = new object();
+ $result = new stdClass();
$result->info = get_string('numviews', '', $numviews);
$result->time = $lastlog->time;
return NULL;
}
- $info = new object();
+ $info = new stdClass();
$info->name = $resource->name;
if ($resource->tobemigrated) {
$track->timemodified = time();
$DB->update_record('scorm_scoes_track',$track);
} else {
- $track = new object();
+ $track = new stdClass();
$track->userid = $USER->id;
$track->scormid = $scorm->id;
$track->scoid = $sco->id;
*/
function scorm_get_aicc_columns($row,$mastername='system_id') {
$tok = strtok(strtolower($row),"\",\n\r");
- $result = new object();
+ $result = new stdClass();
$result->columns = array();
$i=0;
while ($tok) {
$launch = 0;
if (isset($courses)) {
foreach ($courses as $course) {
- $sco = new object();
+ $sco = new stdClass();
$sco->identifier = $course->id;
$sco->scorm = $scorm->id;
$sco->organization = '';
$id = $DB->insert_record('scorm_scoes',$sco);
}
if (!empty($id)) {
- $scodata = new object();
+ $scodata = new stdClass();
$scodata->scoid = $id;
if (isset($element->web_launch)) {
$scodata->name = 'parameters';
$grades = grade_get_grades($course->id, 'mod', 'scorm', $scorm->id, $user->id);
if (!empty($grades->items[0]->grades)) {
$grade = reset($grades->items[0]->grades);
- $result = new object();
+ $result = new stdClass();
$result->info = get_string('grade') . ': '. $grade->str_long_grade;
$result->time = $grade->dategraded;
return $result;
if (empty($userid)) {
if ($scousers = $DB->get_records_select('scorm_scoes_track', "scormid=? GROUP BY userid", array($scorm->id), "", "userid,null")) {
foreach ($scousers as $scouser) {
- $grades[$scouser->userid] = new object();
+ $grades[$scouser->userid] = new stdClass();
$grades[$scouser->userid]->id = $scouser->userid;
$grades[$scouser->userid]->userid = $scouser->userid;
$grades[$scouser->userid]->rawgrade = scorm_grade_user($scorm, $scouser->userid);
if (!$DB->get_records_select('scorm_scoes_track', "scormid=? AND userid=? GROUP BY userid", array($scorm->id, $userid), "", "userid,null")) {
return false; //no attempt yet
}
- $grades[$userid] = new object();
+ $grades[$userid] = new stdClass();
$grades[$userid]->id = $userid;
$grades[$userid]->userid = $userid;
$grades[$userid]->rawgrade = scorm_grade_user($scorm, $userid);
scorm_grade_item_update($scorm, $grades);
} else if ($userid and $nullifnone) {
- $grade = new object();
+ $grade = new stdClass();
$grade->userid = $userid;
$grade->rawgrade = NULL;
scorm_grade_item_update($scorm, $grade);
}
}
if ($tracks = $DB->get_records('scorm_scoes_track', array('userid'=>$userid, 'scoid'=>$scoid, 'attempt'=>$attempt),'element ASC')) {
- $usertrack = new object();
+ $usertrack = new stdClass();
$usertrack->userid = $userid;
$usertrack->scoid = $scoid;
// Defined in order to unify scorm1.2 and scorm2004
function scorm_get_sco_runtime($scormid, $scoid, $userid, $attempt=1) {
global $DB;
- $timedata = new object();
+ $timedata = new stdClass();
$sql = !empty($scoid) ? "userid=$userid AND scormid=$scormid AND scoid=$scoid AND attempt=$attempt" : "userid=$userid AND scormid=$scormid AND attempt=$attempt";
$tracks = $DB->get_records_select('scorm_scoes_track',"$sql ORDER BY timemodified ASC");
if ($tracks) {
if ($answers = $DB->get_records("survey_answers", array('survey'=>$survey->id, 'userid'=>$user->id))) {
$lastanswer = array_pop($answers);
- $result = new object();
+ $result = new stdClass();
$result->info = get_string("done", "survey");
$result->time = $lastanswer->time;
return $result;
function survey_add_analysis($survey, $user, $notes) {
global $DB;
- $record = new object();
+ $record = new stdClass();
$record->survey = $survey;
$record->userid = $user;
$record->notes = $notes;
$timenow = time();
foreach ($answers as $key => $val) {
if ($key != 'sesskey') {
- $newdata = new object();
+ $newdata = new stdClass();
$newdata->time = $timenow;
$newdata->userid = $USER->id;
$newdata->survey = $survey->id;
$introformat = FORMAT_MOODLE;
}
- $url = new object();
+ $url = new stdClass();
$url->course = $candidate->course;
$url->name = $candidate->name;
$url->intro = $intro;
$numviews = count($logs);
$lastlog = array_pop($logs);
- $result = new object();
+ $result = new stdClass();
$result->info = get_string('numviews', '', $numviews);
$result->time = $lastlog->time;
return NULL;
}
- $info = new object();
+ $info = new stdClass();
$info->name = $url->name;
//note: there should be a way to differentiate links from normal resources
$usehtmleditor = can_use_html_editor();
echo '<table><tr><td>';
if ($usehtmleditor) { //clean and convert before editing
- $options = new object();
+ $options = new stdClass();
$options->smiley = false;
$options->filter = false;
$oldtext = format_text(ewiki_format($data["content"]), $moodle_format, $options);