2 // register.php - allows admin to register their site on moodle.org
4 require_once('../config.php');
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 print_error('confirmsesskeybad', 'error');
18 if (!$admin = get_admin()) {
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']);
33 $stradministration = get_string("administration");
34 $strregistration = get_string("registration");
35 $strregistrationinfo = get_string("registrationinfo");
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%");
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>';
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>';
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
).'" />';
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")."...", "", "");
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", "", "", "");
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", "", "", "");
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";
118 $count = count_records('user', 'deleted', 0);
119 echo get_string("users").": ".$count;
120 echo "<input type=\"hidden\" name=\"users\" value=\"$count\" />\n";
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";
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,
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";
144 $count = count_records('forum_posts');
145 echo get_string("posts", 'forum').": ".$count;
146 echo "<input type=\"hidden\" name=\"posts\" value=\"$count\" />\n";
149 $count = count_records('question');
150 echo get_string("questions", 'quiz').": ".$count;
151 echo "<input type=\"hidden\" name=\"questions\" value=\"$count\" />\n";
154 $count = count_records('resource');
155 echo get_string("modulenameplural", "resource").": ".$count;
156 echo "<input type=\"hidden\" name=\"resources\" value=\"$count\" />\n";
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)."\" />";
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\" />";
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", "", "", "");
184 echo '<div class="felement fsubmit"><input name="submitbutton" value="'.get_string('registrationsend').'" type="submit" id="id_submitbutton" /></div>';
186 echo "</fieldset>\n";