本文整理汇总了PHP中Device::get_parts方法的典型用法代码示例。如果您正苦于以下问题:PHP Device::get_parts方法的具体用法?PHP Device::get_parts怎么用?PHP Device::get_parts使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Device
的用法示例。
在下文中一共展示了Device::get_parts方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: catch
} catch (Exception $e) {
$messages[] = array('text' => nl2br($e->getMessage()), 'strong' => true, 'color' => 'red');
}
break;
case 'copy_device':
// make a copy of this device (including all parts)
try {
$device->copy($copy_new_name, $copy_new_parent_id, $copy_recursive);
$html->set_variable('refresh_navigation_frame', true, 'boolean');
} catch (Exception $e) {
$messages[] = array('text' => nl2br($e->getMessage()), 'strong' => true, 'color' => 'red');
}
break;
case 'export':
try {
$device_parts = $device->get_parts();
if ($export_only_missing) {
foreach ($device_parts as $key => $devicepart) {
$needed = $devicepart->get_mount_quantity() * $export_multiplier;
$instock = $devicepart->get_part()->get_instock();
$mininstock = $devicepart->get_part()->get_mininstock();
if ($instock - $needed >= $mininstock) {
unset($device_parts[$key]);
}
}
}
$download = isset($_REQUEST['export_download']);
$export_string = export_parts($device_parts, 'deviceparts', $export_format_id, $download, 'deviceparts_' . $device->get_name(), array('export_quantity' => $export_multiplier));
} catch (Exception $e) {
$messages[] = array('text' => nl2br($e->getMessage()), 'strong' => true, 'color' => 'red');
}
示例2: array
$fatal_error = true;
}
}
/********************************************************************************
*
* Generate "Devices to order"-Table
*
*********************************************************************************/
if (!$fatal_error) {
try {
$order_devices = Device::get_order_devices($database, $current_user, $log);
$order_devices_loop = array();
$row_odd = true;
foreach ($order_devices as $device) {
$too_less_parts = 0;
foreach ($device->get_parts() as $devicepart) {
$needed = $devicepart->get_mount_quantity() * $device->get_order_quantity();
$instock = $devicepart->get_part()->get_instock();
$mininstock = $devicepart->get_part()->get_mininstock();
if ($instock - $needed < $mininstock) {
$too_less_parts++;
}
}
$order_devices_loop[] = array('row_odd' => $row_odd, 'id' => $device->get_id(), 'name' => $device->get_name(), 'full_path' => $device->get_full_path(), 'order_quantity' => $device->get_order_quantity(), 'only_missing_parts' => $device->get_order_only_missing_parts(), 'parts_count' => $device->get_parts_count(), 'parts_count_to_order' => $too_less_parts);
$row_odd = !$row_odd;
}
$html->set_loop('order_devices_loop', $order_devices_loop);
} catch (Exception $e) {
$messages[] = array('text' => nl2br($e->getMessage()), 'strong' => true, 'color' => 'red');
$fatal_error = true;
}