本文整理汇总了PHP中Color::find方法的典型用法代码示例。如果您正苦于以下问题:PHP Color::find方法的具体用法?PHP Color::find怎么用?PHP Color::find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Color
的用法示例。
在下文中一共展示了Color::find方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: search_data
public static function search_data($vehicle_data, $driver = NULL)
{
if (!empty($vehicle_data)) {
$vehicles_vin = $vehicle_data->vehicles_vin;
$vehicles_model_id = $vehicle_data->vehicles_model_id;
$vehicles_use_type_id = $vehicle_data->vehicles_use_type;
$vehicle_color = Color::find($vehicle_data->vehicles_color)->colors_name;
$owner = $vehicle_data->owners;
foreach ($owner as $own) {
$owner_names['name'][] = $own->drivers_fname . " " . $own->drivers_lname;
}
if (!isset($owner_names)) {
$owner_names = null;
}
$model = Model::find($vehicles_model_id);
$model_make_id = $model->model_make_id;
$model_name = $model->model_name;
$vehicle_use_types_name = VehicleUseType::find($vehicles_use_type_id)->vehicle_use_types_name;
$result_data[] = array('id' => $vehicle_data->id, 'vin_number' => $vehicles_vin, 'model_make_id' => $model_make_id, 'model_name' => $model_name, 'color' => $vehicle_color, 'owner' => $owner_names, 'vehicle_use_types_name' => $vehicle_use_types_name);
if ($driver) {
return $result_data;
}
Helpers::response_data('200', 'success', $result_data);
} else {
Helpers::response_data('404', 'No record found', NULL);
}
}
示例2: testFind
public function testFind()
{
self::assertEquals(Shell::GNOME, Shell::find('Gnome'));
self::assertEquals(Shell::UNITY, Shell::find('Cinnamon'));
self::assertNull(Color::find(Shell::GNOME));
self::assertEquals(Color::GREY, Color::find('#808080'));
self::assertNotEquals(Color::GRAY, Color::find('#808080'));
}
示例3: indexAction
/**
* 图片分为: 链接, 名字, 图片, 类型
*/
public function indexAction()
{
if (!$this->view->getCache()->exists('index')) {
$websiteData = Website::find(array('order' => 'vote desc', 'cache' => array('key' => 'website', 'lifetime' => 3600)));
$sightData = Sight::find(array('order' => 'RANDOM()', 'cache' => array('key' => 'sight', 'lifetime' => 3600)));
$colorData = Color::find(array('order' => 'RANDOM()', 'cache' => array('key' => 'color', 'lifetime' => 3600)));
$this->view->websiteData = $websiteData;
$this->view->sightData = $sightData;
$this->view->colorData = $colorData;
}
$this->view->cache(array('key' => 'index', 'lifetime' => 7200));
}
示例4: store
//.........这里部分代码省略.........
$owner_info['drivers_lname'] = Input::get('drivers_lname' . $owners_index_id);
$owner_info['drivers_nin'] = Input::get('drivers_nin' . $owners_index_id);
$owner_info['drivers_license_no'] = Input::get('drivers_license_no' . $owners_index_id);
$owner_info['drivers_street'] = Input::get('drivers_street' . $owners_index_id);
$owner_info['drivers_city'] = Input::get('drivers_city' . $owners_index_id);
$owner_info['drivers_po_box'] = Input::get('drivers_po_box' . $owners_index_id);
$owner_info['drivers_country'] = Input::get('drivers_country' . $owners_index_id);
$owner_info['drivers_cell1'] = Input::get('drivers_cell1' . $owners_index_id);
$owner_info['drivers_cell2'] = Input::get('drivers_cell2' . $owners_index_id);
$owner_info['drivers_email'] = Input::get('drivers_email' . $owners_index_id);
$owner_info['drivers_driving_status'] = Input::get('drivers_driving_status' . $owners_index_id);
$insert_owner_into_driver_table = Driver::create($owner_info);
// USED TO ASSOCIATE WITH VEHICLE
$owner_ids[] = $insert_owner_into_driver_table->id;
// USED TO SEND SMS
$ownerNamePh[$owner_info['drivers_cell1']]['name'] = $owner_info['drivers_fname'] . " " . $owner_info['drivers_lname'];
$ownerNamePh[$owner_info['drivers_cell1']]['address'] = $owner_info['drivers_street'] . ", " . $owner_info['drivers_city'] . " - " . $owner_info['drivers_po_box'];
$ownerNamePh[$owner_info['drivers_cell1']]['email'] = $owner_info['drivers_email'];
} else {
$driverExist = Driver::where('drivers_license_no', $drivers_license_no)->first();
// USED TO ASSOCIATE WITH VEHICLE
$owner_ids[] = $driverExist->id;
// USED TO SEND SMS
$ownerNamePh[$driverExist->drivers_cell1]['name'] = $driverExist->drivers_fname . " " . $driverExist->drivers_lname;
$ownerNamePh[$driverExist->drivers_cell1]['address'] = $driverExist->drivers_street . " " . $driverExist->drivers_city . " - " . $driverExist->drivers_po_box;
$ownerNamePh[$driverExist->drivers_cell1]['email'] = $driverExist->drivers_email;
}
}
}
// LINK VEHICLE WITH OWNERS
if (!empty($owner_ids)) {
foreach ($owner_ids as $owner_ids_fet) {
$owner_ids_fet = (int) $owner_ids_fet;
Vehicle::find($vehicle_inserted_id)->owners()->attach($owner_ids_fet);
}
}
// END OWNERS
//BEGIN AUTHORIZED DRIVERS
$authorized_index = Input::get('authorized_index');
// IF AUTHORIZED DRIVERS EXIST, ASSOCIATE WITH DRIVERS.(CHECKING USING LICENSE)
if ($authorized_index != "") {
$authorized_index_arr = explode(',', $authorized_index);
foreach ($authorized_index_arr as $authorized_index_id) {
$authorized_license_no = Input::get('authorized_license_no' . $authorized_index_id);
$authorized_status = Driver::where('drivers_license_no', $authorized_license_no)->first();
//IF DRIVER DOESN'T EXISTS, CREATE DRIVER
if ($authorized_status == NULL) {
$authorized_info['drivers_fname'] = Input::get('authorized_fname' . $authorized_index_id);
$authorized_info['drivers_mname'] = Input::get('authorized_mname' . $authorized_index_id);
$authorized_info['drivers_lname'] = Input::get('authorized_lname' . $authorized_index_id);
$authorized_info['drivers_nin'] = Input::get('authorized_nin' . $authorized_index_id);
$authorized_info['drivers_license_no'] = Input::get('authorized_license_no' . $authorized_index_id);
$authorized_info['drivers_street'] = Input::get('authorized_street' . $authorized_index_id);
$authorized_info['drivers_city'] = Input::get('authorized_city' . $authorized_index_id);
$authorized_info['drivers_po_box'] = Input::get('authorized_po_box' . $authorized_index_id);
$authorized_info['drivers_country'] = Input::get('authorized_country' . $authorized_index_id);
$authorized_info['drivers_cell1'] = Input::get('authorized_cell1' . $authorized_index_id);
$authorized_info['drivers_cell2'] = Input::get('authorized_cell2' . $authorized_index_id);
$authorized_info['drivers_email'] = Input::get('authorized_email' . $authorized_index_id);
$authorized_info['drivers_driving_status'] = Input::get('authorized_driving_status' . $authorized_index_id);
$insert_authorized_into_driver_table = Driver::create($authorized_info);
$authorized_ids[] = $insert_authorized_into_driver_table->id;
} else {
$authorized_ids[] = Driver::where('drivers_license_no', $authorized_license_no)->first()->id;
}
}
示例5: delete_destroy
public function delete_destroy($palette_id, $color_id)
{
$delete = Color::find($color_id)->delete();
if ($delete) {
return Redirect::to('litmus/palettes/' . $palette_id . '/colors')->with('status', 'Your palette was deleted successfully!');
} else {
return Redirect::back()->with('error', "There was an error deleting the record! Please try again.");
}
}
示例6: Door
/**
*
* @param type $report_items
* @param type $count
* @param type $door_id
* @param type $width
* @param type $height
* @param type $is_it_drawer
* @param type $cabinet_count
*/
function report_door_manufacturing_list(&$report_items, $cabinet_order, $count, $door_id, $width, $height, $cabinet_count = 1, $is_it_drawer = false)
{
if ($count > 0) {
$count *= $cabinet_count;
$index_key = "{$door_id}|{$width}X{$height}";
if (isset($report_items[$index_key]['quantity'])) {
$report_items[$index_key]['quantity'] += $count;
} else {
App::import("Model", "Inventory.Door");
$door = new Door();
$door->recursive = -1;
$door_info = $door->find('first', array('conditions' => array('Door.id' => $door_id)));
$door_detail = $door_info['Door'];
App::import("Model", "Inventory.Color");
$color = new Color();
$color->recursive = -1;
$color_info = $color->find('first', array('conditions' => array('Color.id' => $cabinet_order['door_color'])));
$door_color_detail = $color_info['Color'];
$color_info = $color->find('first', array('conditions' => array('Color.id' => $cabinet_order['cabinet_color'])));
$cabinet_color_detail = $color_info['Color'];
$width_code = $this->InventoryLookupValue2Name($width);
$width_code = empty($width_code) ? '--' : $width_code;
$height_code = $this->InventoryLookupValue2Name($height);
$height_code = empty($height_code) ? '--' : $height_code;
if ($is_it_drawer) {
$report_items[$index_key]['code'] = "DR{$width_code}{$height_code}";
} else {
$height_code_door_only = $this->InventoryLookupValue2Name($height);
if (!is_null($height_code_door_only)) {
$height_code = $height_code_door_only;
$height_code = empty($height_code) ? '--' : $height_code;
}
$report_items[$index_key]['code'] = "DO{$width_code}{$height_code}";
}
$report_items[$index_key]['cabinet_color'] = $cabinet_color_detail['name'];
$report_items[$index_key]['door_style'] = $door_detail['door_style'];
$report_items[$index_key]['door_color'] = $door_color_detail['name'];
$report_items[$index_key]['outside_profile'] = $door_detail['outside_profile'];
$report_items[$index_key]['router_cope'] = $door_detail['router_cope'];
$report_items[$index_key]['router_panel'] = $door_detail['router_panel'];
$report_items[$index_key]['wood_species'] = $this->InventoryLookupReverse($door_detail['wood_species']);
$report_items[$index_key]['quantity'] = $count;
$report_items[$index_key]['width'] = $width;
$report_items[$index_key]['height'] = $height;
$report_items[$index_key]['stile_quantity'] = $report_items[$index_key]['quantity'] * 2;
$report_items[$index_key]['stile_width'] = $door_detail['door_stile_width'];
if (!$is_it_drawer || $is_it_drawer && $height >= 170) {
$report_items[$index_key]['stile_height'] = $height + $door_detail['door_stile_offset'];
} else {
$report_items[$index_key]['stile_height'] = $height + $door_detail['drawer_stile_offset'];
}
$report_items[$index_key]['rail_quantity'] = $report_items[$index_key]['quantity'] * 2;
$report_items[$index_key]['rail_width'] = $door_detail['door_rail_width'];
if (!$is_it_drawer || $is_it_drawer && $height >= 170) {
$report_items[$index_key]['rail_height'] = $report_items[$index_key]['height'] + $door_detail['door_rail_offset'];
} else {
$report_items[$index_key]['rail_height'] = $height + $door_detail['drawer_rail_offset'];
}
$report_items[$index_key]['panel_quantity'] = $report_items[$index_key]['quantity'];
$report_items[$index_key]['panel_width'] = $report_items[$index_key]['width'] + $door_detail['door_panel_width_offset'];
if (!$is_it_drawer || $is_it_drawer && $height >= 170) {
$report_items[$index_key]['panel_height'] = $report_items[$index_key]['height'] + $door_detail['door_panel_height_offset'];
} else {
$report_items[$index_key]['panel_height'] = $height + $door_detail['drawer_panel_height_offset'];
}
}
}
}
示例7: calculateCabinetPriceForBuilder
public function calculateCabinetPriceForBuilder($cabinet_id, $cabinet_color, $material_id, $door_id, $door_color, $drawer_id, $drawer_slide_id, $quantity = 1, $delivery_option = '', $delivery_charge = 0)
{
App::import("Model", "Inventory.Cabinet");
App::uses("Material", "Inventory.Model");
App::uses("Door", "Inventory.Model");
App::uses("Color", "Inventory.Model");
App::import("Model", "Inventory.Item");
App::import("Model", "Inventory.CabinetsItem");
App::import("Model", "Inventory.InventoryLookup");
$cabinet_id = Sanitize::escape($cabinet_id);
$material_id = Sanitize::escape($material_id);
$door_id = Sanitize::escape($door_id);
$door_color = Sanitize::escape($door_color);
$cabinet_color = Sanitize::escape($cabinet_color);
$drawer_id = Sanitize::escape($drawer_id);
$drawer_slide_id = Sanitize::escape($drawer_slide_id);
$debug_calculation = '';
$cabinets_items_model = new CabinetsItem();
$cabinets_items_model->recursive = 1;
$cabinets_items = $cabinets_items_model->find('all', array('conditions' => array('cabinet_id' => $cabinet_id, 'accessories' => '0')));
$cabinets_accessories = $cabinets_items_model->find('all', array('conditions' => array('cabinet_id' => $cabinet_id, 'accessories' => '1')));
if (!empty($cabinet_id)) {
$cabinet = new Cabinet();
$cabinet_detail = $cabinet->find('first', array('conditions' => array('id' => $cabinet_id)));
}
// predefined values
$debug_calculation .= "Blum Up Charge = {$this->bulm_up_charge} <br />";
$debug_calculation .= "Default Markup Factor = {$this->default_markup} <br />";
$debug_calculation .= "<br />";
// calculate cabinet sqft
$item_model = new Item();
$cabinet_sqft = $this->calculateCabinetSQFTForBuilder($cabinets_items, $item_model, $material_id);
$debug_calculation .= "Cabinet SQFT = {$cabinet_sqft} <br />";
$debug_calculation .= "<br />";
// calculate cabinet sqft
$panel_sqft = $this->calculatePanelSQFTForBuilder($cabinets_items);
$debug_calculation .= "Panel SQFT = {$panel_sqft} <br />";
$debug_calculation .= "<br />";
// calculate cabinet sqft
$box_total = $this->calculateBoxTotalForBuilder($cabinets_items, $door_id, $drawer_id, $drawer_slide_id);
$debug_calculation .= "<b>Box Total Price = {$box_total} </b><br />";
$debug_calculation .= "<br />";
// get door color price
$door_color_price = 0;
$door_color_detail = array();
if (!empty($door_color)) {
$color = new Color();
$door_color_detail = $color->find('first', array('conditions' => array('id' => $door_color)));
if (isset($door_color_detail['ColorSection']) && !empty($door_color_detail['ColorSection']) && is_array($door_color_detail['ColorSection'])) {
foreach ($door_color_detail['ColorSection'] as $color_section) {
if ($color_section['type'] == 'door_material') {
$door_color_price = $color_section['price'];
break;
}
}
}
unset($door_color_detail);
// clean up
unset($color);
// clean up
}
// get cabinet color price
$cabinet_color_price = 0;
$cabinet_price_color = 0;
$panel_price_color = 0;
$cabinet_color_detail = array();
if (!empty($cabinet_color)) {
$color = new Color();
$cabinet_color_detail = $color->find('first', array('conditions' => array('id' => $cabinet_color)));
if (isset($cabinet_color_detail['ColorSection']) && !empty($cabinet_color_detail['ColorSection']) && is_array($cabinet_color_detail['ColorSection'])) {
foreach ($cabinet_color_detail['ColorSection'] as $color_section) {
// if ($color_section['type'] == 'cabinet_material') {
if ($color_section['type'] == 'cabinate_material') {
$cabinet_color_price = $color_section['price'];
$cabinet_price_color = $cabinet_color_price * $cabinet_sqft;
$debug_calculation .= "Cabinet Color Price = {$cabinet_color_price} <br />";
$debug_calculation .= "<b>Cabinet Price (Color) = {$cabinet_price_color} </b><br />";
$panel_price_color = $cabinet_color_price * $panel_sqft;
$debug_calculation .= "<b>Panel Price (Color) = {$panel_price_color} </b><br />";
$debug_calculation .= "<br />";
break;
}
}
}
unset($cabinet_color_detail);
// clean up
unset($color);
// clean up
}
$doors_drawers_price = 0;
if (!empty($door_id)) {
$door = new Door();
$door_detail = $door->find('first', array('conditions' => array('Door.id' => $door_id)));
$door_cost_markup = $door_detail['Door']['cost_markup_factor'];
$door_drawers = array();
$debug_calculation .= "Door/Drawer Cost Markup = {$door_cost_markup} <br />";
$debug_calculation .= "<br />";
$door_drawers['top_door'] = array('sqft' => 0, 'price' => 0);
if (!empty($cabinet_detail['Cabinet']['top_door_count'])) {
$height = (double) $cabinet_detail['Cabinet']['top_door_height'];
//.........这里部分代码省略.........