function getReasonList()
 {
     $reasonQuery = "SELECT reason_id, reason FROM gban_reason ORDER BY reason_id";
     $this->db->sql_query($reasonQuery);
     $reasonList = array();
     $reasons = $this->db->get_array();
     for ($i = 0; $i < count($reasons); $i++) {
         $reason = new Reason();
         $reason->setId($reasons[$i]['reason_id']);
         $reason->setReason($reasons[$i]['reason']);
         array_push($reasonList, $reason);
         // Add the reason object to the array
     }
     return $reasonList;
 }
Ejemplo n.º 2
0
 /**
  * @param array|MessageLocator $locator
  * @param bool $addDefaultFormatter
  * @param bool $addDefaultExclusiveMissingMessageLocatorHandler
  * @param bool $throwOnMissingTemplate
  */
 public function __construct($locator = null, $addDefaultFormatter = true, $addDefaultExclusiveMissingMessageLocatorHandler = false, $throwOnMissingTemplate = false)
 {
     $this->throwOnMissingTemplate = $throwOnMissingTemplate;
     if ($locator instanceof MessageLocator) {
         $this->locator = $locator;
     } elseif ($locator === null) {
         $this->locator = MessageLocator::fromPhpFile(__DIR__ . '/../../data/default_messages.php');
     } elseif (is_array($locator)) {
         $this->locator = MessageLocator::fromArray($locator);
     } else {
         throw new \InvalidArgumentException('The $locator parameter needs to be an instance of ResultMessageLocator, null or an array containing messages');
     }
     if ($addDefaultFormatter) {
         $this->addMessageFormatter(function ($id, $format) {
             return sprintf('%s in :%s:::%s:', $format, MessageFormatter::FORMAT_KEY_TARGET_ID, MessageFormatter::FORMAT_KEY_LINE);
         });
     }
     if ($addDefaultExclusiveMissingMessageLocatorHandler) {
         $this->getLocator()->addMissingMessageHandler(function ($id, MessageLocator $locator) {
             $locator->terminateCallbackChain();
             $msg = 'Message for id "%s" %s could not be found.';
             $desc = '';
             if (($name = Reason::getReasonNameFromValue((int) $id)) !== 'UNKNOWN') {
                 $desc = '[' . $name . ']';
             }
             return sprintf($msg, $id, $desc);
         }, MessageLocator::CALLBACK_POSITION_PREPEND);
     }
 }
Ejemplo n.º 3
0
 /**
  * Adds a reason to our reason collection
  *
  * @param Reason $reason The reason instance to add
  *
  * @return null
  *
  * @throws \Exception
  */
 public function addReason(Reason $reason)
 {
     $this->reasons[$reason->getSeverity()][] = $reason;
     // we have to keep the final version to increment up to date
     $this->updateVersion();
 }
Ejemplo n.º 4
0
<!-- Message admin -->
<div class="modal fade" id="message-admin" tabindex="-1" role="dialog" aria-hidden="true">
	<div class="modal-dialog">
		<div class="modal-content">
			<div class="modal-header">
				<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
				<h4 class="modal-title">
					Message admin
				</h4>
			</div>
			<div class="modal-body">
				<form id="form-message-admin" action="" method="post">
					<input type="hidden" name="message-admin">
					<select name="reason" class="form-control">
						<?php 
foreach (Reason::all() as $reason) {
    print '<option value="' . $reason->getId() . '">' . $reason->getReason() . '</option>';
}
?>
					</select><br>
					<textarea class="form-control" name="text" placeholder="Write here the message you want to send to the administrator."></textarea>
				</form>
			</div>
			<div class="modal-footer">
				<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
				<button type="button" class="btn btn-danger" onclick="$('#form-message-admin').submit();">Send</button>
			</div>
		</div><!-- /.modal-content -->
	</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
Ejemplo n.º 5
0
        if (count($search_artists) == 1) {
            Page::goArtist($search_artists[0]->getId());
        }
        if (count($search_albums) == 1) {
            Page::goAlbum($search_albums[0]->getId());
        }
        if (count($search_users) == 1) {
            Page::goUser($search_users[0]->getId());
        }
    }
}
/**
 * @author Jérôme Boesch 
 *
 */
if (isset($_POST['text']) && isset($_POST['reason']) && !empty($_POST['text']) && isset($_SESSION['online']) && $_SESSION['online'] && is_numeric($_POST['reason']) && Reason::exists($_POST['reason'])) {
    $db = $_SESSION['db'];
    $user = $_SESSION['user']->getId();
    $reason = $_POST['reason'];
    $text = $_POST['text'];
    $stmt = $db->prepare("insert into message (user, text, date, reason) values (:user, :text, unix_timestamp(), :reason);");
    $stmt->execute(array(':user' => $user, ':text' => $text, ':reason' => $reason));
    $stmt->closeCursor();
    $_SESSION['messageSent'] = true;
}
# Process add artist
/**
 *
 * @author Antoine De Gieter
 *
 */
Ejemplo n.º 6
0
?>
 
</div>
<?php 
$admissions = new Admission();
$sql = "select * from admission_status where applicant_id='" . $session->applicant_id . "'";
$admissions = Admission::find_by_sql($sql);
foreach ($admissions as $admission) {
    $time = $admission->time_completed_application;
    $academic_session = $admission->academic_session;
    $status = $admission->status;
    $reason_ = $admission->reason;
}
$reason = new Reason();
$sql = "select * from reasons_inelligibility where reason='" . $reason_ . "'";
$reason = Reason::find_by_sql($sql);
$reason = array_shift($reason);
//convert the $time to a format that can be read
$when_application_completed = date('l d \\of F Y \\@ \\A\\b\\o\\u\\t g:i:s:A', $time);
if ($status == 0) {
    $msg = '<span class="label label-inverse">You have not completed your application form yet</span>';
} elseif ($status == 1) {
    $msg = '<span class="label ">Pending</span>';
} elseif ($status == 2) {
    $msg = '<span class="label label-info">Processing...</span>';
} elseif ($status == 3) {
    $msg = '<span class="label label-warning">Processing...</span>';
} elseif ($status == 4) {
    $msg = '<span class="label label-important">Not Offered Admission</span>';
} elseif ($status == 5) {
    $msg = '<span class="label label-success">Offered Admission</span>';
<?php

require_once "../../inc/initialize.php";
if (isset($_POST["btn"])) {
    switch ($_POST["btn"]) {
        case 'add_reason':
            $reason = new Reason();
            $reason->db_fields = array('reason', 'description', 'reason_status');
            $reason->reason = $_POST['reason'];
            $reason->description = $_POST['details'];
            $reason->reason_status = 1;
            if ($reason->save()) {
                echo '<h4 class="alert alert-success">Success</h4>';
                echo '<hr>';
                echo "<p>You have successfully added a new record into reason ineligiblity table</p>";
                echo '<hr>';
            } else {
                echo '<h4 class="alert alert-error">Error</h4>';
                echo '<hr>';
                echo "Failed to insert into reason ineligiblity table.";
                echo '<hr>';
            }
            break;
        case 'del_reason':
            $database = new MySQLDatabase();
            $id = $_POST['reason'];
            $result = $database->query("DELETE FROM reasons_inelligibility WHERE reason_id='{$id}'");
            if ($result) {
                echo '<h4 class="alert alert-success">Success</h4>';
                echo '<hr>';
                echo "Ineligiblity reason record successfully deleted";