Exemplo n.º 1
0
 public static function getAllBidbyId($id)
 {
     $select = new SelectPDO();
     $select->from("bid", ["bid.*", "lot.title", "user.first_name", "user.last_Name"])->where("`bid`.`lot_id` = ?", array($id))->join("lot", "lot_id", "id")->join("user", "user_id", "id");
     $data = AbstractModel::getOnComplexQuery($select);
     return $data;
 }
Exemplo n.º 2
0
 /**
  * this function shows us our all lots
  * 
  */
 public function actionMyLots()
 {
     if ($this->request->order == "") {
         $products = MyProduct::getMyProduct($this->user->id);
         if (!$products) {
             $products = [];
         }
         $countLots = $this->user->getQuantityLots();
         $countBids = $this->user->getQuantityBids();
         if ($countLots == "") {
             $countLots = 0;
         }
         if ($countBids == "") {
             $countBids = 0;
         }
         $this->view->lots = $countLots;
         $this->view->countBids = $countBids;
         $this->view->user = $this->name;
         $this->view->products = $products;
         $this->view->render('mylots');
         $this->view->display();
     } else {
         $id = (int) $_POST["order"];
         $fields = ["title", "description", "current_price", "id", "front_img", "created"];
         $where = "user_id = ? ";
         $user_id = $this->user->id;
         $select = new SelectPDO();
         $select->from("lot", $fields)->where($where, array($user_id));
         switch ($id) {
             case '0':
                 $select->order("current_price", false);
                 break;
             case '1':
                 $select->order("current_price", true);
                 break;
             case '2':
                 $select->order("created");
                 break;
             default:
                 $select->order("title");
                 break;
         }
         $data = AbstractModel::getOnComplexQuery($select);
         $data = json_encode($data);
         echo $data;
         exit;
         $products = MyProduct::getMyProduct($this->user->id);
         echo json_encode($products);
     }
 }