Example #1
0
 /**
  * 依照folder_id得到文件信息
  */
 public function get_files($folder_id)
 {
     $cache = Mycache::instance();
     $cache_key = $this->object_name . '_' . $folder_id;
     $cache_data = $cache->get($cache_key);
     //if(!is_array($cache_data))
     //{
     $folder = Mykc_folder::instance()->get($folder_id);
     $cache_data = $this->lists(array('where' => array('site_id' => $folder['site_id'], 'kc_folder_id' => $folder['id'])));
     if (!empty($cache_data)) {
         foreach ($cache_data as $key_cache_data => $_cache_data) {
             //扩充
             $cache_data[$key_cache_data]['readable'] = TRUE;
             $cache_data[$key_cache_data]['writable'] = isset($_cache_data['writable']) ? $_cache_data['writable'] : true;
             $cache_data[$key_cache_data]['big_icon'] = isset($_cache_data['big_icon']) ? $_cache_data['big_icon'] : true;
             $cache_data[$key_cache_data]['small_icon'] = isset($_cache_data['small_icon']) ? $_cache_data['small_icon'] : true;
             $cache_data[$key_cache_data]['thumb'] = isset($_cache_data['thumb']) ? $_cache_data['thumb'] : true;
             $cache_data[$key_cache_data]['small_thumb'] = isset($_cache_data['small_thumb']) ? $_cache_data['small_thumb'] : false;
         }
         $cache->set($cache_key, $cache_data);
     }
     //}
     return $cache_data;
 }
Example #2
0
 /**
  * 得到文件夹中文件个数及大小
  * 包括其所有的子文件夹
  **/
 protected function get_detail($folder_id)
 {
     $image_count = 0;
     $image_total_size = 0;
     $folder_ids = array();
     $folders = Mykc_folder::instance()->get_tree_by_folder_id($folder_id);
     foreach ($folders as $_folder) {
         $folder_ids[] = $_folder['id'];
     }
     $images = Mykc_image::instance()->lists(array('where' => array('kc_folder_id' => $folder_ids)));
     foreach ($images as $_img) {
         $image_count++;
         $image_total_size += $_img['image_size'];
     }
     $return['count'] = $image_count;
     $return['size'] = $image_total_size;
     return $return;
 }