Exemplo n.º 1
0
 public function getFoods($fid)
 {
     $food = new Foods();
     $res = mysql_query("SELECT * FROM food WHERE id=" . $fid);
     if (mysql_num_rows($res) > 0) {
         while ($userRow = mysql_fetch_array($res)) {
             $food->setId($userRow['id']);
             $food->setFood($userRow['food']);
             $food->setImgs($userRow['imgs']);
             $food->setPrice($userRow['price']);
             $food->setIngredients($userRow['ingredients']);
             $food->setDescription($userRow['description']);
             $food->setType($userRow['type']);
             $food->setMeal($userRow['meal']);
             $food->setVeg($userRow['veg']);
             $food->setSpicy($userRow['spicy']);
             $food->setStock($userRow['stock']);
             $food->setDelivery($userRow['delivery']);
             $food->setDtime($userRow['dtime']);
         }
     }
     return $food;
 }
Exemplo n.º 2
0
                 $currentdate = date("d M Y");
                 $file_name_all .= $filename . "*";
             }
         }
     }
     $filepath = rtrim($file_name_all, '*');
 } else {
     $filepath = "";
 }
 echo $filepath;
 /*$query=mysql_query("INSERT into image (`image`) VALUES('".addslashes($filepath)."'); ");
   if($query)
   {
       header("location:".$_SERVER['PHP_SELF']);
   }*/
 $food = new Foods();
 $food->setId($_POST['id']);
 $food->setFood(mysql_real_escape_string($_POST['food']));
 $food->setPrice(mysql_real_escape_string($_POST['price']));
 $food->setIngredients(mysql_real_escape_string($_POST['ingredients']));
 $food->setDescription(mysql_real_escape_string($_POST['description']));
 $food->setType(mysql_real_escape_string($_POST['types']));
 $food->setMeal(mysql_real_escape_string($_POST['meal']));
 $food->setStock(mysql_real_escape_string($_POST['stock']));
 $food->setVeg(mysql_real_escape_string($_POST['veg']));
 $food->setSpicy(mysql_real_escape_string($_POST['spicy']));
 $food->setDelivery(mysql_real_escape_string($_POST['delivery']));
 $food->setDtime(mysql_real_escape_string($_POST['dtime']));
 $food->setImgs($filepath);
 $processfood = new Processfood();
 $msg_register = $processfood->updateFood($food);
Exemplo n.º 3
0
$bread->scrap();
echo "<hr>";
$bread->name = 'loaf of bread';
echo $bread->name;
echo "<hr>";
$bread->price = 2.25;
echo $bread->price;
echo "<hr>";
/*
* class Food
* Second Object
* $product_name, $product_price, $product_quantity, $product_expenses, $product_expiry_date
*/
$chocolate_sold = 3200;
$chocolate_delivered = 5000;
$chocolate = new Foods('chocolate', 4.25, 5252, 1.23, '18-10-15');
echo "<p><strong>Initial info</strong></p>";
$chocolate->ShowInfo();
echo "<p><strong>What happened next</strong></p>";
$chocolate->InStock($chocolate_sold, $chocolate_delivered);
$chocolate->printProfit($chocolate_sold);
$chocolate->scrap();
echo "<hr>";
$chocolate->expiry_date = '01-10-15';
echo $chocolate->expiry_date;
echo "<br>";
$chocolate->scrap();
echo "<hr>";
/*
* class Hardware
* First Object
Exemplo n.º 4
0
 /**
  * Short description of method getFoods
  *
  * @access public
  * @author firstname and lastname of author, <*****@*****.**>
  * @return mixed
  */
 public static function getFoods()
 {
     $food1 = new Foods();
     $food1->setName('Astelpaju');
     $food1->setId(1);
     $food2 = new Foods();
     $food2->setName('Pihlakas');
     $food2->setId(2);
     $food3 = new Foods();
     $food3->setName('Kuusk');
     $food1->setId(3);
     $food4 = new Foods();
     $food4->setName('Rukola');
     $food4->setId(4);
     $food5 = new Foods();
     $food5->setName('Kaalikas');
     $food5->setId(5);
     $food6 = new Foods();
     $food6->setName('Avokaado');
     $food6->setId(6);
     $foodsArray = array(1 => $food1, 2 => $food2, 3 => $food3, 4 => $food4, 5 => $food5, 6 => $food6);
     return $foodsArray;
 }
