Example #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();
$trackingDAO->unfollowUser(1, 2);
$results = $trackingDAO->getFollowed(2);
//a QUIEN SIGUE 2
if (array_search("1", $results) != null) {
    echo "User 2 is still followed by User 1";
}
$followersOf1 = $trackingDAO->getFollowers(1);
//Los seguidores de 1
if (array_search("2", $results) != null) {
    echo "User 2 is still followed by User 1";
}
/*
	public function getFollowers($userId){
        $connector = new DBConnector();
        $connection = $connector->createConnection();
        $result = mysql_query("SELECT t.followerId AS uid, u.name AS name FROM trackings t JOIN users u WHERE u.id=t.followerId AND t.approved=1 AND followedId='$userId'") or die ("Error");
        $ans = array();
        while($row = mysql_fetch_assoc($result)) {
            $ans[$row['uid']] = $row['name'];
        }
        mysql_free_result($result);
        mysql_close($connection);
Example #2
0
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";
}
$results = $trackingDAO->getFollowed(5);
// a quien sigue 1
if ($results[1] == null) {
    echo "User 1 is not following User 5 after Tracking acceptance";
}
$results = $trackingDAO->getFollowers(1);
//Los seguidores de 5
if ($results[5] == null) {
    echo "User 1 is not a follower of User 5 after Tracking acceptance ";
}