diff --git a/Helper/QualKardHelper.php b/Helper/QualKardHelper.php index beab78f..bdb7717 100644 --- a/Helper/QualKardHelper.php +++ b/Helper/QualKardHelper.php @@ -193,4 +193,18 @@ class QualKardHelper extends Base )); $this->db->table(TaskModel::TABLE)->eq('id', $task_id)->update(array('date_due' => $due)); } + + /** + * The mastery badge (label + CSS class) for a card, from its stored average. + * + * @param int $task_id + * @return array + */ + public function cardBadge($task_id) + { + $raw = $this->taskMetadataModel->get($task_id, 'qualkard_avg', ''); + $avg = ($raw === '' || $raw === null) ? null : (float) $raw; + + return self::badge($avg); + } } diff --git a/Plugin.php b/Plugin.php index 44b20dc..6d77412 100644 --- a/Plugin.php +++ b/Plugin.php @@ -48,6 +48,13 @@ class Plugin extends Base } } }); + + // Mastery badge under the card title on the board, plus its stylesheet. + $this->template->hook->attach('template:board:private:task:after-title', 'qualKard:board/badge'); + $this->template->hook->attach('template:board:public:task:after-title', 'qualKard:board/badge'); + $this->hook->on('template:layout:css', array( + 'template' => 'plugins/QualKard/Asset/css/qualkard.css', + )); } public function getHelpers() @@ -74,7 +81,7 @@ class Plugin extends Base public function getPluginVersion() { - return '0.4.0'; + return '0.5.0'; } public function getPluginHomepage() diff --git a/Template/project/integration.php b/Template/project/integration.php index fd45f3a..603c6fd 100644 --- a/Template/project/integration.php +++ b/Template/project/integration.php @@ -1,10 +1,10 @@
= t('QualKard needs the RecoReco plugin (its move engine). Install RecoReco to use QualKard.') ?>
-helper->QualKardHelper->isEnabled($project['id'])): ?> +QualKardHelper->isEnabled($project['id'])): ?>= 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.') ?>