本文整理汇总了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);
}