Authored by xuqi

Merge branch 'develop' of http://git.dev.yoho.cn/web/yohobuy into develop

framework @ 119c247f
Subproject commit 75bbc3b075de19f239532f60c5995d06c5f814e2
Subproject commit 119c247f5cf929aa1e059e40609bb16dd6b58f05
... ...
... ... @@ -98,7 +98,8 @@
position: fixed;
right: 1px;
border-radius: 6px;
background: rgba(0,0,0,.8);
background: rgba(0,0,0,.8);
z-index: 2;
b {
height: 16px;
... ...
... ... @@ -108,11 +108,51 @@ class ClassModel
foreach ($classesData as $val) {
foreach ($val['ca'] as $single) {
$classes[$single['id']] = $single['name'];
$classes += array_column($single['sub'], 'name', 'id');
$classes += self::array_column($single['sub'], 'name', 'id');
}
}
return $classes;
}
/**
* 自定义array_column函数
*
* @return array 返回数组中指定的一列组成的数组
*/
/**
* 自定义array_column函数
* @param array $input 需要取出数组咧的多维数组
* @param string $columnKey 需要返回的列
* @param mixed $indexKey 作为返回数组的索引值
* @return array 从多维数组中返回单列数组
*/
private static function array_column(array $input, $columnKey, $indexKey = null)
{
$array = array();
foreach ($input as $value) {
if ( ! isset($value[$columnKey])) {
trigger_error("Key \"$columnKey\" does not exist in array");
return false;
}
if (is_null($indexKey)) {
$array[] = $value[$columnKey];
}
else {
if ( ! isset($value[$indexKey])) {
trigger_error("Key \"$indexKey\" does not exist in array");
return false;
}
if ( ! is_scalar($value[$indexKey])) {
trigger_error("Key \"$indexKey\" does not contain scalar value");
return false;
}
$array[$value[$indexKey]] = $value[$columnKey];
}
}
return $array;
}
}
... ...