Пример #1
0
 /**
  * 获取用户最近使用菜单,菜单截取标题为8个中文字符
  * @param $userId
  * @return array|bool
  */
 public static function get_user_last_menus_info($userId)
 {
     //最近使用菜单
     $last_used_menus = Bll_UserUsedLog::get_user_last_used_menus($userId, Const_Cms::CMS_SIJI_MENU_DEEPTH);
     $last_used_menus = Tool_Array::init_new_arr_by_key($last_used_menus, "item_id");
     //菜单ID数组
     $menus_ids = Tool_Array::get_val_arr($last_used_menus, "item_id");
     $menus_total_info = self::get_menus_info_by_ids($menus_ids);
     $menus_total_info = Tool_Array::init_new_arr_by_key($menus_total_info, "id");
     $last_menus = array();
     foreach ($last_used_menus as $last_used_menus_key => $last_used_menus_val) {
         if (empty($menus_total_info[$last_used_menus_key])) {
             //菜单无效
             unset($last_used_menus[$last_used_menus_key]);
             continue;
         }
         $menus_total_info[$last_used_menus_key]['item_title'] = Tool_Font::split_font($menus_total_info[$last_used_menus_key]['item_title'], Const_Cms::CMS_LAST_USED_FONT_LEN, "");
         //<=8字,超出截字显示;数字或字母,按半字符计算;
         $last_menus[] = $menus_total_info[$last_used_menus_key];
     }
     return $last_menus;
 }