예제 #1
0
//
//    Pastèque is free software: you can redistribute it and/or modify
//    it under the terms of the GNU General Public License as published by
//    the Free Software Foundation, either version 3 of the License, or
//    (at your option) any later version.
//
//    Pastèque is distributed in the hope that it will be useful,
//    but WITHOUT ANY WARRANTY; without even the implied warranty of
//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//    GNU General Public License for more details.
//
//    You should have received a copy of the GNU General Public License
//    along with Pastèque.  If not, see <http://www.gnu.org/licenses/>.
namespace BaseResources;

$resSrv = new \Pasteque\ResourcesService();
if (isset($_GET['delete-res'])) {
    $resSrv->delete($_GET['delete-res']);
}
$resources = $resSrv->getAll();
?>

<h1><?php 
\pi18n("Resources", PLUGIN_NAME);
?>
</h1>

<?php 
\Pasteque\tpl_btn('btn-add', \Pasteque\get_module_url_action(PLUGIN_NAME, "resource_edit"), \i18n('Add a resource', PLUGIN_NAME), 'img/btn_add.png');
?>
예제 #2
0
//    it under the terms of the GNU General Public License as published by
//    the Free Software Foundation, either version 3 of the License, or
//    (at your option) any later version.
//
//    Pastèque is distributed in the hope that it will be useful,
//    but WITHOUT ANY WARRANTY; without even the implied warranty of
//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//    GNU General Public License for more details.
//
//    You should have received a copy of the GNU General Public License
//    along with Pastèque.  If not, see <http://www.gnu.org/licenses/>.
namespace BaseResources;

$message = null;
$error = null;
$resSrv = new \Pasteque\ResourcesService();
if (isset($_POST['id'])) {
    if ($_FILES['file']['tmp_name'] !== "") {
        $content = file_get_contents($_FILES['file']['tmp_name']);
    } else {
        if ($_POST['type'] == \Pasteque\Resource::TYPE_TEXT) {
            $content = $_POST['content'];
        }
    }
    $res = \Pasteque\Resource::__build($_POST['id'], $_POST['label'], $_POST['type'], $content);
    if ($resSrv->update($res)) {
        $message = \i18n("Changes saved");
    } else {
        $error = \i18n("Unable to save changes");
    }
} else {