MDL-11510 added missing fields in new gradebook backup
[moodle-pu.git] / admin / register.php
blobce558f4824b0c0d33fcc1bbd9f9fc51dea5ef74b
1 <?php // $Id$
2 // register.php - allows admin to register their site on moodle.org
4 require_once('../config.php');
6 require_login();
8 require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM, SITEID));
10 if (!$site = get_site()) {
11 redirect("index.php");
14 if (!confirm_sesskey()) {
15 error(get_string('confirmsesskeybad', 'error'));
18 if (!$admin = get_admin()) {
19 error("No admins");
22 if (!$admin->country and $CFG->country) {
23 $admin->country = $CFG->country;
26 if (empty($CFG->siteidentifier)) { // Unique site identification code
27 set_config('siteidentifier', random_string(32).$_SERVER['HTTP_HOST']);
31 /// Print headings
33 $stradministration = get_string("administration");
34 $strregistration = get_string("registration");
35 $strregistrationinfo = get_string("registrationinfo");
36 $navlinks = array();
37 $navlinks[] = array('name' => $stradministration, 'link' => "../$CFG->admin/index.php", 'type' => 'misc');
38 $navlinks[] = array('name' => $strregistration, 'link' => null, 'type' => 'misc');
39 $navigation = build_navigation($navlinks);
40 print_header("$site->shortname: $strregistration", $site->fullname, $navigation);
42 print_heading($strregistration);
44 print_simple_box($strregistrationinfo, "center", "70%");
47 /// Print the form
49 echo "<form id=\"mform1\" class=\"mform\" action=\"http://moodle.org/register/\" method=\"post\">\n";
50 echo '<fieldset id="registration">';
51 echo '<legend>Registration Information</legend>';
53 echo "<!-- The following hidden variables are to help prevent fake entries being sent. -->\n";
54 echo "<!-- Together they form a key. If any of these change between updates then the entry -->\n";
55 echo "<!-- is flagged as a new entry and will be manually checked by the list maintainer -->\n";
56 echo "<input type=\"hidden\" name=\"url\" value=\"$CFG->wwwroot\" />\n";
57 echo "<input type=\"hidden\" name=\"secret\" value=\"$CFG->siteidentifier\" />\n";
58 echo "<input type=\"hidden\" name=\"host\" value=\"".$_SERVER["HTTP_HOST"]."\" />\n";
59 echo "<input type=\"hidden\" name=\"lang\" value=\"".current_language()."\" />\n";
61 echo "<input type=\"hidden\" name=\"version\" value=\"$CFG->version\" />\n";
62 echo "<input type=\"hidden\" name=\"release\" value=\"$CFG->release\" />\n";
64 echo '<div class="fitem">';
65 echo '<div class="fitemtitle"><label>URL</label></div>';
66 echo '<div class="felement ftext">'.$CFG->wwwroot.'</div>';
67 echo '</div>';
69 echo '<div class="fitem">';
70 echo '<div class="fitemtitle"><label>'.get_string("currentversion").'</label></div>';
71 echo '<div class="felement ftext">'."$CFG->release ($CFG->version)".'</div>';
72 echo '</div>';
74 echo '<div class="fitem">';
75 echo '<div class="fitemtitle"><label for="sitename">'.get_string("fullsitename").'</label></div>';
76 echo '<div class="felement ftext">';
77 echo '<input size="50" id="sitename" type="text" name="sitename" value="'.format_string($site->fullname).'" />';
78 echo '</div>';
79 echo '</div>';
81 echo '<div class="fitem">';
82 echo '<div class="fitemtitle"><label for="menucountry">'.get_string("country").'</label></div>';
83 echo '<div class="felement ftext">';
84 choose_from_menu (get_list_of_countries(), "country", $admin->country, get_string("selectacountry")."...", "", "");
85 echo '</div>';
86 echo '</div>';
88 echo '<div class="fitem">';
89 echo '<div class="fitemtitle"><label for="menupublic">'."<a href=\"http://moodle.org/sites/?country=$admin->country\" title=\"".get_string("publicdirectorytitle")."\">".get_string("publicdirectory")."</a>".'</label></div>';
90 echo '<div class="felement ftext">';
91 $options[0] = get_string("publicdirectory0");
92 $options[1] = get_string("publicdirectory1");
93 $options[2] = get_string("publicdirectory2");
94 choose_from_menu ($options, "public", "2", "", "", "");
95 unset($options);
96 echo '</div>';
97 echo '</div>';
99 echo '<div class="fitem">';
100 echo '<div class="fitemtitle"><label for="menucontact">'.get_string("registrationcontact").'</label></div>';
101 echo '<div class="felement ftext">';
102 $options[0] = get_string("registrationcontactno");
103 $options[1] = get_string("registrationcontactyes");
104 choose_from_menu ($options, "contact", "1", "", "", "");
105 unset($options);
106 echo '</div>';
107 echo '</div>';
109 echo '<div class="fitem">';
110 echo '<div class="fitemtitle"><label>'.get_string("statistics")."<br />(".get_string("notpublic").')'.'</label></div>';
111 echo '<div class="felement ftext">';
113 $count = count_records('course')-1;
114 echo get_string("courses").": ".$count;
115 echo "<input type=\"hidden\" name=\"courses\" value=\"$count\" />\n";
116 echo '<br />';
118 $count = count_records('user', 'deleted', 0);
119 echo get_string("users").": ".$count;
120 echo "<input type=\"hidden\" name=\"users\" value=\"$count\" />\n";
121 echo '<br />';
123 // total number of role assignments
124 $count = count_records('role_assignments');
125 echo get_string('roleassignments', 'role').": ".$count;
126 echo "<input type=\"hidden\" name=\"roleassignments\" value=\"$count\" />\n";
127 echo '<br />';
129 // first find all distinct roles with mod/course:update
130 // please change the name and strings to something appropriate to reflect the new data collected
131 $sql = "SELECT COUNT(DISTINCT u.id)
132 FROM {$CFG->prefix}role_capabilities rc,
133 {$CFG->prefix}role_assignments ra,
134 {$CFG->prefix}user u
135 WHERE (rc.capability = 'moodle/course:update' or rc.capability='moodle/site:doanything')
136 AND rc.roleid = ra.roleid
137 AND u.id = ra.userid";
139 $count = count_records_sql($sql);
140 echo get_string("teachers").": ".$count;
141 echo "<input type=\"hidden\" name=\"courseupdaters\" value=\"$count\" />\n";
142 echo '<br />';
144 $count = count_records('forum_posts');
145 echo get_string("posts", 'forum').": ".$count;
146 echo "<input type=\"hidden\" name=\"posts\" value=\"$count\" />\n";
147 echo '<br />';
149 $count = count_records('question');
150 echo get_string("questions", 'quiz').": ".$count;
151 echo "<input type=\"hidden\" name=\"questions\" value=\"$count\" />\n";
152 echo '<br />';
154 $count = count_records('resource');
155 echo get_string("modulenameplural", "resource").": ".$count;
156 echo "<input type=\"hidden\" name=\"resources\" value=\"$count\" />\n";
157 echo '</div>';
158 echo '</div>';
160 echo '<div class="fitem">';
161 echo '<div class="fitemtitle"><label for="adminname">'.get_string("administrator").'</label></div>';
162 echo '<div class="felement ftext">';
163 echo "<input size=\"50\" type=\"text\" id=\"adminname\" name=\"adminname\" value=\"".fullname($admin, true)."\" />";
164 echo '</div>';
165 echo '</div>';
167 echo '<div class="fitem">';
168 echo '<div class="fitemtitle"><label for="adminemail">'.get_string("email").'</label></div>';
169 echo '<div class="felement ftext">';
170 echo "<input size=\"50\" type=\"text\" id=\"adminemail\" name=\"adminemail\" value=\"$admin->email\" />";
171 echo '</div>';
172 echo '</div>';
174 echo '<div class="fitem">';
175 echo '<div class="fitemtitle"><label for="menumailme">'.get_string("registrationemail").'</label></div>';
176 echo '<div class="felement ftext">';
177 $options[0] = get_string("registrationno");
178 $options[1] = get_string("registrationyes");
179 choose_from_menu ($options, "mailme", "1", "", "", "");
180 unset($options);
181 echo '</div>';
182 echo '</div>';
184 echo '<div class="felement fsubmit"><input name="submitbutton" value="'.get_string('registrationsend').'" type="submit" id="id_submitbutton" /></div>';
186 echo "</fieldset>\n";
188 echo "</form>\n";
190 print_footer();