<?php

namespace Qnet\Controller;

require_once dirname(__FILE__) . '\\..\\util.php';
check_session();
require_dao('trackingsDAO');
use Qnet\Dao\TrackingsDAO;
$followed = $_GET['uid'];
$follower = getUID();
$trackingsDAO = new TrackingsDAO();
$trackingsDAO->newTracking($follower, $followed);
<?php

namespace Qnet\Controller;

require_once dirname(__FILE__) . '\\..\\util.php';
require_dao('trackingsDAO');
require_dao('userDAO');
use Qnet\Dao\TrackingsDAO;
$followedUID = intval($_GET['followed']);
$followerUID = intval($_GET['follower']);
$uid = getUID();
if ($uid == $followedUID || $uid == $followerUID) {
    $tdao = new TrackingsDAO();
    $tdao->unfollowUser($followedUID, $followerUID);
}
header("Location: /Qnet/target/classes/php/qnet/ui/viewprofile.php");
Example #3
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";
Example #4
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);
<?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']);
}