Noted that xml format can now handle images.
[moodle-linuxchix.git] / admin / register.php
blobbe8938c5b2d4291f6cdf702755cff5fce10abc90
1 <?php // $Id$
2 // register.php - allows admin to register their site on moodle.org
4 require_once('../config.php');
6 require_login();
8 if (!isadmin()) {
9 error("Only the admin can use this page");
12 if (!$site = get_site()) {
13 redirect("index.php");
16 if (!confirm_sesskey()) {
17 error(get_string('confirmsesskeybad', 'error'));
20 if (!$admin = get_admin()) {
21 error("No admins");
24 if (!$admin->country and $CFG->country) {
25 $admin->country = $CFG->country;
28 if (empty($CFG->siteidentifier)) { // Unique site identification code
29 set_config('siteidentifier', random_string(32));
33 /// Print headings
35 $stradministration = get_string("administration");
36 $strregistration = get_string("registration");
37 $strregistrationinfo = get_string("registrationinfo");
39 print_header("$site->shortname: $strregistration", "$site->fullname",
40 "<a href=\"../$CFG->admin/index.php\">$stradministration</a> -> $strregistration");
42 print_heading($strregistration);
44 print_simple_box($strregistrationinfo, "center", "70%");
45 echo "<br />";
48 /// Print the form
50 print_simple_box_start("center", "");
52 echo "<form name=\"form\" action=\"http://moodle.org/register/\" method=\"post\">\n";
53 echo "<table cellpadding=\"9\" border=\"0\">\n";
54 echo "<tr valign=\"top\">\n";
55 echo "<td align=\"center\" colspan=\"2\">".get_string("location")."</td>\n";
56 echo "</tr>\n";
58 echo "<tr valign=\"top\">\n";
59 echo "<td align=\"right\">Moodle URL:</td>\n";
60 echo "<td>$CFG->wwwroot</td>\n";
61 echo "<!-- The following hidden variables are to help prevent fake entries being sent. -->\n";
62 echo "<!-- Together they form a key. If any of these change between updates then the entry -->\n";
63 echo "<!-- is flagged as a new entry and will be manually checked by the list maintainer -->\n";
65 echo "<input type=\"hidden\" name=\"url\" value=\"$CFG->wwwroot\">\n";
66 echo "<input type=\"hidden\" name=\"secret\" value=\"$CFG->siteidentifier\">\n";
67 echo "<input type=\"hidden\" name=\"host\" value=\"".$_SERVER["HTTP_HOST"]."\">\n";
68 echo "<input type=\"hidden\" name=\"lang\" value=\"".current_language()."\">\n";
69 echo "</td></tr>\n";
71 echo "<tr valign=\"top\">\n";
72 echo "<td align=\"right\">".get_string("currentversion").":</td>\n";
73 echo "<td>$CFG->release ($CFG->version)</td>\n";
74 echo "<input type=\"hidden\" name=\"version\" value=\"$CFG->version\">\n";
75 echo "<input type=\"hidden\" name=\"release\" value=\"$CFG->release\">\n";
76 echo "</td></tr>\n";
78 echo "<tr valign=\"top\">\n";
79 echo "<td align=\"right\">".get_string("fullsitename").":</td>\n";
80 echo "<td><input size=\"50\" type=\"text\" name=\"sitename\" value=\"$site->fullname\"></td>\n";
81 echo "</tr>\n";
83 echo "<tr valign=\"top\">\n";
84 echo "<td align=\"right\">".get_string("country").":</td>\n";
85 echo "<td>";
86 choose_from_menu (get_list_of_countries(), "country", $admin->country, get_string("selectacountry")."...", "", "");
87 echo "</td>\n";
88 echo "</tr>\n";
90 echo "<tr valign=\"top\">\n";
91 echo "<td align=\"right\"><a href=\"http://moodle.org/sites/?country=$admin->country\" title=\"See the current list of sites\" target=_blank>".get_string("publicdirectory")."</a>:</td>\n";
92 echo "<td>";
93 $options[0] = get_string("publicdirectory0");
94 $options[1] = get_string("publicdirectory1");
95 $options[2] = get_string("publicdirectory2");
96 choose_from_menu ($options, "public", "2", "", "", "");
97 unset($options);
98 echo "</td>\n";
99 echo "</tr>\n";
101 echo "<tr valign=\"top\">\n";
102 echo "<td align=\"right\">".get_string("registrationcontact")."</a>:</td>\n";
103 echo "<td>\n";
104 $options[0] = get_string("registrationcontactno");
105 $options[1] = get_string("registrationcontactyes");
106 choose_from_menu ($options, "contact", "1", "", "", "");
107 unset($options);
108 echo "</td>\n";
109 echo "</tr>\n";
111 echo "<tr valign=\"top\">\n";
112 echo "<td align=\"right\">".get_string("statistics").":";
113 echo "<br />(".get_string("notpublic").')';
114 echo "</td>\n";
115 echo "<td>";
117 $count = count_records('course')-1;
118 echo get_string("courses").": ".$count;
119 echo "<input type=\"hidden\" name=\"courses\" value=\"$count\">\n";
120 echo '<br />';
122 $count = count_records('user')-1;
123 echo get_string("users").": ".$count;
124 echo "<input type=\"hidden\" name=\"users\" value=\"$count\">\n";
125 echo '<br />';
127 $count = count_records('user_students');
128 echo get_string("enrolments").": ".$count;
129 echo "<input type=\"hidden\" name=\"enrolments\" value=\"$count\">\n";
130 echo '<br />';
132 $count = count_records('user_teachers');
133 echo get_string("teachers").": ".$count;
134 echo "<input type=\"hidden\" name=\"teachers\" value=\"$count\">\n";
135 echo '<br />';
137 $count = count_records('forum_posts');
138 echo get_string("posts", 'forum').": ".$count;
139 echo "<input type=\"hidden\" name=\"posts\" value=\"$count\">\n";
140 echo '<br />';
142 $count = count_records('question');
143 echo get_string("questions", 'quiz').": ".$count;
144 echo "<input type=\"hidden\" name=\"questions\" value=\"$count\">\n";
145 echo '<br />';
147 $count = count_records('resource');
148 echo get_string("modulenameplural", "resource").": ".$count;
149 echo "<input type=\"hidden\" name=\"resources\" value=\"$count\">\n";
150 echo '<br />';
152 echo "</td>\n";
153 echo "</tr>\n";
155 echo "<tr valign=\"top\">\n";
156 echo "<td align=\"center\" colspan=\"2\"><hr size=\"1\" noshade>".get_string("administrator")."</td>\n";
157 echo "</tr>\n";
159 echo "<tr valign=\"top\">\n";
160 echo "<td align=\"right\">".get_string("administrator").":</td>\n";
161 echo "<td><input size=\"50\" type=\"text\" name=\"adminname\" value=\"".fullname($admin, true)."\"></td>\n";
162 echo "</tr>\n";
164 echo "<tr valign=\"top\">\n";
165 echo "<td align=\"right\">".get_string("email").":</td>\n";
166 echo "<td><input size=\"50\" type=\"text\" name=\"adminemail\" value=\"$admin->email\"></td>\n";
167 echo "</tr>\n";
169 echo "<tr valign=\"top\">\n";
170 echo "<td align=\"right\">".get_string("registrationemail")."</a>:</td>\n";
171 echo "<td>\n";
172 $options[0] = get_string("registrationno");
173 $options[1] = get_string("registrationyes");
174 choose_from_menu ($options, "mailme", "1", "", "", "");
175 unset($options);
176 echo "</td>\n";
177 echo "</tr>\n";
179 echo "<tr valign=\"top\">\n";
180 echo "<td align=\"right\">&nbsp;</td>\n";
181 echo "<td><input type=\"submit\" value=\"".get_string("registrationsend")."\"></td>\n";
182 echo "</tr>\n";
185 echo "</table>\n";
186 echo "</form>\n";
188 print_simple_box_end();
190 echo "<br />\n";
192 print_footer();