Esempio n. 1
0
 public static function getInstance()
 {
     if (!self::$offerManager) {
         self::$offerManager = new OfferManager();
         self::$offerDataStore = new BeanDataStore(Offer::$className, Offer::$tableName);
         return self::$offerManager;
     }
     return self::$offerManager;
 }
Esempio n. 2
0
<?php

require_once "functions.php";
require_once "OfferManager.class.php";
require_once "header.php";
$OfferManager = new OfferManager($mysqli, $_SESSION["logged_in_user_id"]);
if ($_SESSION["logged_in_user_group_id"] == "3") {
    header("Location: requests.php");
}
if (!isset($_GET["offers_data_id"])) {
    header("Location: requests.php");
}
$price = $comment = "";
$price_error = $comment_error = "";
if ($_SERVER["REQUEST_METHOD"] == "POST") {
    if (isset($_POST["add_new_offer"])) {
        if (empty($_POST["price"])) {
            $price_error = "Hind on kohustuslik";
        } else {
            $price = cleanInput($_POST["price"]);
        }
        if (empty($_POST["comment"])) {
            $comment_error = "Kommentaar on kohustuslik";
        } else {
            $comment = cleanInput($_POST["comment"]);
        }
        if ($price_error == "" && $comment_error == "") {
            $OfferManager->addNewOffer($_POST["request_id"], $_SESSION["logged_in_user_id"], $price, $comment);
            header("Location: requests.php");
        }
    }
Esempio n. 3
0
<?php
	require_once("functions.php");
	require_once("OfferManager.class.php");
	require_once("header.php");
	
	$OfferManager = new OfferManager($mysqli, $_SESSION["logged_in_user_id"]);
	
	/* See tähendab, et see leht on mõeldud ainult admini jaoks */
	if($_SESSION["logged_in_user_group_id"] != "1"){
		header("Location: requests.php");
	}
	
	$history_array = $OfferManager->gethistoryData();

?>

<h3>Ajalugu</h3>

<table class='table table-striped'>
	<tr>
		<th>Jrk</th>
		<th>Kasutaja ID</th>
		<th>Kasutaja nimi</th>
		<th>Sisselogimine</th>
		<th>Väljalogimine</th>
	</tr>
	
<?php
	
	for($i = 0; $i < count($history_array); $i++){
		echo "<tr>";
Esempio n. 4
0
<?php

require_once "functions.php";
require_once "OfferManager.class.php";
require_once "header.php";
$OfferManager = new OfferManager($mysqli, $_SESSION["logged_in_user_id"]);
$keyword = "";
if (isset($_GET["keyword"])) {
    $keyword = $_GET["keyword"];
    $orders_array = $OfferManager->getAllData($keyword);
} else {
    $orders_array = $OfferManager->getAllData();
}
$offers_array = $OfferManager->getOffersData();
if (isset($_GET["update"])) {
    $OfferManager->updateOrdersData(cleanInput($_GET["request_id"]), cleanInput($_GET["text_type"]), cleanInput($_GET["subject"]), cleanInput($_GET["description"]), cleanInput($_GET["target_group"]), cleanInput($_GET["source"]), cleanInput($_GET["length"]), cleanInput($_GET["offer_deadline"]), cleanInput($_GET["work_deadline"]), cleanInput($_GET["output"]));
}
if (isset($_GET["delete"])) {
    $OfferManager->deleteOrdersData($_GET["delete"]);
}
function cleanInput($data)
{
    $data = trim($data);
    $data = stripslashes($data);
    $data = htmlspecialchars($data);
    return $data;
}
?>

<h3>Tööpakkumised</h3>
<?php
	require_once("functions.php");
	require_once("OfferManager.class.php");
	require_once("header.php");
	
	$OfferManager = new OfferManager($mysqli, $_SESSION["logged_in_user_id"]);
	
	if(!isSet($_GET["offer_id"])){
		header("Location: offers.php");
	}
	
	$feedback = "";
	$feedback_error = "";
	
	if($_SERVER["REQUEST_METHOD"] == "POST"){
		
		if(isSet($_POST["add_new_feedback"])){
			
			if(empty($_POST["feedback"])){
				$feedback_error = "Palun sisesta tagasiside";
			}else{
				$feedback = cleanInput($_POST["feedback"]);
			}
			
					
			if($feedback_error == ""){
				$OfferManager->addNewFeedback($_SESSION['logged_in_user_id'], $_POST["to_user_id"], $_POST["offer_id"], $feedback);
				header("Location: requests.php");  
			}
		}
	}
Esempio n. 6
0
<?php

	require_once("functions.php");
	require_once("OfferManager.class.php");
	require_once("header.php");
	
	$OfferManager = new OfferManager($mysqli, $_SESSION["logged_in_user_id"]);
	
	if(!isset($_GET["user_feedback_id"])){
		header("Location: ?user_feedback_id=".$_SESSION['logged_in_user_id']);
	}

	$feedback_array = $OfferManager->getFeedbackData();

?>

<?php
	
	/* SEE ON MÕELDUD ADMINI JAOKS */
	if($_SESSION["logged_in_user_group_id"] == "1"){
		
		echo"<h3>Tagasiside</h3>";
		
		echo "<table class='table table-striped'>";
		echo "<tr>";
		echo "<th>To:Eesnimi</th>";
		echo "<th>To:Perekonnanimi</th>";
		echo "<th>To:Ettevõtte nimetus</th>";
		echo "<th>Kommentaar</th>";
		echo "<th>From:Eesnimi</th>";
		echo "<th>From:Perekonnanimi</th>";
Esempio n. 7
0
<?php

require_once "functions.php";
require_once "OfferManager.class.php";
require_once "header.php";
$OfferManager = new OfferManager($mysqli, $_SESSION["logged_in_user_id"]);
if ($_SESSION["logged_in_user_group_id"] == "2") {
    header("Location: requests.php");
}
$text_type = $subject = $target_group = $description = $source = $length = $offer_deadline = $work_deadline = $output = $m = "";
$text_type_error = $subject_error = $target_group_error = $description_error = $source_error = $length_error = $offer_deadline_error_1 = $offer_deadline_error_2 = $work_deadline_error_1 = $work_deadline_error_2 = $output_error = "";
if ($_SERVER["REQUEST_METHOD"] == "POST") {
    if (isset($_POST["add_new_order"])) {
        if (empty($_POST["text_type"])) {
            $text_type_error = "Teksti tüüp on kohustuslik";
        } else {
            $text_type = cleanInput($_POST["text_type"]);
        }
        if (empty($_POST["subject"])) {
            $subject_error = "Teema on kohustuslik";
        } else {
            $subject = cleanInput($_POST["subject"]);
        }
        if (empty($_POST["target_group"])) {
            $target_group_error = "Sihtgrupp on kohustuslik";
        } else {
            $target_group = cleanInput($_POST["target_group"]);
        }
        if (empty($_POST["description"])) {
            $description_error = "Kirjeldus on kohustuslik";
        } else {
Esempio n. 8
0
<?php

require_once "functions.php";
require_once "OfferManager.class.php";
require_once "header.php";
$OfferManager = new OfferManager($mysqli, $_SESSION["logged_in_user_id"]);
if (isset($_GET["update"])) {
    $OfferManager->updateOrdersData(cleanInput($_GET["orders_id"]), cleanInput($_GET["text_type"]), cleanInput($_GET["subject"]), cleanInput($_GET["target_group"]), cleanInput($_GET["description"]), cleanInput($_GET["source"]), cleanInput($_GET["length"]), cleanInput($_GET["offer_deadline"]), cleanInput($_GET["work_deadline"]), cleanInput($_GET["output"]));
}
if (isset($_GET["edit_id"])) {
    $order = $OfferManager->getSingleOrderData($_GET["edit_id"]);
} else {
    header("Location: requests.php");
}
function cleanInput($data)
{
    $data = trim($data);
    $data = stripslashes($data);
    $data = htmlspecialchars($data);
    return $data;
}
?>

<h3>Tellimuse muutmine</h3>

<form action="edit.php" method="get">
	<input type="hidden" name="orders_id" value="<?php 
echo $_GET["edit_id"];
?>
">
	<select name="text_type">
Esempio n. 9
0
<?php

require_once "functions.php";
require_once "OfferManager.class.php";
require_once "header.php";
$OfferManager = new OfferManager($mysqli, $_SESSION["logged_in_user_id"]);
if (isset($_GET["update_1"], $_GET["update_2"])) {
    $OfferManager->updateOffersAndRequestsData($_GET["update_1"], $_GET["update_2"]);
}
$offers_array = $OfferManager->getOffersData();
?>

<h3>Pakkumised</h3>

<?php 
/* Antud lehekülg on mõeldud nii ajakirjanikule kui ka ettevõttele, st:
(1) iga ajakirjanik saab vaadata enda tehtud pakkumisi ettevõtete tööpakkumistele ja
(2) iga ettevõte saab vaadata ajakirjanike pakkumisi antud ettevõtte tööpakkumistele */
/* AJAKIRJANIK */
if ($_SESSION["logged_in_user_group_id"] == "2") {
    echo "<table class='table table-striped'>";
    echo "<tr>";
    echo "<th>Teema</th>";
    echo "<th>Tellija</th>";
    echo "<th>Pakkumise kuupäev</th>";
    echo "<th>Hind (EUR)</th>";
    echo "<th>Kommentaar</th>";
    echo "<th>Accepted</th>";
    echo "<th></th>";
    echo "</tr>";
    for ($i = 0; $i < count($offers_array); $i++) {