Example #1
0
			<p>Add a picture
			<input type="file" name="picture"/></p>
		</div>
		<?php 
echo '<input type="hidden" name="where" value="breezy";/>';
?>
		<input type="submit" value="Post !"/>
	</form>
	<div>
		<div>
			<a href="#" id="notifications">
				<p>
				<img src="./pictures/notification.png"/>
				<?php 
$user = ManagerMember::get_member($_SESSION['login']);
$notification_factory = new NotificationFactory($user->get_id());
echo $notification_factory->size;
echo '</p>';
?>
			</a>
		</div>
		<div id="notification_menu">
			<?php 
$t_size = $notification_factory->size;
for ($i = 0; $i < $t_size; $i++) {
    $notification_factory->display($i);
}
?>
		</div>
	</div>
    </aside>
Example #2
0
	final public function leave_date(BadmintonDate $badminton_date) {
		/*
		(BadmintonDate) -> Bool
		Attempts for the current user to leave the badminton date
		 */
		if ($this->user_id && $badminton_date->date_id) {
			if ($this->in_date($badminton_date)) {
				if ($badminton_date->can_be_left()) {
					$sql = "UPDATE `joins` SET status = '" . self::LEFT_STATUS . "' WHERE date_id = '$badminton_date->date_id' AND user_id = '$this->user_id'";
					$result = $this->dbc->query($sql)
					or die ($this->dbc->error);
					$action = new LeaveBadmintonDate(array(
						'leaver' => clone $this,
						'badminton_date' => $badminton_date)
					);

					$affected_rows = $this->dbc->affected_rows;

					if ($affected_rows == 1) {
						//New row was inserted
						//Push the action
						ActionFactory::push_action($action);

						//Push notifications to the group
						NotificationFactory::push_notification($action);			
					}
					return true;
				}
				else {
					return false;
				}
			}
			else {
				return true;
			}
		}
		else {
			throw new UnexpectedValueException('UnexpectedValueException occured on request on method call leave_date, invalid parameters');
		}
	}