$upper_limit = $db->getOne($sql); $lic_avail = isset($upper_limit); } } if ($i == 30) { generate_error_image(" license_cache.php isn't run on : " . date("Y-m-d", $current_date) . " " . $upper_limit . " " . $lic_avail); exit; } #if ( !isset($upper_limit) || $upper_limit <= 0 ) { # generate_error_image("Total num licenses not available. license_cache.php isn't run"); # exit; #} $period = htmlspecialchars($_GET['period']); $i = 1; # Set some kind of value even if the set is empty $image->setData(1, 0); $image->setItemData(0, 0); $current_date = mktime(0, 0, 0, date("m"), date("d"), date("Y")); switch ($period) { case 'day': $xlimit = 0; break; case 'week': $xlimit = 6; break; case 'month': $xlimit = date("t", $current_date) - 1; break; case 'year': $xlimit = 364; break;
if (isset($_GET['time_breakdown'])) { ############################################################################# # This query gets how many times particular number of users used ############################################################################# $sql = "SELECT flmusage_users,count(*) FROM license_usage WHERE flmusage_product='" . htmlspecialchars($_GET['feature']) . "' AND flmusage_date = '" . htmlspecialchars($_GET['mydate']) . "' GROUP BY flmusage_users ORDER BY flmusage_users"; $recordset = $db->query($sql); if (DB::isError($recordset)) { die($recordset->getMessage()); } while ($row = $recordset->fetchRow()) { $data[$row[0]] = $row[1] * ($collection_interval / 60); } $recordset->free(); # Set some kind of value even if the set is empty otherwise # graph function will fail $image->setData(1, 0); $image->setItemData(0, 0); ################################################################### # There may be holes in usage stats ie. only 1 or 3 licenses are # used. We loop through the array. If there is no record we set # the value to zero ################################################################### for ($i = 0; $i <= $upper_limit; $i++) { if (isset($data[$i])) { $image->setData($i + 1, $data[$i]); } else { $image->setData($i + 1, 0); } $image->setItemData($i + 1, $i); } $image->enable("ItemData");