Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[K6.4] Update cpanel and change install sample data (changes from Pinkeltje) #9770 #9827

Merged
merged 10 commits into from
Feb 16, 2025
180 changes: 105 additions & 75 deletions src/admin/tmpl/cpanel/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,89 +31,119 @@
<div id="kunena" class="container-fluid">
<div class="row">
<div id="j-main-container" class="col-md-12" role="main">
<?php if (!KunenaForum::versionSampleData()) :
?>
<div class="row clearfix">
<div class="col-xl-3 col-md-3">
<div class="card proj-t-card bg-warning">
<div class="card-body">
<div class="row align-items-center mb-30">
<div class="col-auto">
<i class="fas fa-database text-white f-30"></i>
</div>
<div class="col pl-0">
<h6 class="mb-0 text-white"><?php echo Text::_('COM_KUNENA_CPANEL_LABEL_INSTALL'); ?></h6>
<h6 class="mb-0 text-white"><?php echo Text::_('COM_KUNENA_CPANEL_LABEL_SAMPLE_DATA'); ?></h6>
</div>
</div>
<div>
<ul id="sample-data-wrapper" class="list-group list-group-flush sample-data">
<li class="list-group-item sampledata-kunena">
<div class="d-flex justify-content-between align-items-center">
<div class="sample-data__title me-2">
<span class="sample-data__icon icon-comments me-1" aria-hidden="true"></span>
<?php echo Text::_('COM_KUNENA_CPANEL_LABEL_KUNENA_FORUM_SAMPLE_DATA'); ?>
</div>
<button type="button" class="btn btn-secondary btn-sm apply-sample-data" data-type="kunena" data-steps="1">
<span class="icon-upload" aria-hidden="true"></span> <?php echo Text::_('COM_KUNENA_CPANEL_BUTTON_INSTALL'); ?> <span class="visually-hidden"><?php echo Text::_('COM_KUNENA_CPANEL_LABEL_KUNENA_FORUM_SAMPLE_DATA'); ?></span>
</button>
</div>
<p class="sample-data__desc small mt-1"><?php echo Text::_('COM_KUNENA_CPANEL_LABEL_INSTALL_SAMPLE_DATA') ?></p>
</li>
<li class="list-group-item sampledata-progress-kunena d-none">
<div class="progress mb-3">
<div class="progress-bar progress-bar-striped progress-bar-animated" role="progressbar"></div>
</div>
</li>
</ul>
</div>
<h6 class="pt-badge bg-cyan"><i class="fas fa-exclamation text-white f-18"></i></h6>
</div>
<?php
function setSampleDataFlag($value = 1)
{
$db = Factory::getContainer()->get('DatabaseDriver');
$query = $db->getQuery(true);

$query->update($db->quoteName('#__kunena_version'))
->set($db->quoteName('sampleData') . ' = ' . $db->quote($value));

$db->setQuery($query);

try {
return $db->execute();
} catch (Exception $e) {
return false;
}
}

