}
global $CFG, $USER, $course;
- if (isset($USER->id)) {
+ if (!empty($USER->id)) {
$userBlog->userid = $USER->id;
} //what is $userBlog anyway
if($this->content !== NULL) {
}
}
- if (empty($CFG->disablemycourses) and isset($USER->id) and !(isadmin() and $adminseesall)) { // Just print My Courses
+ if (empty($CFG->disablemycourses) and !empty($USER->id) and !(isadmin() and $adminseesall)) { // Just print My Courses
if ($courses = get_my_courses($USER->id)) {
foreach ($courses as $course) {
if ($course->id == SITEID) {
// then allow the user to add rss feeds
global $USER;
$userisloggedin = false;
- if (isset($USER) && isset($USER->id) && $USER->id && !isguest()) {
+ if (isset($USER) && !empty($USER->id) && $USER->id && !isguest()) {
$userisloggedin = true;
}
if ( $userisloggedin && ($submitters == SUBMITTERS_ALL_ACCOUNT_HOLDERS || ($submitters == SUBMITTERS_ADMIN_AND_TEACHER && $isteacher)) ) {
page_map_class($pagetype, $pageclass);
// Now, create our page object.
-if (!isset($USER->id)) {
+if (empty($USER->id)) {
$PAGE = page_create_object($pagetype);
} else {
$PAGE = page_create_object($pagetype, $USER->id);
echo '<div class="commands">';
- if (isset($USER->id)) {
+ if (!empty($USER->id)) {
$context = get_context_instance(CONTEXT_SYSTEM, SITEID);
$canmanage = has_capability('moodle/blog:manageentries', $context->id);
/// Everyone can add personal tags as long as they can write blog entries.
if (!confirm_sesskey() ||
!has_capability('moodle/blog:writeentries', $context) ||
- !isset($USER->id)) {
+ empty($USER->id)) {
error ('you can not add tags');
}
// The empty() instead of !isset() here makes a whole world of difference,
// as it will automatically change to the user's id when the user first logs
// in. With !isset(), it would never do that.
- $SESSION->cal_users_shown = isset($USER->id) ? $USER->id : false;
+ $SESSION->cal_users_shown = !empty($USER->id) ? $USER->id : false;
}
else if(is_numeric($SESSION->cal_users_shown) && !empty($USER->id) && $SESSION->cal_users_shown != $USER->id) {
// Follow the white rabbit, for example if a teacher logs in as a student
global $USER, $CFG;
- if (!isset($USER->id)) {
+ if (empty($USER->id)) {
error("It shouldn't be possible to see My Moodle without being logged in.");
}
error('Could not find or create a main news forum for the site');
}
- if (isset($USER->id)) {
+ if (!empty($USER->id)) {
$SESSION->fromdiscussion = $CFG->wwwroot;
if (forum_is_subscribed($USER->id, $newsforum->id)) {
$subtext = get_string('unsubscribe', 'forum');
function require_logout() {
global $USER, $CFG;
- if (isset($USER) and isset($USER->id)) {
+ if (!empty($USER->id)) {
add_to_log(SITEID, "user", "logout", "view.php?id=$USER->id&course=".SITEID, $USER->id, 0, $USER->id);
if ($USER->auth == 'cas' && !empty($CFG->cas_enabled)) {
function user_login_string($course=NULL, $user=NULL) {
global $USER, $CFG, $SITE;
- if (empty($user) and isset($USER->id)) {
+ if (empty($user) and !empty($USER->id)) {
$user = $USER;
}
$submitted = '<a href="submissions.php?id='.$this->cm->id.'">'.
get_string('viewsubmissions', 'assignment', $count).'</a>';
} else {
- if (isset($USER->id)) {
+ if (!empty($USER->id)) {
if ($submission = $this->get_submission($USER->id)) {
if ($submission->timemodified) {
if ($submission->timemodified <= $this->assignment->timedue || empty($this->assignment->timedue)) {
$output .= '<img align="middle" src="'.$CFG->pixpath.'/f/'.$icon.'" height="16" width="16" alt="'.$icon.'" />'.
'<a href="'.$ffurl.'" >'.$file.'</a> ['.$filesize.'] <br />';
} else {
- if (isset($USER->id)) {
+ if (!empty($USER->id)) {
if ($submission = $this->get_submission($USER->id)) {
//i have changed timemodified=0 for Draft assignments, thats' why we remove this condition
//otherwise student's dont' se etheir own submissions
notice("There are no choices", "../../course/view.php?id=$course->id");
}
- if ( isset($USER->id) and $allanswers = get_records("choice_answers", "userid", $USER->id)) {
+ if ( !empty($USER->id) and $allanswers = get_records("choice_answers", "userid", $USER->id)) {
foreach ($allanswers as $aa) {
$answers[$aa->choiceid] = $aa;
}
}
//if user has already made a selection, and they are not allowed to update it, show their selected answer.
- if (isset($USER->id) && ($current = get_record('choice_answers', 'choiceid', $choice->id, 'userid', $USER->id))) {
+ if (!empty($USER->id) && ($current = get_record('choice_answers', 'choiceid', $choice->id, 'userid', $USER->id))) {
print_simple_box(get_string("yourselection", "choice", userdate($choice->timeopen)).": ".format_string(choice_get_option_text($choice, $current->optionid)), "center");
}
$fullpivot = 1;
$userid = '';
- if ( isset($USER->id) ) {
+ if ( !empty($USER->id) ) {
$userid = "OR ge.userid = $USER->id";
}
switch ($tab) {
$currentsection = '';
foreach ($surveys as $survey) {
- if (isset($USER->id) and survey_already_done($survey->id, $USER->id)) {
+ if (!empty($USER->id) and survey_already_done($survey->id, $USER->id)) {
$ss = $strdone;
} else {
$ss = $strnotdone;
define('MESSAGE_WINDOW', true); // This prevents the message window coming up
- if (!isset($USER->id)) {
+ if (empty($USER->id)) {
require_login();
}