Ejemplo n.º 1
0
                         $batchuser->enabled = 1;
                         $batchuser->pending = 0;
                         $batchuser->create();
                     }
                     if (isset($_POST['sectionselect']) && $_POST['sectionselect'] != "NOTHING") {
                         $section = Section::get_by_id($_POST['sectionselect']);
                         $batch = Batch::get_by_id($section->batchid);
                         $sectionuser = new SectionUser();
                         $sectionuser->sectionid = $section->id;
                         $sectionuser->batchid = $batch->id;
                         $sectionuser->userid = $object->id;
                         $sectionuser->schoolid = $school->id;
                         $sectionuser->level = 0;
                         $sectionuser->enabled = 1;
                         $sectionuser->pending = 0;
                         $sectionuser->create();
                     }
                     $log = new Log($session->user_id, $clientip, "WEB", "CREATED USER: "******"success";
                 }
             } else {
                 $log = new Log($session->user_id, $clientip, "WEB", "CREATE USER NOT FILLED");
                 $log->create();
                 $message = "Please enter a username and a password.";
             }
         } else {
             $message = "unknown";
         }
     }
 }
Ejemplo n.º 2
0
 } else {
     if (isset($_GET['sectionid'])) {
         if (!SectionUser::userExists($user->id, $_GET['sectionid'])) {
             $section = Section::get_by_id($_GET['sectionid']);
             $batch = Batch::get_by_id($section->batchid);
             $school = School::get_by_id($batch->schoolid);
             $object = new SectionUser();
             $object->userid = $user->id;
             $object->schoolid = $school->id;
             $object->batchid = $batch->id;
             $object->sectionid = $section->id;
             $object->level = 0;
             $object->role = "student";
             $object->enabled = 1;
             $object->pending = 1;
             $object->create();
             $notification = new Notification();
             $notification->fromuserid = $session->user_id;
             $notification->touserid = $user->id;
             $notification->itemid = $object->id;
             $notification->itemtype = "sectionuser";
             $notification->title = "Invites you";
             $notification->create();
             $response = "success";
         } else {
             $theuser = SectionUser::getUser($user->id, $_GET['sectionid']);
             if ($theuser->pending == 0) {
                 $response = "This user is already a member.";
             } else {
                 $response = "This user is already pending.";
             }