Skip to content

Instantly share code, notes, and snippets.

@craigrodway
Created January 14, 2011 08:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save craigrodway/779363 to your computer and use it in GitHub Desktop.
Save craigrodway/779363 to your computer and use it in GitHub Desktop.
Adding a logo to PrintMaster - line ~73.
<?php
/*
Copyright (C) 2010 Craig A Rodway.
This file is part of Print Master.
Print Master is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Print Master is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Print Master. If not, see <http://www.gnu.org/licenses/>.
*/
include_once('inc/init.php');
// Do not show page title beneath menu (two columns have own titles)
$tpl->set('hidetitle', TRUE);
// Set page title
$tpl->set('title', 'Home');
$tpl->place('header');
/**
* Consumable stock
*/
// Get consumables
$sql = "SELECT
consumables.*,
( round( ( (consumables.qty) / (SELECT MAX(qty) FROM consumables) ) * 100 ) ) AS qty_percent,
GROUP_CONCAT(CAST(CONCAT(manufacturers.name, ' ', models.name) AS CHAR) SEPARATOR ', ') AS model
FROM consumables
LEFT JOIN consumables_models ON consumables.id = consumables_models.consumable_id
LEFT JOIN models ON consumables_models.model_id = models.id
LEFT JOIN manufacturers ON models.manufacturer_id = manufacturers.id
GROUP BY consumables.id
ORDER BY models.name ASC, consumables.name ASC";
$consumables = $db->query($sql)->asObjects();
// Get the most consumables in stock
$sql = 'SELECT MAX(qty) AS max FROM consumables';
$max_consumables = $db->query($sql)->fetchRow();
$max_consumables = $max_consumables['max'];
/**
* Quick add
*/
// List of printers
$printers = Printer::getSimple($db);
// List of models and which consumables are available
$models_consumables = Consumable::getForModels($db);
$models_consumables_json = fJSON::encode($models_consumables);
?>
<br />
<div class="grid_12">
<img src="web/img/mylogo.png" />
</div>
<div class="grid_5 suffix_1">
<?php include 'views/home/quickadd.php'; ?>
</div>
<div class="grid_6">
<?php include 'views/home/stock.php'; ?>
</div>
<?php
$tpl->place('footer');
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment