Beispiel #1
0
 function execute()
 {
     if ($this->executed || !count($this->itemarray) && !count($this->destroyedIDarray) && !count($this->droppedIDarray)) {
         return;
     }
     $sql = "select inv.icon, inv.typeID, " . "itp.price, kb3_item_types.*, dga.value as techlevel, " . "dc.value as usedcharge, dl.value as usedlauncher, " . "inv.groupID, inv.typeName, inv.capacity, inv.raceID, " . "inv.basePrice, inv.marketGroupID";
     if (count($this->destroyedIDarray)) {
         $sql .= ", if(dl.attributeID IS NULL,sum(itd.itd_quantity)," . "truncate(sum(itd.itd_quantity)/count(dl.attributeID),0)) " . "as itd_quantity, itd_itm_id, itd_itl_id, itl_location ";
     } else {
         if (count($this->droppedIDarray)) {
             $sql .= ", if(dl.attributeID IS NULL,sum(itd.itd_quantity)," . "truncate(sum(itd.itd_quantity)/count(dl.attributeID),0)) " . "as itd_quantity, itd_itm_id, itd_itl_id, itl_location ";
         }
     }
     $sql .= "from kb3_invtypes inv " . "left join kb3_dgmtypeattributes dga " . "on dga.typeID=inv.typeID and dga.attributeID=633 " . "left join kb3_item_price itp on itp.typeID=inv.typeID " . "left join kb3_item_types on inv.groupID=itt_id " . "left join kb3_dgmtypeattributes dc " . "on dc.typeID = inv.typeID AND dc.attributeID IN (128) " . "left join kb3_dgmtypeattributes dl " . "on dl.typeID = inv.typeID AND dl.attributeID IN (137,602) ";
     if (count($this->destroyedIDarray)) {
         $sql .= "join kb3_items_destroyed itd on inv.typeID = itd_itm_id " . "and itd_kll_id in (" . implode(',', $this->destroyedIDarray) . ") " . "left join kb3_item_locations itl " . "on (itd.itd_itl_id = itl.itl_id " . "or (itd.itd_itl_id = 0 and itl.itl_id = 1))";
     } else {
         if (count($this->droppedIDarray)) {
             $sql .= "join kb3_items_dropped itd " . "on inv.typeID = itd_itm_id and itd_kll_id in (" . implode(',', $this->droppedIDarray) . ") " . "left join kb3_item_locations itl " . "on (itd.itd_itl_id = itl.itl_id " . "or (itd.itd_itl_id = 0 and itl.itl_id = 1)) ";
         } else {
             $sql .= "where inv.typeID in (" . implode(',', $this->itemarray) . ") ";
         }
     }
     if (count($this->destroyedIDarray) || count($this->droppedIDarray)) {
         $sql .= "group by itd.itd_itm_id, itd.itd_itl_id " . "order by itd.itd_itl_id ";
     }
     $this->qry->execute($sql);
     $this->executed = true;
 }
 private function execQuery()
 {
     if ($this->executed) {
         return;
     }
     $sql = "select ctr.ctr_id, ctr.ctr_started, ctr.ctr_ended, ctr.ctr_name\n                from kb3_contracts ctr\n               where ctr.ctr_site = '" . KB_SITE . "'";
     if ($this->active_ == "yes") {
         $sql .= " and ( ctr_ended is null or now() <= ctr_ended )";
     } else {
         if ($this->active_ == "no") {
             $sql .= " and ( now() >= ctr_ended )";
         }
     }
     $sql .= " order by ctr_ended, ctr_started desc";
     $this->qry = DBFactory::getDBQuery();
     $this->qry->execute($sql);
     $this->executed = true;
 }