Remove ValidateIterator, replaced by Validate::iterate().
[platal.git] / modules / admin.php
index c39e2ba..e1e2ceb 100644 (file)
@@ -1012,7 +1012,6 @@ class AdminModule extends PLModule
         $page->setTitle('Administration - Valider une demande');
         $page->addCssLink('nl.css');
         $page->addJsLink('ajax.js');
-        require_once 'validations.inc.php';
 
         if ($action == 'edit' && !is_null($id)) {
             $page->assign('preview_id', $id);
@@ -1061,7 +1060,7 @@ class AdminModule extends PLModule
         // where several copies of the site use the same DB, but not the same "dynamic configuration"
         global $globals;
         $globals->updateNbValid();
-        $page->assign('vit', new ValidateIterator());
+        $page->assign('vit', Validate::iterate());
     }
 
     function handler_validate_answers(&$page, $action = 'list', $id = null)
@@ -1152,9 +1151,10 @@ class AdminModule extends PLModule
             S::assert_xsrf_token();
             $firstname = Post::t('firstname');
             $lastname = strtoupper(Post::t('lastname'));
-            $sex = Post::b('sex') ? User::GENDER_FEMALE : User::GENDER_FEMALE;
+            $sex = Post::b('sex') ? User::GENDER_FEMALE : User::GENDER_MALE;
             $email = Post::t('email');
-            $login = PlUser::makeHrid($firstname, $lastname, 'ax');
+            $type = Post::s('type');
+            $login = PlUser::makeHrid($firstname, $lastname, $type);
             if (!isvalid_email($email)) {
                 $page->trigError("Invalid email address: $email");
             } else if (strlen(Post::s('pwhash')) != 40) {
@@ -1165,14 +1165,14 @@ class AdminModule extends PLModule
                 XDB::execute("INSERT INTO  accounts (hruid, type, state, password,
                                                      registration_date, email, full_name,
                                                      display_name, sex, directory_name)
-                                   VALUES  ({?}, 'ax', 'active', {?}, NOW(), {?}, {?}, {?}, {?}, {?})",
-                             $login, Post::s('pwhash'), $email, $full_name, $full_name, $sex,
+                                   VALUES  ({?}, {?}, 'active', {?}, NOW(), {?}, {?}, {?}, {?}, {?})",
+                             $login, $type, Post::s('pwhash'), $email, $full_name, $full_name, $sex,
                              $directory_name);
             }
         }
 
-        $uf = new UserFilter(new UFC_AccountType('ax'));
-        $page->assign('users', $uf->iterUsers(new PlLimit(10)));
+        $uf = new UserFilter(new UFC_AccountType('ax', 'school', 'fx'));
+        $page->assign('users', $uf->iterUsers());
 
     }
 
@@ -1398,9 +1398,9 @@ class AdminModule extends PLModule
         $page->changeTpl('admin/jobs.tpl');
 
         if (Env::has('search')) {
-            $res = XDB::query("SELECT  e.id, e.name, e.acronym
-                                 FROM  profile_job_enum AS e
-                                WHERE  e.name LIKE CONCAT('% ', {?}, '%') OR e.acronym LIKE CONCAT('% ', {?}, '%')",
+            $res = XDB::query("SELECT  id, name, acronym
+                                 FROM  profile_job_enum
+                                WHERE  name LIKE CONCAT('%', {?}, '%') OR acronym LIKE CONCAT('%', {?}, '%')",
                               Env::t('job'), Env::t('job'));
 
             if ($res->numRows() <= 20) {