[jobberbase] r426 committed - enh: show spam report statistic

0 views
Skip to first unread message

codesite...@google.com

unread,
Feb 7, 2010, 7:32:51 AM2/7/10
to jobbe...@googlegroups.com
Revision: 426
Author: putyp...@gmail.com
Date: Sun Feb 7 04:31:57 2010
Log: enh: show spam report statistic
http://code.google.com/p/jobberbase/source/detail?r=426

Modified:
/trunk/public/_includes/class.Job.php
/trunk/public/admin/_templates/css/screen.css
/trunk/public/admin/_templates/posts-loop.tpl
/trunk/public/admin/page_category.php

=======================================
--- /trunk/public/_includes/class.Job.php Sat Feb 6 11:54:22 2010
+++ /trunk/public/_includes/class.Job.php Sun Feb 7 04:31:57 2010
@@ -1272,11 +1272,6 @@
}
}

- /**
- * Returns an associative array containing the
- * @param $jobIDs an array of job IDs
- * @return
- */
public function GetApplicationsStatistics($jobIDs)
{
global $db;
@@ -1293,6 +1288,23 @@

return $statisticalData;
}
+
+ public function GetSpamReportStatistics($jobIDs)
+ {
+ global $db;
+
+ $statisticalData = array();
+
+ $sql = 'SELECT job_id, count(id) numberOfSpamReports,
DATE_FORMAT(max(the_time), "' . DATE_TIME_FORMAT . '") lastSpamReportOn
+ FROM '.DB_PREFIX.'spam_reports
+ WHERE job_id in (' . $this->buildCommaSeparatedIDsString($jobIDs) . ')
GROUP BY job_id';
+ $result = $db->query($sql);
+
+ while ($row = $result->fetch_assoc())
+ $statisticalData[$row['job_id']] = $row;
+
+ return $statisticalData;
+ }

private function buildCommaSeparatedIDsString($numbersArray)
{
=======================================
--- /trunk/public/admin/_templates/css/screen.css Fri Feb 5 15:15:39 2010
+++ /trunk/public/admin/_templates/css/screen.css Sun Feb 7 04:31:57 2010
@@ -420,6 +420,7 @@
.icons a {
margin-right: 0.3em;}
.time {color: #333; font-size: 0.9em; padding-right: 0.5em;}
+.spam {color: #f00;}

h2#inactive, h2#jobs, h2#categories, h2#pages, h2#edit_job, h2#stats,
h2#cities, h2#job_types, h2#links, h2#settings, h2#password {
background-image: url(../img/inactive.png);
=======================================
--- /trunk/public/admin/_templates/posts-loop.tpl Sat Feb 6 11:47:22 2010
+++ /trunk/public/admin/_templates/posts-loop.tpl Sun Feb 7 04:31:57 2010
@@ -22,7 +22,7 @@

<img
src="{$BASE_URL}_templates/{$THEME}/img/icon-{$job.type_var_name}.png"
alt="{$job.type_name}" />
<a href="{$BASE_URL_ADMIN}{$URL_JOB}/{$job.id}/{$job.url_title}/"
title="{$job.title}">{$job.title}</a> <span class="light">at</span>
{$job.company}{if $job.is_location_anywhere},
{$translations.jobs.location_anywhere}{else} <span class="light">in</span>
{$job.location}{/if}
- <div>viewed {$job.views_count} times{if $statisticalData[$job.id]},
{$statisticalData[$job.id].numberOfApplications} applicants, last
application on {$statisticalData[$job.id].lastApplicationOn}{/if}</div>
+ <div>viewed {$job.views_count} times{if $statisticalData[$job.id]},
{$statisticalData[$job.id].numberOfApplications} applicants, last
application on {$statisticalData[$job.id].lastApplicationOn}{/if}{if
$spamReportStatisticalData[$job.id]},<span class="spam"> reported as spam
{$spamReportStatisticalData[$job.id].numberOfSpamReports} times, last time
on {$spamReportStatisticalData[$job.id].lastSpamReportOn}</span>{/if}</div>
</div>
{/foreach}
</div>
=======================================
--- /trunk/public/admin/page_category.php Mon Dec 14 09:16:06 2009
+++ /trunk/public/admin/page_category.php Sun Feb 7 04:31:57 2010
@@ -35,6 +35,7 @@
$the_jobs = $job->GetPaginatedJobsForCategory($category_id, $firstLimit,
JOBS_PER_PAGE, $type_id);

$statisticalData = array();
+ $spamReportStatisticalData = array();

if (count($the_jobs))
{
@@ -44,11 +45,13 @@
$jobIDs[] = $aJob['id'];

$statisticalData = $job->GetApplicationsStatistics($jobIDs);
+ $spamReportStatisticalData = $job->GetSpamReportStatistics($jobIDs);
}

$smarty->assign("pages", $paginator->pages_link);

$smarty->assign('statisticalData', $statisticalData);
+ $smarty->assign('spamReportStatisticalData', $spamReportStatisticalData);
$smarty->assign('jobs', $the_jobs);
$smarty->assign('jobs_count', $jobsCount);
$smarty->assign('types', get_types());

Reply all
Reply to author
Forward
0 new messages