2010-01-25 13:40:17 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This file is part of the Froxlor project.
|
|
|
|
* Copyright (c) 2010 the Froxlor Team (see authors).
|
|
|
|
*
|
|
|
|
* For the full copyright and license information, please view the COPYING
|
|
|
|
* file that was distributed with this source code. You can also view the
|
|
|
|
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
|
|
|
|
*
|
|
|
|
* @copyright (c) the authors
|
|
|
|
* @author Froxlor team <team@froxlor.org> (2010-)
|
|
|
|
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
|
2010-01-25 15:32:36 +00:00
|
|
|
* @package Panel
|
2011-05-04 09:59:20 +00:00
|
|
|
*
|
2010-01-25 13:40:17 +00:00
|
|
|
*/
|
2022-02-20 17:00:44 +00:00
|
|
|
|
|
|
|
const AREA = 'admin';
|
|
|
|
require __DIR__ . '/lib/init.php';
|
2010-01-25 15:32:36 +00:00
|
|
|
|
2019-11-10 17:35:32 +00:00
|
|
|
use Froxlor\Api\Commands\Cronjobs;
|
2022-02-28 08:21:04 +00:00
|
|
|
use Froxlor\UI\Panel\UI;
|
2022-02-20 17:00:44 +00:00
|
|
|
use Froxlor\UI\Request;
|
2018-12-18 12:45:05 +00:00
|
|
|
|
2022-02-20 17:00:44 +00:00
|
|
|
$id = (int) Request::get('id');
|
2010-01-25 15:32:36 +00:00
|
|
|
|
2013-04-27 07:22:23 +00:00
|
|
|
if ($page == 'cronjobs' || $page == 'overview') {
|
|
|
|
if ($action == '') {
|
2018-12-26 14:51:26 +00:00
|
|
|
$log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_NOTICE, 'viewed admin_cronjobs');
|
2010-01-27 09:19:19 +00:00
|
|
|
|
2019-11-10 17:35:32 +00:00
|
|
|
try {
|
2022-02-28 08:21:04 +00:00
|
|
|
$cron_list_data = include_once dirname(__FILE__) . '/lib/tablelisting/admin/tablelisting.cronjobs.php';
|
|
|
|
$collection = (new \Froxlor\UI\Collection(\Froxlor\Api\Commands\Cronjobs::class, $userinfo))
|
|
|
|
->withPagination($cron_list_data['cron_list']['columns']);
|
2019-11-10 17:35:32 +00:00
|
|
|
} catch (Exception $e) {
|
|
|
|
\Froxlor\UI\Response::dynamic_error($e->getMessage());
|
|
|
|
}
|
2010-01-27 09:19:19 +00:00
|
|
|
|
2022-03-18 11:53:34 +00:00
|
|
|
UI::view('user/table-note.html.twig', [
|
2022-02-28 08:21:04 +00:00
|
|
|
'listing' => \Froxlor\UI\Listing::format($collection, $cron_list_data['cron_list']),
|
2022-03-04 15:12:25 +00:00
|
|
|
// alert-box
|
|
|
|
'type' => 'warning',
|
|
|
|
'alert_msg' => $lng['cron']['changewarning']
|
2022-02-28 08:21:04 +00:00
|
|
|
]);
|
2013-04-27 07:22:23 +00:00
|
|
|
} elseif ($action == 'new') {
|
2010-01-27 09:19:19 +00:00
|
|
|
/*
|
2010-03-26 08:42:13 +00:00
|
|
|
* @TODO later
|
2010-01-27 09:19:19 +00:00
|
|
|
*/
|
2013-04-27 07:22:23 +00:00
|
|
|
} elseif ($action == 'edit' && $id != 0) {
|
2018-10-28 07:53:25 +00:00
|
|
|
try {
|
2018-12-22 07:15:31 +00:00
|
|
|
$json_result = Cronjobs::getLocal($userinfo, array(
|
2018-10-28 07:53:25 +00:00
|
|
|
'id' => $id
|
|
|
|
))->get();
|
|
|
|
} catch (Exception $e) {
|
2018-12-21 10:22:03 +00:00
|
|
|
\Froxlor\UI\Response::dynamic_error($e->getMessage());
|
2018-10-28 07:53:25 +00:00
|
|
|
}
|
|
|
|
$result = json_decode($json_result, true)['data'];
|
2013-04-27 07:22:23 +00:00
|
|
|
if ($result['cronfile'] != '') {
|
|
|
|
if (isset($_POST['send']) && $_POST['send'] == 'send') {
|
2018-10-28 07:53:25 +00:00
|
|
|
try {
|
2018-12-22 07:15:31 +00:00
|
|
|
Cronjobs::getLocal($userinfo, $_POST)->update();
|
2018-10-28 07:53:25 +00:00
|
|
|
} catch (Exception $e) {
|
2018-12-21 10:22:03 +00:00
|
|
|
\Froxlor\UI\Response::dynamic_error($e->getMessage());
|
2010-03-26 08:42:13 +00:00
|
|
|
}
|
2018-12-21 10:22:03 +00:00
|
|
|
\Froxlor\UI\Response::redirectTo($filename, array(
|
2022-03-14 21:51:59 +00:00
|
|
|
'page' => $page
|
2018-12-19 15:57:03 +00:00
|
|
|
));
|
2013-04-27 07:22:23 +00:00
|
|
|
} else {
|
2014-01-13 07:55:39 +00:00
|
|
|
|
2018-12-19 15:57:03 +00:00
|
|
|
$cronjobs_edit_data = include_once dirname(__FILE__) . '/lib/formfields/admin/cronjobs/formfield.cronjobs_edit.php';
|
2011-02-08 11:53:24 +00:00
|
|
|
|
2022-03-18 11:53:34 +00:00
|
|
|
UI::view('user/form.html.twig', [
|
2022-03-04 09:21:45 +00:00
|
|
|
'formaction' => $linker->getLink(array('section' => 'cronjobs', 'id' => $id)),
|
|
|
|
'formdata' => $cronjobs_edit_data['cronjobs_edit'],
|
|
|
|
'editid' => $id
|
|
|
|
]);
|
2010-03-26 08:42:13 +00:00
|
|
|
}
|
|
|
|
}
|
2018-12-19 15:57:03 +00:00
|
|
|
} elseif ($action == 'delete' && $id != 0) {
|
2010-01-27 09:19:19 +00:00
|
|
|
/*
|
2010-03-26 08:42:13 +00:00
|
|
|
* @TODO later
|
2010-01-27 09:19:19 +00:00
|
|
|
*/
|
2010-01-25 15:32:36 +00:00
|
|
|
}
|
|
|
|
}
|