Esempio n. 1
0
    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']);
            $log->create();
            SchoolUser::get_by_id($_POST['id'])->delete();
        }
    }
}
Esempio n. 2
0
if (isset($_GET['itemid']) && $_GET['itemid'] != '' && isset($_GET['itemtype']) && $_GET['itemtype'] != '' && isset($_GET['touserid']) && $_GET['touserid'] != '' && isset($_GET['notificationid']) && $_GET['notificationid'] != '') {
    $itemtype = $_GET['itemtype'];
    $itemid = $_GET['itemid'];
    $touserid = $_GET['touserid'];
    $notificationid = $_GET['notificationid'];
    $notification = new Notification();
    if ($itemtype == "friend") {
        $object = Friend::get_by_id($itemid);
        $object->pending = 0;
        $object->update();
        $notification->title = "message";
        $notification->itemid = $itemid;
        $notification->itemtype = "friend";
    } else {
        if ($itemtype == "schooluser") {
            $object = SchoolUser::get_by_id($itemid);
            $object->pending = 0;
            $object->update();
            $notification->title = "message";
            $notification->itemid = $itemid;
            $notification->itemtype = "schooluser";
        } else {
            if ($itemtype == "batchuser") {
                $object = BatchUser::get_by_id($itemid);
                $object->pending = 0;
                $object->update();
                $notification->title = "message";
                $notification->itemid = $itemid;
                $notification->itemtype = "batchuser";
            } else {
                if ($itemtype == "sectionuser") {
Esempio n. 3
0
     $html .= "\t\t<button class='btn btn-primary btnaccept'>Accept<span hidden class='itemid'>" . $notification->itemid . "</span><span hidden class='itemtype'>" . $notification->itemtype . "</span><span hidden class='fromuserid'>" . $notification->fromuserid . "</span><span hidden class='notificationid'>" . $notification->id . "</span></button> ";
     $html .= "\t\t<button class='btn btn-danger btndecline'>Decline<span hidden class='itemid'>" . $notification->itemid . "</span><span hidden class='itemtype'>" . $notification->itemtype . "</span><span hidden class='fromuserid'>" . $notification->fromuserid . "</span><span hidden class='notificationid'>" . $notification->id . "</span></button>";
 } else {
     if ($notification->itemtype == "friend") {
         $object = Friend::get_by_id($notification->itemid);
         if ($object->userid != $session->user_id) {
             $touser = User::get_by_id($object->userid);
         } else {
             if ($object->touserid != $session->user_id) {
                 $touser = User::get_by_id($object->touserid);
             }
         }
         $html .= "Now friends";
     } else {
         if ($notification->itemtype == "schooluser") {
             $object = SchoolUser::get_by_id($notification->itemid);
             $school = School::get_by_id($object->schoolid);
             $html .= "Now a member in School <a href='school.php?id=" . $school->id . "'>" . $school->name . "</a>";
         } else {
             if ($notification->itemtype == "batchuser") {
                 $object = BatchUser::get_by_id($notification->itemid);
                 $batch = Batch::get_by_id($object->batchid);
                 $school = School::get_by_id($object->schoolid);
                 $html .= "Now a member in Batch <a href='batch.php?id=" . $batch->id . "'>" . $batch->get_batchyear() . "</a> of School <a href='school.php?id=" . $school->id . "'>" . $school->name . "</a>";
             } else {
                 if ($notification->itemtype == "sectionuser") {
                     $object = SectionUser::get_by_id($notification->itemid);
                     $section = Section::get_by_id($object->sectionid);
                     $batch = Batch::get_by_id($object->batchid);
                     $school = School::get_by_id($object->schoolid);
                     $html .= "Now a member in Section <a href='section.php?id=" . $section->id . "'>" . $section->name . "</a> of Batch <a href='batch.php?id=" . $batch->id . "'>" . $batch->get_batchyear() . "</a> of School <a href='school.php?id=" . $school->id . "'>" . $school->name . "</a>";
Esempio n. 4
0
         SectionUser::delete_all_by_schoolid($school->id);
         Section::delete_all_by_schoolid($school->id);
         //===================BATCH=============================//
         BatchUser::delete_all_by_schoolid($school->id);
         Batch::delete_all_by_schoolid($school->id);
         //===================SCHOOL=============================//
         SchoolUser::delete_all_by_schoolid($school->id);
         $school->delete();
     }
     $log = new Log($session->userid, $clientip, "WEB", "DELETED MULTIPLE SCHOOLS");
     $log->create();
     $response = "success";
 } else {
     if ($what == "schooluser") {
         foreach ($ids as $id) {
             SchoolUser::get_by_id($id)->delete();
         }
         $log = new Log($session->userid, $clientip, "WEB", "DELETED MULTIPLE SCHOOLUSERS");
         $log->create();
         $response = "success";
     } else {
         if ($what == "batch") {
             foreach ($ids as $id) {
                 $batch = Batch::get_by_id($id);
                 SectionUser::delete_all_by_schoolid($batch->schoolid);
                 Section::delete_all_by_schoolid($batch->schoolid);
                 BatchUser::delete_all_by_batchid($batch->id);
                 $folder_path = "../../public/schools/" . $batch->schoolid . "/yearbooks/" . $batch->get_batchyear();
                 rrmdir($folder_path);
                 $batch->delete();
             }