function addToDatabase($rname, $rsize, $rtype, $rname_usr, $rtype_usr, $rdesc, $extension, $rprio)
{
    $auth = new Authenticate();
    $con = new Connection();
    $link = $con->getConnection();
    $query = "INSERT INTO `resources`(`ID`, `name`,`rNameUsr`,`rsize`, `rtype`, `format`, `doc_by`,`user_r_type`,`rDescription`,`rprio`, `when`, `approved`) VALUES (NULL,?,?,?,?,?,?,?,?,?,?,?)";
    //$query = "INSERT INTO `categories`(`cat_id`,`cat_name`,`cat_description`,`cat_by`) VALUES (NULL,?,?,?)";
    $stmt = $link->prepare($query);
    $stmt->execute(array($rname, $rname_usr, $rsize, $rtype, $extension, $auth->getFullName($_SESSION['user_id']), $rtype_usr, $rdesc, $rprio, date("Y-m-d H:i:m", time()), 0));
    $stmt = null;
    return TRUE;
}
 function rewardUser($user_id, $totalScore, $count)
 {
     $auth = new Authenticate();
     return $reply = '<div id="evaluationDiv">' . '<h3>User Reward!</h3>' . '<p id="headLabel">Name:' . $auth->getFullName($user_id) . '</p>' . '<p id="qtag">Total Question:' . $count . '</p>' . '<p id="qtag">Total Score:' . $totalScore . '</p>' . '<p id="qtag">Percentage:' . $totalScore / $count * 100 . '%</p>' . '<p><label id="mqs">Total Time Expired or Count Exceede</label></p>' . '</div>';
 }
Beispiel #3
0
            $smarty->display("index.tpl");
        } else {
            go_homeforlogin();
            $smarty->display("index.tpl");
        }
    } else {
        go_homeforlogin();
        $smarty->display("index.tpl");
    }
} else {
    //user is loged in and making request
    $msg = isset($_GET['loginerrorfeed']) ? $_GET["loginerrorfeed"] : "";
    $smarty->assign("message", $msg);
    $smarty->assign('user_id', $id);
    $smarty->assign('token', $token);
    $smarty->assign('user', $auth->getFullName($id));
    $smarty->assign('profile', $auth->getProfile($id));
    if (isset($_GET["view"])) {
        $view = htmlspecialchars($_GET["view"]);
        $rtype = isset($_GET['rtype']) ? $_GET["rtype"] : "";
        if ($view == "homeView") {
            go_homeforlogedin();
        } else {
            if ($view == "resourceView") {
                if ($rtype == "documents") {
                    $smarty->assign('documents', $rMan->getAllDocumentResources());
                    $smarty->assign('mainContent', $smarty->fetch("documentResource.tpl"));
                } else {
                    if ($rtype == "images") {
                        $smarty->assign('images', $rMan->getAllImageResources());
                        $smarty->assign('mainContent', $smarty->fetch("imageResources.tpl"));