本文整理汇总了PHP中Printer::getSimple方法的典型用法代码示例。如果您正苦于以下问题:PHP Printer::getSimple方法的具体用法?PHP Printer::getSimple怎么用?PHP Printer::getSimple使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Printer
的用法示例。
在下文中一共展示了Printer::getSimple方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Printer
$date_to = fCRUD::getSearchValue('date_to');
/**
* Default action - show report of consumable installation
*/
if ($action == 'list') {
// Set the users to be sortable by name or email, defaulting to name
$sort = fCRUD::getSortColumn(array('events.date', 'models.name', 'printers.name', 'consumables.name', 'events.cost'));
// Set the sorting to default to ascending
$dir = fCRUD::getSortDirection('desc');
// Redirect the user if one of the values was loaded from the session
fCRUD::redirectWithLoadedValues();
// Determine search parameters
$sql_where = '';
if ($printer_id) {
$printer = new Printer($printer_id);
$sql_where .= ' AND events.printer_id = ' . $db->escape('integer', $printer_id);
}
if ($date_from) {
$sql_where .= ' AND DATE(events.date) >= ' . $db->escape('date', $date_from);
}
if ($date_to) {
$sql_where .= ' AND DATE(events.date) <= ' . $db->escape('date', $date_to);
}
// Get recordset object from tables
$sql = "SELECT\n\t\t\t\tCAST(CONCAT(manufacturers.name, ' ', models.name) AS CHAR) AS model,\n\t\t\t\tprinters.name AS printer_name,\n\t\t\t\tprinters.ipaddress,\n\t\t\t\tconsumables.name AS consumable_name,\n\t\t\t\tconsumables.col_c, consumables.col_y, consumables.col_m, consumables.col_k,\n\t\t\t\tconsumables.chargeback,\n\t\t\t\tevents.*\n\t\t\tFROM events\n\t\t\tLEFT JOIN consumables ON events.consumable_id = consumables.id\n\t\t\tLEFT JOIN printers ON events.printer_id = printers.id\n\t\t\tLEFT JOIN models ON printers.model_id = models.id\n\t\t\tLEFT JOIN manufacturers ON models.manufacturer_id = manufacturers.id\n\t\t\tWHERE 1 = 1\n\t\t\t{$sql_where}\n\t\t\tORDER BY {$sort} {$dir}";
$events = $db->query($sql)->asObjects();
// Get list of printers for dropdown box
$printers = Printer::getSimple($db);
// Include page to show table
include 'views/reports/index.php';
}