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


PHP Files::folder_contents方法代码示例

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


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

示例1: index

 public function index($product)
 {
     // Get the product
     $product = $this->products_m->get_product($product);
     // Check it exists
     if ($product) {
         // General information
         $this->data->product = $product;
         $this->data->category = $this->products_m->get_category($product);
         $this->data->folder = '/' . UPLOAD_PATH . 'products/' . $this->data->product['id'] . '/';
         // Fire event
         Events::trigger('product_viewed', array('id' => $product['id']));
         // Images
         $folder = $this->products_m->get_file_folder_by_slug($product['slug']);
         $images = Files::folder_contents($folder->id);
         $this->data->images = $images['data']['file'];
         // Add key for easy limits, main, etc.
         foreach ($this->data->images as $key => $image) {
             $this->data->images[$key]->position = $key;
         }
         // Breadcrumbs
         $cat_tree = $this->products_m->get_cat_path($this->data->category, true);
         $this->template->set_breadcrumb('Home', '/home');
         foreach ($cat_tree as $key => $cat) {
             if ($key == 0) {
                 $this->data->parent = $cat['id'];
             }
             $this->template->set_breadcrumb($cat['title'], '/category/' . $cat['slug']);
         }
         // Build Page
         $this->template->set_breadcrumb($this->data->product['title'], '/product/' . $this->data->product['slug'])->title($this->data->product['title'])->set($this->data);
         // Fire events
         Events::trigger('page_build', $this->template);
         // Build page
         $this->template->build('product');
     } else {
         set_status_header(404);
         echo Modules::run('pages/_remap', '404');
     }
 }
开发者ID:rosellkarlrossj,项目名称:FireSALE,代码行数:40,代码来源:front_product.php

示例2: folder_contents

 /**
  * Get all files and folders within a folder
  *
  * Grabs the parent id from the POST data.
  */
 public function folder_contents()
 {
     $parent = $this->input->post('parent');
     echo json_encode(Files::folder_contents($parent));
 }
开发者ID:blekedeg,项目名称:lbhpers,代码行数:10,代码来源:admin.php

示例3: delete_product

 /**
  * Deletes a product, the images and Files folder related to it.
  *
  * @param integer $id The Product ID to delete
  * @return boolean TRUE or FALSE on success of failure
  * @access public
  */
 public function delete_product($id)
 {
     $product = $this->get_product($id);
     if ($this->db->delete('firesale_products', array('id' => $id))) {
         // Remove files folder
         if ($product !== FALSE) {
             $folder = $this->get_file_folder_by_slug($product->slug);
             if ($folder != FALSE) {
                 $images = Files::folder_contents($folder->id);
                 $images = $images['data']['file'];
                 foreach ($images as $image) {
                     Files::delete_file($image->id);
                 }
                 Files::delete_folder($folder->id);
             }
         }
         return TRUE;
     } else {
         return FALSE;
     }
 }
开发者ID:rosellkarlrossj,项目名称:FireSALE,代码行数:28,代码来源:products_m.php

示例4: create

 public function create($id = NULL, $row = NULL)
 {
     // Check for post data
     if (substr($this->input->post('btnAction'), 0, 4) == 'save') {
         // Variables
         $input = $this->input->post();
         $skip = array('btnAction');
         $extra = array('return' => '/admin/firesale/products/edit/-id-', 'success_message' => lang('firesale:prod_' . ($id == NULL ? 'add' : 'edit') . '_success'), 'error_message' => lang('firesale:prod_' . ($id == NULL ? 'add' : 'edit') . '_error'));
         // Check button action for return location
         if ($this->input->post('btnAction') == 'save_exit') {
             $extra['return'] = '/admin/firesale/products';
         }
         // Manually update categories
         // Multiple tends not to do it
         if ($id !== NULL) {
             $this->products_m->update_categories($id, $this->stream->id, $input['category']);
             unset($_POST['category']);
         }
         // Added to seperate if since above will be removed for 2.2
         if ($id !== NULL) {
             $data = array_merge(array('id' => $id, 'stream' => 'firesale_products'), $input);
             Events::trigger('product_updated', $data);
         }
     } else {
         $input = FALSE;
         $skip = array();
         $extra = array();
     }
     // Get the stream fields
     $fields = $this->fields->build_form($this->stream, $id == NULL ? 'new' : 'edit', $id == NULL ? $input : $row, FALSE, FALSE, $skip, $extra);
     // Assign variables
     if ($row !== NULL) {
         $this->data = $row;
     }
     $this->data->id = $id;
     $this->data->fields = fields_to_tabs($fields, $this->tabs);
     $this->data->tabs = array_keys($this->data->fields);
     // Get current images
     if ($row != FALSE) {
         $folder = $this->products_m->get_file_folder_by_slug($row->slug);
         $images = Files::folder_contents($folder->id);
         $this->data->images = $images['data']['file'];
     }
     // Add metadata
     $this->template->append_js('module::jquery.filedrop.js')->append_js('module::upload.js')->append_metadata($this->load->view('fragments/wysiwyg', NULL, TRUE));
     // Add page data
     $this->template->title(lang('firesale:title') . ' ' . lang('firesale:prod_title_' . ($id == NULL ? 'create' : 'edit')))->set($this->data)->enable_parser(true);
     // Fire events
     Events::trigger('page_build', $this->template);
     // Build page
     $this->template->build('admin/products/create');
 }
开发者ID:rosellkarlrossj,项目名称:FireSALE,代码行数:52,代码来源:admin_products.php


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