Beispiel #1
0
    if ($searchOper == 'eq') {
        $searchString = $searchString;
    }
    if ($searchOper == 'bw' || $searchOper == 'bn') {
        $searchString .= '%';
    }
    if ($searchOper == 'ew' || $searchOper == 'en') {
        $searchString = '%' . $searchString;
    }
    if ($searchOper == 'cn' || $searchOper == 'nc' || $searchOper == 'in' || $searchOper == 'ni') {
        $searchString = '%' . $searchString . '%';
    }
    $where = "{$searchField} {$ops} '{$searchString}'";
    $batchusers = BatchUser::get_by_sql("SELECT * FROM " . T_BATCHUSERS . " WHERE " . $where . " AND " . $where2 . " ORDER BY {$sidx} {$sord} LIMIT {$start} , {$limit}");
} else {
    $batchusers = BatchUser::get_by_sql("SELECT * FROM " . T_BATCHUSERS . " WHERE " . $where2 . " ORDER BY {$sidx} {$sord} LIMIT {$start} , {$limit}");
}
header("Content-type: text/xml;charset=utf-8");
$s = "<?xml version='1.0' encoding='utf-8'?>";
$s .= "<rows>";
$s .= "<page>" . $page . "</page>";
$s .= "<total>" . $total_pages . "</total>";
$s .= "<records>" . $count . "</records>";
foreach ($batchusers as $batchuser) {
    $user = User::get_by_id($batchuser->userid);
    if (!$user) {
        $user = new User();
    }
    $school = School::get_by_id($batchuser->schoolid);
    if (!$school) {
        $school = new School();
Beispiel #2
0
     } 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";
         }
     } 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();
Beispiel #3
0
        $log = new Log($session->user_id, $clientip, "WEB", "UPDATED SCHOOL: " . $_POST['id']);
        $log->create();
    } else {
        if ($_POST['oper'] == 'del') {
            $log = new Log($session->user_id, $clientip, "WEB", "DELETED SCHOOL: " . $_POST['id']);
            $log->create();
            $school = School::get_by_id($_POST['id']);
            $folder_path = "../../public/schools/" . $school->id;
            if (file_exists($folder_path) && $folder_path != "../../public/schools/") {
                rrmdir($folder_path);
            }
            //===================SECTION=============================//
            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();
        }
    }
}
function rrmdir($dir)
{
    foreach (glob($dir . '/*') as $file) {
        if (is_dir($file)) {
            rrmdir($file);
        } else {
            unlink($file);
        }
Beispiel #4
0
$schooladmins = SchoolUser::getAdminSchools($session->user_id);
if (count($schooladmins) > 0) {
    foreach ($schooladmins as $schooladmin) {
        echo "<option value='" . $schooladmin->schoolid . "'>" . School::get_by_id($schooladmin->schoolid)->name . "</option>";
    }
} else {
    echo "<option value='0'>NO SCHOOLS YET</option>";
}
?>
	</select>

	<select name="batchselect" id="batchselect">
	  <?php 
if (count($schooladmins) > 0) {
    $onlyschool = School::get_by_id($schooladmins[0]->schoolid);
    $batchadmins = BatchUser::getAdminBatchs($session->user_id, $onlyschool->id);
    if (count($batchadmins) > 0) {
        foreach ($batchadmins as $batchadmin) {
            $batchselect = Batch::get_by_id($batchadmin->batchid);
            echo "<option value='" . $batchadmin->batchid . "'>" . $batchselect->fromyear . "-" . ($batchselect->fromyear + 1) . "</option>";
        }
    } else {
        echo "<option value='0'>NO BATCHS YET</option>";
    }
}
?>
	</select>

  	<br/>

    <div class="accordion" id="accordion2">
Beispiel #5
0
    } else {
        $school = School::get_by_id($object->schoolid);
        //$batchname = $school->name." ".$object->get_batchyear();
        $batchname = $object->get_batchyear();
    }
} else {
    header("location: index.php?negative");
}
if (!$session->is_logged_in()) {
    header("location: index.php?negative");
} else {
    $user = User::get_by_id($session->user_id);
    if ($user->enabled == DISABLED) {
        header("location: index.php?disabled");
    }
    if (!BatchUser::amIAdmin($session->user_id, $object->id) && !SchoolUser::amIAdmin($session->user_id, $object->schoolid) && !$user->is_super_admin()) {
        header("location: index.php?negative");
    }
}
$pathinfo = pathinfo($_SERVER["PHP_SELF"]);
$basename = $pathinfo["basename"];
$currentFile = str_replace(".php", "", $basename);
?>
<div class="container-fluid">
  <div class="row-fluid">
    <div class="span1"></div>
    <div class="span9">
      <form id="theform" class="form-horizontal" method="post" action="#" enctype="multipart/form-data">
        <fieldset>
        <legend>
          Update Batch: <?php 