Exemplo n.º 5
0
 public function getProduct($f)
 {
     $id = $f->getId();
     $res = mysql_query("SELECT *,food.id AS fid, seller.id AS sid FROM food INNER JOIN seller ON seller.id=food.seller_id WHERE food.id='" . $id . "'");
     $userRow = mysql_fetch_array($res);
     $food = new Foods();
     $seller = new Seller();
     $review = new Review();
     $food->setId($userRow['fid']);
     $food->setFood($userRow['food']);
     $food->setImgs($userRow['imgs']);
     $food->setPrice($userRow['price']);
     $food->setIngredients($userRow['ingredients']);
     $food->setDescription($userRow['description']);
     $food->setType($userRow['type']);
     $food->setMeal($userRow['meal']);
     $food->setVeg($userRow['veg']);
     $food->setSpicy($userRow['spices']);
     $food->setStock($userRow['stock']);
     $food->setDelivery($userRow['delivery']);
     $food->setDtime($userRow['dtime']);
     $seller->setId($userRow['sid']);
     $seller->setCompany($userRow['company']);
     $seller->setAddress($userRow['address']);
     $seller->setCity($userRow['city']);
     $seller->setPostalcode($userRow['postalcode']);
     $seller->setDescription($userRow['description']);
     $seller->setLogo($userRow['logo']);
     $seller->setUser_id($userRow['user_id']);
     $resR = mysql_query("SELECT * FROM review WHERE food_id='" . $f->getId() . "'");
     $userRowR = mysql_fetch_array($resR);
     $review->setId($userRowR['id']);
     $review->setName($userRowR['name']);
     $review->setEmail($userRowR['email']);
     $review->setComment($userRowR['comment']);
     $review->setRtime($userRowR['rtime']);
     $review->setRday($userRowR['rday']);
     $review->setFood_id($userRowR['food_id']);
     $objs = array();
     $objs[] = $food;
     $objs[] = $seller;
     $objs[] = $review;
     return $objs;
 }
Exemplo n.º 6
0
$processitems = new Processitems();
if (isset($_POST['btn-review'])) {
    $review = new Review();
    $review->setName($_POST['rname']);
    $review->setComment($_POST['comment']);
    $review->setEmail($_POST['rmail']);
    $review->setId($_POST['rid']);
    $mydate = getdate(date("U"));
    $rday = $mydate[month] . " " . $mydate[mday] . ", " . $mydate[year];
    $rtime = date(" H:i", time());
    $review->setRday($rday);
    $review->setRtime($rtime);
    $msg = $processitems->addReview($review);
}
if (isset($_GET['id'])) {
    $food = new Foods();
    $food->setId($_GET['id']);
    $objs = $processitems->getProduct($food);
    $f = $objs[0];
    $s = $objs[1];
    $r = $objs[2];
} else {
    if (isset($_POST['id'])) {
        $c = new Cart();
        $c->setFood_id(mysql_real_escape_string($_POST['id']));
        $c->setQuantity(mysql_real_escape_string($_POST['quantity']));
        $processitems->addToCart($c);
    } else {
        header("Location: productList.php");
    }
}
Exemplo n.º 7
0
 * @author andrus
 */
$listOfVitamins = Vitamins::getVitamins();
//vitamiinide nimekiri
$listOfVitamins[1]->insertIdOfFoods(1);
$listOfVitamins[1]->insertIdOfFoods(2);
$listOfVitamins[1]->insertIdOfFoods(3);
$listOfVitamins[2]->insertIdOfFoods(3);
$listOfVitamins[2]->insertIdOfFoods(4);
$listOfVitamins[2]->insertIdOfFoods(5);
$listOfVitamins[3]->insertIdOfFoods(2);
$listOfVitamins[3]->insertIdOfFoods(6);
$listOfVitamins[3]->insertIdOfFoods(1);
$listOfFoodsOfVitamin3 = $listOfVitamins[3]->getIdOfFooods();
$listOfFoodsOfVitamin1 = $listOfVitamins[1]->getIdOfFooods();
$listOfFoods = Foods::getFoods();
$listOfFoods[1]->insertIdOfVitamins(1);
$listOfFoods[1]->insertIdOfVitamins(3);
$listOfFoods[2]->insertIdOfVitamins(1);
$listOfFoods[2]->insertIdOfVitamins(3);
$listOfFoods[3]->insertIdOfVitamins(1);
$listOfFoods[3]->insertIdOfVitamins(2);
$listOfFoods[4]->insertIdOfVitamins(2);
$listOfFoods[5]->insertIdOfVitamins(2);
$listOfFoods[6]->insertIdOfVitamins(3);
/**
 * print to display
 */
foreach ($listOfFoodsOfVitamin3 as $idOfFood) {
    echo $listOfFoods[$idOfFood]->getName() . ' ';
}