From 284dc1a10397f13039669e36e00e11173c4d8baf Mon Sep 17 00:00:00 2001 From: moodler Date: Mon, 16 Aug 2004 12:50:20 +0000 Subject: [PATCH] Added new login block from Janne! --- blocks/login/block_login.php | 77 ++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 blocks/login/block_login.php diff --git a/blocks/login/block_login.php b/blocks/login/block_login.php new file mode 100644 index 0000000000..89d8b54300 --- /dev/null +++ b/blocks/login/block_login.php @@ -0,0 +1,77 @@ +title = get_string('login'); + $this->content_type = BLOCK_TYPE_TEXT; + $this->course = $course; + $this->version = 2004081600; + } + + function applicable_formats() { + return COURSE_FORMAT_SITE; + } + + function get_content () { + global $USER, $CFG; + $wwwroot = ''; + $signup = ''; + + if ($this->content !== NULL) { + return $this->content; + } + + if (empty($CFG->loginhttps)) { + $wwwroot = $CFG->wwwroot; + } else { + // This actually is not so secure ;-), 'cause we're + // in unencrypted connection... + $wwwroot = str_replace("http://", "https://", $CFG->wwwroot); + } + + switch ($CFG->auth) { + // I'm not sure if user can create an account + // him/her self when using ldap authentication. + // If true, then there should be a method for it. + case "email": + $signup = $wwwroot . '/login/signup.php'; + break; + case "none": + // just for the user to see instructions! + $signup = $wwwroot . '/login/index.php'; + break; + default: + $signup = ''; + } + + $username = get_moodle_cookie(); + if (empty($USER->loggedin)) { + $this->content->text = "
content->text .= " action=\"". $wwwroot ."/login/index.php\">\n"; + $this->content->text .= "content->text .= " width=\"100%\" style=\"font-size: small;\">\n"; + $this->content->text .= "\n\n\n"; + $this->content->text .= "\n\n\n"; + $this->content->text .= "\n\n\n"; + $this->content->text .= "\n\n\n"; + $this->content->text .= "\n\n\n"; + if (!empty($signup)) { + $this->content->text .= "\n"; + } + $this->content->text .= "
". get_string("username") .":
content->text .= $username . "\" />
". get_string("password") .":
content->text .= get_string("login"); + $this->content->text .= "\" />
"; + $this->content->text .= get_string('startsignup'); + $this->content->text .= "
\n"; + $this->content->text .= "
\n"; + } else { + $this->content->text = ''; // It's time to dissapear! + // And keep the self test happy by + // passing empty string! + } + return $this->content; + } +} + +?> -- 2.39.5