Beispiel #1
0
 }
 $file = new File($_FILES['picture']);
 if ($file->valid) {
     $object->picture = $file->data;
 }
 $object->create();
 if (isset($_POST['schoolselect']) && $_POST['schoolselect'] != "NOTHING") {
     $school = School::get_by_id($_POST['schoolselect']);
 }
 $schooluser = new SchoolUser();
 $schooluser->schoolid = $school->id;
 $schooluser->userid = $object->id;
 $schooluser->level = 0;
 $schooluser->enabled = 1;
 $schooluser->pending = 0;
 $schooluser->create();
 if (isset($_POST['batchselect']) && $_POST['batchselect'] != "NOTHING") {
     $batch = Batch::get_by_id($_POST['batchselect']);
     $batchuser = new BatchUser();
     $batchuser->schoolid = $school->id;
     $batchuser->batchid = $batch->id;
     $batchuser->userid = $object->id;
     $batchuser->level = 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();
<?php

require_once "../../includes/initialize.php";
global $session;
if (!$session->is_logged_in()) {
    redirect_to("../../index.php");
}
if ($_POST['oper'] == 'add') {
    $user = new SchoolUser();
    $user->pending = $_POST['pending'];
    $user->enabled = $_POST['enabled'];
    $user->schoolid = $_POST['schoolid'];
    $user->userid = $_POST['userid'];
    $user->level = $_POST['level'];
    $user->create();
    $log = new Log($session->user_id, $clientip, "WEB", "CREATED SCHOOLUSER: "******"WEB", "UPDATED SCHOOLUSER: "******"WEB", "DELETED SCHOOLUSER: " . $_POST['id']);
Beispiel #3
0
require_once "../initialize.php";
$response = "";
if ((isset($_GET['schoolid']) || isset($_GET['batchid']) || isset($_GET['sectionid'])) && isset($_GET['userid'])) {
    $user = User::get_by_id($_GET['userid']);
    if (isset($_GET['schoolid'])) {
        if (!SchoolUser::userExists($user->id, $_GET['schoolid'])) {
            $school = School::get_by_id($_GET['schoolid']);
            $object = new SchoolUser();
            $object->schoolid = $school->id;
            $object->userid = $user->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 = "schooluser";
            $notification->title = "Invites you";
            $notification->create();
            $response = "success";
        } else {
            $theuser = SchoolUser::getUser($user->id, $_GET['schoolid']);
            if ($theuser->pending == 0) {
                $response = "This user is already a member.";
            } else {
                $response = "This user is already pending.";
            }