return get_system_context();
}
- $context = new object();
+ $context = new stdClass();
$context->contextlevel = $contextlevel;
$context->instanceid = $instanceid;
global $DB, $ACCESSLIB_PRIVATE;
if ($cache and defined('SYSCONTEXTID')) {
if (is_null($ACCESSLIB_PRIVATE->systemcontext)) {
- $ACCESSLIB_PRIVATE->systemcontext = new object();
+ $ACCESSLIB_PRIVATE->systemcontext = new stdClass();
$ACCESSLIB_PRIVATE->systemcontext->id = SYSCONTEXTID;
$ACCESSLIB_PRIVATE->systemcontext->contextlevel = CONTEXT_SYSTEM;
$ACCESSLIB_PRIVATE->systemcontext->instanceid = 0;
}
if (!$context) {
- $context = new object();
+ $context = new stdClass();
$context->contextlevel = CONTEXT_SYSTEM;
$context->instanceid = 0;
$context->depth = 1;
$context = get_context_instance(CONTEXT_SYSTEM);
// Insert the role record.
- $role = new object();
+ $role = new stdClass();
$role->name = $name;
$role->shortname = $shortname;
$role->description = $description;
return true;
}
- $cap = new object;
+ $cap = new stdClass();
$cap->contextid = $contextid;
$cap->roleid = $roleid;
$cap->capability = $capability;
}
// Create a new entry
- $ra = new object();
+ $ra = new stdClass();
$ra->roleid = $roleid;
$ra->contextid = $context->id;
$ra->userid = $userid;
$filecaps[$cachedcap->name]['riskbitmask'] = 0; // no risk if not specified
}
if ($cachedcap->captype != $filecaps[$cachedcap->name]['captype']) {
- $updatecap = new object();
+ $updatecap = new stdClass();
$updatecap->id = $cachedcap->id;
$updatecap->captype = $filecaps[$cachedcap->name]['captype'];
$DB->update_record('capabilities', $updatecap);
}
if ($cachedcap->riskbitmask != $filecaps[$cachedcap->name]['riskbitmask']) {
- $updatecap = new object();
+ $updatecap = new stdClass();
$updatecap->id = $cachedcap->id;
$updatecap->riskbitmask = $filecaps[$cachedcap->name]['riskbitmask'];
$DB->update_record('capabilities', $updatecap);
$filecaps[$cachedcap->name]['contextlevel'] = 0; // no context level defined
}
if ($cachedcap->contextlevel != $filecaps[$cachedcap->name]['contextlevel']) {
- $updatecap = new object();
+ $updatecap = new stdClass();
$updatecap->id = $cachedcap->id;
$updatecap->contextlevel = $filecaps[$cachedcap->name]['contextlevel'];
$DB->update_record('capabilities', $updatecap);
}
// Add new capabilities to the stored definition.
foreach ($newcaps as $capname => $capdef) {
- $capability = new object();
+ $capability = new stdClass();
$capability->name = $capname;
$capability->captype = $capdef['captype'];
$capability->contextlevel = $capdef['contextlevel'];
function allow_override($sroleid, $troleid) {
global $DB;
- $record = new object();
+ $record = new stdClass();
$record->roleid = $sroleid;
$record->allowoverride = $troleid;
$DB->insert_record('role_allow_override', $record);
function allow_assign($fromroleid, $targetroleid) {
global $DB;
- $record = new object();
+ $record = new stdClass();
$record->roleid = $fromroleid;
$record->allowassign = $targetroleid;
$DB->insert_record('role_allow_assign', $record);
function allow_switch($fromroleid, $targetroleid) {
global $DB;
- $record = new object();
+ $record = new stdClass();
$record->roleid = $fromroleid;
$record->allowswitch = $targetroleid;
$DB->insert_record('role_allow_switch', $record);
}
// note: in PHP5 the objects are passed by reference, no need to return $rec
- $context = new object();
+ $context = new stdClass();
$context->id = $rec->ctxid; unset($rec->ctxid);
$context->path = $rec->ctxpath; unset($rec->ctxpath);
$context->depth = $rec->ctxdepth; unset($rec->ctxdepth);
foreach ($allroles as $role) {
$rolesort[$i] = $role->id;
if ($role->sortorder != $i) {
- $r = new object();
+ $r = new stdClass();
$r->id = $role->id;
$r->sortorder = $i;
$DB->update_record('role', $r);
$found = true;
}
if ($found) {
- $result = new object();
+ $result = new stdClass();
$result->page = $this;
$result->settings = array();
return array($this->name => $result);
* if you specify something other than system or front page. Defaults to system.
*/
public function __construct($name, $visiblename, $req_capability='moodle/site:config', $hidden=false, $context=NULL) {
- $this->settings = new object();
+ $this->settings = new stdClass();
$this->name = $name;
$this->visiblename = $visiblename;
if (is_array($req_capability)) {
}
if ($found) {
- $result = new object();
+ $result = new stdClass();
$result->page = $this;
$result->settings = $found;
return array($this->name => $result);
$found = true;
}
if ($found) {
- $result = new object();
+ $result = new stdClass();
$result->page = $this;
$result->settings = array();
return array($this->name => $result);
set_config($name, $value, $this->plugin);
// log change
- $log = new object();
+ $log = new stdClass();
$log->userid = during_initial_install() ? 0 :$USER->id; // 0 as user id during install
$log->timemodified = time();
$log->plugin = $this->plugin;
*/
public function write_setting($data) {
global $DB, $SITE;
- $record = new object();
+ $record = new stdClass();
$record->id = SITEID;
$record->{$this->name} = ($data == '1' ? 1 : 0);
$record->timemodified = time();
return $validated;
}
- $record = new object();
+ $record = new stdClass();
$record->id = SITEID;
$record->{$this->name} = $data;
$record->timemodified = time();
*/
public function write_setting($data) {
global $DB, $SITE;
- $record = new object();
+ $record = new stdClass();
$record->id = SITEID;
$record->{$this->name} = $data;
$record->timemodified = time();
}
}
if ($found) {
- $result = new object();
+ $result = new stdClass();
$result->page = $this;
$result->settings = array();
return array($this->name => $result);
}
}
if ($found) {
- $result = new object();
+ $result = new stdClass();
$result->page = $this;
$result->settings = array();
return array($this->name => $result);
}
}
if ($found) {
- $result = new object();
+ $result = new stdClass();
$result->page = $this;
$result->settings = array();
return array($this->name => $result);
$original = serialize($setting->get_setting()); // comparison must work for arrays too
$error = $setting->write_setting($data[$fullname]);
if ($error !== '') {
- $adminroot->errors[$fullname] = new object();
+ $adminroot->errors[$fullname] = new stdClass();
$adminroot->errors[$fullname]->data = $data[$fullname];
$adminroot->errors[$fullname]->id = $setting->get_id();
$adminroot->errors[$fullname]->error = $error;
foreach ($protocols_available as $protocol => $location) {
$name = get_string('pluginname', 'webservice_'.$protocol);
- $plugin = new object();
+ $plugin = new stdClass();
if (file_exists($CFG->dirroot.'/webservice/'.$protocol.'/version.php')) {
include($CFG->dirroot.'/webservice/'.$protocol.'/version.php');
}
}
/**
- * Creates a new object of the specified block class.
+ * Creates a new instance of the specified block class.
*
* @param string $blockname the name of the block.
* @param $instance block_instances DB table row (optional).
global $DB, $CFG;
// Get completion info
- $course = new object();
+ $course = new stdClass();
$course->id = $completion->course;
$info = new completion_info($course);
global $CFG, $DB;
// Get completion info
- $course = new object();
+ $course = new stdClass();
$course->id = $completion->course;
$info = new completion_info($course);
* Returns object with fields and values that are defined in database
*/
public function get_record_data() {
- $data = new object();
+ $data = new stdClass();
foreach ($this as $var=>$value) {
if (in_array($var, $this->required_fields) or array_key_exists($var, $this->optional_fields)) {
$category = reset($category);
} else {
- $cat = new object();
+ $cat = new stdClass();
$cat->name = get_string('miscellaneous');
$cat->depth = 1;
$cat->sortorder = MAX_COURSES_IN_CATEGORY;
/// Update $USER->lastaccess for next checks
$USER->lastaccess = $timenow;
- $last = new object();
+ $last = new stdClass();
$last->id = $USER->id;
$last->lastip = getremoteaddr();
$last->lastaccess = $timenow;
// Update course lastaccess for next checks
$USER->currentcourseaccess[$courseid] = $timenow;
- $last = new object();
+ $last = new stdClass();
$last->userid = $USER->id;
$last->courseid = $courseid;
$last->timeaccess = $timenow;
$params = array('mode'=>$mode, 'username'=>$username, 'lastlogin'=>$lastlogin);
$select = "module='login' AND action='error' AND time > :lastlogin";
- $count = new object();
+ $count = new stdClass();
if (is_siteadmin()) {
if ($count->attempts = $DB->count_records_select('log', $select, $params)) {
/// create site course
- $newsite = new object();
+ $newsite = new stdClass();
$newsite->fullname = '';
$newsite->shortname = '';
$newsite->summary = NULL;
/// bootstrap mnet
- $mnethost = new object();
+ $mnethost = new stdClass();
$mnethost->wwwroot = $CFG->wwwroot;
$mnethost->name = '';
$mnethost->name = '';
set_config('mnet_localhost_id', $mnetid);
// Initial insert of mnet applications info
- $mnet_app = new object();
+ $mnet_app = new stdClass();
$mnet_app->name = 'moodle';
$mnet_app->display_name = 'Moodle';
$mnet_app->xmlrpc_server_url = '/mnet/xmlrpc/server.php';
$mnet_app->sso_jump_url = '/auth/mnet/jump.php';
$moodleapplicationid = $DB->insert_record('mnet_application', $mnet_app);
- $mnet_app = new object();
+ $mnet_app = new stdClass();
$mnet_app->name = 'mahara';
$mnet_app->display_name = 'Mahara';
$mnet_app->xmlrpc_server_url = '/api/xmlrpc/server.php';
$DB->insert_record('mnet_application', $mnet_app);
// Set up the probably-to-be-removed-soon 'All hosts' record
- $mnetallhosts = new object();
+ $mnetallhosts = new stdClass();
$mnetallhosts->wwwroot = '';
$mnetallhosts->ip_address = '';
$mnetallhosts->public_key = '';
set_config('mnet_all_hosts_id', $mnetallhosts->id);
/// Create guest record - do not assign any role, guest user get's the default guest role automatically on the fly
- $guest = new object();
+ $guest = new stdClass();
$guest->auth = 'manual';
$guest->username = 'guest';
$guest->password = hash_internal_user_password('guest');
/// Now create admin user
- $admin = new object();
+ $admin = new stdClass();
$admin->auth = 'manual';
$admin->firstname = get_string('admin');
$admin->lastname = get_string('user');
license_manager::install_licenses();
/// Add two lines of data into this new table
- $mypage = new object();
+ $mypage = new stdClass();
$mypage->userid = NULL;
$mypage->name = '__default';
$mypage->private = 0;
if (!isset($blocks[$stickyblock->blockid]) || empty($blocks[$stickyblock->blockid]->name)) {
continue;
}
- $newblock = new object();
+ $newblock = new stdClass();
$newblock->blockname = $blocks[$stickyblock->blockid]->name;
$newblock->contextid = $syscontext->id;
$newblock->showinsubcontexts = 1;
$existingrolecontextlevels->close();
// Put the data into the database.
- $rcl = new object();
+ $rcl = new stdClass();
foreach ($rolecontextlevels as $roleid => $contextlevels) {
$rcl->roleid = $roleid;
foreach ($contextlevels as $level) {
}
/// Add two lines of data into this new table. These are the default pages.
- $mypage = new object();
+ $mypage = new stdClass();
$mypage->userid = NULL;
$mypage->name = '__default';
$mypage->private = 0;
* @param string $debuginfo
*/
function __construct($fieldname, $tablename, $debuginfo=null) {
- $a = new object();
+ $a = new stdClass();
$a->fieldname = $fieldname;
$a->tablename = $tablename;
parent::__construct('ddlfieldnotexist', $a, $debuginfo);
class ddl_dependency_exception extends ddl_exception {
function __construct($targettype, $targetname, $offendingtype, $offendingname, $debuginfo=null) {
- $a = new object();
+ $a = new stdClass();
$a->targettype = $targettype;
$a->targetname = $targetname;
$a->offendingtype = $offendingtype;
if (!is_object($user)) {
$userid = $user;
- $user = new object();
+ $user = new stdClass();
$user->id = $userid;
}
if (isset($this->current_row) || !isset($this->current_table)) {
throw new dbtransfer_exception('malformedxmlexception');
}
- $this->current_row = new object();
+ $this->current_row = new stdClass();
break;
case 'field' :
if (isset($this->current_field) || !isset($this->current_row)) {
if (!isset($this->config)) {
$name = $this->get_name();
if (!$config = get_config("enrol_$name")) {
- $config = new object();
+ $config = new stdClass();
}
$this->config = $config;
}
$DB->update_record('user_enrolments', $ue);
}
} else {
- $ue = new object();
+ $ue = new stdClass();
$ue->enrolid = $instance->id;
$ue->status = ENROL_USER_ACTIVE;
$ue->userid = $userid;
throw new coding_exception('Invalid request to add enrol instance to frontpage.');
}
- $instance = new object();
+ $instance = new stdClass();
$instance->enrol = $this->get_name();
$instance->status = ENROL_INSTANCE_ENABLED;
$instance->courseid = $course->id;
$name = $this->get_name();
$versionfile = "$CFG->dirroot/enrol/$name/version.php";
- $plugin = new object();
+ $plugin = new stdClass();
include($versionfile);
if (empty($plugin->cron)) {
return false;
$status = $environment_result->getStatus();
$error_code = $environment_result->getErrorCode();
- $a = new object();
+ $a = new stdClass();
if ($error_code) {
$a->error_code = $error_code;
$errors[] = array($info, get_string('environmentxmlerror', 'admin', $a));
}
// We are comparing versions
- $rec = new object();
+ $rec = new stdClass();
if ($rec->needed = $environment_result->getNeededVersion()) {
$rec->current = $environment_result->getCurrentVersion();
if ($environment_result->getLevel() == 'required') {
} else {
// same event name matches, this event has been updated, update the datebase
- $handler = new object();
+ $handler = new stdClass();
$handler->id = $cachedhandlers[$eventname]['id'];
$handler->handlerfile = $filehandler['handlerfile'];
$handler->handlerfunction = serialize($filehandler['handlerfunction']); // static class methods stored as array
} else {
// if we are here, this event handler is not present in db (new)
// add it
- $handler = new object();
+ $handler = new stdClass();
$handler->eventname = $eventname;
$handler->component = $component;
$handler->handlerfile = $filehandler['handlerfile'];
}
// make a new queue handler
- $qhandler = new object();
+ $qhandler = new stdClass();
$qhandler->queuedeventid = $event->id;
$qhandler->handlerid = $handler->id;
$qhandler->errormessage = $errormessage;
}
//dispatching failed
- $qh = new object();
+ $qh = new stdClass();
$qh->id = $qhandler->id;
$qh->errormessage = $errormessage;
$qh->timemodified = time();
}
// if even type is not instant, or dispatch asked for retry, queue it
- $event = new object();
+ $event = new stdClass();
$event->userid = $USER->id;
$event->eventdata = base64_encode(serialize($eventdata));
$event->timecreated = time();
throw new moodle_exception('tokengenerationfailed');
}
} while ($DB->record_exists('external_tokens', array('token'=>$generatedtoken)));
- $newtoken = new object();
+ $newtoken = new stdClass();
$newtoken->token = $generatedtoken;
if (!is_object($serviceorid)){
$service = $DB->get_record('external_services', array('id' => $serviceorid));
$url = str_replace($newlines, '', $url);
if (!preg_match('|^https?://|i', $url)) {
if ($fullresponse) {
- $response = new object();
+ $response = new stdClass();
$response->status = 0;
$response->headers = array();
$response->response_code = 'Invalid protocol specified in url';
} else {
curl_close($ch);
if ($fullresponse) {
- $response = new object();
+ $response = new stdClass();
$response->status = '0';
$response->headers = array();
$response->response_code = 'SOCKS5 proxy is not supported in PHP4';
}
// set up header and content handlers
- $received = new object();
+ $received = new stdClass();
$received->headers = array(); // received headers array
$received->tofile = $tofile;
$received->fh = null;
curl_close($ch);
if ($fullresponse) {
- $response = new object();
+ $response = new stdClass();
if ($error_no == 28) {
$response->status = '-100'; // mimic snoopy
} else {
if (empty($info['http_code'])) {
// for security reasons we support only true http connections (Location: file:// exploit prevention)
- $response = new object();
+ $response = new stdClass();
$response->status = '0';
$response->headers = array();
$response->response_code = 'Unknown cURL error';
$response->error = 'Unknown cURL error';
} else {
- $response = new object();;
+ $response = new stdClass();;
$response->status = (string)$info['http_code'];
$response->headers = $received->headers;
$response->response_code = $received->headers[0];
}
} else { // Try to put the file through filters
if ($mimetype == 'text/html') {
- $options = new object();
+ $options = new stdClass();
$options->noclean = true;
$options->nocache = true; // temporary workaround for MDL-5136
$text = $pathisstring ? $path : implode('', file($path));
echo $output;
// only filter text if filter all files is selected
} else if (($mimetype == 'text/plain') and ($filter == 1)) {
- $options = new object();
+ $options = new stdClass();
$options->newlines = false;
$options->noclean = true;
$text = htmlentities($pathisstring ? $path : implode('', file($path)));
} else { // Try to put the file through filters
if ($mimetype == 'text/html') {
- $options = new object();
+ $options = new stdClass();
$options->noclean = true;
$options->nocache = true; // temporary workaround for MDL-5136
$text = $stored_file->get_content();
echo $output;
// only filter text if filter all files is selected
} else if (($mimetype == 'text/plain') and ($filter == 1)) {
- $options = new object();
+ $options = new stdClass();
$options->newlines = false;
$options->noclean = true;
$text = $stored_file->get_content();
foreach ($this->_rules as $field => $rulesarr){
foreach ($rulesarr as $key => $rule){
if ($rule['message']===null){
- $a=new object();
+ $a=new stdClass();
$a->format=$rule['format'];
$str=get_string('err_'.$rule['type'], 'form', $a);
if (strpos($str, '[[')!==0){
return false;
}
- $image = new object();
+ $image = new stdClass();
$image->width = $imageinfo[0];
$image->height = $imageinfo[1];
$image->type = $imageinfo[2];
return false;
}
- $oldgrade = new object();
+ $oldgrade = new stdClass();
$oldgrade->finalgrade = $grade->finalgrade;
$oldgrade->overridden = $grade->overridden;
$oldgrade->feedback = $grade->feedback;
return false;
}
- $oldgrade = new object();
+ $oldgrade = new stdClass();
$oldgrade->finalgrade = $grade->finalgrade;
$oldgrade->rawgrade = $grade->rawgrade;
$oldgrade->rawgrademin = $grade->rawgrademin;
* Returns object with fields and values that are defined in database
*/
public function get_record_data() {
- $data = new object();
+ $data = new stdClass();
foreach ($this as $var=>$value) {
if (in_array($var, $this->required_fields) or array_key_exists($var, $this->optional_fields)) {
if ($result = parent::insert($source)) {
if (!empty($this->courseid)) {
- $goc = new object();
+ $goc = new stdClass();
$goc->courseid = $this->courseid;
$goc->outcomeid = $this->id;
$DB->insert_record('grade_outcomes_courses', $goc);
}
if (!$DB->record_exists('grade_outcomes_courses', array('courseid' => $courseid, 'outcomeid' => $this->id))) {
- $goc = new object();
+ $goc = new stdClass();
$goc->courseid = $courseid;
$goc->outcomeid = $this->id;
$DB->insert_record('grade_outcomes_courses', $goc);
function grade_get_grades($courseid, $itemtype, $itemmodule, $iteminstance, $userid_or_ids=null) {
global $CFG;
- $return = new object();
+ $return = new stdClass();
$return->items = array();
$return->outcomes = array();
if (empty($grade_item->outcomeid)) {
// prepare information about grade item
- $item = new object();
+ $item = new stdClass();
$item->itemnumber = $grade_item->itemnumber;
$item->scaleid = $grade_item->scaleid;
$item->name = $grade_item->get_name();
foreach ($userids as $userid) {
$grade_grades[$userid]->grade_item =& $grade_item;
- $grade = new object();
+ $grade = new stdClass();
$grade->grade = $grade_grades[$userid]->finalgrade;
$grade->locked = $grade_grades[$userid]->is_locked();
$grade->hidden = $grade_grades[$userid]->is_hidden();
if ($grade_item->gradetype == GRADE_TYPE_SCALE or $grade_item->get_displaytype() != GRADE_DISPLAY_TYPE_REAL) {
$grade->str_long_grade = $grade->str_grade;
} else {
- $a = new object();
+ $a = new stdClass();
$a->grade = $grade->str_grade;
$a->max = grade_format_gradevalue($grade_item->grademax, $grade_item);
$grade->str_long_grade = get_string('gradelong', 'grades', $a);
}
// outcome info
- $outcome = new object();
+ $outcome = new stdClass();
$outcome->itemnumber = $grade_item->itemnumber;
$outcome->scaleid = $grade_outcome->scaleid;
$outcome->name = $grade_outcome->get_name();
foreach ($userids as $userid) {
$grade_grades[$userid]->grade_item =& $grade_item;
- $grade = new object();
+ $grade = new stdClass();
$grade->grade = $grade_grades[$userid]->finalgrade;
$grade->locked = $grade_grades[$userid]->is_locked();
$grade->hidden = $grade_grades[$userid]->is_hidden();
function grade_get_settings($courseid) {
global $DB;
- $settings = new object();
+ $settings = new stdClass();
$settings->id = $courseid;
if ($records = $DB->get_records('grade_settings', array('courseid'=>$courseid))) {
$DB->delete_records('grade_settings', array('courseid'=>$courseid, 'name'=>$name));
} else if (!$existing = $DB->get_record('grade_settings', array('courseid'=>$courseid, 'name'=>$name))) {
- $data = new object();
+ $data = new stdClass();
$data->courseid = $courseid;
$data->name = $name;
$data->value = $value;
$DB->insert_record('grade_settings', $data);
} else {
- $data = new object();
+ $data = new stdClass();
$data->id = $existing->id;
$data->value = $value;
$DB->update_record('grade_settings', $data);
}
// Create the message object
- $savemessage = new object();
+ $savemessage = new stdClass();
$savemessage->useridfrom = $eventdata->userfrom->id;
$savemessage->useridto = $eventdata->userto->id;
$savemessage->subject = $eventdata->subject;
continue;
} else { // Update existing one
- $provider = new object();
+ $provider = new stdClass();
$provider->id = $dbproviders[$messagename]->id;
$provider->capability = $fileprovider['capability'];
$DB->update_record('message_providers', $provider);
} else { // New message provider, add it
- $provider = new object();
+ $provider = new stdClass();
$provider->name = $messagename;
$provider->component = $component;
$provider->capability = $fileprovider['capability'];
}
} else {
if ($value !== null) {
- $config = new object();
+ $config = new stdClass();
$config->name = $name;
$config->value = $value;
$DB->insert_record('config', $config, false);
}
} else {
if ($value !== null) {
- $config = new object();
+ $config = new stdClass();
$config->plugin = $plugin;
$config->name = $name;
$config->value = $value;
$f->timemodified = $timemodified;
$DB->update_record('cache_flags', $f);
} else {
- $f = new object();
+ $f = new stdClass();
$f->flagtype = $type;
$f->name = $name;
$f->value = $value;
$DB->set_field('user_preferences', 'value', (string)$value, array('id'=>$preference->id));
} else {
- $preference = new object();
+ $preference = new stdClass();
$preference->userid = $userid;
$preference->name = $name;
$preference->value = (string)$value;
function create_user_key($script, $userid, $instance=null, $iprestriction=null, $validuntil=null) {
global $DB;
- $key = new object();
+ $key = new stdClass();
$key->script = $script;
$key->userid = $userid;
$key->instance = $instance;
function update_user_login_times() {
global $USER, $DB;
- $user = new object();
+ $user = new stdClass();
$USER->lastlogin = $user->lastlogin = $USER->currentlogin;
$USER->currentlogin = $user->lastaccess = $user->currentlogin = time();
}
else if (!empty($reset)) { // if it's not there and we're resetting, don't bother.
// make a new one
- $pref = new object();
+ $pref = new stdClass();
$pref->name = 'email_send_count';
$pref->value = 1;
$pref->userid = $user->id;
}
else if (!empty($reset)) { // if it's not there and we're resetting, don't bother.
// make a new one
- $pref = new object();
+ $pref = new stdClass();
$pref->name = 'email_bounce_count';
$pref->value = 1;
$pref->userid = $user->id;
$course->modinfo = $DB->get_field('course', 'modinfo', array('id'=>$course->id));
}
- $modinfo = new object();
+ $modinfo = new stdClass();
$modinfo->courseid = $course->id;
$modinfo->userid = $userid;
$modinfo->sections = array();
continue;
}
// reconstruct minimalistic $cm
- $cm = new object();
+ $cm = new stdClass();
$cm->id = $mod->cm;
$cm->instance = $mod->id;
$cm->course = $course->id;
$authplugin = get_auth_plugin($auth);
- $newuser = new object();
+ $newuser = new stdClass();
if ($newinfo = $authplugin->get_userinfo($username)) {
$newinfo = truncate_userinfo($newinfo);
}
// mark internal user record as "deleted"
- $updateuser = new object();
+ $updateuser = new stdClass();
$updateuser->id = $user->id;
$updateuser->deleted = 1;
$updateuser->username = $delname; // Remember it just in case
}
$auths = $authsenabled;
- $user = new object();
+ $user = new stdClass();
$user->id = 0; // User does not exist
}
fulldelete($CFG->dataroot.'/'.$course->id);
// cleanup course record - remove links to delted stuff
- $oldcourse = new object();
+ $oldcourse = new stdClass();
$oldcourse->id = $course->id;
$oldcourse->summary = '';
$oldcourse->modinfo = NULL;
return $supportuser;
}
- $supportuser = new object;
+ $supportuser = new stdClass();
$supportuser->email = $CFG->supportemail ? $CFG->supportemail : $CFG->noreplyaddress;
$supportuser->firstname = $CFG->supportname ? $CFG->supportname : get_string('noreplyname');
$supportuser->lastname = '';
$DB->set_field('user', 'password', hash_internal_user_password($newpassword), array('id'=>$user->id));
- $a = new object();
+ $a = new stdClass();
$a->firstname = fullname($user, true);
$a->sitename = format_string($site->fullname);
$a->username = $user->username;
print_error("cannotsetpassword");
}
- $a = new object();
+ $a = new stdClass();
$a->firstname = $user->firstname;
$a->lastname = $user->lastname;
$a->sitename = format_string($site->fullname);
$site = get_site();
$supportuser = generate_email_supportuser();
- $data = new object();
+ $data = new stdClass();
$data->firstname = fullname($user);
$data->sitename = format_string($site->fullname);
$data->admin = generate_email_signoff();
$site = get_site();
$supportuser = generate_email_supportuser();
- $data = new object();
+ $data = new stdClass();
$data->firstname = $user->firstname;
$data->lastname = $user->lastname;
$data->sitename = format_string($site->fullname);
$supportuser = generate_email_supportuser();
$systemcontext = get_context_instance(CONTEXT_SYSTEM);
- $data = new object();
+ $data = new stdClass();
$data->firstname = $user->firstname;
$data->lastname = $user->lastname;
$data->sitename = format_string($site->fullname);
if ($mod === 'NEWMODULE') { // Someone has unzipped the template, ignore it
continue;
}
- $module = new object();
+ $module = new stdClass();
if (!is_readable($fullmod.'/version.php')) {
continue;
}
if (!is_readable($fullblock.'/version.php')) {
continue;
}
- $plugin = new object();
+ $plugin = new stdClass();
$plugin->version = NULL;
include($fullblock.'/version.php');
if (empty($installed[$blockname])) {
if (!is_readable($fullplug.'/version.php')) {
continue;
}
- $plugin = new object();
+ $plugin = new stdClass();
include($fullplug.'/version.php'); // defines $plugin with version etc
$installedversion = get_config($component, 'version');
if (empty($installedversion)) { // new installation
if (!array_key_exists($row, $this->data)) {
$this->data[$row] = array();
}
- $this->data[$row][$col] = new object();
+ $this->data[$row][$col] = new stdClass();
$this->data[$row][$col]->value = $str;
$this->data[$row][$col]->type = 'string';
$this->data[$row][$col]->format = $format;
if (!array_key_exists($row, $this->data)) {
$this->data[$row] = array();
}
- $this->data[$row][$col] = new object();
+ $this->data[$row][$col] = new stdClass();
$this->data[$row][$col]->value = $num;
$this->data[$row][$col]->type = 'float';
$this->data[$row][$col]->format = $format;
if (!array_key_exists($row, $this->data)) {
$this->data[$row] = array();
}
- $this->data[$row][$col] = new object();
+ $this->data[$row][$col] = new stdClass();
$this->data[$row][$col]->value = $url;
$this->data[$row][$col]->type = 'string';
$this->data[$row][$col]->format = $format;
if (!array_key_exists($row, $this->data)) {
$this->data[$row] = array();
}
- $this->data[$row][$col] = new object();
+ $this->data[$row][$col] = new stdClass();
$this->data[$row][$col]->value = $date;
$this->data[$row][$col]->type = 'date';
$this->data[$row][$col]->format = $format;
* @param integer $level The optional outline level (0-7)
*/
function set_row($row, $height, $format = 0, $hidden = false, $level = 0) {
- $this->rows[$row] = new object();
+ $this->rows[$row] = new stdClass();
$this->rows[$row]->height = $height;
//$this->rows[$row]->format = $format; // TODO: fix and enable
$this->rows[$row]->hidden = $hidden;
*/
function set_column($firstcol, $lastcol, $width, $format = 0, $hidden = false, $level = 0) {
for($i=$firstcol; $i<=$lastcol; $i++) {
- $this->columns[$i] = new object();
+ $this->columns[$i] = new stdClass();
$this->columns[$i]->width = $width;
//$this->columns[$i]->format = $format; // TODO: fix and enable
$this->columns[$i]->hidden = $hidden;
$settings = get_config('theme_'.$themename);
} catch (dml_exception $e) {
// most probably moodle tables not created yet
- $settings = new object();
+ $settings = new stdClass();
}
if ($config = theme_config::find_theme_config($themename, $settings)) {
return null;
}
- $THEME = new object();
+ $THEME = new stdClass();
$THEME->name = $themename;
$THEME->dir = $dir;
$THEME->settings = $settings;
$url = new moodle_url('/portfolio/add.php');
foreach ($this->callbackargs as $key => $value) {
if (!empty($value) && !is_string($value) && !is_numeric($value)) {
- $a = new object();
+ $a = new stdClass();
$a->key = $key;
$a->value = print_r($value, true);
debugging(get_string('nonprimative', 'portfolio', $a));
$smallbody = get_string('insanebodysmall', 'portfolio', $a);
foreach ($admins as $admin) {
- $eventdata = new object();
+ $eventdata = new stdClass();
$eventdata->modulename = 'portfolio';
$eventdata->component = 'portfolio';
$eventdata->name = 'notices';
// Make a category in the parent context to move the questions to.
if (is_null($newcategory)) {
- $newcategory = new object();
+ $newcategory = new stdClass();
$newcategory->parent = 0;
$newcategory->contextid = $newcontextid;
$newcategory->name = get_string('questionsrescuedfrom', 'question', $oldplace);
unset($states[$qid]->id);
} else {
// create a new empty state
- $states[$qid] = new object;
+ $states[$qid] = new stdClass();
$states[$qid]->question = $qid;
$states[$qid]->responses = array('' => '');
$states[$qid]->raw_grade = 0;
}
}
if ($changed){
- $toinsert = new object();
+ $toinsert = new stdClass();
$toinsert->oldgrade = round((float)$states[count($states)-1]->grade, 5);
$toinsert->newgrade = round((float)$replaystate->grade, 5);
$toinsert->attemptid = $attempt->uniqueid;
function question_add_tops($categories, $pcontexts){
$topcats = array();
foreach ($pcontexts as $context){
- $newcat = new object();
+ $newcat = new stdClass();
$newcat->id = "0,$context";
$newcat->name = get_string('top');
$newcat->parent = -1;
//XML item
if ($return) {
- $item = new object();
+ $item = new stdClass();
$item->title = "RSS Error";
$item->link = $CFG->wwwroot;
$item->pubdate = time();
*/
define('SITEID', 1);
// And the 'default' course
- $COURSE = new object(); // no site created yet
+ $COURSE = new stdClass(); // no site created yet
$COURSE->id = 1;
} else {
throw $e;
}
}
- $info = new object();
+ $info = new stdClass();
$info->message = $message;
$info->errorcode = $errorcode;
$info->backtrace = $backtrace;
global $PERF, $CFG, $USER;
- $PERF = new object();
+ $PERF = new stdClass();
$PERF->logwrites = 0;
if (function_exists('microtime')) {
$PERF->starttime = microtime();
accesslib_clear_all_caches_for_unit_testing();
$this->switch_to_test_db();
- $course = new object();
+ $course = new stdClass();
$course->category = 0;
$this->testdb->insert_record('course', $course);
$syscontext = get_system_context(false);
}
function test_question_state_is_closed() {
- $state = new object();
+ $state = new stdClass();
$state->event = QUESTION_EVENTOPEN;
$this->assertFalse(question_state_is_closed($state));
}
function test_question_state_is_graded() {
- $state = new object();
+ $state = new stdClass();
$state->event = QUESTION_EVENTOPEN;
$this->assertFalse(question_state_is_graded($state));
parent::generateReport($data);
// head data
- $data = new object();
+ $data = new stdClass();
$data->time = time();
$data->title = $this->heading;
$data->output = $this->outputDir;
$serfilepath = $CFG->dataroot . '/codecoverage/' . $type . '/codecoverage.ser';
if (file_exists($serfilepath) && is_readable($serfilepath)) {
if ($data = unserialize(file_get_contents($serfilepath))) {
- $info = new object();
+ $info = new stdClass();
$info->date = userdate($data->time);
$info->files = format_float($data->totalfiles, 0);
$info->percentage = format_float($data->totalpercentage, 2) . '%';
function stats_get_parameters($time,$report,$courseid,$mode,$roleid=0) {
global $CFG, $DB;
- $param = new object();
+ $param = new stdClass();
$param->params = array();
if ($time < 10) { // dailies
return NULL;
}
- $a = new object();
+ $a = new stdClass();
$a->daysdone = $DB->get_field_sql("SELECT COUNT(DISTINCT(timeend)) FROM {stats_daily}");
// how many days between the last day and now?
$lsortorder = get_string('asc');
}
- $override = new object();
+ $override = new stdClass();
$override->firstname = 'firstname';
$override->lastname = 'lastname';
$fullnamelanguage = get_string('fullnamedisplay', '', $override);
* appropriate clause of the query.
*/
function set_sql($fields, $from, $where, array $params = NULL){
- $this->sql = new object();
+ $this->sql = new stdClass();
$this->sql->fields = $fields;
$this->sql->from = $from;
$this->sql->where = $where;
class upgrade_requires_exception extends moodle_exception {
function __construct($plugin, $pluginversion, $currentmoodle, $requiremoodle) {
global $CFG;
- $a = new object();
+ $a = new stdClass();
$a->pluginname = $plugin;
$a->pluginversion = $pluginversion;
$a->currentmoodle = $currentmoodle;
continue;
}
- $plugin = new object();
+ $plugin = new stdClass();
require($fullplug.'/version.php'); // defines $plugin with version etc
if (empty($plugin->version)) {
throw new plugin_defective_exception($component, 'Missing version.php');
}
- $module = new object();
+ $module = new stdClass();
require($fullmod .'/version.php'); // defines $module with version etc
if (empty($module->version)) {
if (!is_readable($fullblock.'/version.php')) {
throw new plugin_defective_exception('block/'.$blockname, 'Missing version.php file.');
}
- $plugin = new object();
+ $plugin = new stdClass();
$plugin->version = NULL;
$plugin->cron = 0;
include($fullblock.'/version.php');
}
}
foreach ($functions as $fname => $function) {
- $dbfunction = new object();
+ $dbfunction = new stdClass();
$dbfunction->name = $fname;
$dbfunction->classname = $function['classname'];
$dbfunction->methodname = $function['methodname'];
}
}
foreach ($service['functions'] as $fname) {
- $newf = new object();
+ $newf = new stdClass();
$newf->externalserviceid = $dbservice->id;
$newf->functionname = $fname;
$DB->insert_record('external_services_functions', $newf);
unset($functions);
}
foreach ($services as $name => $service) {
- $dbservice = new object();
+ $dbservice = new stdClass();
$dbservice->name = $name;
$dbservice->enabled = empty($service['enabled']) ? 0 : $service['enabled'];
$dbservice->requiredcapability = empty($service['requiredcapability']) ? null : $service['requiredcapability'];
$dbservice->timecreated = time();
$dbservice->id = $DB->insert_record('external_services', $dbservice);
foreach ($service['functions'] as $fname) {
- $newf = new object();
+ $newf = new stdClass();
$newf->externalserviceid = $dbservice->id;
$newf->functionname = $fname;
$DB->insert_record('external_services_functions', $newf);
}
}
- $log = new object();
+ $log = new stdClass();
$log->type = $type;
$log->plugin = $plugin;
$log->version = $version;
}
if (!$this->status) {
if (!$this->config->recoverifmultiple && count($this->files) > 1) {
- $a = new object();
+ $a = new stdClass();
$a->name = $this->files[$name]['originalname'];
$a->problem = $this->files[$name]['uploadlog'];
if (!$this->config->silent) {
else {
$newname = clean_filename($this->files[$name]['name']);
if ($newname != $this->files[$name]['name']) {
- $a = new object();
+ $a = new stdClass();
$a->oldname = $this->files[$name]['name'];
$a->newname = $newname;
$this->files[$name]['uploadlog'] .= get_string('uploadrenamedchars','moodle', $a);
while (!$this->check_before_renaming($destination, $name.'_'.$i.$extension, $file)) {
$i++;
}
- $a = new object();
+ $a = new stdClass();
$a->oldname = $file['name'];
$file['name'] = $name.'_'.$i.$extension;
$a->newname = $file['name'];
case 0: // glee! we're ok.
return 1; // translate clam return code into reasonable return code consistent with everything else.
case 1: // bad wicked evil, we have a virus.
- $info = new object();
+ $info = new stdClass();
if (!empty($course)) {
$info->course = $course->fullname;
}
$subject = get_string('clamemailsubject', 'moodle', format_string($site->fullname));
$admins = get_admins();
foreach ($admins as $admin) {
- $eventdata = new object();
+ $eventdata = new stdClass();
$eventdata->modulename = 'moodle';
$eventdata->userfrom = get_admin();
$eventdata->userto = $admin;
return $text;
}
- $newcacheitem = new object();
+ $newcacheitem = new stdClass();
$newcacheitem->md5key = $md5key;
$newcacheitem->formattedtext = $text;
$newcacheitem->timemodified = time();