public function update_ressources() { $sql = "SELECT income from modifiers WHERE user_id = {$this->id}"; $req = Db::query($sql); $income = $req->fetchColumn(); $this->increase_ressource(round(get_time_diff($this->last_refresh) * $income), true); }
} else { if ($sortby == 'category') { } } } } } } } $printlist = ''; $taburls = array(); foreach ($output as $page) { $t = str_replace("_", " ", $page['title']); $old_id = $page['stable_id']; $url = get_wikipedia_url($language, $t) . "&diffonly={$diff_only}&oldid={$old_id}&diff=cur"; $timediff = get_time_diff($page['timestamp'], 'D'); //size $diff = $page['diff']; if (abs($diff) > $show_color_at) { $bg = '#AAAAAA'; } else { $bg = '#FFFFFF'; } if ($diff > 0) { $diff_display = "<span style='color:green;background:{$bg}'>+{$diff}</span>"; } else { if ($diff < 0) { $diff_display = "<span style='color:red;background:{$bg}'>{$diff}</span>"; } else { $diff_display = "<span style='background:{$bg}'>{$diff}</span>"; }
function make_project_box($project_id, $project_name, $user_id, $lead_id, $lead_name, $purpose, $expiration, $expired, $handle_req_str) { global $project_slice_counts, $user; if (array_key_exists($project_id, $project_slice_counts)) { $slice_count = $project_slice_counts[$project_id]; } else { $slice_count = 0; } $has_slices = $slice_count == 0 ? '' : "-HAS-SLICES-"; $expired_project_class = $expired ? "-EXPIRED-PROJECTS-" : "-ACTIVE-PROJECTS-"; $project_lead_class = $lead_id == $user_id ? "-MY-PROJECTS-" : "-THEIR-PROJECTS-"; if ($expiration) { $exp_diff = get_time_diff($expiration); } else { $exp_diff = 100000000; // a very far away time indicating this will never expire } $box = ''; // Give div specific classes for filtering purposes, data-* attributes for sorting purposes $box .= "<div class='floatleft slicebox {$expired_project_class} {$project_lead_class} {$has_slices}'\n data-projname='{$project_name}' data-projexp='{$exp_diff}' data-slicecount='{$slice_count}'>"; $box .= "<table><tr class='slicetopbar'>"; $box .= "<td class='slicetopbar' style='text-align: left;'>"; $box .= "<a href='project.php?project_id={$project_id}' class='projectname'>{$project_name}</a></td>"; $box .= "<td class='slicetopbar sliceactions' style='text-align: right;'>"; $box .= make_project_actions_dropdown($project_id, $expired); print "</td></tr>"; if ($handle_req_str) { $box .= "<tr><td colspan='2'>"; $box .= "<span class='smallleadname'><b>Lead:</b> {$lead_name} </span>"; $box .= "<span class='requeststring'>{$handle_req_str}</span>"; $box .= "</td></tr>"; } else { $box .= "<tr><td colspan='2'>"; $box .= "<span class='leadname'><b>Lead:</b> {$lead_name} </span>"; $box .= "</td></tr>"; } if ($slice_count == 0) { $box .= "<tr><td colspan='2'>"; $box .= "<i> No slices</i>"; } else { $slice_word = $slice_count > 1 ? "slices" : "slice"; $box .= "<tr><td colspan='2'>Has <a onclick='show_slices_for_project(\"{$project_name}\");'>"; $box .= "<b>{$slice_count}</b> {$slice_word}</a>"; } $box .= "</td></tr>"; if ($expiration) { if (!$expired) { $expiration_string = get_time_diff_string($exp_diff); $expiration_color = get_urgency_color($exp_diff); $expiration_string = "Project expires in <b title='{$expiration}'>{$expiration_string}</b>"; $expiration_icon = get_urgency_icon($exp_diff); $expiration_icon = "<i class='material-icons' style='color: {$expiration_color}'>{$expiration_icon}</i>"; } else { $expiration_string = "<b>Project is expired</b>"; $expiration_icon = "<i class='material-icons' style='color: #EE583A;'>report</i>"; } } else { $expiration_string = "<i>No expiration</i>"; $expiration_icon = ""; } $box .= "<tr style='height: 40px;'><td style='border-bottom:none;'>{$expiration_string}</td>"; $box .= "<td style='vertical-align: middle; border-bottom:none;'>{$expiration_icon}</td></tr>"; $box .= "</table></div>"; return $box; }
print "<div class='card' id='sliceactionbar'>"; print "<div style='display: table-cell; vertical-align: middle; width: 250px;'>"; print "<h3 style='margin: 0px; font-size: 1.1em;'><b>Slice:</b> {$slice_name} </h3>\n"; print "<h6 style='margin: 0px; width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;'><b>Project: </b><a href='{$proj_url}'>{$project_name}</a></h6>\n"; print "</div>"; if ($project_expiration) { $project_exp_hours = get_time_diff($project_expiration); $project_exp_print = get_time_diff_string($project_exp_hours); $project_exp_color = get_urgency_color($project_exp_hours); $project_exp_icon = get_urgency_icon($project_exp_hours); $project_line = "Project expires in <b style='color: {$project_exp_color}' title='{$project_expiration}'>{$project_exp_print}</b>"; $project_line .= "<i class='material-icons' style='font-size: 18px; color: {$project_exp_color}'>{$project_exp_icon}</i>"; } else { $project_line = "Project has no expiration <i class='material-icons' style='font-size: 18px; color: #339933'>check_circle</i>"; } $slice_exp_hours = get_time_diff($slice_expiration); $slice_exp_print = get_time_diff_string($slice_exp_hours); $slice_exp_color = get_urgency_color($slice_exp_hours); $slice_exp_icon = get_urgency_icon($slice_exp_hours); $slice_line = "Slice expires in <b style='color: {$slice_exp_color}' title='{$slice_expiration}'>{$slice_exp_print}</b>"; $slice_line .= "<i class='material-icons' style='font-size: 18px; color: {$slice_exp_color}'>{$slice_exp_icon}</i>"; print "<div style='display: table-cell; vertical-align: middle; width: 275px;'>"; print "<h6 style='margin: 0px;'>{$slice_line}</h6>"; print "<h6 style='margin: 0px;'>{$project_line}</h6>"; print "</div>"; print "<div style='display: table-cell; vertical-align: middle;'>"; print "<a class='button' href='{$add_url}' style='margin-right: 5px;' {$add_slivers_disabled} {$disable_buttons_str}>Add Resources</a>"; print "<a class='button' id='showrenewbox'>Renew</a>"; $hostname = $_SERVER['SERVER_NAME']; print "<ul class='has-sub selector' id='slicetools' style='vertical-align: middle; float: none; margin: 5px !important;'>"; print "<span class='selectorshown'>Tools</span><ul class='submenu' style='width: 100px;'>";
function list_slice($slice, $user) { global $project_objects, $slice_owner_names; global $base_url, $slice_base_url, $listres_base_url, $resource_base_url; global $delete_sliver_base_url; global $gemini_base_url, $labwiki_base_url; global $disabled, $jfed_button_start, $jfed_button_part2; global $sa_url, $user; global $portal_max_slice_renewal_days; $slice_id = $slice[SA_SLICE_TABLE_FIELDNAME::SLICE_ID]; $slice_urn = $slice[SA_ARGUMENT::SLICE_URN]; $slice_expired = false; if (array_key_exists(SA_SLICE_TABLE_FIELDNAME::EXPIRED, $slice)) { $slice_expired = $slice[SA_SLICE_TABLE_FIELDNAME::EXPIRED]; } $disable_buttons_str = ""; if (isset($slice_expired) && convert_boolean($slice_expired)) { $disable_buttons_str = "disabled"; } $slice_name = $slice[SA_ARGUMENT::SLICE_NAME]; $args['slice_id'] = $slice_id; $query = http_build_query($args); $slice_url = $slice_base_url . $query; print "<tr class='slicetablerow'><td><a href='{$slice_url}'>{$slice_name}</a></td>"; $slice_project_id = $slice[SA_ARGUMENT::PROJECT_ID]; // There's an odd edge case in which a project has expired // but some slice of the project has not. In this case, $project_objects may not // contain the project of the slice. If so, list the project using something else. if (!array_key_exists($slice_project_id, $project_objects)) { $slice_project_name = "-Expired Project-"; $project_expiration = ""; } else { $project = $project_objects[$slice_project_id]; $project_expiration = $project[PA_PROJECT_TABLE_FIELDNAME::EXPIRATION]; $slice_project_name = $project[PA_PROJECT_TABLE_FIELDNAME::PROJECT_NAME]; } print "<td><a href='project.php?project_id={$slice_project_id}'>{$slice_project_name}</a></td>"; // Slice owner name $slice_owner_id = $slice[SA_ARGUMENT::OWNER_ID]; $slice_owner_name = $slice_owner_names[$slice_owner_id]; print "<td>{$slice_owner_name}</td>"; // Slice expiration $slice_exp_date = $slice[SA_ARGUMENT::EXPIRATION]; $slice_exp_hours = get_time_diff($slice_exp_date); $slice_exp_str = dateUIFormat($slice_exp_date); $slice_exp_pretty_str = "In <b>" . get_time_diff_string($slice_exp_hours) . "</b>"; $slice_exp_color = get_urgency_color($slice_exp_hours); $slice_exp_icon = get_urgency_icon($slice_exp_hours); print "<td><span title='{$slice_exp_str}'>{$slice_exp_pretty_str} "; print "<i class='material-icons' style='color:{$slice_exp_color}; font-size: 18px;'>{$slice_exp_icon}</i></span></td>"; // Next resource expiration $slivers = lookup_sliver_info_by_slice($sa_url, $user, $slice_urn); $resource_count = count($slivers); if ($resource_count == 0) { $resource_exp_str = ""; $resource_exp_pretty_str = "<i>No resources</i>"; $resource_exp_color = "#5F584E"; $resource_exp_icon = ""; $resource_exp_hours = 1000000; } else { $first_sliver = reset($slivers); $next_exp = new DateTime($first_sliver[SA_SLIVER_INFO_TABLE_FIELDNAME::SLIVER_INFO_EXPIRATION]); foreach ($slivers as $sliver) { $this_date = new DateTime($sliver[SA_SLIVER_INFO_TABLE_FIELDNAME::SLIVER_INFO_EXPIRATION]); if ($next_exp > $this_date) { $next_exp = $this_date; } } $resource_exp_str = dateUIFormat($next_exp); $resource_exp_hours = get_time_diff($resource_exp_str); $resource_exp_pretty_str = "In <b>" . get_time_diff_string($resource_exp_hours) . "</b>"; $resource_exp_color = get_urgency_color($resource_exp_hours); $resource_exp_icon = get_urgency_icon($resource_exp_hours); } print "<td><span title='{$resource_exp_str}'>{$resource_exp_pretty_str} "; print "<i class='material-icons' style='color:{$resource_exp_color}; font-size: 18px;'>{$resource_exp_icon}</i></span></td>"; // Slice actions $add_url = $resource_base_url . $query; $remove_url = $delete_sliver_base_url . $query; $listres_url = $listres_base_url . $query; $gemini_url = $gemini_base_url . $query; $labwiki_url = $labwiki_base_url . $query; print "<td style='text-align: center;'>"; print "<ul class='selectorcontainer slicetableactions' style='margin: 0px;'><li class='has-sub selector' style='float:none;'>"; print "<span class='selectorshown'>Actions</span><ul class='submenu'>"; print "<li><a href='{$slice_url}'>Manage slice</a></li>"; if ($user->isAllowed(SA_ACTION::ADD_SLIVERS, CS_CONTEXT_TYPE::SLICE, $slice_id)) { print "<li><a href='{$add_url}'>Add resources</a></li>"; } $dashboard_max_renewal_days = 7; $renewal_days = min($dashboard_max_renewal_days, $portal_max_slice_renewal_days); if ($project_expiration) { $project_expiration_dt = new DateTime($project_expiration); $now_dt = new DateTime(); $difference = $project_expiration_dt->diff($now_dt); $renewal_days = $difference->days; $renewal_days = min($renewal_days, $portal_max_slice_renewal_days, $dashboard_max_renewal_days); } $slivers = lookup_sliver_info_by_slice($sa_url, $user, $slice_urn); $renewal_hours = 24 * $renewal_days; $disable_renewal = ""; if ($slice_exp_hours > $renewal_hours && $resource_exp_hours > $renewal_hours) { $disable_renewal = "class='disabledaction'"; } if ($resource_count > 0) { print "<li><a {$disable_renewal} onclick='renew_slice(\"{$slice_id}\", {$renewal_days}, {$resource_count}, {$slice_exp_hours}, {$resource_exp_hours});'>Renew resources ({$renewal_days} days)</a></li>"; if ($user->isAllowed(SA_ACTION::GET_SLICE_CREDENTIAL, CS_CONTEXT_TYPE::SLICE, $slice_id)) { print "<li><a onclick='info_set_location(\"{$slice_id}\", \"{$listres_url}\")'>Resource details</a></li>"; } if ($user->isAllowed(SA_ACTION::DELETE_SLIVERS, CS_CONTEXT_TYPE::SLICE, $slice_id)) { print "<li><a onclick='info_set_location(\"{$slice_id}\", \"{$remove_url}\")'>Delete resources</a></li>"; } } print "</ul></li></ul>"; print "</td></tr>\n"; }
function findCompletedTime($id) { //$status 0->Pending 1-> Accepted -> 2 Rejected ->3 Hold->4 $status = get_cell('base', $id, 'ivr_flag'); if ($status != 1 && $status != 2 && $status != 3) { return "Process.."; } else { $udt = get_cell('base', $id, 'upload_date_time'); if ($status == 1) { $ivr_time = get_cell('base', $id, 'ivr_accepted_timestamp'); } else { if ($status == 2) { $ivr_time = get_cell('base', $id, 'ivr_rejected_timestamp'); } else { if ($status == 3) { $ivr_time = get_cell('base', $id, 'ivr_hold_timestamp'); } } } $time_diff = get_time_diff($udt, $ivr_time); return $time_diff; } }
header("HTTP/1.1 404 Not Found"); include 'views/404.phtml'; die; } } else { $template = 'views/maintenance.view.phtml'; } // Mise à jour des données if (User::isLogged()) { $user = new User($_SESSION['user']['id']); $queue = new Queue($user->id); $army = new Army($user->id); // mise à jour des ressources $user->update_ressources(); // mise à jour des construction $queue->update_queue(get_time_diff($user->last_refresh)); // résolution des combats foreach (Combat::get_arrived_troops() as $combat) { $combat = new Combat($combat['id']); $combat->solve_combats(); } // mise à jour de l'armée (après les constructions et combats) $troops = $army->get_troops(); // mise à jour de l'heure $user->update_value('last_refresh', date("Y-m-d H:i:s")); } if (!_MAINTENANCE_) { include $controller; } if (!isset($_POST['ajax'])) { include 'views/layout.phtml';
function get_post_views_time($v_type = 'normal', $o_type = 'content', $format = 'Y-m-d H:i:s', $by_front = false) { global $wpdb, $post, $last_visited_time; $post_id = $post->ID; $pv_rec_options = get_option('post_views_rec_options'); if (!empty($pv_rec_options)) { $real_time_views = $pv_rec_options['real_time_views']; } if (cache_enable() && $by_front != true && $real_time_views == 1) { $cache_views = ""; $cache_views .= "<label id=\"post_views_last_time_" . $post_id . "\">" . __('Never', 'post-views'); $cache_views .= "</label>"; $cache_views .= "\n" . '<script type="text/javascript">' . "\n"; $cache_views .= 'jQuery.ajax({type:"GET",async:false,url:"' . plugins_url('post-views/post-views.php') . '",data:"last_view_time=timespan&cache_post_id=' . $post_id . '",cache:false,success: function(responseText, textStatus, XMLHttpRequest){this;document.getElementById("post_views_last_time_' . $post_id . '").innerText = responseText;}});'; $cache_views .= "\n</script>\n"; return $cache_views; } else { if ($format == 'timespan') { if (empty($last_visited_time[$v_type][$o_type])) { return __('Never', 'post-views'); } else { return get_time_diff(time(), strtotime($last_visited_time[$v_type][$o_type])); } } else { if (empty($last_visited_time[$v_type][$o_type])) { return __('Never', 'post-views'); } else { return post_views_localtime($last_visited_time[$v_type][$o_type], post_views_timezone(), $format); } } } }
</p> <div class="col-footer"> <a href="#" class="read-more">More...</a><!-- end read-more --> </div><!-- end col-footer --> </li><!-- end facebook --> </ul> </li><!-- end social-networks --> <li class="posts"> <ul> <?php if (!empty($people_stories)) { foreach ($people_stories as $stories) { $article = $stories->article_text; $story = word_limiter($article, 10); $cur_date = date('Y-m-d H:i:s'); $time_diff = get_time_diff($stories->created_on, $cur_date); $user_image_path = base_url() . '/public/uploads/user_image/'; $user_image = $stories->profile_pic; if ($user_image != '') { $image = $user_image_path . $user_image; } else { $image = ''; } ?> <li> <img src="<?php echo $image; ?> " alt="geeta" /> <div class="post-text-content"> <a href="#" class="byline"><?php