-
Notifications
You must be signed in to change notification settings - Fork 101
Expand file tree
/
Copy pathkeys.php
More file actions
73 lines (63 loc) · 1.62 KB
/
keys.php
File metadata and controls
73 lines (63 loc) · 1.62 KB
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
<?php
/**
* @package Com.Api
*
* @copyright Copyright (C) 2005 - 2017 Techjoomla, Techjoomla Pvt. Ltd. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
// No direct access.
defined('_JEXEC') or die();
use Joomla\CMS\MVC\Controller\AdminController;
use Joomla\CMS\MVC\Model\BaseDatabaseModel;
use Joomla\CMS\Factory;
use Joomla\Utilities\ArrayHelper;
/**
* Keys list controller class.
*
* @since 1.0
*/
class ApiControllerKeys extends AdminController
{
/**
* Method to get a model object, loading it if required.
*
* @param string $name The model name. Optional.
* @param string $prefix The class prefix. Optional.
*
* @return \BaseDatabaseModel|boolean Model object on success; otherwise false on failure.
*
* @since 3.0
*/
public function getModel($name = 'key', $prefix = 'ApiModel', $config = array())
{
$model = parent::getModel($name, $prefix, array('ignore_request' => true));
return $model;
}
/**
* Method to save the submitted ordering values for records via AJAX.
*
* @return void
*
* @since 3.0
*/
public function saveOrderAjax()
{
// Get the input
$input = Factory::getApplication()->input;
$pks = $input->post->get('cid', array(), 'array');
$order = $input->post->get('order', array(), 'array');
// Sanitize the input
ArrayHelper::toInteger($pks);
ArrayHelper::toInteger($order);
// Get the model
$model = $this->getModel();
// Save the ordering
$return = $model->saveorder($pks, $order);
if ($return)
{
echo "1";
}
// Close the application
Factory::getApplication()->close();
}
}