/**
 * Used by react on initial load to load the thread state. 
 *
 * PHP version 5
 *
 * @category Behavioural
 * @package  Main
 * @author   Evan McIlroy <*****@*****.**>
 * @license  GPLv3 <http://www.gnu.org/licenses/gpl-3.0.en.html>
 * @link     https://www.github.com/aces/Loris-Trunk/
 */
header("content-type:application/json");
ini_set('default_charset', 'utf-8');
set_include_path(__DIR__ . "/../../../project/libraries:" . __DIR__ . "/../../../php/libraries:" . "/usr/share/pear:");
require_once __DIR__ . "/../../../vendor/autoload.php";
require_once "NDB_Client.class.inc";
$client = new NDB_Client();
$client->initialize();
$user =& User::singleton();
$username = $user->getUsername();
if (isset($_POST['candID']) && !isset($_POST['sessionID'])) {
    $feedbackThread =& NDB_BVL_Feedback::Singleton($username, $_POST['candID']);
} elseif (isset($_POST['candID']) && isset($_POST['sessionID']) && !isset($_POST['commentID'])) {
    $feedbackThread =& NDB_BVL_Feedback::Singleton($username, $_POST['candID'], $_POST['sessionID']);
} elseif (isset($_POST['candID']) && isset($_POST['sessionID']) && isset($_POST['commentID'])) {
    $feedbackThread =& NDB_BVL_Feedback::Singleton($username, $_POST['candID'], $_POST['sessionID'], $_POST['commentID']);
}
$feedbackThreadList = $feedbackThread->getThreadList();
echo json_encode($feedbackThreadList);
exit;
<?php

/**
 * File to close a BVL feedback thread via the BVL feedback panel.
 *
 * PHP version 5
 *
 * @category Behavioural
 * @package  Main
 * @author   Evan McIlroy <*****@*****.**>
 * @license  GPLv3 <http://www.gnu.org/licenses/gpl-3.0.en.html>
 * @link     https://www.github.com/aces/Loris-Trunk/
 */
ini_set('default_charset', 'utf-8');
require "bvl_panel_ajax.php";
$user =& User::singleton();
$username = $user->getUsername();
if (isset($_POST['feedbackID']) && isset($_POST['candID'])) {
    $feedbackThread =& NDB_BVL_Feedback::Singleton($username, $_POST['candID']);
    $feedbackThread->closeThread($_POST['feedbackID']);
}
exit;