if (!isset($_POST['sample_data_choice']) && !KunenaForum::versionSampleData()) : ?>
<div class="row clearfix">
<div class="col-xl-3 col-md-3">
<div class="card proj-t-card bg-warning">
<div class="card-body">
<div class="row align-items-center mb-30">
<div class="col-auto">
<i class="fas fa-database text-white f-30"></i>
</div>
<div class="col pl-0">
<h6 class="mb-0 text-white"><?php echo Text::_('COM_KUNENA_CPANEL_LABEL_INSTALL'); ?></h6>
<h6 class="mb-0 text-white"><?php echo Text::_('COM_KUNENA_CPANEL_LABEL_SAMPLE_DATA'); ?></h6>
</div>
</div>
</div>
<?php endif; ?>
<?php if (!Factory::getApplication()->getLanguage()->getTag() != "en-GB" && !$this->getLanguagePack()) : ?>
<div class="row clearfix">
<div class="col-xl-3 col-md-3">
<div class="card proj-t-card bg-warning">
<div class="card-body">
<div class="row align-items-center mb-30">
<div class="col-auto">
<i class="fas fa-language text-white f-30"></i>
</div>
<div class="col pl-0">
<h6 class="mb-0 text-white"><?php echo Text::_('COM_KUNENA_CPANEL_LABEL_LANGUAGE'); ?></h6>
<h6 class="mb-0 text-white"><?php echo Text::_('COM_KUNENA_CPANEL_LABEL_LANGUAGE_PACK_NOT_INSTALLED'); ?></h6>
<div>
<form method="post" id="sampleDataForm">
<ul id="sample-data-wrapper" class="list-group list-group-flush sample-data">
<li class="list-group-item sampledata-kunena">
<div class="d-flex flex-column">
<div class="sample-data__title mb-3">
<?php echo Text::_('COM_KUNENA_CPANEL_SAMPLE_DATA_QUESTION'); ?>
</div>
<div class="btn-group justify-content-center">
<button type="submit" name="sample_data_choice" value="yes" class="btn btn-secondary btn-sm mx-1">
<?php echo Text::_('JYES'); ?>
</button>
<button type="submit" name="sample_data_choice" value="no" class="btn btn-secondary btn-sm mx-1">
<?php echo Text::_('JNO'); ?>
</button>
</div>
</div>
</li>
</ul>
</form>
</div>
<h6 class="pt-badge bg-cyan"><i class="fas fa-exclamation text-white f-18"></i></h6>
</div>
</div>
</div>
</div>
<?php else :
if (isset($_POST['sample_data_choice']) && $_POST['sample_data_choice'] === 'no') {
setSampleDataFlag(1);
echo '<div class="alert alert-success">' . Text::_('COM_KUNENA_CPANEL_SAMPLE_DATA_SKIPPED') . '</div>';
} elseif (isset($_POST['sample_data_choice']) && $_POST['sample_data_choice'] === 'yes') {
if (!KunenaForum::versionSampleData()) : ?>
<div class="row clearfix">
<div class="col-xl-3 col-md-3">
<div class="card proj-t-card bg-warning">
<div class="card-body">
<div class="row align-items-center mb-30">
<div class="col-auto">
<i class="fas fa-database text-white f-30"></i>
</div>
<div>
<ul class="list-group list-group-flush">
<li class="list-group-item kunena">
<div class="d-flex justify-content-between align-items-center">
<div class="title me-2">
<i class="fas fa-language"></i>
<?php echo Text::_('COM_KUNENA_CPANEL_LABEL_KUNENA_LANGUAGE'); ?>
</div>
<a href="https://www.kunena.org/download" target="_blank" class="btn btn-secondary btn-sm">
<?php echo Text::_('COM_KUNENA_CPANEL_LABEL_DONWLOAD_LANGUAGE_PACK'); ?>
</a>
</div>
<p class="sample-data__desc small mt-1"><?php echo Text::_('COM_KUNENA_CPANEL_LABEL_INSTALL_LANGUAGE_PACK'); ?></p>
</li>
<li class="list-group-item sampledata-progress-kunena d-none">
<div class="progress mb-3">
<div class="progress-bar progress-bar-striped progress-bar-animated" role="progressbar"></div>
</div>
</li>
</ul>
<div class="col pl-0">
<h6 class="mb-0 text-white"><?php echo Text::_('COM_KUNENA_CPANEL_LABEL_INSTALL'); ?></h6>
<h6 class="mb-0 text-white"><?php echo Text::_('COM_KUNENA_CPANEL_LABEL_SAMPLE_DATA'); ?></h6>
</div>
<h6 class="pt-badge bg-cyan"><i class="fas fa-exclamation text-white f-18"></i></h6>
</div>
<div>
<ul id="sample-data-wrapper" class="list-group list-group-flush sample-data">
<li class="list-group-item sampledata-kunena">
<div class="d-flex justify-content-between align-items-center">
<div class="sample-data__title me-2">
<span class="sample-data__icon icon-comments me-1" aria-hidden="true"></span>
<?php echo Text::_('COM_KUNENA_CPANEL_LABEL_KUNENA_FORUM_SAMPLE_DATA'); ?>
</div>
<button type="button"
class="btn btn-secondary btn-sm apply-sample-data"
data-type="kunena"
data-steps="1">
<span class="icon-upload" aria-hidden="true"></span>
<?php echo Text::_('COM_KUNENA_CPANEL_BUTTON_INSTALL'); ?>
</button>
</div>
<p class="sample-data__desc small mt-1">
<?php echo Text::_('COM_KUNENA_CPANEL_LABEL_INSTALL_SAMPLE_DATA') ?>
</p>
</li>
<li class="list-group-item sampledata-progress-kunena d-none">
<div class="progress mb-3">
<div class="progress-bar progress-bar-striped progress-bar-animated" role="progressbar"></div>
</div>
</li>
</ul>
</div>
</div>
</div>
</div>
<?php endif; ?>
</div>


<?php endif;
}
endif; ?>
<?php if (!$this->KunenaMenusExists) : ?>
<div class="row clearfix">
<div class="col-xl-3 col-md-3">
Expand Down Expand Up @@ -486,4 +516,4 @@
</div>
<div class="mt-3 text-center small">
<?php echo KunenaVersion::getLongVersionHTML(); ?>
</div>
</div>
Loading