Fixes to the PaintWeb cron task.
[moodle/mihaisucan.git] / admin / register.php
blobdeee6b7aeee52715ddecf36303b56a5b79c63d72
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));
10 if (!$site = get_site()) {
11 redirect("index.php");
14 if (!confirm_sesskey()) {
15 print_error('confirmsesskeybad', 'error');
18 if (!$admin = get_admin()) {
19 error("No admins");
22 if (!$admin->country and $CFG->country) {
23 $admin->country = $CFG->country;
26 /// Print headings
27 $stradministration = get_string("administration");
28 $strregistration = get_string("registration");
29 $strregistrationinfo = get_string("registrationinfo");
30 $navlinks = array();
31 $navlinks[] = array('name' => $stradministration, 'link' => "../$CFG->admin/index.php", 'type' => 'misc');
32 $navlinks[] = array('name' => $strregistration, 'link' => null, 'type' => 'misc');
33 $navigation = build_navigation($navlinks);
34 print_header("$site->shortname: $strregistration", $site->fullname, $navigation);
36 print_heading($strregistration);
38 print_simple_box($strregistrationinfo, "center", "70%");
41 /// Print the form
43 echo "<form id=\"mform1\" class=\"mform\" action=\"http://moodle.org/register/\" method=\"post\">\n";
44 echo '<fieldset id="registration">';
45 echo '<legend>'.get_string("registrationinfotitle").'</legend>';
47 echo "<!-- The following hidden variables are to help prevent fake entries being sent. -->\n";
48 echo "<!-- Together they form a key. If any of these change between updates then the entry -->\n";
49 echo "<!-- is flagged as a new entry and will be manually checked by the list maintainer -->\n";
50 echo "<input type=\"hidden\" name=\"url\" value=\"$CFG->wwwroot\" />\n";
51 echo "<input type=\"hidden\" name=\"secret\" value=\"" . get_site_identifier() . "\" />\n";
52 echo "<input type=\"hidden\" name=\"host\" value=\"".$_SERVER["HTTP_HOST"]."\" />\n";
53 echo "<input type=\"hidden\" name=\"lang\" value=\"".current_language()."\" />\n";
55 echo "<input type=\"hidden\" name=\"version\" value=\"$CFG->version\" />\n";
56 echo "<input type=\"hidden\" name=\"release\" value=\"$CFG->release\" />\n";
58 echo '<div class="fitem">';
59 echo '<div class="fitemtitle"><label>URL</label></div>';
60 echo '<div class="felement ftext">'.$CFG->wwwroot.'</div>';
61 echo '</div>';
63 echo '<div class="fitem">';
64 echo '<div class="fitemtitle"><label>'.get_string("currentversion").'</label></div>';
65 echo '<div class="felement ftext">'."$CFG->release ($CFG->version)".'</div>';
66 echo '</div>';
68 echo '<div class="fitem">';
69 echo '<div class="fitemtitle"><label for="sitename">'.get_string("fullsitename").'</label></div>';
70 echo '<div class="felement ftext">';
71 echo '<input size="50" id="sitename" type="text" name="sitename" value="'.format_string($site->fullname).'" />';
72 echo '</div>';
73 echo '</div>';
75 echo '<div class="fitem">';
76 echo '<div class="fitemtitle"><label for="menucountry">'.get_string("country").'</label></div>';
77 echo '<div class="felement ftext">';
78 choose_from_menu (get_list_of_countries(), "country", $admin->country, get_string("selectacountry")."...", "", "");
79 echo '</div>';
80 echo '</div>';
82 echo '<div class="fitem">';
83 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>';
84 echo '<div class="felement ftext">';
85 $options[0] = get_string("publicdirectory0");
86 $options[1] = get_string("publicdirectory1");
87 $options[2] = get_string("publicdirectory2");
88 choose_from_menu ($options, "public", "2", "", "", "");
89 unset($options);
90 echo '</div>';
91 echo '</div>';
93 echo '<div class="fitem">';
94 echo '<div class="fitemtitle"><label for="menucontact">'.get_string("registrationcontact").'</label></div>';
95 echo '<div class="felement ftext">';
96 $options[0] = get_string("registrationcontactno");
97 $options[1] = get_string("registrationcontactyes");
98 choose_from_menu ($options, "contact", "1", "", "", "");
99 unset($options);
100 echo '</div>';
101 echo '</div>';
103 echo '<div class="fitem">';
104 echo '<div class="fitemtitle"><label>'.get_string("statistics")."<br />(".get_string("notpublic").')'.'</label></div>';
105 echo '<div class="felement ftext">';
107 $count = count_records('course')-1;
108 echo get_string("courses").": ".$count;
109 echo "<input type=\"hidden\" name=\"courses\" value=\"$count\" />\n";
110 echo '<br />';
112 $count = count_records('user', 'deleted', 0);
113 echo get_string("users").": ".$count;
114 echo "<input type=\"hidden\" name=\"users\" value=\"$count\" />\n";
115 echo '<br />';
117 // total number of role assignments
118 $count = count_records('role_assignments');
119 echo get_string('roleassignments', 'role').": ".$count;
120 echo "<input type=\"hidden\" name=\"roleassignments\" value=\"$count\" />\n";
121 echo '<br />';
123 // first find all distinct roles with mod/course:update
124 // please change the name and strings to something appropriate to reflect the new data collected
125 $sql = "SELECT COUNT(DISTINCT u.id)
126 FROM {$CFG->prefix}role_capabilities rc,
127 {$CFG->prefix}role_assignments ra,
128 {$CFG->prefix}user u
129 WHERE (rc.capability = 'moodle/course:update' or rc.capability='moodle/site:doanything')
130 AND rc.roleid = ra.roleid
131 AND u.id = ra.userid";
133 $count = count_records_sql($sql);
134 echo get_string("teachers").": ".$count;
135 echo "<input type=\"hidden\" name=\"courseupdaters\" value=\"$count\" />\n";
136 echo '<br />';
138 $count = count_records('forum_posts');
139 echo get_string("posts", 'forum').": ".$count;
140 echo "<input type=\"hidden\" name=\"posts\" value=\"$count\" />\n";
141 echo '<br />';
143 $count = count_records('question');
144 echo get_string("questions", 'quiz').": ".$count;
145 echo "<input type=\"hidden\" name=\"questions\" value=\"$count\" />\n";
146 echo '<br />';
148 $count = count_records('resource');
149 echo get_string("modulenameplural", "resource").": ".$count;
150 echo "<input type=\"hidden\" name=\"resources\" value=\"$count\" />\n";
151 echo '</div>';
152 echo '</div>';
154 echo '<div class="fitem">';
155 echo '<div class="fitemtitle"><label for="adminname">'.get_string("administrator").'</label></div>';
156 echo '<div class="felement ftext">';
157 echo "<input size=\"50\" type=\"text\" id=\"adminname\" name=\"adminname\" value=\"".fullname($admin, true)."\" />";
158 echo '</div>';
159 echo '</div>';
161 echo '<div class="fitem">';
162 echo '<div class="fitemtitle"><label for="adminemail">'.get_string("email").'</label></div>';
163 echo '<div class="felement ftext">';
164 echo "<input size=\"50\" type=\"text\" id=\"adminemail\" name=\"adminemail\" value=\"$admin->email\" />";
165 echo '</div>';
166 echo '</div>';
168 echo '<div class="fitem">';
169 echo '<div class="fitemtitle"><label for="menumailme">'.get_string("registrationemail").'</label></div>';
170 echo '<div class="felement ftext">';
171 $options[0] = get_string("registrationno");
172 $options[1] = get_string("registrationyes");
173 choose_from_menu ($options, "mailme", "1", "", "", "");
174 unset($options);
175 echo '</div>';
176 echo '</div>';
178 echo '<div class="felement fsubmit"><input name="submitbutton" value="'.get_string('registrationsend').'" type="submit" id="id_submitbutton" /></div>';
180 echo "</fieldset>\n";
182 echo "</form>\n";
184 print_footer();