Esempio n. 1
0
<?php

require_once dirname(__FILE__) . '\\..\\util.php';
require_db();
require_dao('TrackingsDAO');
require_model('User');
use Qnet\Dao\TrackingsDAO;
use Qnet\Model\User;
$trackingDAO = new TrackingsDAO();
$tid = $trackingDAO->newTracking(5, 1);
$notifications = $trackingDAO->getNotificationsByUserId(1);
if ($notifications[$tid] == null) {
    echo "User 1 is not notified new tracking";
}
$trackingDAO->approvalAccepted($tid);
$notifications = $trackingDAO->getNotificationsByUserId(1);
if ($notifications[$tid] != null) {
    echo "User 1 is still notified after accepting";
}
$notifications = $trackingDAO->getNotificationsByUserId(5);
if ($notifications[$tid] == null) {
    echo "User 1 is not notified new tracking";
}
$trackingDAO->notificationReceived($tid);
$notifications = $trackingDAO->getNotificationsByUserId(1);
if ($notifications[$tid] != null) {
    echo "Notification still exists after accepting it";
}
$notifications = $trackingDAO->getNotificationsByUserId(5);
if ($notifications[$tid] != null) {
    echo "Notification still exists after accepting it";
<?php

namespace Qnet\Controller;

require_once dirname(__FILE__) . '\\..\\util.php';
check_session();
require_dao('trackingsDAO');
use Qnet\Dao\TrackingsDAO;
$trackingsDAO = new TrackingsDAO();
if ($_GET['response'] == 1) {
    $trackingsDAO->approvalAccepted($_GET['notificationId']);
} else {
    $trackingsDAO->notificationReceived($_GET['notificationId']);
}