Skip to content

Commit

Permalink
Archive Management added
Browse files Browse the repository at this point in the history
Archive searching, deleting, restoring
Moodle 3.6 fixes
  • Loading branch information
Syxton committed Dec 14, 2018
1 parent 4f19970 commit 19c5456
Show file tree
Hide file tree
Showing 21 changed files with 1,122 additions and 97 deletions.
72 changes: 57 additions & 15 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,62 @@
language: php

sudo: false
sudo: true

addons:
chrome: stable
postgresql: '9.4'
apt:
packages:
- oracle-java8-installer
- oracle-java8-set-default
- chromium-chromedriver

cache:
directories:
- $HOME/.composer/cache

php:
- 7.2
- 7.0
- $HOME/.npm

matrix:
allow_failures:
include:
- php: 7.0
env:
- MOODLE_BRANCH=MOODLE_36_STABLE
- DB=mysqli

- php: 7.0
env:
- MOODLE_BRANCH=master
- DB=mysqli

- php: 7.0
env:
- MOODLE_BRANCH=MOODLE_36_STABLE
- DB=pgsql

- php: 7.0
env:
- MOODLE_BRANCH=master
- DB=pgsql

env:
global:
- MOODLE_BRANCH=MOODLE_35_STABLE
- MOODLE_BRANCH=MOODLE_36_STABLE
- MOODLE_BRANCH=master
matrix:
- DB=pgsql
- DB=mysqli
- php: 7.2
env:
- MOODLE_BRANCH=MOODLE_36_STABLE
- DB=mysqli

- php: 7.2
env:
- MOODLE_BRANCH=master
- DB=mysqli

- php: 7.2
env:
- MOODLE_BRANCH=MOODLE_36_STABLE
- DB=pgsql

- php: 7.2
env:
- MOODLE_BRANCH=master
- DB=pgsql

before_install:
- phpenv config-rm xdebug.ini
Expand All @@ -33,6 +69,12 @@ before_install:
install:
- moodle-plugin-ci install

before_script:
# include ChromeDriver in PATH
- ln --symbolic /usr/lib/chromium-browser/chromedriver "${HOME}/bin/chromedriver"
# start Chrome and listen on localhost
- google-chrome-stable --headless --disable-gpu --remote-debugging-port=9222 http://localhost &

script:
- moodle-plugin-ci phplint
- moodle-plugin-ci phpcpd
Expand All @@ -43,4 +85,4 @@ script:
- moodle-plugin-ci mustache
- moodle-plugin-ci grunt
- moodle-plugin-ci phpunit
- moodle-plugin-ci behat
- moodle-plugin-ci behat --profile chrome --dump
69 changes: 69 additions & 0 deletions archivelist.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
<?php
// This file is part of
//
// Moodle 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.
//
// Moodle 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 Moodle. If not, see <http://www.gnu.org/licenses/>.

/**
* Archive manager.
*
* @package tool_coursearchiver
* @copyright 2015 Matthew Davidson
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

define('NO_OUTPUT_BUFFERING', true);

require(__DIR__ . '/../../../config.php');
require_once($CFG->libdir . '/adminlib.php');

header('X-Accel-Buffering: no');

require_login();

$searchterm = optional_param('searchterm', "", PARAM_TEXT);
$recover = optional_param('recover', false, PARAM_BOOL);
$emaillist = optional_param('emaillist', false, PARAM_BOOL);
$selected = optional_param_array('selected', array(), PARAM_TEXT);

global $SESSION, $OUTPUT;

$context = context_system::instance();
$PAGE->set_url(new \moodle_url('/admin/tool/coursearchiver/archivelist.php'));
$PAGE->navbar->add(get_string('archivelist', 'tool_coursearchiver'));
$PAGE->set_context($context);
$PAGE->set_pagelayout('admin');
$PAGE->set_title(get_string('coursearchiver', 'tool_coursearchiver'));

if (!empty($emaillist)) {
tool_coursearchiver_processor::deleted_archive_emails();
}

tool_coursearchiver_processor::select_deselect_javascript();

echo $OUTPUT->header();
echo $OUTPUT->heading_with_help(get_string('coursearchiver', 'tool_coursearchiver'), 'coursearchiver', 'tool_coursearchiver');

if (!empty($selected)) {
if (!$recover) {
tool_coursearchiver_processor::delete_archives($selected);
} else {
tool_coursearchiver_processor::recover_archives($selected);
}
}

$list = tool_coursearchiver_processor::get_archivelist(trim($searchterm), $recover);

echo $list;

echo $OUTPUT->footer();
Loading

0 comments on commit 19c5456

Please sign in to comment.