Beispiel #1
0
 function ordersPerMonth()
 {
     $db = Database::getDatabase();
     $orders = $db->getRows("SELECT DATE_FORMAT(dt, '%Y-%m') as dtstr, COUNT(*) FROM shine_orders WHERE type = 'PayPal' AND app_id = '{$this->id}' GROUP BY CONCAT(YEAR(dt), '-', MONTH(dt)) ORDER BY YEAR(dt) ASC, MONTH(dt) ASC");
     $keys = gimme($orders, 'dtstr');
     $values = gimme($orders, 'COUNT(*)');
     $orders = array();
     for ($i = 0; $i < count($keys); $i++) {
         $orders[$keys[$i]] = $values[$i];
     }
     $first_order_date = $db->getValue("SELECT dt FROM shine_orders ORDER BY dt ASC LIMIT 1");
     list($year, $month) = explode('-', dater($first_order_date, 'Y-n'));
     do {
         $month = str_pad($month, 2, '0', STR_PAD_LEFT);
         if (!isset($orders["{$year}-{$month}"])) {
             $orders["{$year}-{$month}"] = 0;
         }
         $month = intval($month) + 1;
         if ($month == 13) {
             $month = 1;
             $year++;
         }
     } while ($year != date('Y') && $month != date('m'));
     ksort($orders);
     return $orders;
 }
Beispiel #2
0
<?php

//Bootstrap SPF
require 'includes/master.inc.php';
//This loads up $user - $isadmin - $js
require 'includes/user.inc.php';
printr(gimme(Options::groups(), 'group'));
?>
<form method="post">
    <select name='option' title='Options'>
        <?php 
echo get_options('options', 'key', 'key', @$_POST['option']);
?>
    
    </select> 
    <select name='group' title='Groups of options'>
        <?php 
echo get_options('options_groups', 'group', 'group', @$_POST['group']);
?>
    
    </select>
    <select  name='type' title='Type of variable'>
        <?php 
echo array2options(Options::types(), @$_POST['type']);
?>
    </select>
    <input type='hidden' name='action' value='update' />
    <input type='submit' class='input-large' value='Update' />
</form>

<?php 
 function testGimme()
 {
     $arr = array(array(1, 3, 5, 7, 9), array(2, 4, 5, 6, 1), array(3, 1, 4, 4, 5));
     $this->true(array(1, 2, 3) === gimme($arr));
     $this->true(array(3, 4, 1) === gimme($arr, 1));
     $this->true(array(9, 1, 5) === gimme($arr, 4));
 }
Beispiel #4
0
<a href="<?php 
echo $opw_fb->draw(false);
?>
" class="fb"><?php 
$opw->draw();
?>
</a>
</div>
</div>

					<?php 
$db = Database::getDatabase();
// Downloads
$sel = "TO_DAYS(dt)";
$order_totals = $db->getRows("SELECT {$sel} as dtstr, COUNT(*) FROM downloads WHERE DATE_ADD(dt, INTERVAL 30 DAY) > NOW() GROUP BY {$sel} ORDER BY {$sel} ASC");
$opw = new googleChart(implode(',', gimme($order_totals, 'COUNT(*)')), 'bary');
$opw->showGrid = 1;
$opw->dimensions = '280x100';
$opw->setLabelsMinMax(4, 'left');
$opw_fb = clone $opw;
$opw_fb->dimensions = '640x400';
?>

				<div class="block">
					<div class="hd">
						<h2>Downloads 30 Days</h2>
					</div>
					<div class="bd">
						<a href="<?php 
echo $opw_fb->draw(false);
?>
 function testGimme()
 {
     $arr = array(array(1, 3, 5, 7, 9), array(2, 4, 5, 6, 1), array(3, 1, 4, 4, 5));
     $this->assertEquals(array(1, 2, 3), gimme($arr));
     $this->assertEquals(array(3, 4, 1), gimme($arr, 1));
     $this->assertEquals(array(9, 1, 5), gimme($arr, 4));
 }