Beispiel #6
0
$thestudent = User::get_by_id($_GET['studentid']);
if ($filterby == "schoolmates") {
    $orgbyuser = SchoolUser::getSchoolsImIn($thestudent->id);
    $ids = array();
    foreach ($orgbyuser as $item) {
        array_push($ids, $item->schoolid);
    }
    $mates = SchoolUser::getUsersInMultipleSchoolsSearch($ids, $_GET['input']);
} else {
    if ($filterby == "batchmates") {
        $orgbyuser = BatchUser::getBatchsImIn($thestudent->id);
        $ids = array();
        foreach ($orgbyuser as $item) {
            array_push($ids, $item->batchid);
        }
        $mates = BatchUser::getUsersInMultipleBatchsSearch($ids, $_GET['input']);
    } else {
        if ($filterby == "sectionmates") {
            $orgbyuser = SectionUser::getSectionsImIn($thestudent->id);
            $ids = array();
            foreach ($orgbyuser as $item) {
                array_push($ids, $item->sectionid);
            }
            $mates = SectionUser::getUsersInMultipleSectionsSearch($ids, $_GET['input']);
        } else {
            if ($filterby == "clubmates") {
                $orgbyuser = ClubUser::getClubsImIn($thestudent->id);
                $ids = array();
                foreach ($orgbyuser as $item) {
                    array_push($ids, $item->clubid);
                }
if ($_POST['oper'] == 'add') {
    $batchuser = new BatchUser();
    $batchuser->pending = $_POST['pending'];
    $batchuser->enabled = $_POST['enabled'];
    $batchuser->schoolid = $_POST['schoolid'];
    $batchuser->batchid = $_POST['batchid'];
    $batchuser->userid = $_POST['userid'];
    $batchuser->level = $_POST['level'];
    $batchuser->create();
    $log = new Log($session->user_id, $clientip, "WEB", "CREATED BATCHUSER: "******"WEB", "UPDATED BATCHUSER: "******"WEB", "DELETED BATCHUSER: " . $_POST['id']);
            $log->create();
            $batchuser = BatchUser::get_by_id($_POST['id'])->delete();
        }
    }
}
<?php

require_once "../initialize.php";
$sectionsselect = null;
if (isset($_GET["batchid"])) {
    if (is_numeric($_GET["batchid"])) {
        $batch = Batch::get_by_id($_GET["batchid"]);
        if (SchoolUser::amIAdmin($session->user_id, $batch->schoolid) || BatchUser::amIAdmin($session->user_id, $batch->id)) {
            $sections = Section::get_all_by_batchid($batch->id);
            if (count($sections) > 0) {
                foreach ($sections as $section) {
                    $sectionsselect .= "<option value='" . $section->id . "'>" . $section->name . "</option>";
                }
                if (User::get_by_id($session->user_id)->is_super_admin()) {
                    $sectionsselect .= "<option value='NOTHING'>NOTHING</option>";
                }
            } else {
                $sectionsselect .= "<option value='0'>NO SECTIONS YET</option>";
            }
        } else {
            $sectionadmins = SectionUser::getSectionsIAdminInBatch($session->user_id, $_GET["batchid"]);
            if (count($sectionadmins) > 0) {
                foreach ($sectionadmins as $sectionadmin) {
                    $section = Section::get_by_id($sectionadmin->sectionid);
                    $sectionsselect .= "<option value='" . $section->id . "'>" . $section->name . "</option>";
                }
                if (User::get_by_id($session->user_id)->is_super_admin()) {
                    $sectionsselect .= "<option value='NOTHING'>NOTHING</option>";
                }
            } else {
                $sectionsselect .= "<option value='0'>NO SECTIONS YET</option>";
Beispiel #9
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) {
Beispiel #10
0
          <div class="controls">
            <select name="batchselect" id="batchselect">
              <?php 
if (SchoolUser::amIAdmin($session->user_id, $object->schoolid) || $user->is_super_admin()) {
    $batchs = Batch::get_all_by_schoolid($school->id);
    if (count($batchs) > 0) {
        foreach ($batchs as $batch) {
            if ($batch->pending == 0 && $batch->enabled == 1) {
                echo "<option value='" . $batch->id . "'>" . $batch->get_batchyear() . "</option>";
            }
        }
    } else {
        echo "<option value='0'>NO BATCHS YET</option>";
    }
} else {
    $batchusers = BatchUser::getBatchsIAdminInSchool($session->user_id, $school->id);
    if (count($batchusers) > 0) {
        foreach ($batchusers as $batchuser) {
            $batch = Batch::get_by_id($batchuser->batchid);
            if ($batch->pending == 0 && $batch->enabled == 1) {
                echo "<option value='" . $batch->id . "'>" . $batch->get_batchyear() . "</option>";
            }
        }
    } else {
        echo "<option value='0'>NO BATCHS YET</option>";
    }
}
?>
            </select>
          </div>
        </div>
Beispiel #11
0
<?php

require_once "../initialize.php";
$batchid = $_GET['id'];
$batch = Batch::get_by_id($batchid);
$batch->delete();
SectionUser::delete_all_by_batchid($batch->id);
BatchUser::delete_all_by_batchid($batch->id);
$folder_path = "../../public/schools/" . $batch->schoolid . "/yearbooks/" . $batch->id;
rrmdir($folder_path);
$log = new Log($session->user_id, $clientip, "WEB", "DELETED BATCH: " . $batch->id);
$log->create();
echo "success";
function rrmdir($dir)
{
    foreach (glob($dir . '/*') as $file) {
        if (is_dir($file)) {
            rrmdir($file);
        } else {
            unlink($file);
        }
    }
    rmdir($dir);
}
Beispiel #12
0
        $user->comments = $_POST['comments'];
        $user->pending = $_POST['pending'];
        $user->enabled = $_POST['enabled'];
        $user->username = $_POST['username'];
        $user->password = $_POST['password'];
        $user->email = $_POST['email'];
        $user->firstname = $_POST['firstname'];
        $user->middlename = $_POST['middlename'];
        $user->lastname = $_POST['lastname'];
        $user->address = $_POST['address'];
        $user->moto = $_POST['moto'];
        $user->birthdate = $_POST['birthdate'];
        $user->number = $_POST['number'];
        $user->update();
        $log = new Log($session->user_id, $clientip, "WEB", "UPDATED USER: "******"WEB", "DELETED USER: " . $_POST['id']);
                $log->create();
                SchoolUser::delete_all_by_userid($_POST['id']);
                BatchUser::delete_all_by_userid($_POST['id']);
                SectionUser::delete_all_by_userid($_POST['id']);
                ClubUser::delete_all_by_userid($_POST['id']);
                GroupUser::delete_all_by_userid($_POST['id']);
                User::get_by_id($_POST['id'])->delete();
            }
        }
    }
}
Beispiel #13
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 {
Beispiel #14
0
             if (BatchUser::amIAdmin($session->user_id, $batch->id) || SchoolUser::amIAdmin($session->user_id, $batch->schoolid) || $user->is_super_admin()) {
                 echo '
                         <li class="divider"></li>
                         <li><a href="updatebatch.php?id=' . $batch->id . '"><i class="icon-large icon-pencil"></i> Edit Batch</a></li>
                         <li><a href="editor.php?id=' . $batch->id . '"><i class="icon-large icon-pencil"></i> Edit Yearbook</a></li>
                         <li class="divider"></li>';
             }
             $sectionsInBatch = Section::get_all_by_batchid($batch->id);
             if (count($sectionsInBatch) > 0) {
                 foreach ($sectionsInBatch as $section) {
                     echo '
                             <li class="dropdown-submenu">
                               <a tabindex="-1" href="section.php?id=' . $section->id . '"> ' . $section->name . ' </a>
                               <ul class="dropdown-menu">
                                 <li><a href="section.php?id=' . $section->id . '"><i class="icon-large icon-play"></i> View</a></li>';
                     if (SectionUser::amIAdmin($session->user_id, $section->id) || BatchUser::amIAdmin($session->user_id, $section->batchid) || SchoolUser::amIAdmin($session->user_id, $section->schoolid) || $user->is_super_admin()) {
                         echo '<li><a href="updatesection.php?id=' . $section->id . '"><i class="icon-large icon-pencil"></i> Edit</a></li>';
                     }
                     echo '
                               </ul>
                             </li>
                             ';
                 }
             }
             echo '
                         </ul>
                       </li>
                       ';
         }
     }
 } else {
Beispiel #15
0
         $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;
             $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();
     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();
     }
     $log = new Log($session->userid, $clientip, "WEB", "DELETED MULTIPLE BATCHS");
     $log->create();
     $response = "success";
 } else {
     if ($what == "batchuser") {
         foreach ($ids as $id) {
             BatchUser::get_by_id($id)->delete();
         }
         $log = new Log($session->userid, $clientip, "WEB", "DELETED MULTIPLE BATCHUSERS");
         $log->create();
         $response = "success";
     } else {
         if ($what == "section") {
             foreach ($ids as $id) {
                 Section::get_by_id($id)->delete();
             }
             $log = new Log($session->userid, $clientip, "WEB", "DELETED MULTIPLE SECTIONS");
             $log->create();
             $response = "success";
         } else {
             if ($what == "sectionuser") {
                 foreach ($ids as $id) {
Beispiel #17
0
           Add Friend<span hidden>' . $user->id . '</span>
         </button>
         ';
         }
     }
 }
 echo '
       <div class="btn-group pull-right">
         <a id="btninvite" class="btn-mini dropdown-toggle" data-toggle="dropdown" href="#">
           <i class="icon-large icon-circle-arrow-down"></i> Invite <i class="icon-caret-down"></i>
           <span class="caret"></span>
         </a>
         <ul class="dropdown-menu">
     ';
 $schoolsImIn = SchoolUser::getSchoolsImIn($session->user_id);
 $bathsImIn = BatchUser::getBatchsImIn($session->user_id);
 $sectionsImIn = SectionUser::getSectionsImIn($session->user_id);
 if ($loggeduser->is_super_admin()) {
     if (count($schoolsImIn) > 0) {
         echo '<li class="divider"> schools</li>';
         foreach ($schoolsImIn as $theuser) {
             $school = School::get_by_id($theuser->schoolid);
             if (!$school) {
                 $theuser->delete();
             }
             echo '<li><a href="#" onclick="invite(\'schoolid\', ' . $school->id . '); return false;">' . $school->name . '</a></li>';
         }
     }
 }
 if (count($bathsImIn) > 0) {
     echo '<li class="divider"> batchs</li>';
Beispiel #18
0
     $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") {
                 $object = SectionUser::get_by_id($itemid);
                 $object->pending = 0;
                 $object->update();
                 $notification->title = "message";
                 $notification->itemid = $itemid;
                 $notification->itemtype = "sectionuser";
             } else {
                 if ($itemtype == "clubuser") {
Beispiel #19
0
<?php

require_once "header.php";
$pathinfo = pathinfo($_SERVER["PHP_SELF"]);
$basename = $pathinfo["basename"];
$currentFile = str_replace(".php", "", $basename);
$sound = isset($_GET['success']) ? "positive" : "";
if ($session->is_logged_in()) {
    $user = User::get_by_id($session->user_id);
    if ($user->enabled == DISABLED) {
        header("location: index.php?disabled");
    } else {
        $schoolsIAdminCount = count(SchoolUser::getAdminSchools($session->user_id));
        $batchsIAdminCount = count(BatchUser::getAdminBatchs($session->user_id));
        $sectionsIAdminCount = count(SectionUser::getAdminSections($session->user_id));
        $iAdminSomething = false;
        if ($schoolsIAdminCount + $batchsIAdminCount + $sectionsIAdminCount > 0 || $user->is_super_admin()) {
            $iAdminSomething = true;
        }
    }
} else {
    header("location: index.php?negative");
}
?>

<div class="container-fluid">
  <div class="row-fluid">
    <ul class="nav nav-tabs">
      <?php 
if ($user->is_super_admin()) {
    echo '<li><a id="userstab" href="#users" data-toggle="tab">Students</a></li>';
Beispiel #20
0
<?php

require_once "header.php";
$currentFile = str_replace(".php", "", pathinfo($_SERVER['PHP_SELF'])['basename']);
$batchUsers = BatchUser::getUsersInBatch($_GET['batchid']);
?>

<div class="container-fixed" >
  <div class="row-fixed" >
    <div class="span12 offset1">
      <?php 
foreach ($batchUsers as $batchuser) {
    $user = User::get_by_id($batchuser->userid);
    echo '
          <div class="span2 mygridbox">
            <img class="mygridimage" src="' . $user->picture() . '" />
            <p class="mygridname span2">' . $user->get_full_name() . '</p>
            <p class="mygridmotto">"' . $user->moto . '"</p>
            <p><a class="btn pull-bottom" href="profile.php?id=' . $user->id . '">View Profile &raquo;</a></p>
          </div>
        ';
}
?>
    </div><!--/span-->
  </div><!--/row-->
  
<?php 
require_once "footer.php";
Beispiel #21
0
<?php

require_once "../../includes/initialize.php";
global $session;
if (!$session->is_logged_in()) {
    redirect_to("../../index.php");
}
$page = $_GET['page'];
$limit = $_GET['rows'];
$sidx = $_GET['sidx'];
$sord = $_GET['sord'];
$user = User::get_by_id($session->user_id);
$schoolusers = SchoolUser::getAdminSchools($user->id);
$batchusers = BatchUser::getAdminBatchs($user->id);
$criteria = "" . C_SECTION_ID . " IN (SELECT " . C_SECTIONUSER_SECTIONID . " FROM " . T_SECTIONUSERS . " \r\nWHERE " . C_SECTIONUSER_USERID . "=" . $session->user_id . " AND " . C_SECTIONUSER_LEVEL . "=1)";
if (count($batchusers) > 0) {
    $criteria = "" . C_SECTION_BATCHID . " IN (SELECT " . C_BATCHUSER_BATCHID . " FROM " . T_BATCHUSERS . " \r\n    WHERE " . C_BATCHUSER_USERID . "=" . $session->user_id . " AND " . C_BATCHUSER_LEVEL . "=1)";
}
if (count($schoolusers) > 0) {
    $criteria = "" . C_SECTION_SCHOOLID . " IN (SELECT " . C_SCHOOLUSER_SCHOOLID . " FROM " . T_SCHOOLUSERS . " \r\n    WHERE " . C_SCHOOLUSER_USERID . "=" . $session->user_id . " AND " . C_SCHOOLUSER_LEVEL . "=1)";
}
if ($user->is_super_admin()) {
    $sections_count = Section::get_by_sql("SELECT * FROM " . T_SECTIONS);
} else {
    $sections_count = Section::get_by_sql("SELECT * FROM " . T_SECTIONS . " WHERE " . $criteria);
}
$count = count($sections_count);
if ($count > 0 && $limit > 0) {
    $total_pages = ceil($count / $limit);
} else {
    $total_pages = 0;
Beispiel #22
0
require_once "header.php";
if (!$session->is_logged_in()) {
    header("location: index.php?negative");
} else {
    $user = User::get_by_id($session->user_id);
    if ($user->enabled == DISABLED) {
        header("location: index.php?disabled");
    }
}
$school = School::get_by_id(CSNTRID);
$pathinfo = pathinfo($_SERVER["PHP_SELF"]);
$basename = $pathinfo["basename"];
$currentFile = str_replace(".php", "", $basename);
$schoolusers = SchoolUser::getAdminSchools($session->user_id);
$batchusers = BatchUser::getAdminBatchs($session->user_id);
$sectionusers = SectionUser::getAdminSections($session->user_id);
if (count($schoolusers) == 0 && count($batchusers) == 0 && count($sectionusers) == 0) {
    header("location: index.php?negative");
}
?>
<div class="container-fluid">
  <div class="row-fluid">
    <div class="span1"></div>
    <div class="span9">
      <form id="theform" class="form-horizontal" method="post" action="#" enctype="multipart/form-data">
        <fieldset>
        <legend>
          Create Student
        </legend>
Beispiel #23
0
require_once "../../includes/initialize.php";
global $session;
if (!$session->is_logged_in()) {
    redirect_to("../../index.php");
}
if ($_POST['oper'] == 'add') {
    $batch = new Batch();
    $batch->comments = $_POST['comments'];
    $batch->about = $_POST['about'];
    $batch->pending = $_POST['pending'];
    $batch->enabled = $_POST['enabled'];
    $batch->fromyear = $_POST['fromyear'];
    $batch->schoolid = $_POST['schoolid'];
    $batch->create();
    $batchuser = new BatchUser();
    $batchuser->pending = 0;
    $batchuser->enabled = 1;
    $batchuser->schoolid = $batch->schoolid;
    $batchuser->batchid = $batch->id;
    $batchuser->userid = $session->user_id;
    $batchuser->level = 1;
    $batchuser->create();
    $folder_path = "../../public/schools/" . $batch->schoolid . "/yearbooks/" . $batch->id . "/";
    mkdir($folder_path, 0700);
    mkdir($folder_path . "pages", 0700);
    mkdir($folder_path . "files", 0700);
    copy("../../public/index.php", $folder_path . "/pages/index.php");
    copy("../../public/page1.html", $folder_path . "/pages/page1.html");
    $log = new Log($session->user_id, $clientip, "WEB", "CREATED BATCH: " . $_POST['id']);
    $log->create();
Beispiel #24
0
     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>";
             } else {
                 if ($notification->itemtype == "clubuser") {
                     $object = ClubUser::get_by_id($notification->itemid);
                     $club = Club::get_by_id($object->clubid);
                     $school = School::get_by_id($object->schoolid);
Beispiel #25
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 {
<?php

require_once "../initialize.php";
$batchsselect = null;
if (isset($_GET["schoolid"])) {
    if (SchoolUser::amIAdmin($session->user_id, $_GET["schoolid"])) {
        $batchadmins = BatchUser::getBatchsImIn($session->user_id);
    } else {
        $batchadmins = BatchUser::getBatchsIAdminInSchool($session->user_id, $_GET["schoolid"]);
    }
    if (count($batchadmins) > 0) {
        foreach ($batchadmins as $batchadmin) {
            $batch = Batch::get_by_id($batchadmin->batchid);
            $batchsselect .= "<option value='" . $batch->id . "'>" . $batch->fromyear . "-" . ($batch->fromyear + 1) . "</option>";
        }
        if (User::get_by_id($session->user_id)->is_super_admin()) {
            $batchsselect .= "<option value='NOTHING'>NOTHING</option>";
        }
    } else {
        $batchsselect .= "<option value='0'>NO BATCHS YET</option>";
    }
    if (User::get_by_id($session->user_id)->is_super_admin()) {
        $batchsselect = "";
        $batchs = Batch::get_all();
        if (count($batchs) > 0) {
            foreach ($batchs as $batch) {
                $batchsselect .= "<option value='" . $batch->id . "'>" . $batch->fromyear . "-" . ($batch->fromyear + 1) . "</option>";
            }
            $batchsselect .= "<option value='NOTHING'>NOTHING</option>";
        } else {
            $batchsselect .= "<option value='0'>NO BATCHS YET</option>";