Example #1
0
        <?php 
if ($session->is_logged_in()) {
    echo '
            <a href="#invitationBox" role="button" class="btn-mini pull-right" data-toggle="modal">
              <i class="icon-large icon-comment"></i> Invite Students
            </a>
          ';
    if ($loggeduser->is_super_admin() || SchoolUser::amIAdmin($loggeduser->id, $school->id)) {
        echo '
              <a href="updateschool.php?id=' . $school->id . '" class="btn-mini pull-right">
              <i class="icon-large icon-pencil"></i> Edit
              </a>
            ';
    }
    $loggedschooluser = SchoolUser::getUser($session->user_id, $school->id);
    if ($loggedschooluser == null) {
        echo ' 
              <button role="button" class="btn-mini btn-link pull-right" onclick="join(); return false;">
                <i class="icon-large icon-envelope"></i> Join
              </button>
            ';
    } else {
        if ($loggedschooluser != null) {
            if ($loggedschooluser->pending == 1) {
                echo ' 
                <button role="button" class="btn-mini btn-link pull-right" onclick="cancelpending(); return false;">
                  <i class="icon-large icon-envelope"></i> Cancel Pending
                </button>
              ';
            } else {
Example #2
0
         $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.";
         }
     }
 } else {
     if (isset($_GET['batchid'])) {
         if (!BatchUser::userExists($user->id, $_GET['batchid'])) {
             $batch = Batch::get_by_id($_GET['batchid']);
             $school = School::get_by_id($batch->schoolid);
             $object = new BatchUser();
             $object->schoolid = $school->id;
             $object->batchid = $batch->id;
             $object->userid = $user->id;
Example #3
0
<?php

require_once "../initialize.php";
$response = "";
if (isset($_GET['schoolid']) || isset($_GET['batchid']) || isset($_GET['sectionid'])) {
    if (isset($_GET['schoolid'])) {
        if (SchoolUser::userExists($session->user_id, $_GET['schoolid'])) {
            $object = SchoolUser::getUser($session->user_id, $_GET['schoolid']);
            $object->pending == 0;
            $object->update();
            $response = "success";
        } else {
            $response = "Error";
        }
    } else {
        if (isset($_GET['batchid'])) {
            if (BatchUser::userExists($session->user_id, $_GET['batchid'])) {
                $object = BatchUser::getUser($session->user_id, $_GET['batchid']);
                $object->update();
                $response = "success";
            } else {
                $response = "Error";
            }
        } else {
            if (isset($_GET['sectionid'])) {
                if (SectionUser::userExists($session->user_id, $_GET['sectionid'])) {
                    $object = SectionUser::getUser($session->user_id, $_GET['sectionid']);
                    $object->update();
                    $response = "success";
                } else {
                    $response = "Error";
Example #4
0
<?php

require_once "../initialize.php";
$input = $_GET['input'];
$html = "";
$filteredstudents = User::search($input);
if (count($filteredstudents) > 0) {
    foreach ($filteredstudents as $object) {
        $html .= '<tr>';
        $html .= '	<td><img style="height:40px;" src="data:image/jpeg;base64, ' . $object->picture . ' " /></td>';
        $html .= '  <td><a href="student.php?id=' . $object->id . '">' . $object->get_full_name() . '</a></td>';
        if (isset($_GET['schoolid'])) {
            $school = School::get_by_id($_GET['schoolid']);
            $theuser = SchoolUser::getUser($object->id, $school->id);
            if ($theuser) {
                if ($theuser->pending == 1) {
                    $html .= '  <td><button class="btn-small button-flat-primary disabled">Already Pending</button></td>';
                } else {
                    $html .= '<td><button class="btn-small button-flat-action disabled">Member</button></td>';
                }
            } else {
                $html .= '<td><button class="btn-small button-flat-primary btninvite">Invite<span hidden>' . $object->id . '</span></button></td>';
            }
        } else {
            if (isset($_GET['batchid'])) {
                $batch = Batch::get_by_id($_GET['batchid']);
                $theuser = BatchUser::getUser($object->id, $batch->id);
                if ($theuser) {
                    if ($theuser->pending == 1) {
                        $html .= '<td><button class="btn-small button-flat-primary disabled">Already Pending</button></td>';
                    } else {
Example #5
0
<?php

require_once "../initialize.php";
$response = "";
$loggeduser = User::get_by_id($session->user_id);
if (isset($_GET['schoolid']) || isset($_GET['batchid']) || isset($_GET['sectionid'])) {
    if (isset($_GET['schoolid'])) {
        $school = School::get_by_id($_GET['schoolid']);
        if (SchoolUser::userExists($loggeduser->id, $school->id)) {
            $object = SchoolUser::getUser($loggeduser->id, $school->id);
            $object->delete();
            $response = "success";
            $notification = new Notification();
            $notification->fromuserid = $loggeduser->id;
            $notification->itemid = $object->id;
            $notification->itemtype = "message";
            $notification->title = "Opted Out";
            $admins = SchoolUser::getAdmins($school->id);
            foreach ($admins as $admin) {
                $notification->touserid = $admin->userid;
                $notification->create();
            }
        } else {
            $response = "Error";
        }
    } else {
        if (isset($_GET['batchid'])) {
            $batch = Batch::get_by_id($_GET['batchid']);
            if (BatchUser::userExists($loggeduser->id, $_GET['batchid'])) {
                $object = BatchUser::getUser($loggeduser->id, $_GET['batchid']);
                $object->delete();