Exemplo n.º 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() || BatchUser::amIAdmin($loggeduser->id, $batch->id)) {
        echo '
              <a href="updatebatch.php?id=' . $batch->id . '" class="btn-mini pull-right">
              <i class="icon-large icon-pencil"></i> Edit
              </a> 
            ';
    }
    $loggedbatchuser = BatchUser::getUser($session->user_id, $batch->id);
    if ($loggedbatchuser == 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 ($loggedbatchuser != null) {
            if ($loggedbatchuser->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 {
Exemplo n.º 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 = "batchuser";
         $notification->title = "Invites you";
         $notification->create();
         $response = "success";
     } else {
         $theuser = BatchUser::getUser($user->id, $_GET['batchid']);
         if ($theuser->pending == 0) {
             $response = "This user is already a member.";
         } else {
             $response = "This user is already pending.";
         }
     }
 } 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;
Exemplo n.º 3
0
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";
                }
            } else {
Exemplo n.º 4
0
 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 {
                 $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['sectionid'])) {
             $section = Section::get_by_id($_GET['sectionid']);
             $theuser = SectionUser::getUser($object->id, $section->id);
             if ($theuser) {
                 if ($theuser->pending == 1) {
Exemplo n.º 5
0
         $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();
             $response = "success";
             $notification = new Notification();
             $notification->fromuserid = $loggeduser->id;
             $notification->itemid = $object->id;
             $notification->itemtype = "message";
             $notification->title = "Opted Out";
             $admins = BatchUser::getAdmins($batch->id);
             foreach ($admins as $admin) {
                 $notification->touserid = $admin->userid;
                 $notification->create();
             }
         } else {
             $response = "Error";
         }