function showIndividualNewspaper($code, $title, $homepage) { $t = new Smarty(); if ($title != NULL) { $t->assign('NEWSPAPER_TITLE', $title); } $t->assign('NEWS_CODE', $code); $t->assign('MOST_RECENT_NEWS_ABOUT', "Cele mai recente știri (via <a href=" . "\"http://{$homepage}\">{$homepage}</a>)"); // Show the guys that show up most in the news. $list = getMostPresentInNews(10, NULL, NULL, NULL, NULL, $code); $list = newsAddPreviousWeekToList($list, NULL, $code); $t->assign('numArticles', countAllMostRecentNews(7, $code)); $t->assign('topPeople', $list); $t->assign('SHOW_LATEST_ARTICLE', false); $t->assign('news', getMostRecentNewsArticles(NULL, NULL, 12, $code)); $t->display('revista_presei_one_newspaper.tpl'); }
/** * Given a list of people produced by getMostPresentInNews, also add the * information about where they were last week. * @param $list * @return Array The list with the modified stuff. */ function newsAddPreviousWeekToList($list, $what = NULL, $source = 'mediafax') { // first, extract the list of id's. $ids = array(); for ($i = 0; $i < sizeof($list); $i++) { $ids[] = $list[$i]['idperson']; } // find out what was last Sunday. $tend = time() - 60 * 60 * 24 * 7 + 60 * 60 * 8; // Adjusting for the timezone $tstart = $tend - 60 * 60 * 24 * 7; $newlist = getMostPresentInNews(100, $what, $tstart, $tend, $ids, $source); $hash = array(); for ($i = 0; $i < sizeof($newlist); $i++) { $hash['k' . $newlist[$i]['idperson']] = $newlist[$i]['mentions']; } for ($i = 0; $i < sizeof($list); $i++) { $list[$i]['mentions_prev'] = $hash['k' . $list[$i]['idperson']] ? $hash['k' . $list[$i]['idperson']] : 0; $list[$i]['mentions_dif'] = $list[$i]['mentions'] - $list[$i]['mentions_prev']; } return $list; }
<?php include_once 'pages/functions_common.php'; include_once 'pages/pres_2009/functions.php'; include_once 'hp-includes/news.php'; $t = new Smarty(); // Show the guys that show up most in the news. $t->assign('candidati', getPresidentialCandidates('pres', '2009', 100)); // Show the guys that show up most in the news. $list = getMostPresentInNews(10, 'pres/2009'); $list = newsAddPreviousWeekToList($list, 'pres/2009'); $t->assign('newsPeople', $list); $t->assign('news', getMostRecentNewsArticles('pres', '2009', 10)); $t->assign('MOST_RECENT_NEWS_ABOUT', 'Cele mai recente stiri cu candidați'); $t->assign('video_columns', 7); $t->assign('videos', getMostRecentVideos(14)); $t->display('pres_2009_summary.tpl');
<?php include_once 'pages/functions_common.php'; include_once 'pages/cdep_2008/functions.php'; include_once 'pages/senat_2008/functions.php'; include_once 'hp-includes/declarations.php'; include_once 'hp-includes/news.php'; $t = new Smarty(); // Show the guys that show up most in the news. $list = getMostPresentInNews(10, NULL, NULL, NULL, NULL, NULL); $list = newsAddPreviousWeekToList($list, NULL, '%'); $t->assign('topPeople', $list); $t->assign('news', getMostRecentNewsArticles(NULL, NULL, 7, '%')); $t->assign('blogposts', getMostRecentBlogPosts(7)); // Get the top three senators. $t->assign('top_senators', getSenatSorted(3, 'DESC', 3)); $t->assign('bottom_senators', array_reverse(getSenatSorted(3, 'ASC', 3))); // Get the top three senators. $t->assign('top_cdep', getCdepSorted(3, 'DESC', 3)); $t->assign('bottom_cdep', array_reverse(getCdepSorted(3, 'ASC', 3))); $parties = array(array("id" => "1", "logo" => "images/parties/1.gif"), array("id" => "2", "logo" => "images/parties/2.png"), array("id" => "7", "logo" => "images/parties/7.jpg"), array("id" => "14", "logo" => "images/parties/14.jpg")); $t->assign('parties', $parties); $diff = abs(strtotime("2012-12-09") - time()); $years = floor($diff / (365 * 60 * 60 * 24)); $months = floor(($diff - $years * 365 * 60 * 60 * 24) / (30 * 60 * 60 * 24)); $days = floor(($diff - $years * 365 * 60 * 60 * 24 - $months * 30 * 60 * 60 * 24) / (60 * 60 * 24)); $t->assign('days_until_election', $days + 1); $t->assign('declarations', getMostRecentDeclarations()); $t->display('home_page_summary.tpl');
<?php include_once 'pages/functions_common.php'; include_once 'pages/cdep_2008/functions.php'; $t = new Smarty(); // Show the top most present and absent people. $t->assign('mostPresent', getCdepSorted(3, "DESC", 10)); $t->assign('leastPresent', getCdepSorted(3, "ASC", 10)); // Show the guys that show up most in the news. $list = getMostPresentInNews(10, 'cdep/2008'); $list = decorateListWithExtraInfo($list, '2008', 'cdep', 'votes_agg', 'percent'); $list = newsAddPreviousWeekToList($list, 'cdep/2008'); $t->assign('newsPeople', $list); $t->assign('news', getMostRecentNewsArticles('cdep', '2008', 6)); $t->assign('MOST_RECENT_NEWS_ABOUT', 'Cele mai recente stiri cu deputați'); // Show the latest global votes in the parliament. $t->assign('mostRecentVotes', getCdepVotes("DESC", 6, 0)); // Make sure the hook for the 'more bla bla link' is okay. // TODO(vivi): Maybe generalize this so the boxes above benefit. $t->assign('cid', $cid); $t->assign('sidVotes', getSidFor('all_votes.php')); $t->display('cdep_2008_summary.tpl');
<?php include_once 'pages/functions_common.php'; include_once 'pages/senat_2008/functions.php'; $t = new Smarty(); // Here do some magical stuff to actually show statistics. :-) // We don't know how to do that yet. :-S // For starters, let's select the top present people and top absent people, // in some SQL queries. $t->assign('mostPresent', getSenatSorted(3, "DESC", 10)); $t->assign('leastPresent', getSenatSorted(3, "ASC", 10)); $list = getMostPresentInNews(10, 'senat/2008'); $list = decorateListWithExtraInfo($list, '2008', 'senat', 'votes_agg', 'percent'); $list = newsAddPreviousWeekToList($list, 'senat/2008'); $t->assign('newsPeople', $list); // votes_agg, percent $t->assign('news', getMostRecentNewsArticles('senat', '2008', 6)); $t->assign('MOST_RECENT_NEWS_ABOUT', 'Cele mai recente știri cu senatori'); $t->assign('mostRecentVotes', getSenatVotes("DESC", 6, 0)); $t->assign('cid', $cid); $t->assign('sidVotes', getSidFor('all_votes.php')); $t->display('senat_2008_summary.tpl');
<?php include_once 'pages/functions_common.php'; $t = new Smarty(); // Show the guys that show up most in the news. $list = getMostPresentInNews(200); $list = newsAddPreviousWeekToList($list); $list = newsAddMostRecentArticle($list); $t->assign('numArticles', countAllMostRecentNews(7)); $t->assign('topPeople', $list); $t->assign('SHOW_LATEST_ARTICLE', true); $t->display('revista_presei_all_people.tpl');