diff options
Diffstat (limited to 'include/home.php')
-rw-r--r-- | include/home.php | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/include/home.php b/include/home.php index 2b64290..b42ec8e 100644 --- a/include/home.php +++ b/include/home.php @@ -37,7 +37,7 @@ require('./header.php'); <div class="row"> <div class="col-lg-3 col-md-3 col-sm-6"> <?php - $count = count(BusinessAdmin::getOfferIds($_pdo, array("`accepted` = 0"))); + $count = Offer::count($_pdo, ["`accepted` = 0"]); ?> <div class="panel panel-<?=($count==0 ? 'primary' : 'yellow')?>"> <div class="panel-heading"> @@ -62,7 +62,7 @@ require('./header.php'); </div> <div class="col-lg-3 col-md-3 col-sm-6"> <?php - $count = count(BusinessAdmin::getOfferIds($_pdo, array("`accepted`=1", "`start_date` <= CURDATE()", "`end_date` >= CURDATE()"))); + $count = Offer::count($_pdo, ["`accepted`=1", "`start_date` <= CURDATE()", "`end_date` >= CURDATE()"]); ?> <div class="panel panel-<?=($count==0 ? 'primary' : ($count < 3) ? 'green' : ($count < 5 ? 'yellow' : 'red'))?>"> <div class="panel-heading"> @@ -87,7 +87,7 @@ require('./header.php'); </div> <div class="col-lg-3 col-md-3 col-sm-6"> <?php - $count = count(BusinessAdmin::getOfferIds($_pdo, array("`accepted`=1", "`end_date` <= CURDATE()", "`invoice_date` IS NULL OR `invoice_date`='1970-01-01' OR `invoice_date`>CURDATE()"))); + $count = Offer::count($_pdo, ["`accepted`=1", "`end_date` <= CURDATE()", "`invoice_date` IS NULL OR `invoice_date`='1970-01-01' OR `invoice_date`>CURDATE()"]); ?> <div class="panel panel-<?=($count==0 ? 'primary' : ($count < 3) ? 'green' : ($count < 5 ? 'yellow' : 'red'))?>"> <div class="panel-heading"> @@ -112,11 +112,11 @@ require('./header.php'); </div> <div class="col-lg-3 col-md-3 col-sm-6"> <?php - $count = count(BusinessAdmin::getOffers($_pdo, [ + $count = Offer::count($_pdo, [ "`invoice_date` > '1970-01-01'", "`invoice_date`<=CURDATE()", - "NOT EXISTS (SELECT * FROM `".Constants::db_prefix."payment` WHERE `offerId`=`".Constants::db_prefix."offer`.`id`)"])); - foreach (BusinessAdmin::getOffers($_pdo, ['EXISTS (SELECT * FROM `'.Constants::db_prefix.'payment` WHERE `offerId`=`'.Constants::db_prefix.'offer`.`id` AND `braintree_id` IS NOT NULL)']) as $offer) { + "NOT EXISTS (SELECT * FROM `".Constants::db_prefix."payment` WHERE `offerId`=`".Constants::db_prefix."offer`.`id`)"]); + foreach (Offer::search($_pdo, ['EXISTS (SELECT * FROM `'.Constants::db_prefix.'payment` WHERE `offerId`=`'.Constants::db_prefix.'offer`.`id` AND `braintree_id` IS NOT NULL)']) as $offer) { if (!$offer->getPayment()->isBraintreeFinished()) { $count++; } @@ -154,7 +154,7 @@ require('./header.php'); <!-- /.panel-heading --> <div class="panel-body"> <?php - $offers = BusinessAdmin::getOffers($_pdo, array("`accepted`=1", "`start_date` <= CURDATE()", "`end_date` >= CURDATE()")); + $offers = Offer::search($_pdo, ["`accepted`=1", "`start_date` <= CURDATE()", "`end_date` >= CURDATE()"]); $list = array(); foreach ($offers as $offer) { $start = BusinessAdmin::formatDate($offer->start_date, false); @@ -209,7 +209,7 @@ require('./header.php'); </thead> <tbody> <?php - $offers = BusinessAdmin::getOffers($_pdo, array("`accepted`=1", "`end_date` <= CURDATE()", "`invoice_date` IS NULL OR `invoice_date`='1970-01-01' OR `invoice_date`>CURDATE()")); + $offers = Offer::search($_pdo, ["`accepted`=1", "`end_date` <= CURDATE()", "`invoice_date` IS NULL OR `invoice_date`='1970-01-01' OR `invoice_date`>CURDATE()"]); foreach ($offers as $offer) { echo "<tr> <td><a href='offers?id={$offer->id}'>{$offer->id}</a></td> @@ -245,11 +245,11 @@ require('./header.php'); </thead> <tbody> <?php - $offers = BusinessAdmin::getOffers($_pdo, array( + $offers = Offer::search($_pdo, [ "`invoice_date` > '1970-01-01'", "`invoice_date`<=CURDATE()", - "NOT EXISTS (SELECT * FROM `".Constants::db_prefix."payment` WHERE `offerId`=`".Constants::db_prefix."offer`.`id`)")); - $open_offers = BusinessAdmin::getOffers($_pdo, + "NOT EXISTS (SELECT * FROM `".Constants::db_prefix."payment` WHERE `offerId`=`".Constants::db_prefix."offer`.`id`)"]); + $open_offers = Offer::search($_pdo, ['EXISTS (SELECT * FROM `'.Constants::db_prefix.'payment` WHERE `offerId`=`'.Constants::db_prefix.'offer`.`id` AND `braintree_id` IS NOT NULL)']); $count = count($offers); foreach ($open_offers as $offer) { @@ -300,7 +300,7 @@ require('./header.php'); <div class="panel-body"> <ul class="timeline"> <?php - $offers = BusinessAdmin::getOffers($_pdo, array('`accepted`=1')); + $offers = Offer::search($_pdo, ['`accepted`=1']); $list = array(); $sort_list = array(); foreach ($offers as $offer) { |