本文整理匯總了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';
}