Exemplo n.º 1
0
<?php

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");
    }
}
$pathinfo = pathinfo($_SERVER["PHP_SELF"]);
$basename = $pathinfo["basename"];
$currentFile = str_replace(".php", "", $basename);
$batchusers = BatchUser::getBatchsIAdminInSchool($session->user_id, CSNTRID);
$schoolusersX = SchoolUser::getAdminSchools($session->user_id);
$batchusersX = BatchUser::getAdminBatchs($session->user_id);
if (count($schoolusersX) == 0 && count($batchusersX) == 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 a Section
        </legend>
Exemplo n.º 2
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>
<?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>";