Location: PHPKode > projects > Knowledge Box > knowledgebox/display/labels.php
<?php

  /*
   * Free IT Foundation
   * Free Technology Serving Knowledge
   * http://www.free-it-foundation.org
   * 
   * This file is part of Knowledge Box.
   * 
   * Knowledge Box is free software: you can redistribute it and/or modify
   * it under the terms of the GNU General Public License as published by
   * the Free Software Foundation, either version 3 of the License, or
   * (at your option) any later version.
   * 
   * Knowledge Box is distributed in the hope that it will be useful,
   * but WITHOUT ANY WARRANTY; without even the implied warranty of
   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   * GNU General Public License for more details.
   * 
   * You should have received a copy of the GNU General Public License
   * along with Knowledge Box.  If not, see <http://www.gnu.org/licenses/>.
   */


  // base
  $base = new KBModuleBase ();
  $base->load (KB_BASE);

  // instanciate group
  $group = new KBModuleGroup ();

  // load group
  if (!$group->load (KB_GROUP))
  {
    // failed
    $AppUI->setMsg ('invalidID', UI_MSG_ERROR, true);
    $AppUI->redirect ();
  }

  // get labels
  $labels = KBModuleLabel::getLabelsByGroup ($group->getId ());

?>

<h2 style="background-color:#FFFFFF;padding-top:10px;padding-bottom:5px;padding-left:2px;"><?= $AppUI->_('titleLabels') ?></h2>

<p style="background-color:#FFFFFF;margin:0px;padding-left:2px;padding-bottom:10px;">
  <?= $AppUI->_('crumbGroupObject') ?>
  <a href="index.php?m=<?= KB_MODULE ?>&e=groups"><?= $group->getName () ?></a>
</p>

<table width="100%" border="0" cellpadding="2" cellspacing="1" class="tbl">
<tr>
  <th width="65"><?= $AppUI->_('columnLabelKeywords') ?></th>
  <th width="35"><?= $AppUI->_('columnEdit') ?></th>
  <th><?= $AppUI->_('columnLabelName') ?></th>
  <th width="80"><?= $AppUI->_('columnLabelKeywordsCounter') ?></th>
  <th width="70"><?= $AppUI->_('columnLabelDisplayed') ?></th>
</tr>
<?

  // iterate over labels
  foreach ($labels as $label)
  {
    // childs
    $keywords = KBModuleKeyword::getKeywordsByLabel ($label->getId ());
?>
<tr>
  <td align="center">
    <a href="index.php?m=<?= KB_MODULE ?>&pane=<?= KB_PANE_KEYWORDS ?>&label_id=<?= $label->getId () ?>">
    <?= dPshowImage ('./images/next.gif', '16', '16') ?></a>
  </td>
  <td align="center">
    <a href="index.php?m=<?= KB_MODULE ?>&a=label&id=<?= $label->getId () ?>">
    <?= dPshowImage ('./images/icons/posticon.gif', '14', '11') ?></a>
  </td>
  <td>
    <a href="index.php?m=<?= KB_MODULE ?>&pane=<?= KB_PANE_KEYWORDS ?>&label_id=<?= $label->getId () ?>">
    <?= $label->getName () ?></a>
  </td>
  <td align="center">
    <?= count ($keywords); ?>
  </td>
  <td align="center">
    <? if ($label->isVisible ()) { ?>
      <? if (KBModuleKeyword::hasKeywordsInLabel ($label->getId ())) { ?>
        <?= dPshowImage ('./images/log-notice.gif', '14', '14') ?></a>
      <? } else { ?>
        <?= dPshowImage ('./images/obj/warning.gif', '14', '14') ?></a>
      <? } ?>
    <? } else { ?>
      <?= dPshowImage ('./images/log-error.gif', '14', '14') ?></a>
    <? } ?>
  </td>
</tr>
<?

  }
  // end iteration

  // empty list
  if (count ($labels) == 0)
  {

?>
<tr>
  <td></td>
  <td></td>
  <td>
    <?= $AppUI->_('noLabelAvailable'); ?>
    <br />
    <a href="index.php?m=<?= KB_MODULE ?>&a=label"><?= $AppUI->_('noLabelAtLeastOne'); ?></a>
  </td>
  <td></td>
  <td></td>
</tr>
<?

  }
  // end empty list

?>
</table>
Return current item: Knowledge Box