phpMyFAQ PHP Cross Reference Customer Relationship Management

Source: /admin/stat.ratings.php - 123 lines - 4149 bytes - Summary - Text - Print

Description: The page with the ratings of the votings

   1  <?php
   2  /**
   3   * The page with the ratings of the votings
   4   *
   5   * PHP Version 5.3
   6   *
   7   * This Source Code Form is subject to the terms of the Mozilla Public License,
   8   * v. 2.0. If a copy of the MPL was not distributed with this file, You can
   9   * obtain one at http://mozilla.org/MPL/2.0/.
  10   *
  11   * @category  phpMyFAQ
  12   * @package   Administration
  13   * @author    Thorsten Rinne <thorsten@phpmyfaq.de>
  14   * @copyright 2003-2014 phpMyFAQ Team
  15   * @license   http://www.mozilla.org/MPL/2.0/ Mozilla Public License Version 2.0
  16   * @link      http://www.phpmyfaq.de
  17   * @since     2003-02-24
  18   */
  19  
  20  if (!defined('IS_VALID_PHPMYFAQ')) {
  21      $protocol = 'http';
  22      if (isset($_SERVER['HTTPS']) && strtoupper($_SERVER['HTTPS']) === 'ON'){
  23          $protocol = 'https';
  24      }
  25      header('Location: ' . $protocol . '://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['SCRIPT_NAME']));
  26      exit();
  27  }
  28  
  29  if ($permission['viewlog']) {
  30  
  31      $category = new PMF_Category($faqConfig, array(), false);
  32      $category->setUser($currentAdminUser);
  33      $category->setGroups($currentAdminGroups);
  34      $ratings     = new PMF_Rating($faqConfig);
  35      $ratingdata  = $ratings->getAllRatings();
  36      $numratings  = count($ratingdata);
  37      $oldcategory = 0;
  38  ?>
  39          <header>
  40              <h2><i class="icon-tasks"></i> <?php echo $PMF_LANG["ad_rs"] ?></h2>
  41          </header>
  42  
  43          <table class="table table-striped">
  44          <tbody>
  45  <?php
  46      foreach ($ratingdata as $data) {
  47          if ($data['category_id'] != $oldcategory) {
  48  ?>
  49              <tr>
  50                  <th colspan="6" style="text-align: left;">
  51                      <h4><?php echo $category->categoryName[$data['category_id']]['name']; ?></h4>
  52                  </th>
  53              </tr>
  54  <?php
  55          }
  56  
  57          $question = PMF_String::htmlspecialchars(trim($data['question']));
  58          $url      = sprintf(
  59              '../index.php?action=artikel&amp;cat=%d&amp;id=%d&amp;artlang=%s',
  60              $data['category_id'],
  61              $data['id'],
  62              $data['lang']
  63          );
  64  ?>
  65              <tr>
  66                  <td><?php echo $data['id']; ?></td>
  67                  <td><?php echo $data['lang']; ?></td>
  68                  <td>
  69                      <a href="<?php echo $url ?>" title="<?php echo $question; ?>">
  70                          <?php echo PMF_Utils::makeShorterText($question, 14); ?>
  71                      </a>
  72                  </td>
  73                  <td style="width: 60px;"><?php echo $data['usr']; ?></td>
  74                  <td style="width: 60px;">
  75                      <?php
  76                      if (round($data['num'] * 20) > 75) {
  77                          $progressBar = 'success';
  78                      } elseif (round($data['num'] * 20) < 25) {
  79                          $progressBar = 'danger';
  80                      } else {
  81                          $progressBar = 'info';
  82                      }
  83                      ?>
  84                      <div class="progress progress-<?php echo $progressBar ?>" style="width: 50px;">
  85                          <div class="bar" style="width: <?php echo round($data['num'] * 20); ?>%;"></div>
  86                      </div>
  87                  </td>
  88                  <td style="width: 60px;"><?php echo round($data['num'] * 20); ?>%</td>
  89              </tr>
  90  <?php
  91          $oldcategory = $data['category_id'];
  92      }
  93  ?>
  94          </tbody>
  95  <?php if ($numratings > 0) { ?>
  96          <tfoot>
  97              <tr>
  98                  <td colspan="6">
  99                      <small>
 100                      <span style="color: green; font-weight: bold;">
 101                          <?php echo $PMF_LANG["ad_rs_green"] ?>
 102                      </span>
 103                      <?php echo $PMF_LANG["ad_rs_ahtf"] ?>,
 104                      <span style="color: red; font-weight: bold;">
 105                          <?php echo $PMF_LANG["ad_rs_red"] ?>
 106                      </span>
 107                      <?php echo $PMF_LANG["ad_rs_altt"] ?>
 108                      </small>
 109                  </td>
 110              </tr>
 111          </tfoot>
 112  <?php } else { ?>
 113          <tfoot>
 114              <tr>
 115                  <td colspan="6"><?php echo $PMF_LANG["ad_rs_no"] ?></td>
 116              </tr>
 117          </tfoot>
 118  <?php } ?>
 119          </table>
 120  <?php
 121  } else {
 122      echo $PMF_LANG["err_NotAuth"];
 123  }

title

Description

title

Description

title

Description

title

title

Body