xref: /plugin/qc/helper.php (revision 1c8457749c0d73df0789872e745e575b222391d8)
18fce80b1SAndreas Gohr<?php
28fce80b1SAndreas Gohr/**
38fce80b1SAndreas Gohr * @license    GPL 2 (http://www.gnu.org/licenses/gpl.html)
48fce80b1SAndreas Gohr */
58fce80b1SAndreas Gohr
68fce80b1SAndreas Gohr// must be run within Dokuwiki
78fce80b1SAndreas Gohrif(!defined('DOKU_INC')) die();
88fce80b1SAndreas Gohr
98fce80b1SAndreas Gohrclass helper_plugin_qc extends DokuWiki_Plugin {
108fce80b1SAndreas Gohr
11*1c845774SAndreas Gohr    /**
12*1c845774SAndreas Gohr     * Output the standard quality header. Needs to be called formt he template
13*1c845774SAndreas Gohr     */
148fce80b1SAndreas Gohr    function tpl() {
158fce80b1SAndreas Gohr        global $ACT, $INFO, $ID;
168fce80b1SAndreas Gohr        if($ACT != 'show' || !$INFO['exists']) return;
1732905264SAndreas Gohr        if(p_get_metadata($ID, 'relation qcplugin_disabled')) return;
18c8193605SDominik Eckelmann        if($this->getConf('adminonly')) {
19c8193605SDominik Eckelmann            if(!isset($_SERVER['REMOTE_USER']) || !auth_isadmin())
20c8193605SDominik Eckelmann                return;
21c8193605SDominik Eckelmann        }
22*1c845774SAndreas Gohr
23f7678e42SJana Deutschländer        echo '<div id="plugin__qc__wrapper">';
24*1c845774SAndreas Gohr        echo '<div class="summary">';
25*1c845774SAndreas Gohr        echo $this->getLang('i_qcscore');
26*1c845774SAndreas Gohr        echo '</div>';
27*1c845774SAndreas Gohr        echo '<div class="output"></div>';
289068e431SAndreas Gohr        echo '</div>';
298fce80b1SAndreas Gohr    }
308fce80b1SAndreas Gohr
31*1c845774SAndreas Gohr    /**
32*1c845774SAndreas Gohr     * Return the raw quality data
33*1c845774SAndreas Gohr     *
34*1c845774SAndreas Gohr     * Always call this asynchronly!
35*1c845774SAndreas Gohr     *
36*1c845774SAndreas Gohr     * @param $theid
37*1c845774SAndreas Gohr     * @return array
38*1c845774SAndreas Gohr     */
398fce80b1SAndreas Gohr    function getQCData($theid) {
408fce80b1SAndreas Gohr        global $ID;
418fce80b1SAndreas Gohr        $oldid = $ID;
428fce80b1SAndreas Gohr        $ID = $theid;
438437661aSAdrian Lang        $data = unserialize(p_cached_output(wikiFN($ID), 'qc', $ID));
448fce80b1SAndreas Gohr        $ID = $oldid;
458fce80b1SAndreas Gohr        return $data;
468fce80b1SAndreas Gohr    }
47193c8bebSJana Deutschländer}
48