public static function UCXF_Value::load_list in Extra Fields Checkout Pane 6.2
Same name and namespace in other branches
- 7 class/UCXF_Value.class.php \UCXF_Value::load_list()
Loads a list of values from database
Parameters
int $element_id: id of element, order_id or uc_addresses id
int $element_type: type of element: order or address
Return value
array
3 calls to UCXF_Value::load_list()
- UCXFApiTestCase::testUCXF_Value in ./
uc_extra_fields_pane.test - Test if UCXF_Value behaves as excepted.
- UCXFTestCase::checkValuesInDatabase in ./
uc_extra_fields_pane.test - Test if these values appear in the database.
- uc_extra_fields_pane_value_list_load in ./
uc_extra_fields_pane.module - uc_extra_fields_pane_value_list_load() Loads a list of values from database
File
- class/
UCXF_Value.class.php, line 289 - Contains the UCXF_Value class.
Class
- UCXF_Value
- This class is used to keep track of all field values currently loaded.
Code
public static function load_list($element_id, $element_type) {
// Check if value list has already been loaded
if (isset(self::$loaded_lists[$element_id][$element_type]) && isset(self::$loaded_values[$element_id][$element_type]) && self::$loaded_lists[$element_id][$element_type]) {
return self::$loaded_values[$element_id][$element_type];
}
$query = "SELECT\n ucxf_values.element_id,\n ucxf_values.element_type,\n ucxf_values.field_id,\n ucxf_values.value,\n ucxf_fields.db_name\n FROM {uc_extra_fields_values} AS ucxf_values\n INNER JOIN {uc_extra_fields} AS ucxf_fields USING(field_id)\n WHERE ucxf_values.element_id=%d\n AND ucxf_values.element_type=%d\n ";
$result = db_query($query, $element_id, $element_type);
if ($result) {
self::dbResultToValue($result);
}
// Check if we have a result now
if (isset(self::$loaded_values[$element_id][$element_type])) {
// Set flag that the list is loaded.
self::$loaded_lists[$element_id][$element_type] = TRUE;
// Return the loaded list.
return self::$loaded_values[$element_id][$element_type];
}
return array();
}