Ejemplo n.º 1
0
         $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.";
         }
     }
 } else {
     if (isset($_GET['clubid'])) {
         if (!ClubUser::userExists($user->id, $_GET['clubid'])) {
             $club = Club::get_by_id($_GET['clubid']);
             $object = new ClubUser();
             $object->userid = $user->id;
             $object->clubid = $club->id;
             $object->level = 0;
             $object->role = "student";
Ejemplo n.º 2
0
 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) {
                 $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['clubid'])) {
             $club = Club::get_by_id($_GET['clubid']);
             $theuser = ClubUser::getUser($object->id, $club->id);
             if ($theuser) {
                 if ($theuser->pending == 1) {
Ejemplo n.º 3
0
     } 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 {
             if (isset($_GET['clubid'])) {
                 if (ClubUser::userExists($session->user_id, $_GET['clubid'])) {
                     $object = ClubUser::getUser($session->user_id, $_GET['clubid']);
                     $object->update();
                     $response = "success";
                 } else {
                     $response = "Error";
                 }
             } else {
Ejemplo n.º 4
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() || SectionUser::amIAdmin($loggeduser->id, $section->id)) {
        echo '
              <a href="updatesection.php?id=' . $section->id . '" class="btn-mini pull-right">
              <i class="icon-large icon-pencil"></i> Edit
              </a>
            ';
    }
    $loggedsectionuser = SectionUser::getUser($session->user_id, $section->id);
    if ($loggedsectionuser == 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 ($loggedsectionuser != null) {
            if ($loggedsectionuser->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 {
Ejemplo n.º 5
0
         $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";
     }
 } else {
     if (isset($_GET['sectionid'])) {
         $section = Section::get_by_id($_GET['sectionid']);
         if (SectionUser::userExists($loggeduser->id, $_GET['sectionid'])) {
             $object = SectionUser::getUser($loggeduser->id, $_GET['sectionid']);
             $object->delete();
             $response = "success";
             $notification = new Notification();
             $notification->fromuserid = $loggeduser->id;
             $notification->itemid = $object->id;
             $notification->itemtype = "message";
             $notification->title = "Opted Out";
             $admins = SectionUser::getAdmins($section->id);
             foreach ($admins as $admin) {
                 $notification->touserid = $admin->userid;
                 $notification->create();
             }
         } else {
             $response = "Error";
         }