Site Statistics

For everything else related to Pro_News - tips, tricks, your new ways to use and extend it. A place to exchange ideas and explore future possibilities.
  
1 Mar '13 Fri Mar 01, 2013 08:50    
macuserau
Newbie  Newbie
  •  

Post Site Statistics

is there a way to integrate pro-news into the statistic aspect of dragonfly.
Dragonfly current has the stats for the standard news module, can a option be coded to make it the stats from pro-news



macuserau's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)

Unix / Apache 2.2.15 / MySQL 5.0.90 / PHP 5.3.2/ CMS 9.3.3.0

 
 
 
 
  
1 Mar '13 Fri Mar 01, 2013 16:29    
layingback
Site Admin  
  •  

Post Re: Site Statistics

Easy enough.

In modules/Statistics/index.php insert around line 103:

PHP:
	if (is_active('Pro_News')) {
list($count) = $db->sql_ufetchrow('SELECT COUNT(*) FROM '.$prefix.'_pronews_articles WHERE active="1" AND approved = "1"',SQL_NUM);
$cpgtpl->assign_block_vars('misc', array('IMG' => 'pro_news', 'NAME' => _ARTICLESSEC, 'COUNT' => $count));
}

For the image to appear you need to make an image 16x16 and store as themes/{your_theme}/images/stats/pro_news.png (or copy the one from themes/default/images/admin/small/ but it will be slightly undersized at 12x12).

There's no general way to get the number of comments posted that I can think of. *If* you've funnelled all comments into a dedicated Forum *and* locked all other newposts from that forum (by setting Forums Permissions Posts to Admin only or similar) so that the only way to create a new thread is via writing a comment on a Pro_News article, then adding this to the above just before the } might work (not tested though):

PHP:
		list($count) = $db->sql_ufetchrow('SELECT forum_posts FROM '.$prefix.'_bbforums WHERE forum_id="XX"',SQL_NUM);
$cpgtpl->assign_block_vars('misc', array('IMG' => 'pro_news', 'NAME' => _COMMENTSPOSTED, 'COUNT' => $count));

where XX is replaced by the Id of that forum. (If > 1 forum then you'll need to duplicate the code and sum the totals.)

To get number waiting for approval add the following to the above before the closing } (also not tested):

PHP:
	list($count) = $db->sql_ufetchrow('SELECT COUNT(*) FROM '.$prefix.'_pronews_articles WHERE active="1" AND approved = "0"',SQL_NUM);
$cpgtpl->assign_block_vars('misc', array('IMG' => 'pro_news', 'NAME' => _NEWSWAITING, 'COUNT' => $count));

But if it is just from your/admin use, then Pro_News 3.4.7 provides a whole (better) new way to track and approve Pending Articles.

Hope this helps!



layingback's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)

2.6.32 / 1.3 - 2.4 / 5.5 - 5.6 / 5.4 - 5.5 / 9.4

 
 
 
 
Link  QR 
Share this Printer Friendly Page  facebook   google+   linkedin   twitthis  
Show more ...



Forum Permissions - You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum