1 Commits
v0.5 ... v0.6

4 changed files with 41 additions and 21 deletions

View File

@@ -120,6 +120,18 @@ class QualKardHelper extends Base
return (int) $this->projectMetadataModel->get($project_id, 'qualkard_col_'.$role, 0);
}
/**
* Is FinanceBuddy enabled on this board? QualKard refuses to convert a FinanceBuddy board (its
* restructure would wreck the finance columns).
*
* @param int $project_id
* @return bool
*/
public function fbEnabled($project_id)
{
return (int) $this->projectMetadataModel->get($project_id, 'financebuddy_enabled', 0) === 1;
}
/**
* Write the inert RecoReco config for a card: move-mode to Study, fire from anywhere but Done,
* daily (innocuous -- QualKard sets the due date on each grade), anchor 0 so RecoReco skips it

View File

@@ -81,7 +81,7 @@ class Plugin extends Base
public function getPluginVersion()
{
return '0.5.0';
return '0.6.0';
}
public function getPluginHomepage()

View File

@@ -1,28 +1,36 @@
<?php
// QualKard is inside the shared Integrations form, so the buttons use formaction (NOT nested <form>s)
// to post to QualKard's own controller. Set up is destructive; disabling only stops the automation.
$has = $this->QualKardHelper->hasRecoReco();
$fb = $this->QualKardHelper->fbEnabled($project['id']);
$enabled = $this->QualKardHelper->isEnabled($project['id']);
$blocked = ! $has || $fb;
?>
<h3><i class="fa fa-graduation-cap fa-fw" aria-hidden="true"></i> <?= t('QualKard') ?></h3>
<div class="listing">
<?php if (! $this->QualKardHelper->hasRecoReco()): ?>
<?php if ($enabled): ?>
<p class="form-help"><?= t('QualKard needs the RecoReco plugin (its move engine). Install RecoReco to use QualKard.') ?></p>
<?php elseif (! $this->QualKardHelper->isEnabled($project['id'])): ?>
<p class="form-help"><?= t('Turn this project into a spaced-repetition study board. This restructures the columns to Drafts | Study | Hairy | Hard | Medium | Easy | Done and moves every card to Drafts.') ?></p>
<form method="post" action="<?= $this->url->href('QualKardController', 'setup', array('plugin' => 'QualKard', 'project_id' => $project['id'])) ?>" onsubmit="return confirm('<?= t('This restructures the board and moves all cards to Drafts. Continue?') ?>');">
<?= $this->form->csrf() ?>
<button type="submit" class="btn btn-blue"><?= t('Set up QualKard study board') ?></button>
</form>
<p class="form-help"><?= t('QualKard is enabled on this board.') ?></p>
<div class="form-actions">
<button type="submit" class="btn" formaction="<?= $this->url->href('QualKardController', 'reset', array('plugin' => 'QualKard', 'project_id' => $project['id'])) ?>" onclick="return confirm('<?= t('Reset every card to unread and move them to Drafts. Continue?') ?>');"><?= t('Reset all cards') ?></button>
<button type="submit" class="btn btn-red" formaction="<?= $this->url->href('QualKardController', 'disable', array('plugin' => 'QualKard', 'project_id' => $project['id'])) ?>"><?= t('Disable QualKard machinery') ?></button>
</div>
<p class="form-help"><?= t('"Disable" only stops the QualKard automation -- it does not restructure the board or touch your cards.') ?></p>
<?php else: ?>
<p class="form-help"><?= t('QualKard is enabled on this board.') ?></p>
<form method="post" style="display:inline" action="<?= $this->url->href('QualKardController', 'reset', array('plugin' => 'QualKard', 'project_id' => $project['id'])) ?>" onsubmit="return confirm('<?= t('Reset every card to unread and move them to Drafts. Continue?') ?>');">
<?= $this->form->csrf() ?>
<button type="submit" class="btn"><?= t('Reset all cards') ?></button>
</form>
<form method="post" style="display:inline" action="<?= $this->url->href('QualKardController', 'disable', array('plugin' => 'QualKard', 'project_id' => $project['id'])) ?>">
<?= $this->form->csrf() ?>
<button type="submit" class="btn btn-red"><?= t('Disable QualKard') ?></button>
</form>
<p class="form-help">
<?php if (! $has): ?>
<?= t('QualKard needs the RecoReco plugin (its move engine).') ?>
<?php elseif ($fb): ?>
<?= t('Disabled while FinanceBuddy is enabled here -- QualKard would restructure the columns.') ?>
<?php else: ?>
<?= t('Set up turns this project into a study board: columns become Drafts | Study | Hairy | Hard | Medium | Easy | Done and every card moves to Drafts.') ?>
<?php endif ?>
</p>
<div class="form-actions"<?= $blocked ? ' style="opacity:0.5"' : '' ?>>
<button type="submit" class="btn btn-blue" <?= $blocked ? 'disabled="disabled"' : '' ?> formaction="<?= $this->url->href('QualKardController', 'setup', array('plugin' => 'QualKard', 'project_id' => $project['id'])) ?>" onclick="return confirm('<?= t('This restructures the board and moves all cards to Drafts. Continue?') ?>');"><?= t('Set up QualKard study board') ?></button>
</div>
<?php endif ?>
</div>

View File

@@ -1 +1 @@
QualKard v0.5
QualKard v0.6