-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
/
tracks.raw.php
111 lines (91 loc) · 3.23 KB
/
tracks.raw.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
<?php
/**
* @package Joomla.Administrator
* @subpackage com_banners
*
* @copyright Copyright (C) 2005 - 2015 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Tracks list controller class.
*
* @since 1.6
*/
class BannersControllerTracks extends JControllerLegacy
{
/**
* @var string The context for persistent state.
*
* @since 1.6
*/
protected $context = 'com_banners.tracks';
/**
* Proxy for getModel.
*
* @param string $name The name of the model.
* @param string $prefix The prefix for the model class name.
* @param array $config Configuration array for model. Optional.
*
* @return JModel
*
* @since 1.6
*/
public function getModel($name = 'Tracks', $prefix = 'BannersModel', $config = array())
{
$model = parent::getModel($name, $prefix, array('ignore_request' => true));
return $model;
}
/**
* Display method for the raw track data.
*
* @param boolean $cachable If true, the view output will be cached
* @param array $urlparams An array of safe url parameters and their variable types, for valid values see {@link JFilterInput::clean()}.
*
* @return JController This object to support chaining.
*
* @since 1.5
* @todo This should be done as a view, not here!
*/
public function display($cachable = false, $urlparams = false)
{
// Get the document object.
$document = JFactory::getDocument();
$vName = 'tracks';
$vFormat = 'raw';
// Get and render the view.
if ($view = $this->getView($vName, $vFormat))
{
// Get the model for the view.
$model = $this->getModel($vName);
// Load the filter state.
$app = JFactory::getApplication();
$type = $app->getUserState($this->context . '.filter.type');
$model->setState('filter.type', $type);
$begin = $app->getUserState($this->context . '.filter.begin');
$model->setState('filter.begin', $begin);
$end = $app->getUserState($this->context . '.filter.end');
$model->setState('filter.end', $end);
$categoryId = $app->getUserState($this->context . '.filter.category_id');
$model->setState('filter.category_id', $categoryId);
$clientId = $app->getUserState($this->context . '.filter.client_id');
$model->setState('filter.client_id', $clientId);
$model->setState('list.limit', 0);
$model->setState('list.start', 0);
$input = JFactory::getApplication()->input;
$form = $input->get('jform', array(), 'array');
$model->setState('basename', $form['basename']);
$model->setState('compressed', $form['compressed']);
$config = JFactory::getConfig();
$cookie_domain = $config->get('cookie_domain', '');
$cookie_path = $config->get('cookie_path', '/');
setcookie(JApplicationHelper::getHash($this->context . '.basename'), $form['basename'], time() + 365 * 86400, $cookie_path, $cookie_domain);
setcookie(JApplicationHelper::getHash($this->context . '.compressed'), $form['compressed'], time() + 365 * 86400, $cookie_path, $cookie_domain);
// Push the model into the view (as default).
$view->setModel($model, true);
// Push document object into the view.
$view->document = $document;
$view->display();
}
}
}