I want custom group plugin by Social engine
So in application/modules/Group/settings/content.php
I added :
array(
'title' => 'Overall Statistic',
'description' => 'Displays overall statistic of groups on group home page.',
'category' => 'Groups',
'type' => 'widget',
'name' => 'group.overall-statistic',
'defaultParams' => array(
'title' => 'Overall Statistic',
),
),
In widget folder in group plugin I added two files : Controller.php and Index.php
(it looks like this : application/modules/Group/widgets/overall-statistic
)
controller.php :
<?php
class Group_Widget_OverallStatisticController extends Engine_Content_Widget_Abstract
{
public function indexAction()
{
$groupTable = Engine_Api::_()->getItemTable('group');
$select = new Zend_Db_Select($groupTable->getAdapter());
$select -> from($groupTable->info('name'), 'COUNT(*) AS count')
-> where('group_id > 0');
$this->view->count_groups = $select->query()->fetchColumn(0);
$albumTable = Engine_Api::_()->getItemTable('advgroup_album');
$select = new Zend_Db_Select($albumTable->getAdapter());
$select->from($albumTable->info('name'), 'COUNT(*) AS count')
-> where('album_id > 0');;
$this->view->count_albums = $select->query()->fetchColumn(0);
$photoTable = Engine_Api::_()->getItemTable('advgroup_photo');
$select = new Zend_Db_Select($photoTable->getAdapter());
$select->from($photoTable->info('name'), 'COUNT(*) AS count')
-> where('photo_id > 0');;
$this->view->count_photos = $select->query()->fetchColumn(0);
$topicTable = Engine_Api::_()->getItemTable('advgroup_topic');
$select = new Zend_Db_Select($topicTable->getAdapter());
$select->from($topicTable->info('name'), 'COUNT(*) AS count')
->where('topic_id > 0');;
$this->view->count_topics = $select->query()->fetchColumn(0);
}
}
index.php :
<ul class = "global_form_box" style="margin-bottom: 15px; padding : 0px 15px 15px 15px;">
<br/>
<div class="statistic_info"> <?php echo $this->translate('Total Groups');?></div>
<div class="statistic_count"> <?php echo $this->count_groups?> </div>
<br/>
<div class="statistic_info"> <?php echo $this->translate('Total Albums');?></div>
<div class="statistic_count"> <?php echo $this->count_albums?> </div>
<br/>
<div class="statistic_info"> <?php echo $this->translate('Total Photos');?></div>
<div class="statistic_count"> <?php echo $this->count_photos?> </div>
<br/>
<div class="statistic_info"> <?php echo $this->translate('Total Topics'); ?></div>
<div class="statistic_count"> <?php echo $this->count_topics?> </div>
</ul>
In panel admin I added the widget when I want show it but index.php doesn't appear in my website ..
Controller.php work well because when I add (in controller.php)
var_dump($groupTable); die;
I can see it in my website
How is it possible? Is what I forgot to edit a file? Thank you