/** * Display a listing of the resource. * * @return Response */ public function index() { $key = Input::get('key'); $assets = \Asset::get(); for ($i = 0; $i < count($assets); $i++) { $assets[$i]->extId = $assets[$i]->_id; unset($assets[$i]->_id); unset($assets[$i]->_token); unset($assets[$i]->thumbnail_url); unset($assets[$i]->large_url); unset($assets[$i]->medium_url); unset($assets[$i]->full_url); unset($assets[$i]->delete_type); unset($assets[$i]->delete_url); unset($assets[$i]->filename); unset($assets[$i]->filesize); unset($assets[$i]->temp_dir); unset($assets[$i]->filetype); unset($assets[$i]->is_image); unset($assets[$i]->is_audio); unset($assets[$i]->is_video); unset($assets[$i]->fileurl); unset($assets[$i]->file_id); unset($assets[$i]->caption); unset($assets[$i]->files); unset($assets[$i]->medium_portrait_url); if (isset($assets[$i]->defaultpictures)) { $dp = $assets[$i]->defaultpictures; unset($dp['delete_type']); unset($dp['delete_url']); unset($dp['temp_dir']); foreach ($dp as $k => $v) { $name = 'picture' . str_replace(' ', '', ucwords(str_replace('_', ' ', $k))); $assets[$i]->{$name} = $v; } unset($assets[$i]->defaultpictures); } else { $assets[$i]->pictureThumbnailUrl = ''; $assets[$i]->pictureLargeUrl = ''; $assets[$i]->pictureMediumUrl = ''; $assets[$i]->pictureFullUrl = ''; $assets[$i]->pictureBrchead = ''; $assets[$i]->pictureBrc1 = ''; $assets[$i]->pictureBrc2 = ''; $assets[$i]->pictureBrc3 = ''; } $assets[$i]->createdDate = date('Y-m-d H:i:s', $assets[$i]->createdDate->sec); $assets[$i]->lastUpdate = date('Y-m-d H:i:s', $assets[$i]->lastUpdate->sec); } $actor = $key; \Event::fire('log.api', array($this->controller_name, 'get', $actor, 'logged out')); return $assets; // }
public function index($offset = 0) { $this->filter_access('Assets', 'roled_select', base_url()); $asset_list = new Asset(); $data['staff'] = new Staff(); switch ($this->input->get('c')) { case "1": $data['col'] = "asset_name"; break; case "2": $data['col'] = "asset_status"; break; case "3": $data['col'] = "staff_id"; break; case "4": $data['col'] = "date"; break; case "5": $data['col'] = "asset_id"; break; default: $data['col'] = "asset_id"; } if ($this->input->get('d') == "1") { $data['dir'] = "DESC"; } else { $data['dir'] = "ASC"; } $total_rows = $asset_list->count(); $data['title'] = "Assets"; $data['btn_add'] = anchor('assets/add', 'Add New', array('class' => 'btn btn-primary')); $data['btn_home'] = anchor(base_url(), 'Home', array('class' => 'btn')); $uri_segment = 3; $offset = $this->uri->segment($uri_segment); $asset_list->order_by($data['col'], $data['dir']); $data['asset_list'] = $asset_list->get($this->limit, $offset)->all; $config['base_url'] = site_url("assets/index"); $config['total_rows'] = $total_rows; $config['per_page'] = $this->limit; $config['uri_segment'] = $uri_segment; $this->pagination->initialize($config); $data['pagination'] = $this->pagination->create_links(); $this->load->view('assets/index', $data); }
public function __get($name) { if ($name == 'object') { if ($this->object == null) { if ($this->key != null) { $this->object = Asset::get($this->db, $this->key); } } return $this->object; } trigger_error('Undefined property: ' . get_class($this) . '::$' . $name, E_USER_NOTICE); }
* Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. The names of the author(s) of this software may not be used to endorse * or promote products derived from this software without specific prior * written permission. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL * AUTHORS OF THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ require dirname(__FILE__) . '/../lib/common.php'; $db = DBCore::connect(DB_IRI); array_shift($argv); foreach ($argv as $a) { $obj = Asset::get($db, $a); print_r($obj); }