Beispiel #1
0
 /**
  * Task@trigger
  */
 public function trigger()
 {
     $controller = new AjaxController();
     $controller->pageHeader();
     $task_name = Filter::get('task');
     $token_submitted = Filter::get('force');
     $token = $this->module->getSetting('MAJ_AT_FORCE_EXEC_TOKEN');
     $tasks = $this->provider->getTasksToRun($token == $token_submitted, $task_name);
     foreach ($tasks as $task) {
         $task->execute();
     }
 }
Beispiel #2
0
use Fisharebest\Webtrees\Controller\AjaxController;
use Fisharebest\Webtrees\Functions\FunctionsImport;
use PDOException;
define('WT_SCRIPT_NAME', 'import.php');
require './includes/session.php';
// Don't use ged=XX as we want to be able to run without changing the current gedcom.
// This will let us load several gedcoms together, or to edit one while loading another.
$gedcom_id = Filter::getInteger('gedcom_id');
$tree = Tree::findById($gedcom_id);
if (!$tree || !Auth::isManager($tree, Auth::user())) {
    http_response_code(403);
    return;
}
$controller = new AjaxController();
$controller->pageHeader();
// Don't allow the user to cancel the request.  We do not want to be left
// with an incomplete transaction.
ignore_user_abort(true);
// Run in a transaction
Database::beginTransaction();
// Only allow one process to import each gedcom at a time
Database::prepare("SELECT * FROM `##gedcom_chunk` WHERE gedcom_id=? FOR UPDATE")->execute(array($gedcom_id));
// What is the current import status?
$row = Database::prepare("SELECT" . " SUM(IF(imported, LENGTH(chunk_data), 0)) AS import_offset," . " SUM(LENGTH(chunk_data))                  AS import_total" . " FROM `##gedcom_chunk` WHERE gedcom_id=?")->execute(array($gedcom_id))->fetchOneRow();
if ($row->import_offset == $row->import_total) {
    Tree::findById($gedcom_id)->setPreference('imported', '1');
    // Finished?  Show the maintenance links, similar to admin_trees_manage.php
    Database::commit();
    $controller->addInlineJavascript('jQuery("#import' . $gedcom_id . '").addClass("hidden");' . 'jQuery("#actions' . $gedcom_id . '").removeClass("hidden");');
    return;
Beispiel #3
0
						event.preventDefault();
						return;
					}
					else {
						jQuery("#loading-indicator").addClass("loading-image");
					}
					ui.jqXHR.success(function() {
						ui.tab.data("loaded", true);
					});
				}
			});
		')->pageHeader();
    echo '<div id="statistics-page"><h2>', I18N::translate('Statistics'), '</h2>', '<div id="statistics_chart">', '<ul>', '<li><a href="statistics.php?ged=', $WT_TREE->getNameUrl(), '&amp;ajax=1&amp;tab=0">', '<span id="stats-indi">', I18N::translate('Individuals'), '</span></a></li>', '<li><a href="statistics.php?ged=', $WT_TREE->getNameUrl(), '&amp;ajax=1&amp;tab=1">', '<span id="stats-fam">', I18N::translate('Families'), '</span></a></li>', '<li><a href="statistics.php?ged=', $WT_TREE->getNameUrl(), '&amp;ajax=1&amp;tab=2">', '<span id="stats-other">', I18N::translate('Others'), '</span></a></li>', '<li><a href="statistics.php?ged=', $WT_TREE->getNameUrl(), '&amp;ajax=1&amp;tab=3">', '<span id="stats-own">', I18N::translate('Own charts'), '</span></a></li>', '</ul>', '<div id="loading-indicator" style="margin:auto;width:100%;"></div>', '</div>', '</div>', '<br><br>';
} else {
    $controller = new AjaxController();
    $controller->pageHeader()->addInlineJavascript('autocomplete();')->addInlineJavascript('jQuery("#loading-indicator").removeClass("loading-image");');
    $stats = new Stats($WT_TREE);
    if ($tab == 0) {
        echo '<fieldset>
		<legend>', I18N::translate('Total individuals: %s', $stats->totalIndividuals()), '</legend>
		<table class="facts_table">
			<tr>
				<td class="facts_label">', I18N::translate('Total males'), '</td>
				<td class="facts_label">', I18N::translate('Total females'), '</td>
				<td class="facts_label">', I18N::translate('Total living'), '</td>
				<td class="facts_label">', I18N::translate('Total dead'), '</td>
			</tr>
			<tr>
				<td class="facts_value" align="center">', $stats->totalSexMales(), '</td>
				<td class="facts_value" align="center">', $stats->totalSexFemales(), '</td>
				<td class="facts_value" align="center">', $stats->totalLiving(), '</td>
 /**
  * AdminConfig@generateToken
  *
  * Ajax call to generate a new token. Display the token, if generated.
  * Tokens call only be generated by a site administrator.
  *
  */
 public function generateToken()
 {
     $controller = new AjaxController();
     $controller->restrictAccess(Auth::isAdmin());
     $token = Functions::generateRandomToken();
     $this->module->setSetting('MAJ_AT_FORCE_EXEC_TOKEN', $token);
     Log::addConfigurationLog($this->module->getTitle() . ' : New token generated.');
     $controller->pageHeader();
     echo $token;
 }