2017-05-27 19:46:46 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
class pluginCategories extends Plugin {
|
|
|
|
|
|
|
|
public function init()
|
|
|
|
{
|
|
|
|
// Fields and default values for the database of this plugin
|
|
|
|
$this->dbFields = array(
|
|
|
|
'label'=>'Categories'
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Method called on the settings of the plugin on the admin area
|
|
|
|
public function form()
|
|
|
|
{
|
|
|
|
global $Language;
|
|
|
|
|
|
|
|
$html = '<div>';
|
|
|
|
$html .= '<label>'.$Language->get('Label').'</label>';
|
|
|
|
$html .= '<input id="jslabel" name="label" type="text" value="'.$this->getValue('label').'">';
|
|
|
|
$html .= '</div>';
|
|
|
|
|
|
|
|
return $html;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Method called on the sidebar of the website
|
|
|
|
public function siteSidebar()
|
|
|
|
{
|
|
|
|
global $Language;
|
|
|
|
global $dbCategories;
|
|
|
|
global $Url;
|
|
|
|
|
|
|
|
// URL base filter for categories
|
|
|
|
$filter = $Url->filters('category');
|
|
|
|
|
|
|
|
// HTML for sidebar
|
|
|
|
$html = '<div class="plugin plugin-categories">';
|
|
|
|
$html .= '<h2 class="plugin-label">'.$this->getValue('label').'</h2>';
|
|
|
|
$html .= '<div class="plugin-content">';
|
|
|
|
$html .= '<ul>';
|
|
|
|
|
|
|
|
// By default the database of categories are alphanumeric sorted
|
|
|
|
foreach( $dbCategories->db as $key=>$fields ) {
|
|
|
|
$html .= '<li>';
|
2017-05-30 21:54:09 +02:00
|
|
|
$html .= '<a href="'.DOMAIN_CATEGORY.$key.'">';
|
2017-05-27 19:46:46 +02:00
|
|
|
$html .= $fields['name'];
|
|
|
|
$html .= ' ('.count($fields['list']).')';
|
|
|
|
$html .= '</a>';
|
|
|
|
$html .= '</li>';
|
|
|
|
}
|
|
|
|
|
|
|
|
$html .= '</ul>';
|
|
|
|
$html .= '</div>';
|
|
|
|
$html .= '</div>';
|
|
|
|
|
|
|
|
return $html;
|
|
|
|
}
|
|
|
|
}
|