</style> <div class="container-fluid"> <div class="row" style="text-align: center;"> <div class="col-xs-6 col-sm-4 col-md-4 col-xs-offset-3 col-sm-offset-4 col-md-offset-4"> <span style="float:<?php echo getLBA(); ?> ;"><?php _e('comments_count', '', ':'); ?> </span> <span style="float:<?php echo getLBA_rev(); ?> ;"><?php echo getCommentsCount(); ?> </span><br> </div> </div> </div><br> <div class="container-fluid"> <div class="row" style="text-align: center;"> <div class="col-xs-12 col-sm-12 col-md-10 col-md-offset-1"> <div id="tablediv"> <table width="auto" class="table table-hover" "> <tr> <th style="vertical-align: middle;"><?php _e('', 'ID'); ?>
</div> <hr class="ninty"/> <div class="project-review-type">Ranking: <?php echo $rank = getRankForProject($project['project_id']); ?> </div> </div> <div class="one-third left" style="width: 31%; padding: 10px;"> <div class="project-review-type">Likes: <?php echo getLikesCount($project['project_id']); ?> </div> <hr class="ninty"/> <div class="project-review-type">Comments: <?php echo getCommentsCount($project['project_id']); ?> </div> <hr class="ninty"/> <div class="project-review-type">Routes: 2</div> </div> <div class="one-third left" style="width: 31%; padding: 10px;"> <div class="project-review-type">Raised Value: 0</div> <hr class="ninty" style="width: 82%"/> <div class="project-review-type">Asked Value: <?php echo $project['startup_amount']; ?> </div> <hr class="ninty" style="width: 82%"/> <div class="project-review-type">Investors: <?php echo $project['investor_count'];
<div class = "newsDiv"> <?php echo $data['text']; ?> </div> <div class = "commentsDate"> <?php echo reverseDate($data['date'], "-"); ?> </div> <div> <a href="comments.php?news=<?php echo $data['id']; ?> ">Comments (<?php echo getCommentsCount($data['id']); ?> )</a> </div> <?php } ?> <?php $tournamentId = -1; include "statistics.php"; ?> </div> <?php
$db_con->query($query); $project_title = getProjectTitle($project['project_id']); $url = SITE_URL . '/home.php?pid=' . $project['project_id']; $sent_to = getProjectAuthor($project['project_id']); $text = 'Your Project "' . $project_title . '" has been Published.'; addNotification($sent_to, $text, 168, $url); //automatically published need to define user } $projects = getAllRecentProjects(); foreach ($projects as $project) { $seedrating = calculate_mr($project['project_id']); if ($seedrating == 'N/A') { continue; } $likes = getLikesCount($project_id); $comments = getCommentsCount($project_id); $query = 'SELECT `routed_by` FROM `routed_projects` WHERE `project_id` = ' . $project_id; $users1 = count($db_con->sql2array($query)); $query = 'SELECT DISTINCT(`sent_to`) FROM `suggestions` WHERE `project_id` = ' . $project_id; $routers1 = count($db_con->sql2array($query)); $routers = $users1 + $routers1; if ($likes <= 1 && $comments <= 1 && $routers <= 1) { continue; } $trend_value = calculateTrendForProject($project['project_id']); if ($trend_value <= 0) { continue; } if (!checkProjectInTrend($project['project_id'])) { global $db_con; $db_con->query('INSERT INTO `trend`(project_id) VALUES(' . $project['project_id'] . ')');
function calculateTrendForProject($project_id) { global $db_con; $project = getProjectById($project_id); $likes = getLikesCount($project_id); $ratings = getTotalRatingsForProject($project_id); /*Like + Rating*/ $j = $likes + $ratings - 2; /*comments*/ $comments = getCommentsCount($project_id); $query = 'SELECT DISTINCT(created_by) FROM `comments` WHERE `project_id` = ' . $project_id; $unique_commenter = count($db_con->sql2array($query)); $k = $unique_commenter / $comments; /*Route*/ $query = 'SELECT `routed_by` FROM `routed_projects` WHERE `project_id` = ' . $project_id; $users1 = count($db_con->sql2array($query)); $query = 'SELECT `project_id` FROM `suggestions` WHERE `project_id` = ' . $project_id; $users2 = count($db_con->sql2array($query)); $users = $users1 + $users2; $query = 'SELECT DISTINCT(`sent_to`) FROM `suggestions` WHERE `project_id` = ' . $project_id; $routers1 = count($db_con->sql2array($query)); $routers = $users1 + $routers1; $l = $users / $routers; /*Time period*/ /*Functional period */ $contant = strtotime('2015-03-01'); $m = strtotime($project['created_on']) - $contant; /*Event period*/ $n = time() - strtotime($project['created_on']); /*Raw score*/ $r = $j * $k * $l; if (abs($r) >= 1) { $r = abs($r); } else { $r = 1; } /*Trending score*/ $update_cycle = 11 * 60 * 60; $events = $likes + $ratings; $t = $m / $update_cycle * ($events / $n) * log($r); return $t; }
function calculateTrendForProject($project_id) { global $db_con; $project = getProjectById($project_id); $likes = getLikesCount($project_id); $ratings = getTotalRatingsForProject($project_id); echo "ratins="; //print_r($ratings); /*Like + Rating*/ $j = $likes + $ratings - 2; //why is -2//to cancel the user self event /*comments*/ $comments = getCommentsCount($project_id); //could be zero $query = 'SELECT DISTINCT(created_by) FROM `comments` WHERE `project_id` = ' . $project_id; $unique_commenter = count($db_con->sql2array($query)); $k = $comments / $unique_commenter; //could lead to infinity /*Route*/ $query = 'SELECT `routed_by` FROM `routed_projects` WHERE `project_id` = ' . $project_id; $users1 = count($db_con->sql2array($query)); $query = 'SELECT `project_id` FROM `suggestions` WHERE `project_id` = ' . $project_id; $users2 = count($db_con->sql2array($query)); print_r($users2); $users = $users1 + $users2; print_r($users); echo "22"; $query = 'SELECT DISTINCT(`sent_to`) FROM `suggestions` WHERE `project_id` = ' . $project_id; $routers1 = count($db_con->sql2array($query)); echo "routers1"; print_r($routers1); $routers = $users1 + $routers1; echo "routers"; print_r($routers); $l = $users / $routers; echo "l="; print_r($l); /*Time period*/ /*Functional period */ $contant = strtotime('2015-03-01'); $m = strtotime($project['created_on']) - $contant; echo "constan="; print_r($contant); echo "m="; print_r($m); /*Event period*/ $n = time() - strtotime($project['created_on']); echo "n="; print_r($n); /*Raw score*/ $r = $j * $k * $l; echo "r="; print_r($r); if (abs($r) >= 1) { $r = abs($r); } else { $r = 1; } echo "final r="; print_r($r); /*Trending score*/ $update_cycle = 11 * 60 * 60; $events = $likes + $ratings; echo "events="; print_r($events); $t = $m / $update_cycle * ($events / $n) * log($r); echo "t="; print_r($t); return $t; }