当前位置: 首页>>代码示例>>PHP>>正文


PHP AResource::getAllResourceTypes方法代码示例

本文整理汇总了PHP中AResource::getAllResourceTypes方法的典型用法代码示例。如果您正苦于以下问题:PHP AResource::getAllResourceTypes方法的具体用法?PHP AResource::getAllResourceTypes怎么用?PHP AResource::getAllResourceTypes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AResource的用法示例。


在下文中一共展示了AResource::getAllResourceTypes方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: get

 public function get()
 {
     //init controller data
     $this->extensions->hk_InitData($this, __FUNCTION__);
     $product_id = $this->request->get['product_id'];
     $resource_type = $this->request->get['resource_type'];
     if (!$product_id) {
         $this->rest->setResponseData(array('Error' => 'Missing product ID as a required parameter'));
         $this->rest->sendResponse(200);
         return;
     }
     $resources = array();
     $resource = new AResource('image');
     if ($resource_type == 'image') {
         $images = array();
         $results = $resource->getResources('products', $product_id, $this->config->get('storefront_language_id'));
         foreach ($results as $result) {
             $thumbnail = $resource->getResourceThumb($result['resource_id'], $this->config->get('config_image_additional_width'), $this->config->get('config_image_additional_height'));
             if ($thumbnail) {
                 $images[] = array('origial' => HTTP_DIR_RESOURCE . 'image/' . $result['resource_path'], 'thumb' => $thumbnail);
             }
         }
         $resources = $images;
     } else {
         if ($resource_type == 'pdf') {
             // TODO Add support to other types to return files or codes
         } else {
             $resource = new AResource('image');
             //Getting all available types. NOTE there is no easy way, yet, to tell what resources are available in what type for given product.
             //This is possible only in admin for now
             $resources = $resource->getAllResourceTypes();
         }
     }
     //init controller data
     $this->extensions->hk_UpdateData($this, __FUNCTION__);
     $this->rest->setResponseData(array('total' => count($resources), 'resources' => $resources));
     $this->rest->sendResponse(200);
 }
开发者ID:harshzalavadiya,项目名称:fatak,代码行数:38,代码来源:resources.php


注:本文中的AResource::getAllResourceTypes方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。