public function searchQuery($queryTitle)
 {
     $dao = new QueryDAO();
     $queryId = $dao->getQueryIdByQueryTitle($queryTitle);
     if ($queryId != -1) {
         $this->result = $dao->getQueryById($queryId);
     } else {
         $this->result = -1;
     }
     $uid = getUID();
     $udao = new UserDAO();
     $this->result = ListQueriesController::filterQueries($this->result, $udao->selectUserById($uid));
 }
 function __construct()
 {
     $this->uid = getUID();
     $this->qdao = new QueryDAO();
     $search = $_GET["searchQuery"];
     if (empty($search)) {
         $queriesDateStructure = $this->qdao->getAllQueries();
     } else {
         $queriesDateStructure = $this->qdao->getQueriesByPartialString($search);
     }
     $udao = new UserDAO();
     $this->queries = ListQueriesController::filterQueries($queriesDateStructure[0], $udao->selectUserById($this->uid));
     $this->queriesDates = $queriesDateStructure[1];
 }
 function __construct()
 {
     $this->udao = new UserDAO();
     $this->theuid = $_GET['uid'];
     if (!empty($this->theuid)) {
         $this->theuser = $this->udao->selectUserById($this->theuid);
         if (!$this->theuser) {
             $this->theuid = null;
         } else {
             $ownProfile = $this->theuid == getUID();
         }
     }
     if (empty($this->theuid)) {
         $this->theuid = getUID();
         $this->theuser = $this->udao->selectUserById($this->theuid);
         $ownProfile = true;
     }
     $this->qdao = new QueryDAO();
     $queriesDateStructure = $this->qdao->getQueriesByUserId($this->theuid);
     $this->queries = $queriesDateStructure[0];
     $this->filteredQueries = array_keys(ListQueriesController::filterQueries($this->queries, $this->theuser));
     $this->queriesDates = array_values($queriesDateStructure[1]);
     $this->sdao = new StatisticsDAO();
     $statisticDateStructure = $this->sdao->getStatisticsByUserId($this->theuid);
     $this->statistics = $statisticDateStructure[0];
     $this->statisticsDates = array_values($statisticDateStructure[1]);
     $this->adao = new AnswersDAO();
     $this->cdao = new CommentDAO();
     if ($ownProfile) {
         $this->tdao = new TrackingsDAO();
         $this->trackingNotifications = $this->tdao->getNotificationsByUserId($this->theuid);
         $this->initFollowingNotifications();
     } else {
         $this->trackingNotifications = array();
         $this->followingsNotifications = array();
     }
     $this->createOrderedElementsList();
 }
Beispiel #4
0
<?php

include "fragment/head.php";
?>
<body>
<div id="wrapper">
    <?php 
include "fragment/header.php";
?>
    <?php 
require_once dirname(__FILE__) . '\\..\\util.php';
require_controller('listqueriescontroller');
require_controller('profilecontroller');
require_controller('photoController');
use Qnet\Controller\ListQueriesController;
$controller = new ListQueriesController();
use Qnet\Controller\PhotoController;
$photoController = new PhotoController();
$photoPath = $photoController->getPhoto();
?>

    <div id="page">
        <div id="content">
            <div class="post">
                <h2 class="title">Select a query to answer!</h2>
                <div class="entry">
                <?php 
while ($controller->hasMoreQueries()) {
    $controller->nextQuery();
    echo '<p>' . $controller->getQueryLink() . '</p>';
}
<?php

namespace Qnet\Controller;

require_once dirname(__FILE__) . '\\..\\..\\util.php';
require_dao('QueryDAO');
require_controller('listqueriescontroller');
require_dao('userDAO');
use Qnet\Dao\QueryDAO;
use Qnet\Dao\UserDAO;
use Qnet\Controller\ListQueriesController;
$searchQuery = $_GET["q"];
if ($searchQuery != null) {
    $userDaoIns = new QueryDAO();
    $queriesArray = $userDaoIns->getQueriesByPartialString($searchQuery);
    $uid = getUID();
    $udao = new UserDAO();
    $queriesArray = ListQueriesController::filterQueries($queriesArray, $udao->selectUserById($uid));
    $arraySize = count($queriesArray);
    $answer = "";
    foreach (array_values($queriesArray) as $queryname) {
        $answer = $answer . $queryname . "\n";
    }
    echo $answer;
}
<?php

require_once dirname(__FILE__) . '\\..\\util.php';
require_dao('userDAO');
require_controller('listqueriescontroller');
use Qnet\Controller\ListQueriesController;
use Qnet\Dao\UserDAO;
$udao = new UserDAO();
$applies = $udao->selectUserById(3);
$doesNot = $udao->selectUserById(1);
$queries = array();
$queries[1] = "Chocolate";
$filtered = ListQueriesController::filterQueries($queries, $applies);
if ($filtered[1] != "Chocolate") {
    echo 'Appliying user did not find Chocolate query';
}
$filtered = ListQueriesController::filterQueries($queries, $doesNot);
if ($filtered[1] == "Chocolate") {
    echo 'Not appliying user found Chocolate query';
}