/**
  * 
  * @param bool $refresh
  * @return array:
  */
 static function get($refresh = false)
 {
     global $db;
     if (!self::$initialized || $refresh) {
         self::$awards = array();
         $query = "SELECT *, `id` as award_id FROM `student_awards_internal_types` order by title asc";
         $results = $db->GetAll($query);
         foreach ($results as $result) {
             array_push(self::$awards, InternalAward::fromArray($result));
         }
         self::$initialized = true;
     }
     return self::$awards;
     //return new self(self::$awards);
 }
Exemplo n.º 2
0
 *
*/
if (!defined("PARENT_INCLUDED") || !defined("IN_AWARDS")) {
    exit;
} elseif (!isset($_SESSION["isAuthorized"]) || !$_SESSION["isAuthorized"]) {
    header("Location: " . ENTRADA_URL);
    exit;
} elseif (!$ENTRADA_ACL->amIAllowed("awards", "update", false)) {
    add_error("Your account does not have the permissions required to use this feature of this module.<br /><br />If you believe you are receiving this message in error please contact <a href=\"mailto:" . html_encode($AGENT_CONTACTS["administrator"]["email"]) . "\">" . html_encode($AGENT_CONTACTS["administrator"]["name"]) . "</a> for assistance.");
    echo display_error();
    application_log("error", "Group [" . $_SESSION["permissions"][$ENTRADA_USER->getAccessId()]["group"] . "] and role [" . $_SESSION["permissions"][$ENTRADA_USER->getAccessId()]["role"] . "] does not have access to this module [" . $MODULE . "]");
} else {
    require_once "Models/awards/InternalAwards.class.php";
    require_once "Models/awards/InternalAwardReceipts.class.php";
    process_manage_award_details();
    $awards = InternalAwards::get(true);
    $PAGE_META["title"] = "Awards Listing";
    $PAGE_META["description"] = "";
    $PAGE_META["keywords"] = "";
    ?>
	<div id="award_messages">
		<?php 
    display_status_messages();
    ?>
	</div>
	<h1>Awards Listing</h1>
	
	<?php 
    $show_new_award_form = isset($_GET["show"]) && $_GET["show"] == "add_new_award" ? true : false;
    ?>
	
Exemplo n.º 3
0
function process_awards_admin()
{
    if (isset($_POST['action'])) {
        $action = $_POST['action'];
        switch ($action) {
            case "add_award_recipient":
            case "remove_award_recipient":
            case "edit_award_details":
                $award_id = isset($_POST['award_id']) ? $_POST['award_id'] : 0;
                if ($award_id) {
                    $award = InternalAward::get($award_id);
                    process_manage_award_details();
                    display_status_messages();
                    echo award_recipients_list($award);
                }
                break;
            case "remove_award":
                $award_id = isset($_POST['award_id']) ? $_POST['award_id'] : 0;
                if (!$award_id) {
                    break;
                }
            case "new_award":
                process_manage_award_details();
                display_status_messages();
                $awards = InternalAwards::get(true);
                if ($awards) {
                    echo awards_list($awards);
                }
                break;
        }
    }
}