/** * Return the views output * * @return string The output of the view */ public function display() { //Set the filename $filename = KFactory::get('koowa:filter.filename')->sanitize($this->_properties['FN']); $this->filename = $filename.'.vcf'; //Render the vcard $data = 'BEGIN:VCARD'; $data .= "\r\n"; $data .= 'VERSION:2.1'; $data .= "\r\n"; foreach( $this->_properties as $key => $value ) { $data .= "$key:$value"; $data .= "\r\n"; } $data .= 'REV:'. date( 'Y-m-d' ) .'T'. date( 'H:i:s' ). 'Z'; $data .= "\r\n"; $data .= 'END:VCARD'; $data .= "\r\n"; $this->output = $data; parent::display(); }
/** * Return the views output * * @return string The output of the view */ public function display() { $rows = ''; $columns = array(); $rowset = $this->getModel()->getList(); // Get the columns foreach ($rowset as $row) { $data = $row->toArray(); $columns = array_merge($columns + array_flip(array_keys($data))); } // Empty the column values foreach ($columns as $key => $value) { $columns[$key] = ''; } //Create the rows foreach ($rowset as $row) { $data = $row->toArray(); $data = array_merge($columns, $data); $rows .= $this->_arrayToString(array_values($data)) . $this->eol; } // Create the header $header = $this->_arrayToString(array_keys($columns)) . $this->eol; // Set the output $this->output = $header . $rows; return parent::display(); }
public function display() { $path = base64_decode(KRequest::get('get.path', 'base64')); $container = $this->getService('com://admin/files.model.containers')->slug('downloads-downloads')->getItem(); $this->path = $container->path . DS . $path; $this->filename = basename($path); return parent::display(); }
public function display() { $item = $this->getModel()->getItem(); $state = $this->getModel()->getState(); $container = $this->getService('com://admin/files.model.containers')->slug($item->container)->getItem(); $this->path = $container->path . '/' . $item->path; $this->filename = $item->name; if (!file_exists($this->path)) { throw new KViewException('File not found'); } return parent::display(); }
/** * Return the views output * * @return string The output of the view */ public function display() { //Get the rowset $rowset = $this->getModel()->getList(); // Header $this->output .= $this->_arrayToString($rowset->getColumns()) . $this->eol; // Data foreach ($rowset as $row) { $this->output .= $this->_arrayToString($row->toArray()) . $this->eol; } return parent::display(); }
public function display() { $state = $this->getModel()->getState(); $controller = $this->getService('com://admin/files.controller.file', array('request' => $state->getData())); $file = $controller->read(); $this->path = $file->fullpath; $this->filename = $file->name; $this->mimetype = $file->mimetype ? $file->mimetype : 'application/octet-stream'; if ($file->isImage() || $file->extension === 'pdf') { $this->disposition = 'inline'; } if (!file_exists($this->path)) { throw new KViewException(JText::_('File not found')); } return parent::display(); }
public function display() { require_once JPATH_ROOT . '/components/com_media/helpers/media.php'; $params = KFactory::get('admin::com.ninjaboard.model.settings')->getParams(); $params = $params['attachment_settings']; $attachment = $this->getModel()->getItem(); if (!$attachment->id) { return $this->notFound(); } $post = KFactory::tmp('admin::com.ninjaboard.model.posts')->id($attachment->post)->getItem(); if (!$post->id) { return $this->notFound(); } $topic = KFactory::tmp('admin::com.ninjaboard.model.topics')->id($post->ninjaboard_topic_id)->getItem(); if (!$topic->id) { return $this->notFound(); } $forum = KFactory::tmp('admin::com.ninjaboard.model.forums')->id($topic->forum_id)->getItem(); if (!$forum->id) { return $this->notFound(); } if ($forum->attachment_permissions < 1) { return $this->forbidden(); } $path = JPATH_ROOT . '/media/com_ninjaboard/attachments/' . $attachment->file; if (JFile::getExt($attachment->file) == 'pdf') { $this->mimetype = 'application/pdf'; } if ($attachment->isImage()) { $this->disposition = $params['disposition']; $this->mimetype = 'image/' . $attachment->type; } else { $this->mimetype = 'text/' . $attachment->type; } $this->output = JFile::read($path); $this->filename = $attachment->name; return parent::display(); }
/** * Nooku sets the header disposition headers, we set the caching headers * * @return KViewFile */ protected function _setDisposition() { header('Cache-Control: private, max-age=10800, pre-check=10800'); header("Pragma: private"); header("Expires: " . date("D, d M Y H:i:s", strtotime('+' . $this->expires . ' second')) . ' GMT'); return parent::_setDisposition(); }