root/downloadDatabase/files/lib/acp/action/DownloadDBDataSortAction.class.php @ 402

Revision 402, 1.2 kB (checked in by Tatzelwurm, 5 years ago)
RevLine 
[402]1<?php
2require_once(WCF_DIR.'lib/action/AbstractAction.class.php');
3
4/**
5 * Sortiert die Daten neu.
6 *
7 * @author              Robert "Tatzelwurm" Hempel
8 * @copyright   2007/2008 INSIDE das Hörspiel
9 * @license     GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
10 * @package             de.inside.wcf.DownloadDatabase
11 */
12
13class DownloadDBDataSortAction extends AbstractAction {
14        public $positions = array();
15
16        /**
17         * @see Action::readParameters()
18         */
19        public function readParameters() {
20                parent::readParameters();
21
22                if (isset($_POST['positions']) && is_array($_POST['positions'])) $this->positions = $_POST['positions'];
23        }
24
25        /**
26         * @see Action::execute()
27         */
28        public function execute() {
29                parent::execute();
30                reset($this->positions);
31                while (list($key, $val) = each($this->positions)) {
32                        WCF::getDB()->sendQuery("UPDATE wcf".WCF_N."_dldb_data SET `sortOrder` = '".$val."' WHERE `dataID` = '".$key."'");
33                }
34
35                // reset cache
36                WCF::getCache()->clear(WCF_DIR.'cache/', 'cache.dldbData.php');
37                $this->executed();
38               
39                // forward to list page
40                header('Location: index.php?page=DownloadDBDataList&packageID='.PACKAGE_ID.SID_ARG_2ND_NOT_ENCODED);
41                exit;
42        }
43}
44?>
Note: See TracBrowser for help on using the browser.