function format_time($seconds) { // Get our seconds to hours:minutes:seconds $time = sec2hms($seconds, false); // Explode the time $time = explode(':', $time); // Hour corrections $set = ''; if ($time[0] > 0) { // Set days if viable if ($time[0] > 23) { $days = floor($time[0] / 24); $time[0] = $time[0] - $days * 24; $set .= $days > 1 ? $days . ' Days' : $days . ' Day'; if ($time[0] > 0) { $set .= ','; } } $set .= $time[0] > 1 ? $time[0] . ' Hours' : $time[0] . ' Hour'; } if ($time[1] > 0) { $set .= $time[0] > 0 ? ', ' : ''; $set .= $time[1] > 1 ? $time[1] . ' Minutes' : $time[1] . ' Minute'; } return $set; }
function getTimediff($string) { $a = array(); $a = explode("#", $string); $count = 0; $st1 = array(); $en1 = array(); $flag = 0; $flag1 = 0; $time = array(); foreach ($a as $key => $str) { $s_str = explode(',', $str); if (isset($str) && $str != "") { if (strpos($s_str[7], "[2=1]") && strpos($s_str[7], "[3=1]") && $s_str[3] == '0' && $flag == '0') { $st1 = $s_str[8] . ',' . $s_str[9]; $flag = $key; } if ($flag != "") { if ($s_str[3] != '0' && $flag1 == '0') { $en1 = $s_str[8] . ',' . $s_str[9]; $flag1 = $key; } } if ($flag1 != "" && $flag != "") { $diff = strtotime($en1) - strtotime($st1); if ($diff > '0' && strlen($diff) > 1) { $time[$st1][$en1][] = sec2hms($diff); $flag1 = 0; $flag = 0; } } } } return $time; }
function timeformat($input) { //samples to secs to hms global $tScale; $secs = $input * $tScale; $formatted = formatHms(sec2hms($secs)); return $formatted; }
function getTimediff($string) { $a = array(); $a = explode("#", $string); $count = 0; $st1 = array(); $en1 = array(); $flag = 0; $flag1 = 0; $st_flag = 0; $en_flag = 0; foreach ($a as $key => $str) { //echo strpos($str,"[2=1]"); if (strpos($str, "[3=1]") && $st_flag == '0') { $st = substr($str, strpos($str, "[3=1]"), strlen($str)); $st1[$key] = substr($st, strpos($st, ",") + 1, 19); $flag = $key; $st_flag = 1; } if ($flag != "") { if (strpos($str, "[3=0]") && $en_flag == '0') { $en = substr($str, strpos($str, "[3=0]"), strlen($str)); $en1[$key] = substr($en, strpos($en, ",") + 1, 19); $flag1 = $key; $en_flag = 1; } } if ($flag1 > $flag) { if ($st_flag == 1 && $en_flag == 1) { $diff = strtotime($en1[$flag1]) - strtotime($st1[$flag]); if ($diff > '0') { $time[$st1[$flag]][$en1[$flag1]][] = sec2hms($diff); } $flag1 = 0; $flag = 0; $st_flag = 0; $en_flag = 0; } } } return $time; }
/** > db.SessionLog.find(); { "_id" : ObjectId("4ed4b255c1b4ba6c09000005"), "session_id" : "19aebff52b0cada12ee5f1efbd5583d8", "time_end" : "2011-12-02 08:48:35", "time_start" : "2011-11-29 17:22:13", "user_id" : "4df6e7192cbfd4e6c000fd9b", "username" : "rully" } { "_id" : ObjectId("4ed83050c1b4bac009000000"), "session_id" : "1902b9a2a85bf983f4afa98e14bf4c94", "time_end" : "2011-12-02 08:56:32", "time_start" : "2011-12-02 08:56:32", "user_id" : "4df6e7192cbfd4e6c000fd9b", "username" : "rully" } */ function report_admin_onlinetime($user_id = NULL) { // $time_int = strtotime("2011-12-02 08:48:35"); // // $time_int_reformatted = date("Y-m-d H:i:s", $time_int); // // print("String: " . "2011-12-02 08:48:35" . "<br />"); // print("Timestamp: " . $time_int . "<br />"); // print("Timestamp Reformatted: " . $time_int_reformatted . "<br />"); $lilo_mongo = new LiloMongo(); $lilo_mongo->selectDB('Users'); $lilo_mongo->selectCollection('SessionLog'); $user_id = isset($user_id) ? $user_id : func_arg(0); $criteria = array('user_id' => $user_id); $sess_cursor = $lilo_mongo->find($criteria); $total_time = 0; while ($curr = $sess_cursor->getNext()) { $time_start = strtotime($curr['time_start']); $time_end = strtotime($curr['time_end']); $total_time += $time_end - $time_start; } // return $total_time; return sec2hms($total_time, true); }
/** * Show the library * @return */ function LibraryAssignView() { $db =& $this->db; $user =& $this->user; $response = new ResponseManager(); //Input vars $mediatype = Kit::GetParam('filter_type', _POST, _STRING); $name = Kit::GetParam('filter_name', _POST, _STRING); // Get a list of media $mediaList = $user->MediaList(NULL, array('type' => $mediatype, 'name' => $name)); $rows = array(); // Add some extra information foreach ($mediaList as $row) { $row['duration_text'] = sec2hms($row['duration']); $row['list_id'] = 'MediaID_' . $row['mediaid']; $rows[] = $row; } Theme::Set('table_rows', $rows); // Render the Theme $response->SetGridResponse(Theme::RenderReturn('library_form_assign_list')); $response->callBack = 'LibraryAssignCallback'; $response->pageSize = 5; $response->Respond(); }
?> / <?php echo $result['total_question']; ?> </td></tr> <tr><td bgcolor="#eeeeee" >Obtained Percentage </td><td bgcolor="#eeeeee"><?php echo $result['obtained_percentage']; ?> % </td></tr> <tr><td bgcolor="#ffffff">Time Taken / Time Duration (H:M:S)</td><td bgcolor="#ffffff"> <?php $time_taken = explode(",", $result['time_taken']); echo sec2hms(array_sum($time_taken)); ?> / <?php echo sec2hms($result['test_time'] * 60); ?> </td></tr> <tr><td bgcolor="#eeeeee">Status</td><td bgcolor="#eeeeee"><?php if ($result['status'] == "1") { echo "Pass"; } else { echo "Fail"; } ?> </td></tr> </table> </code>
} else { $rowcontent['vid_type'] = 5; //hotlink from other site } } else { $rowcontent['vid_path'] = ''; } // Auto-Thumb from Youtube - if empty Image if ($rowcontent['vid_type'] == 2 and empty($rowcontent['homeimgfile'])) { $rowcontent['homeimgfile'] = 'http://img.youtube.com/vi/' . get_youtube_id($rowcontent['vid_path']) . '/0.jpg'; $rowcontent['homeimgthumb'] = 3; } // Auto-duration from Youtube - if empty if ($rowcontent['vid_type'] == 2 and empty($rowcontent['vid_duration'])) { $_vid_duration = youtubeVideoDuration($rowcontent['vid_path']); $rowcontent['vid_duration'] = sec2hms($_vid_duration); } if ($rowcontent['id'] == 0) { if (!defined('NV_IS_SPADMIN') and intval($rowcontent['publtime']) < NV_CURRENTTIME) { $rowcontent['publtime'] = NV_CURRENTTIME; } if ($rowcontent['status'] == 1 and $rowcontent['publtime'] > NV_CURRENTTIME) { $rowcontent['status'] = 2; } $sql = 'INSERT INTO ' . NV_PREFIXLANG . '_' . $module_data . '_rows (catid, listcatid, admin_id, admin_name, author, artist, sourceid, addtime, edittime, status, publtime, exptime, archive, title, alias, hometext, vid_path, vid_duration, vid_type, homeimgfile, homeimgalt, homeimgthumb, inhome, allowed_comm, allowed_rating, hitstotal, hitscm, total_rating, click_rating) VALUES (' . intval($rowcontent['catid']) . ', :listcatid, ' . intval($rowcontent['admin_id']) . ', :admin_name, :author,
public function vote($action = NULL, $id = 0) { // Make sure the user is logged in HERE! if ($this->user['logged_in'] == FALSE) { redirect('account/login'); } // Load the vote model, and time helper $this->load->model('Vote_Model', 'model'); $this->load->helper('Time'); // See if we need redirecting! if ($action == 'out' && $id != 0) { $site = $this->model->get_vote_site($id); redirect($site['votelink']); die; } // Load this users vote data $vote_data = $this->model->get_data($this->user['id']); // Get all the vote sites information $list = $this->model->get_vote_sites(); $sites = array(); // Correct the array keys foreach ($list as $site) { $sites[$site['id']] = $site; } // Process the time left for each site $time = time(); foreach ($vote_data as $key => $value) { // Get our remaining time left $left = $value - $time; if ($left > 0) { // Time left still, Let make a fancy time string! $sites[$key]['disabled'] = 'disabled="disabled"'; $sites[$key]['time_left'] = sec2hms($left); } else { // expired time, Good to vote again $sites[$key]['disabled'] = ''; $sites[$key]['time_left'] = "N/A"; } } // Prepare for view $data['sites'] = $sites; $this->load->view('vote', $data); }
echo "<div class=\"date_" . $feeditem->type_title . "_box\" style='float:right';>"; echo JHtml::date($feeditem->created_time, 'l d/m/y H:i'); echo "</div>"; echo "<div class=\"right_" . $feeditem->type_title . "_box\" style='padding-top:50px;'>"; echo "<div style=\"display:block;float:left;width:100px;\" >"; echo "<img src=\"" . $feeditem->thumb_uri . "\" class=\"profile_" . $feeditem->type_title . "_image\">"; echo "</div>"; echo "<div>"; $i = 0; $desc = ""; echo "<div class=\"youtube_video_title\">"; echo $feeditem->title; echo "</div>"; echo "<iframe width=\"560\" height=\"315\" src=\"" . $feeditem->source_link . "\" frameborder=\"0\" allowfullscreen></iframe>"; echo "<div class=\"youtube_duration\">"; echo sec2hms($feeditem->duration); echo "</div>"; echo "<div>"; echo "<div class=\"redsocial_description " . $feeditem->type_title . "\">"; preg_match_all('/(http|https)\\:\\/\\/[a-zA-Z0-9\\-\\.]+\\.[a-zA-Z]{2,3}[^<]*/', str_replace("\n", "<br />", $feeditem->message), $out, PREG_PATTERN_ORDER); foreach ($out[0] as $link) { $feeditem->message = str_replace($link, "<a href=\"" . $link . "\">" . $link . "</a>", $feeditem->message); } echo str_replace("\n", "<br />", $feeditem->message); echo "</div>"; echo "</div>"; echo "</div>"; echo "</div>"; echo "<div style=\"clear:both;\"></div>"; echo "</div><br/><hr/><br/>"; }
function post_params($phpvars) { global $config, $editpostparamid, $FormMethod; $postprocessconfig = LoadPostProcessConfig($config); if (!isset($postprocessconfig)) { return; } echo '<form action="status.php" method=' . $FormMethod . '">'; echo '<input type="hidden" name="save" value="1">'; echo '<input type="hidden" name="editpostparam" value="1">'; echo '<input type="hidden" name="id" value="' . $editpostparamid . '">'; $hasparams = false; $cur_queued = null; if (isset($phpvars['activegroup']) && $phpvars['activegroup']['LastID'] == $editpostparamid) { $cur_queued = $phpvars['activegroup']; } else { foreach ($phpvars['queuedgroups'] as $cur) { if ($cur['LastID'] == $editpostparamid) { $cur_queued = $cur; break; } } } if ($cur_queued != null) { echo '<div class = "block"><center>Postprocessing parameters</center><br>'; echo '<table width="100%">'; echo '<tr><td></td><td>name</td><td width="20">category</td><td width="60" align="right">total</td><td width="60" align="right">left</td><td width="100" align="right">estimated time</td></tr>'; $grouppaused = $cur_queued['PausedSizeLo'] != 0 && $cur_queued['RemainingSizeLo'] == $cur_queued['PausedSizeLo']; if ($grouppaused) { echo '<tr class="pausedgroup">'; } else { echo '<tr class="unpausedgroup">'; } echo '<td width="10"><a href="javascript:updatestatus(\'status.php?action=groupdelete&offset=0&id=' . $cur_queued['LastID'] . '\')"><IMG src=images/cancel.gif width=15 height=15 alt="remove nzb" title="remove nzb"></a></td>'; echo '<td>' . namereplace($cur_queued['NZBNicename']) . '</td>'; echo '<td width="20">'; add_category_combo($cur_queued['Category'], $cur_queued['LastID'], false); echo '</td>'; echo '<td align="right">' . formatSizeMB($cur_queued['FileSizeMB']) . '</td>'; echo '<td align="right">' . formatSizeMB($cur_queued['RemainingSizeMB'] - $cur_queued['PausedSizeMB']) . '</td>'; if ($phpvars['status']['DownloadRate'] > 0) { echo '<td align="right">' . sec2hms(($cur_queued['RemainingSizeMB'] - $cur_queued['PausedSizeMB']) / ($phpvars['status']['DownloadRate'] / 1024 / 1024)) . '</td>'; } else { echo '<td align="right"></td>'; } echo '</tr>'; echo '<tr><td> </td></tr>'; echo '<tr><td colspan="6">'; MergePostValues($config, $cur_queued['Parameters']); $hasparams = count($config) > 0; BuildOptionsContent($config, null, false); echo '</td></tr>'; echo '</table>'; echo '</div>'; } if (!$hasparams) { echo '<div class="block"><table width="100%"><tr><td>'; echo '<span class="INFO">INFO</span> Current postprocessing-script does not have any postprocessing parameters.'; echo '</td></tr></table></div>'; } echo '<div class="block"><table width="100%"><tr><td>'; if ($hasparams) { echo '<input type="submit" value="Save changes"> '; } echo '<input type="button" value="Cancel" onClick="location=\'?\'">'; // TIP: uncomment for debug purposes //echo ' <input type="button" value="Reload (for testing)" onClick="javascript:updatestatus(\'status.php?editpostparam=1&id='.$editpostparamid.'\')">'; echo '</td></tr></table></div>'; echo '</form><br>'; }
$msg .= "\t\t\t</tr>"; $msg .= "\t\t\t<tr align=\"left\" bgcolor=\"#E5ECF9\">"; $msg .= "\t\t\t\t\t<th align=\"left\">% Abandoned</th>"; $msg .= "\t\t\t\t\t<td align=\"right\">" . number_format($prcntAbnd * 100, 1, '.', '') . "%</th>"; $msg .= "\t\t\t</tr>"; $msg .= "\t\t\t<tr align=\"left\" bgcolor=\"#FFFFFF\">"; $msg .= "\t\t\t\t\t<th align=\"left\">Avg Abandoned</th>"; $msg .= "\t\t\t\t\t<td align=\"right\">" . sec2hms($avgAbnd) . "</th>"; $msg .= "\t\t\t</tr>"; $msg .= "\t\t\t<tr align=\"left\" bgcolor=\"#E5ECF9\">"; $msg .= "\t\t\t\t\t<th align=\"left\">ASA</th>"; $msg .= "\t\t\t\t\t<td align=\"right\">" . sec2hms($asa) . "</th>"; $msg .= "\t\t\t</tr>"; $msg .= "\t\t\t<tr align=\"left\" bgcolor=\"#FFFFFF\">"; $msg .= "\t\t\t\t\t<th align=\"left\">IB AHT</th>"; $msg .= "\t\t\t\t\t<td align=\"right\">" . sec2hms($ibaht) . "</th>"; $msg .= "\t\t\t</tr>"; $msg .= "\t\t\t<tr align=\"left\" bgcolor=\"#E5ECF9\">"; $msg .= "\t\t\t\t\t<th align=\"left\">Service Level</th>"; $msg .= "\t\t\t\t\t<td align=\"right\">" . number_format($serviceLvl, 1) . "%</th>"; $msg .= "\t\t\t</tr>"; $msg .= "\t\t</table>"; $msg .= "\t</td>"; $msg .= "\t</tr>"; $msg .= "\t</table>"; $msg .= "<br/><br/>..inetpub/wwwroot/plexis/" . $_SERVER['SCRIPT_NAME']; // ********************** E-Mail Results **************************** //$to='*****@*****.**'; $to = '*****@*****.**'; $subject = 'Monthly Call Data Summary: ' . date('F', mktime(0, 0, 0, date('m') - 1, date('d'), date('Y'))); $headers = 'MIME-Version: 1.0' . "\r\n";
<ul class="samples"> <?php foreach ($tracks as $track => $info) { if ($verified) { ?> <li><a href="<?php echo '/' . $url_prefix . '/record/' . $item['_id'] . '/download?type=play&tracknum=' . $track; ?> " class="mp3player inline-playable"><?php echo $track; ?> . <?php echo $info['title']; ?> (<?php echo sec2hms($info['length']); ?> )</a><span class="right">(<?php echo round($info['size'] / 1048576, 2); ?> MB) <a href="<?php echo '/' . $url_prefix . '/record/' . $item['_id'] . '/download?type=track&tracknum=' . $track; ?> ">Download Track</a></span></li> <?php } else { ?> <li><?php echo $track; ?> . <?php
$array_concepts = mysql_fetch_array($chkresult_concepts); $id_concepts = $array_concepts["id_concepts"]; } } else { $id_concepts = null; } //converto i frame in millisecondi // $starttime_point = round($starttime*1000/$fps); // $endtime_point = round($endtime*1000/$fps); // $start_time_second = (int)round($starttime/$fps); $start_time_second = $starttime / 1000; $starttime_point = $starttime; $endtime_point = $endtime; log_task("selezionato secondo esportazione : " . $start_time_second . "\n"); //estrazione della thumbnail $starttime_point_extraction = sec2hms($start_time_second); log_task("selezionato timecode esportazione : " . $starttime_point_extraction . "\n"); $thumbnail_name = "{$filename}-{$starttime}.png"; $command = "ffmpeg -ss " . $starttime_point_extraction . " -i " . $miccDirectory . "media/video/" . $filename . " -f image2 -vframes 1 -s 320x240 " . $miccDirectory . "media/image/" . $thumbnail_name; log_task("\neseguito: " . $command . "\n"); $result = exec($command); // $insert_id_concept = ($id_concepts != null ?"'".$id_concepts."'": " null "); $insert_id_concept = '10'; $now = date('Y-m-d H:i:s'); $querys = "UPDATE media SET last_modified = '" . $now . "' WHERE id_media = '" . $idfilm . "'"; $result = mysql_query($querys) or die('ERROR'); //creo la query di inserimento del concetto $querys = "INSERT INTO annotations (id_media, title, timepoint, endpoint, id_concepts, id_users, id_annotations_types,thumbnail) VALUES ('" . $idfilm . "', '" . $conceptname . "', '" . $starttime_point . "', '" . $endtime_point . "', '" . $insert_id_concept . "', '" . $owner . "', '2','{$thumbnail_name}')"; $date = date('Y-m-d H:i:s'); $dataserverpath = $absolutePath . 'media/image/'; //echo $querys;
function serverinfobox($phpvars) { global $webversion; echo '<div class = "block"><center>'; echo "NZBGet " . $phpvars['version'] . "<br/>"; echo '<center>Web Interface ' . $webversion . '</center><br/>'; echo "<table width='250'>"; echo "<tr><td>uptime:</td><td align=right><nobr>" . sec2hms($phpvars['status']['UpTimeSec']) . "</nobr></td></tr>"; echo "<tr><td>download time:</td><td align=right><nobr>" . sec2hms($phpvars['status']['DownloadTimeSec']) . "</nobr></td></tr>"; echo "<tr><td><nobr>average download rate:</nobr></td><td align=right><nobr>" . round0($phpvars['status']['AverageDownloadRate'] / 1024) . " KB/s</nobr></td></tr>"; echo "<tr><td>total downloaded:</td><td align=right><nobr>" . formatSizeMB($phpvars['status']['DownloadedSizeMB']) . "</nobr></td></tr>"; echo "<tr><td>free disk space:</td><td align=right><nobr>" . formatSizeMB(freediskspace()) . "</nobr></td></tr>"; echo '</table>'; echo '</center></div><br>'; }
$OBArr['WTD'] = $rows[0]; $outboundAHT['WTD'] = sec2hms($rows[1]); } /************** MTD *****************/ $queryOBMTD = "\tSELECT \t\tcount(*),\n\t\t\t\t\t\t\t\t\t(SUM(\tTIME_TO_SEC(TIMEDIFF(\tCONVERT_TZ( CONCAT( SUBSTR( TC.releaseTime, 1, 4 ) , '-', SUBSTR( TC.releaseTime, 5, 2 ) , '-', SUBSTR( TC.releaseTime, 7, 2 ) , ' ', SUBSTR( TC.releaseTime, 9, 2 ) , ':', SUBSTR( TC.releaseTime, 11, 2 ) , ':', SUBSTR( TC.releaseTime, 13, 2 ) ) , '+00:00', concat(SUBSTR(userTimeZone,2,3),':00') ),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tCONVERT_TZ( CONCAT( SUBSTR( TC.answerTime, 1, 4 ) , '-', SUBSTR( TC.answerTime, 5, 2 ) , '-', SUBSTR( TC.answerTime, 7, 2 ) , ' ', SUBSTR( TC.answerTime, 9, 2 ) , ':', SUBSTR( TC.answerTime, 11, 2 ) , ':', SUBSTR( TC.answerTime, 13, 2 ) ) , '+00:00', concat(SUBSTR(userTimeZone,2,3),':00') )\n\t\t\t\t\t\t\t\t\t\t\t\t)))/count(*)) as outboundAHT\n\t\t\t\t\t\tFROM \t\ttbl_cdr AS TC \n\t\t\t\t\t\tJOIN\t\ttbl_call_rep as TCR \n\t\t\t\t\t\tON\t\t\tTCR.ext = TC.callingNumber \n\t\t\t\t\t\tWHERE \t\tCONVERT_TZ( CONCAT( SUBSTR( TC.startTime, 1, 4 ) , '-', SUBSTR( TC.startTime, 5, 2 ) , '-', SUBSTR( TC.startTime, 7, 2 ) , ' ', SUBSTR( TC.startTime, 9, 2 ) , ':', SUBSTR( TC.startTime, 11, 2 ) , ':', SUBSTR( TC.startTime, 13, 2 ) ) , '+00:00', concat(SUBSTR(userTimeZone,2,3),':00') ) \n\t\t\t\t\t\tBETWEEN \t'" . $MTD . "'\tAND '" . $curDay . "'\n\t\t\t\t\t\tAND\t\t\tanswerIndicator = 'YES'\n\t\t\t\t\t\tAND\t\t\tdirection = 'Originating'"; $result = mysql_query($queryOBMTD, $conn) or die('Query failed: ' . $query . mysql_error()); while ($rows = mysql_fetch_array($result, MYSQL_NUM)) { $OBArr['MTD'] = $rows[0]; $outboundAHT['MTD'] = sec2hms($rows[1]); } /************** YTD *****************/ $queryOBYTD = "\tSELECT \t\tcount(*),\n\t\t\t\t\t\t\t\t\t(SUM(\tTIME_TO_SEC(TIMEDIFF(\tCONVERT_TZ( CONCAT( SUBSTR( TC.releaseTime, 1, 4 ) , '-', SUBSTR( TC.releaseTime, 5, 2 ) , '-', SUBSTR( TC.releaseTime, 7, 2 ) , ' ', SUBSTR( TC.releaseTime, 9, 2 ) , ':', SUBSTR( TC.releaseTime, 11, 2 ) , ':', SUBSTR( TC.releaseTime, 13, 2 ) ) , '+00:00', concat(SUBSTR(userTimeZone,2,3),':00') ),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tCONVERT_TZ( CONCAT( SUBSTR( TC.answerTime, 1, 4 ) , '-', SUBSTR( TC.answerTime, 5, 2 ) , '-', SUBSTR( TC.answerTime, 7, 2 ) , ' ', SUBSTR( TC.answerTime, 9, 2 ) , ':', SUBSTR( TC.answerTime, 11, 2 ) , ':', SUBSTR( TC.answerTime, 13, 2 ) ) , '+00:00', concat(SUBSTR(userTimeZone,2,3),':00') )\n\t\t\t\t\t\t\t\t\t\t\t\t)))/count(*)) as outboundAHT\n\t\t\t\t\t\tFROM \t\ttbl_cdr AS TC \n\t\t\t\t\t\tJOIN\t\ttbl_call_rep as TCR \n\t\t\t\t\t\tON\t\t\tTCR.ext = TC.callingNumber \n\t\t\t\t\t\tWHERE \t\tCONVERT_TZ( CONCAT( SUBSTR( TC.startTime, 1, 4 ) , '-', SUBSTR( TC.startTime, 5, 2 ) , '-', SUBSTR( TC.startTime, 7, 2 ) , ' ', SUBSTR( TC.startTime, 9, 2 ) , ':', SUBSTR( TC.startTime, 11, 2 ) , ':', SUBSTR( TC.startTime, 13, 2 ) ) , '+00:00', concat(SUBSTR(userTimeZone,2,3),':00') ) \n\t\t\t\t\t\tBETWEEN \t'" . $YTD . "'\tAND '" . $curDay . "'\n\t\t\t\t\t\tAND\t\t\tanswerIndicator = 'YES'\n\t\t\t\t\t\tAND\t\t\tdirection = 'Originating'"; $result = mysql_query($queryOBYTD, $conn) or die('Query failed: ' . $query . mysql_error()); while ($rows = mysql_fetch_array($result, MYSQL_NUM)) { $OBArr['YTD'] = $rows[0]; $outboundAHT['YTD'] = sec2hms($rows[1]); } /*********************************************/ /************* ABND / PRCNT DATA *************/ /*********************************************/ /*************** Daily ******************/ $queryAbndDaily = "\tSELECT \t\tcount(*) \n\t\t\t\t\t\t\tFROM \t\ttbl_cdr AS TC \n\t\t\t\t\t\t\tJOIN\t\ttbl_call_rep as TCR \n\t\t\t\t\t\t\tON\t\t\tTCR.ext = TC.userNumber \n\t\t\t\t\t\t\tWHERE \t\tCONVERT_TZ( CONCAT( SUBSTR( TC.startTime, 1, 4 ) , '-', SUBSTR( TC.startTime, 5, 2 ) , '-', SUBSTR( TC.startTime, 7, 2 ) , ' ', SUBSTR( TC.startTime, 9, 2 ) , ':', SUBSTR( TC.startTime, 11, 2 ) , ':', SUBSTR( TC.startTime, 13, 2 ) ) , '+00:00', concat(SUBSTR(userTimeZone,2,3),':00') ) \n\t\t\t\t\t\t\tBETWEEN \t'" . $prevDay . "'\tAND '" . $curDay . "'\n\t\t\t\t\t\t\tAND\t\t\tanswerIndicator = 'NO'\n\t\t\t\t\t\t\tAND\t\t\tdirection = 'Terminating'"; $result = mysql_query($queryAbndDaily, $conn) or die('Query failed: ' . $queryAbndDaily . mysql_error()); while ($rows = mysql_fetch_array($result, MYSQL_NUM)) { $AbndArr['Daily'] = $rows[0]; if ($IBArr['Daily'] + $OBArr['Daily'] == 0) { $PrcntAbndArr['Daily'] = 0; } else { $PrcntAbndArr['Daily'] = 100 * ($AbndArr['Daily'] / ($IBArr['Daily'] + $OBArr['Daily'])); } }
{ $fullProfile = false; //no effect yet if (!$fm->isFriend($userId, $usr)) //trying to view someone elses profile { header("Location: profile.php"); } } $manager = new DcWebManager(); $user = $manager->loadUser($usr); $smarty = smartyInit(); $distUnit = "km"; $totalDist = $manager->getDistanceSince($usr, 0); $totalDist = DcUnitConverter::convertDistance($totalDist, $distUnit); $firstSession = $manager->getFirstSession($usr); $firstTime = $firstSession->startTime; $totalTime = $manager->getTotalTimeSince($usr, 0); $totalTime = formatHms(sec2hms($totalTime),1); if (!$firstTime) $firstTime = "n/a"; $smarty->assign('distUnit', $distUnit); $smarty->assign('totalDist', $totalDist); $smarty->assign('firstTime', $firstTime); $smarty->assign('totalTime', $totalTime); $smarty->assign('user', $user); $smarty->display('profile.tpl'); ?>
private function month_report() { $month =& new kwt_month("month_sel", &$this->smarty, 2005, date("Y")); $month->add_submit(new k_submit("month_sel_sub", &$this->smarty)); $this->smarty->assign("yeard", date("Y")); $this->smarty->assign("monthd", date("m")); if ($month->submited()) { $from = strtotime($month->year->get_value() . "-" . $month->month->get_value() . "-01"); $to = strtotime($month->year->get_value() . "-" . $month->month->get_value() . "-" . cal_days_in_month(CAL_GREGORIAN, $month->month->get_value(), $month->year->get_value())); $dates =& $this->generate_range_report($this->auth->userindex, $from, $to); $this->smarty->assign("drange", date($this->uprefs->date, $from) . " - " . date($this->uprefs->date, $to)); $this->smarty->assign("ruser", $this->auth->username); foreach ($dates[0] as $key => &$value) { $temp = sec2hms($value["totalw"]); $value["totalw"] = $temp["hours"] . ":" . $temp["min"] . ":" . $temp["sec"]; $temp = sec2hms($value["efectivw"]); $value["efectivw"] = $temp["hours"] . ":" . $temp["min"] . ":" . $temp["sec"]; } $temp = sec2hms($dates[1]['work']); $dates[1]['work'] = $temp["hours"] . ":" . $temp["min"] . ":" . $temp["sec"]; $temp = sec2hms($dates[1]['effectiv']); $dates[1]['effectiv'] = $temp["hours"] . ":" . $temp["min"] . ":" . $temp["sec"]; $this->smarty->assign_by_ref("bydate", &$dates[0]); $this->smarty->assign_by_ref("total", &$dates[1]); } $this->smarty->display("month_report.tpl"); }
$dayDist += $session->distance; } if ($numSessions > 0) { $content .= "<div class=\"monthDayDist\">"; //$content .= $dateFrmtd.": <a href=\"viewSession.php?s="; $content .= "<br/><a href=\"day.php?u=".$uId."&t="; $content .= $dayStamp."\">".number_format($dayDist,2)."</a> ".$distUnit." in "; $content .= $numSessions . " sessions. </div>"; $cal->setEventContent($year, $month, $day+$i, $content); } } $totalTimeSecs = $totalTime['seconds'] + 60 * $totalTime['minutes'] + 3600 * $totalTime['hours']; $totalTime = sec2hms($totalTimeSecs); $averageVel = $totalVel / (count($sessions)*$days); $month = $cal->showMonth(); $smarty->assign('user', $user); $smarty->assign('startDate', $startDate); $smarty->assign('distUnit', $distUnit); $smarty->assign('velUnit', $velUnit); $smarty->assign('endDate', $endDate); $smarty->assign('nextMonth', $nextMonth); $smarty->assign('prevMonth', $prevMonth); $smarty->assign('totalDist', $totalDist); $smarty->assign('totalTime', formatHms($totalTime),1); $smarty->assign('averageVel', $averageVel); $smarty->assign('month', $month);
$diff = mktime(substr($startTime, 11, 2), substr($startTime, 14, 2), substr($startTime, 17, 2), substr($startTime, 5, 2), substr($startTime, 8, 2), substr($startTime, 0, 4)) - mktime(substr($prvsStartTime, 11, 2), substr($prvsStartTime, 14, 2), substr($prvsStartTime, 17, 2), substr($prvsStartTime, 5, 2), substr($prvsStartTime, 8, 2), substr($prvsStartTime, 0, 4)) - $prvsIvrSec; //echo substr($startTime,8,2).':'.substr($startTime,10,2).':'.substr($startTime,12,2).' - '.substr($prvsStartTime,8,2).':'.substr($prvsStartTime,10,2).':'.substr($prvsStartTime,12,2).": ". // $diff. "\n"; if ($diff < 900 && $calledNumber == 456) { array_push($diffArr, $diff); } $countMatchCall = 0; } } } $prvsCallingNumber = $callingNumber; $prvsCalledNumber = $calledNumber; $prvsStartTime = $startTime; $prvsIvrSec = $ivrSec; } echo sec2hms(array_sum($diffArr) / count($diffArr)); function sec2hms($sec, $padHours = false) { $hms = ""; // there are 3600 seconds in an hour, so if we // divide total seconds by 3600 and throw away // the remainder, we've got the number of hours $hours = intval(intval($sec) / 3600); // add to $hms, with a leading 0 if asked for $hms .= $padHours ? str_pad($hours, 2, "0", STR_PAD_LEFT) . ':' : $hours . ':'; // dividing the total seconds by 60 will give us // the number of minutes, but we're interested in // minutes past the hour: to get that, we need to // divide by 60 again and keep the remainder $minutes = intval($sec / 60 % 60); // then add to $hms (with a leading 0 if needed)
<span title="<?php echo $playlistItem["titlu"] . " - " . $playlistItem["nume_autor"]; ?> " class="titlu"><?php echo cropText($playlistItem["titlu"] . " - " . $playlistItem["nume_autor"], 44); ?> </span> <span class="download"><a href="<?php echo site_url("download/" . $playlistItem["atasament_id"]); ?> " style="padding-left:2px; margin-left: 2px;"><img src="<?php echo IMAGES_PATH; ?> /player-audio/download.png" /></a></span> <span class="durata"> <?php echo sec2hms($playlistItem["durata"]); ?> </span> <?php if ($playlistItem["data"] != 00 - 00 - 00) { ?> <span class="audio_date" > <?php echo prepareDateDMY($playlistItem["data"]); ?> </span> <?php } ?> </li> <?php
"'Y'," . //on_planet "0," . //dev_warpedit "0," . //dev_genesis "0," . //dev_beacon "0," . //dev_emerwarp "'N'," . //dev_escapepod "'N'," . //dev_fuelscoop "0," . //dev_minedeflector "'$planetinfo[planet_id]'," . //planet_id "''," . //cleared_defences "'N'," . //dev_lssd "'N'," . // dev_sectorwmd "'N'" . // Furangee Tech ")"); echo "Ship building has started. "; $hms = sec2hms(($sched_ticks*$ship[turnstobuild]*60)); echo "It will take approximately ".$hms." to build this ship.<br>"; } } else { echo "<br>Click <a href=buildship.php?kk=".date("U").">here</a> to return to the Ship Building Menu<br><br>"; } } else { echo "You cannot build that ship on this planet yet.<br>"; echo "Click <a href=buildship.php?kk=".date("U").">here</a> to return to the Ship Building Menu<br><br>"; } } else { // No command or unrecognized command // Get the ships that are available to build //echo "SELECT * FROM $dbtables[ship_types] WHERE buyable = 'N' AND tech_level<=$planetinfo[tech_level] ORDER BY tech_level ASC<br>"; $res = $db->Execute("SELECT * FROM $dbtables[ship_types] WHERE buyable = 'N' AND tech_level<='$planetinfo[tech_level]' ORDER BY tech_level ASC"); $numRows=$res->RowCount();
/** * Shows the stats grid */ public function StatsGrid() { $db =& $this->db; $user =& $this->user; $response = new ResponseManager(); $fromDt = Kit::GetParam('fromdt', _POST, _STRING); $toDt = Kit::GetParam('todt', _POST, _STRING); $displayId = Kit::GetParam('displayid', _POST, _INT); $mediaId = Kit::GetParam('mediaid', _POST, _INT); // What if the fromdt and todt are exactly the same? // in this case assume an entire day from midnight on the fromdt to midnight on the todt (i.e. add a day to the todt) if ($fromDt == $toDt) { $toDt = date("Y-m-d", strtotime($toDt) + 86399); } Theme::Set('form_action', ''); Theme::Set('form_meta', '<input type="hidden" name="p" value="stats"/><input type="hidden" name="q" value="OutputCSV"/><input type="hidden" name="displayid" value="' . $displayId . '" /><input type="hidden" name="fromdt" value="' . $fromDt . '" /><input type="hidden" name="todt" value="' . $toDt . '" />'); // Get an array of display id this user has access to. $displays = $this->user->DisplayList(); $display_ids = array(); foreach ($displays as $display) { $display_ids[] = $display['displayid']; } if (count($display_ids) <= 0) { trigger_error(__('No displays with View permissions'), E_USER_ERROR); } // 3 grids showing different stats. // Layouts Ran $SQL = 'SELECT display.Display, layout.Layout, COUNT(StatID) AS NumberPlays, SUM(TIME_TO_SEC(TIMEDIFF(end, start))) AS Duration, MIN(start) AS MinStart, MAX(end) AS MaxEnd '; $SQL .= ' FROM stat '; $SQL .= ' INNER JOIN layout ON layout.LayoutID = stat.LayoutID '; $SQL .= ' INNER JOIN display ON stat.DisplayID = display.DisplayID '; $SQL .= " WHERE stat.type = 'layout' "; $SQL .= sprintf(" AND stat.end > '%s' ", $fromDt); $SQL .= sprintf(" AND stat.start <= '%s' ", $toDt); $SQL .= ' AND stat.displayID IN (' . implode(',', $display_ids) . ') '; if ($displayId != 0) { $SQL .= sprintf(" AND stat.displayID = %d ", $displayId); } $SQL .= 'GROUP BY display.Display, layout.Layout '; $SQL .= 'ORDER BY display.Display, layout.Layout'; if (!($results = $this->db->query($SQL))) { trigger_error($db->error()); trigger_error(__('Unable to get Layouts Shown'), E_USER_ERROR); } $rows = array(); while ($row = $db->get_assoc_row($results)) { $row['Display'] = Kit::ValidateParam($row['Display'], _STRING); $row['Layout'] = Kit::ValidateParam($row['Layout'], _STRING); $row['NumberPlays'] = Kit::ValidateParam($row['NumberPlays'], _INT); $row['DurationSec'] = Kit::ValidateParam($row['Duration'], _INT); $row['Duration'] = sec2hms(Kit::ValidateParam($row['Duration'], _INT)); $row['MinStart'] = Kit::ValidateParam($row['MinStart'], _STRING); $row['MaxEnd'] = Kit::ValidateParam($row['MaxEnd'], _STRING); $rows[] = $row; } Theme::Set('table_layouts_shown', $rows); // Media Ran $SQL = 'SELECT display.Display, media.Name, COUNT(StatID) AS NumberPlays, SUM(TIME_TO_SEC(TIMEDIFF(end, start))) AS Duration, MIN(start) AS MinStart, MAX(end) AS MaxEnd '; $SQL .= ' FROM stat '; $SQL .= ' INNER JOIN display ON stat.DisplayID = display.DisplayID '; $SQL .= ' INNER JOIN media ON media.MediaID = stat.MediaID '; $SQL .= " WHERE stat.type = 'media' "; $SQL .= sprintf(" AND stat.end > '%s' ", $fromDt); $SQL .= sprintf(" AND stat.start <= '%s' ", $toDt); $SQL .= ' AND stat.displayID IN (' . implode(',', $display_ids) . ') '; if ($mediaId != 0) { $SQL .= sprintf(" AND media.MediaID = %d ", $mediaId); } if ($displayId != 0) { $SQL .= sprintf(" AND stat.displayID = %d ", $displayId); } $SQL .= 'GROUP BY display.Display, media.Name '; $SQL .= 'ORDER BY display.Display, media.Name'; if (!($results = $this->db->query($SQL))) { trigger_error($db->error()); trigger_error(__('Unable to get Library Media Ran'), E_USER_ERROR); } $rows = array(); while ($row = $db->get_assoc_row($results)) { $row['Display'] = Kit::ValidateParam($row['Display'], _STRING); $row['Media'] = Kit::ValidateParam($row['Name'], _STRING); $row['NumberPlays'] = Kit::ValidateParam($row['NumberPlays'], _INT); $row['DurationSec'] = Kit::ValidateParam($row['Duration'], _INT); $row['Duration'] = sec2hms(Kit::ValidateParam($row['Duration'], _INT)); $row['MinStart'] = Kit::ValidateParam($row['MinStart'], _STRING); $row['MaxEnd'] = Kit::ValidateParam($row['MaxEnd'], _STRING); $rows[] = $row; } Theme::Set('table_media_shown', $rows); // Media on Layouts Ran $SQL = "SELECT display.Display, layout.Layout, IFNULL(media.Name, 'Text/Rss/Webpage') AS Name, COUNT(StatID) AS NumberPlays, SUM(TIME_TO_SEC(TIMEDIFF(end, start))) AS Duration, MIN(start) AS MinStart, MAX(end) AS MaxEnd "; $SQL .= ' FROM stat '; $SQL .= ' INNER JOIN display ON stat.DisplayID = display.DisplayID '; $SQL .= ' INNER JOIN layout ON layout.LayoutID = stat.LayoutID '; $SQL .= ' LEFT OUTER JOIN media ON media.MediaID = stat.MediaID '; $SQL .= " WHERE stat.type = 'media' "; $SQL .= sprintf(" AND stat.end > '%s' ", $fromDt); $SQL .= sprintf(" AND stat.start <= '%s' ", $toDt); $SQL .= ' AND stat.displayID IN (' . implode(',', $display_ids) . ') '; if ($mediaId != 0) { $SQL .= sprintf(" AND media.MediaID = %d ", $mediaId); } if ($displayId != 0) { $SQL .= sprintf(" AND stat.displayID = %d ", $displayId); } $SQL .= "GROUP BY display.Display, layout.Layout, IFNULL(media.Name, 'Text/Rss/Webpage') "; $SQL .= "ORDER BY display.Display, layout.Layout, IFNULL(media.Name, 'Text/Rss/Webpage')"; if (!($results = $this->db->query($SQL))) { trigger_error($db->error()); trigger_error(__('Unable to get Library Media Ran'), E_USER_ERROR); } $rows = array(); while ($row = $db->get_assoc_row($results)) { $row['Display'] = Kit::ValidateParam($row['Display'], _STRING); $row['Layout'] = Kit::ValidateParam($row['Layout'], _STRING); $row['Media'] = Kit::ValidateParam($row['Name'], _STRING); $row['NumberPlays'] = Kit::ValidateParam($row['NumberPlays'], _INT); $row['DurationSec'] = Kit::ValidateParam($row['Duration'], _INT); $row['Duration'] = sec2hms(Kit::ValidateParam($row['Duration'], _INT)); $row['MinStart'] = Kit::ValidateParam($row['MinStart'], _STRING); $row['MaxEnd'] = Kit::ValidateParam($row['MaxEnd'], _STRING); $rows[] = $row; } Theme::Set('table_media_on_layouts_shown', $rows); $output = Theme::RenderReturn('stats_page_grid'); $response->SetGridResponse($output); $response->Respond(); }
function do_check_applic($applTime, $maxFileSecs) { global $SITE; $timeFormat = $SITE['timeFormat']; $now = time(); $age = $now - $applTime; $updateTime = date($timeFormat, $applTime); $status = ''; $age = sec2hms($age); if ($applTime + $maxFileSecs > $now) { // stale file $status = '<span style="color: green"><b>Current</b></span>'; } else { $status = '<span style="color: red"><b>NOT Current</b></span>'; $updateTime = sec2hms($maxFileSecs) . ' <br/><b>' . $updateTime . '</b> '; } return array($status, $age, $updateTime); }
"/> <input type="text" id="cforms_endtime" name="cforms_endtime" value="<?php echo $date[1]; ?> "/><a class="cf_timebutt2" href="javascript:void(0);"><img src="<?php echo $cforms_root; ?> /images/clock.gif" alt="" title="<?php _e('Time entry.', 'cforms'); ?> "/></a> <label for="cforms_startdate"><?php if ($dt == 'x' && strlen($cformsSettings['form' . $no]['cforms' . $no . '_enddate']) > 1) { $dt = cf_make_time(stripslashes($cformsSettings['form' . $no]['cforms' . $no . '_enddate'])) - time(); if ($dt > 0) { echo __('The form will be available for another ', 'cforms') . sec2hms($dt); } else { echo __('The form is not available anymore.', 'cforms'); } } ?> </label> </td> </tr> <?php if ($cformsSettings['form' . $no]['cforms' . $no . '_maxentries'] != '' || $cformsSettings['form' . $no]['cforms' . $no . '_startdate'] != '' || $cformsSettings['form' . $no]['cforms' . $no . '_enddate'] != '') { ?> <tr class="ob"> <td class="obL"><label for="cforms_limittxt"><strong><?php _e('Limit text', 'cforms');
<img src="<?php echo $video->thumbs->s->url; ?> " alt="<?php echo $video->title; ?> " /> <span class="mcore-border"></span> </a> <div class="mcore-overlay"> <span class="mcore-length"> <?php echo sec2hms($video->duration, true); ?> </span> <span class="mcore-icon"></span> </div> </div> <div class="mcore-info"> <h3> <!-- These links are ugly. --> <a href="javascript:MediaCoreDialog.insert('<?php echo embeddable($video->url);
<title>Předchozí strana</title> <link>' . $url . '</link> <annotation>Předchozí strana</annotation> <durata></durata> <pub></pub> <mediaDisplay name="threePartsView"/> </item>'; } $videos = explode('<entry>', $html); unset($videos[0]); $videos = array_values($videos); foreach ($videos as $video) { $id = str_between($video, "<id>http://gdata.youtube.com/feeds/api/videos/", "</id>"); $title = str_between($video, "<title type='text'>", "</title>"); $descriere = str_between($video, "<content type='text'>", "</content>"); $durata = sec2hms(str_between($video, "duration='", "'")); $data = str_between($video, "<updated>", "</updated>"); $data = str_replace("T", " ", $data); $data = str_replace("Z", "", $data); $data = explode(" ", $data); $data = $data[0]; $name = preg_replace('/[^A-Za-z0-9_]/', '_', $title) . ".mp4"; $item['title'] = $title; $item['id'] = $id; $item['name'] = $name; $item['annotation'] = $descriere; $item['durata'] = $durata; $item['pub'] = $data; echo CreateItem($item); } $sThisFile = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['SCRIPT_NAME'];
function blipgetvideodetails($vidlink, $existingcode, $categorylist, $reqtype) { global $database, $my; $mosConfig_absolute_path = JPATH_SITE; $mosConfig_live_site = substr(JURI::base(), 0, strlen(JURI::base()) - 1); if ($reqtype == "new") { $vidlink = jalemurldecode($vidlink); $smallvideocode = str_replace("http://www.blip.tv/file/", "", $vidlink); $smallvideocode = str_replace("http://blip.tv/file/", "", $smallvideocode); //improved security not to call another site... $vidlink = "http://blip.tv/file/" . $smallvideocode; } else { if ($reqtype == "refresh") { if ($vidlink == "") { $vidlink = "http://blip.tv/file/" . $existingcode; //trytoguess } } } // ################################################## // STRING CREATED FROM HTML SOURCE CODE $videoservertype = "blip"; $strhtml = jalem_file_get_contents($vidlink); // CONVERT HTML SOURCE TO STRING $feedlink = "http://blip.tv/file/" . $smallvideocode . "?skin=rss"; $feedlink = str_replace("/?", "?", $feedlink); $strXML = jalem_file_get_contents($feedlink); // CONVERT API FEED SOURCE TO STRING // ################################################## // ########### VIDEO TITLE PARSE FROM HTML SOURCE // ################################################## $start_position = strpos($strXML, "<media:title>") + 13; $end_position = strpos($strXML, "</media:title>", $start_position) - $start_position; $videotitle = substr($strXML, $start_position, $end_position); $videotitle = htmlentities($videotitle, ENT_NOQUOTES); $videotitle = ucwords(strtolower($videotitle)); // ################################################## // ########### VIDEO DESCRIPTION PARSE FROM HTML SOURCE // ################################################## $start_position = strpos($strhtml, "player.setDescription(\"") + 23; $end_position = strpos($strhtml, "\");", $start_position) - $start_position; $videodescription = substr($strhtml, $start_position, $end_position); $strlength = strlen($videodescription); if ($strlength == 0) { $videodescription = $videotitle; } // $videodescription = str_replace("\"","",$videodescription); // $videodescription = htmlentities($videodescription, ENT_QUOTES); // ################################################## // ########### VIDEO UPDATED TODAYS DATE // ################################################## $date_updated = date('Y-m-d'); // date_added -> FIELD name in Database // ################################################## // ########### VIDEO PUBLISHED DATE FROM HTML SOURCE // ################################################## $start_position = strpos($strXML, "<pubDate>") + 9; $end_position = strpos($strXML, "</pubDate>", $start_position) - $start_position; $video_published = substr($strXML, $start_position, $end_position); $video_published = date("Y-m-d", strtotime($video_published)); // date_added -> FIELD name in Database $video_published = date('Y-m-d'); // ################################################## // ########### VIDEO KEYWORDS PARSE FROM HTML SOURCE // ################################################## $start_position = strpos($strXML, "<media:keywords>") + 16; $end_position = strpos($strXML, "</media:keywords>", $start_position) - $start_position; $videotags = substr($strXML, $start_position, $end_position); $videotag_exisits = strlen($videotags); if ($videotag_exisits == 0) { $videotags = $videotitle; } $videotags = str_replace(",", ", ", $videotags); // ################################################## // ########### VIDEO THUMBNAIL PARSE FROM HTML SOURCE // ################################################## $start_position = strpos($strXML, "<blip:smallThumbnail>") + 21; $end_position = strpos($strXML, "</blip:smallThumbnail>", $start_position) - $start_position; $thumbnail_link = substr($strXML, $start_position, $end_position); // ################################################## // ########### DISLAY THUMBNAIL LARGE PARSE FROM HTML SOURCE // ################################################## $start_position = strpos($strXML, "<media:thumbnail url=\"") + 22; $end_position = strpos($strXML, ".jpg", $start_position) - $start_position; $display_thumb = substr($strXML, $start_position, $end_position + 4); // ################################################## // ########### PLAYER LINK PARSE FROM HTML SOURCE // ################################################## $start_position = strpos($strXML, "<media:player url=\"") + 19; $end_position = strpos($strXML, "\"", $start_position) - $start_position; $video_url = substr($strXML, $start_position, $end_position); // ################################################## // ########### VIDEO ID PARSE FROM HTML SOURCE // ################################################## $start_position = strpos($strhtml, "<option value=\"/file/") + 21; $end_position = strpos($strhtml, "?filename", $start_position) - $start_position; $smallvideocode = substr($strhtml, $start_position, $end_position); // remote_id -> FIELD name in Database // ################################################## // ########### VIDEO DURATION PARSE FROM HTML SOURCE // ################################################## $start_position = strpos($strXML, "<blip:runtime>") + 14; $end_position = strpos($strXML, "</blip:runtime>", $start_position) - $start_position; $sec = substr($strXML, $start_position, $end_position); $videoduration = sec2hms($sec); // Convert to 00:00:00 i.e. hrs:min:sec if ($reqtype == "new") { $renderinputform = renderinputform($video_url, $thumbnail_link, $display_thumb, $videotitle, $videodescription, $videotags, $video_published, $date_updated, $videoduration, $remote_id, $videoservertype, $smallvideocode, $categorylist); return $renderinputform; } else { if ($reqtype == "refresh") { return array($picturelink, $videotitle, $itemcomment); } } }
$oldStatus = "<font style='color:#04B486'>Online</font>"; $newStatus = "<font style='color:#DF0101'>Offline</font>"; } else { $oldStatus = "<font style='color:#DF0101'>Offline</font>"; $newStatus = "<font style='color:#04B486'>Online</font>"; } //set subnet $subnet = $Subnets->fetch_subnet(null, $change['subnetId']); //set section $section = $Tools->fetch_object("sections", "id", $subnet->sectionId); //ago if (is_null($change['lastSeen']) || $change['lastSeen'] == "0000-00-00 00:00:00") { $ago = "never"; } else { $timeDiff = time() - strtotime($change['lastSeen']); $ago = $change['lastSeen'] . " (" . sec2hms($timeDiff) . " ago)"; } //content $content[] = "<tr>"; $content[] = "\t<td style='padding:3px 8px;border:1px solid silver;'><a href='" . $Scan->settings->siteURL . "" . create_link("subnets", $section->id, $subnet->id) . "'>" . $Subnets->transform_to_dotted($change['ip_addr']) . "</a></td>"; $content[] = "\t<td style='padding:3px 8px;border:1px solid silver;'>{$change['description']}</td>"; $content[] = "\t<td style='padding:3px 8px;border:1px solid silver;'><a href='" . $Scan->settings->siteURL . "" . create_link("subnets", $section->id, $subnet->id) . "'>" . $Subnets->transform_to_dotted($subnet->subnet) . "/" . $subnet->mask . " - " . $subnet->description . "</a></td>"; $content[] = "\t<td style='padding:3px 8px;border:1px solid silver;'><a href='" . $Scan->settings->siteURL . "" . create_link("subnets", $section->id) . "'>{$section->name} {$section->description}</a></td>"; $content[] = "\t<td style='padding:3px 8px;border:1px solid silver;'>{$ago}</td>"; $content[] = "\t<td style='padding:3px 8px;border:1px solid silver;'>{$oldStatus}</td>"; $content[] = "\t<td style='padding:3px 8px;border:1px solid silver;'>{$newStatus}</td>"; $content[] = "</tr>"; //plain content $content_plain[] = "\t * " . $Subnets->transform_to_dotted($change['ip_addr']) . " (" . $Subnets->transform_to_dotted($subnet->subnet) . "/" . $subnet->mask . ")\r\n \t " . strip_tags($oldStatus) . " => " . strip_tags($newStatus); } $content[] = "</table>";
function displayRowAgent($agent_id) { global $curDay, $prevDay, $WTD, $MTD, $YTD, $beginWk, $endWk, $nextBizDay, $conn; global $curDay_ts, $prevDay_ts, $WTD_ts, $MTD_ts, $YTD_ts, $beginWk_ts, $endWk_ts; $empl_tbl = array(); for ($i = 0; $i < 4; $i++) { if ($agent_id == -1) { // Total Tab $query_agent = ""; } else { if ($agent_id == 15) { // Others Tab $query_agent = "\t\tWHERE\t\tsubstr(C.destination,1,9) <> 'Local/#40'"; } else { // Agent Tabs $query_agent = "\t\tINNER JOIN \ttbl_callagents as CA\t "; $query_agent .= "\t\tON substr(C.destination,12,3) = CA.ext "; $query_agent .= "\t\tWHERE CA.agent_id = '" . $agent_id . "'"; } } if ($i == 0) { $queryDate = "\t\tAND\t\tstart BETWEEN '" . $prevDay . "' and '" . $curDay . "'"; $queryDate_ts = " \tAND \tC.timestamp BETWEEN '" . $prevDay_ts . "' AND '" . $curDay_ts . "'"; $query_term_date = "AND\t\t((A.term_date is null)\n\t\t\t\t\t\t\t\tOR\t\t'" . $prevDay_ts . "' < UNIX_TIMESTAMP('A.term_date')) "; $agentScoreDate = "\tWHERE\tscore_date BETWEEN '" . $prevDay . "' and '" . $curDay . "'"; $date = "Daily"; } else { if ($i == 1) { $queryDate = "\t\tAND\t\tstart BETWEEN '" . $beginWk . "' and '" . $endWk . "'"; $queryDate_ts = " \tAND \tC.timestamp BETWEEN '" . $beginWk_ts . "' AND '" . $endWk_ts . "'"; $query_term_date = "AND\t\t((A.term_date is null)\n\t\t\t\t\t\t\t\tOR\t\t'" . $beginWk_ts . "' < UNIX_TIMESTAMP('A.term_date')) "; $agentScoreDate = "\tWHERE\tscore_date BETWEEN '" . $beginWk . "' and '" . $endWk . "'"; $date = "WTD"; } else { if ($i == 2) { $queryDate = "\t\tAND\t\tstart BETWEEN '" . $MTD . "' and '" . $curDay . "'"; $queryDate_ts = " \tAND \tC.timestamp BETWEEN '" . $MTD_ts . "' AND '" . $curDay_ts . "'"; $query_term_date = "AND\t\t((A.term_date is null)\n\t\t\t\t\t\t\t\tOR\t\t'" . $MTD_ts . "' < UNIX_TIMESTAMP('A.term_date')) "; $agentScoreDate = "\tWHERE\tscore_date BETWEEN '" . $MTD . "' and '" . $curDay . "'"; $date = "MTD"; } else { if ($i == 3) { $queryDate = "\t\tAND\t\tstart BETWEEN '" . $YTD . "' and '" . $curDay . "'"; $queryDate_ts = " \tAND \tC.timestamp BETWEEN '" . $YTD_ts . "' AND '" . $curDay_ts . "'"; $query_term_date = "AND\t\t((A.term_date is null)\n\t\t\t\t\t\t\t\tOR\t\t'" . $YTD_ts . "' < UNIX_TIMESTAMP('A.term_date')) "; $agentScoreDate = "\tWHERE\tscore_date BETWEEN '" . $YTD . "' and '" . $curDay . "'"; $date = "YTD"; } } } } $query = "\t\tSELECT\t\tcount(*), sum(C.duration)/count(*) "; $query .= "\t\tFROM usi_tbl_callqueue as C "; $query .= "\t\tINNER JOIN usi_tbl_activequeue as Q "; $query .= "\t\tON C.queue_label = Q.client_queue "; $query .= "\t\tJOIN tbl_callagents as A "; $query .= "\t\tON A.ext = substr(C.destination,12,3) "; $query .= $query_agent; $query .= $queryDate_ts; $query .= $query_term_date; $query .= "\t\tAND call_type <> 'CONNECT' "; $query .= "\t\tAND call_type <> 'TRANSFER' "; $query .= "\t\tAND Q.active = '1' "; $query .= "\t\tAND C.end_type <> '0' "; //echo "I: ".$i; //echo $query; $result = mysql_query($query) or die('Query failed: ' . $query . mysql_info()); $rows = mysql_fetch_array($result, MYSQL_NUM); $ib_off = $rows[0]; $ib_aht = $rows[1]; if ($agent_id == -1) { // Totals Tabs $query_agent_ob = "\t\tINNER JOIN\ttbl_callagents as A\n\t\t\t\t\t\t\t\t\tON C.clid like concat('%',A.firstName, ' ', A.lastName, '%')\n\t\t\t\t\t\t\t\t\tWHERE substring(dst,1,2) = '51' \n\t\t\t\t\t\t\t\t\tAND\t\t\t(A.agent_id <> '16'\n\t\t\t\t\t\t\t\t\tOR\t\t\t A.agent_id <> '15') \n\t\t\t\t\t\t\t\t\tAND \tanswer <> '0000-00-00 00:00:00'\t\n\t\t\t\t\t\t\t\t\t"; } else { if ($agent_id == 15) { // Others Tabs $query_agent_ob = "\t\tLEFT OUTER JOIN \ttbl_callagents as A"; $query_agent_ob .= "\tON \t\tConcat('\"',A.firstName, ' ', A.lastName, '\"') = trim(TRAILING '<2122138375>' FROM C.clid)"; $query_agent_ob .= "\tWHERE \t\tsubstring(dst,1,2) = '51'"; $query_agent_ob .= "\tAND \t\tA.agent_id is null "; $query_agent_ob .= "\tAND \t\t\tanswer <> '0000-00-00 00:00:00' "; } else { // Agent Tabs $query_agent_ob = "\t\tINNER JOIN tbl_callagents as A"; $query_agent_ob .= "\tON C.clid like concat('%',A.firstName, ' ', A.lastName, '%')"; $query_agent_ob .= "\tWHERE substring(dst,1,2) = '51'"; $query_agent_ob .= "\tAND \tA.agent_id = '" . $agent_id . "'"; $query_agent_ob .= "\tAND \tanswer <> '0000-00-00 00:00:00'"; } } $query_ob = "\tSELECT count(*),sum(UNIX_TIMESTAMP(C.end)-UNIX_TIMESTAMP(C.answer))/count(*)"; $query_ob .= "\tFROM usi_tbl_callLog as C "; $query_ob .= $query_agent_ob; $query_ob .= $queryDate; $result_ob = mysql_query($query_ob) or die('Query failed: ' . $query_ob . mysql_info()); $rows = mysql_fetch_array($result_ob, MYSQL_NUM); $ob = $rows[0]; $query_ob_aht = "\tSELECT count(*),sum(C.duration)/count(*)"; $query_ob_aht .= "\tFROM usi_tbl_callLog as C "; $query_ob_aht .= $query_agent_ob; $query_ob_aht .= $queryDate; $query_ob_aht .= "\tAND\t\t\tC.answer <> '0000-00-00 00:00:00'"; $result_ob_aht = mysql_query($query_ob_aht) or die('Query failed: ' . $query_ob_aht . mysql_info()); $rows_aht = mysql_fetch_array($result_ob_aht, MYSQL_NUM); $ob_aht = $rows_aht[1]; // ********************************* Call Quality Score Data ********************************** if ($agent_id == -1) { $qry_mon_where = " "; } else { $qry_mon_where = "\tAND\t\tagent_id = '" . $agent_id . "' "; } $query_calls_mon = "\tSELECT\t\tcount(*)"; $query_calls_mon .= "\tFROM\t\ttbl_agentscores2"; $query_calls_mon .= $agentScoreDate; $query_calls_mon .= $qry_mon_where; //echo $query_calls_mon."<br>"; $result_calls_mon = mysql_query($query_calls_mon) or die('Query failed: ' . $query_calls_mon . mysql_info()); $rows_calls_mon = mysql_fetch_array($result_calls_mon, MYSQL_NUM); $calls_mon = $rows_calls_mon[0]; // ********************************* Call Quality Average Score ****************************** $query_calls_mon_avg = "\tSELECT\t\tsum(score)/count(*)"; $query_calls_mon_avg .= "\tFROM\t\ttbl_agentscores2"; $query_calls_mon_avg .= $agentScoreDate; $query_calls_mon_avg .= $qry_mon_where; $result_calls_mon_avg = mysql_query($query_calls_mon_avg) or die('Query failed: ' . $query_calls_mon_avg . mysql_info()); $rows_calls_mon_avg = mysql_fetch_array($result_calls_mon_avg, MYSQL_NUM); $avg_qual = $rows_calls_mon_avg[0]; if ($ib_off == NULL) { $ib_off = 0; } if ($ib_aht == NULL) { $ib_aht = sec2hms(0); } else { $ib_aht = sec2hms($ib_aht); } if ($ob == NULL) { $ob = 0; } if ($ob_aht == NULL) { $ob_aht = sec2hms(0); } else { $ob_aht = sec2hms($ob_aht); } if ($calls_mon == NULL) { $calls_mon = 0; } if ($avg_qual == NULL) { $avg_qual = 0; } // Store all info in array if ($i == 0) { // Daily $empl_tbl["Daily"]["IB_Offered"] = $ib_off; $empl_tbl["Daily"]["IB_AHT"] = $ib_aht; $empl_tbl["Daily"]["OB"] = $ob; $empl_tbl["Daily"]["OB_AHT"] = $ob_aht; $empl_tbl["Daily"]["CA_Monitored"] = $calls_mon; $empl_tbl["Daily"]["Avg_Qual_Score"] = $avg_qual; } else { if ($i == 1) { // WTD $empl_tbl["WTD"]["IB_Offered"] = $ib_off; $empl_tbl["WTD"]["IB_AHT"] = $ib_aht; $empl_tbl["WTD"]["OB"] = $ob; $empl_tbl["WTD"]["OB_AHT"] = $ob_aht; $empl_tbl["WTD"]["CA_Monitored"] = $calls_mon; $empl_tbl["WTD"]["Avg_Qual_Score"] = $avg_qual; } else { if ($i == 2) { // MTD $empl_tbl["MTD"]["IB_Offered"] = $ib_off; $empl_tbl["MTD"]["IB_AHT"] = $ib_aht; $empl_tbl["MTD"]["OB"] = $ob; $empl_tbl["MTD"]["OB_AHT"] = $ob_aht; $empl_tbl["MTD"]["CA_Monitored"] = $calls_mon; $empl_tbl["MTD"]["Avg_Qual_Score"] = $avg_qual; } else { if ($i == 3) { // YTD $empl_tbl["YTD"]["IB_Offered"] = $ib_off; $empl_tbl["YTD"]["IB_AHT"] = $ib_aht; $empl_tbl["YTD"]["OB"] = $ob; $empl_tbl["YTD"]["OB_AHT"] = $ob_aht; $empl_tbl["YTD"]["CA_Monitored"] = $calls_mon; $empl_tbl["YTD"]["Avg_Qual_Score"] = $avg_qual; } } } } } $spanDate_id = 0; foreach ($empl_tbl as $key => $val) { $query = "\tINSERT INTO `usi_misc`.`usi_flashagent_tbl3` \n\t\t\t\t\t(\t`runDate`, \n\t\t\t\t\t\t`agent_id`, \n\t\t\t\t\t\t`spanDate_id`, \n\t\t\t\t\t\t`ib_offered`, \n\t\t\t\t\t\t`ib_aht`, \n\t\t\t\t\t\t`outbound`, \n\t\t\t\t\t\t`ob_aht`, \n\t\t\t\t\t\t`call_monitored`, \n\t\t\t\t\t\t`avg_qual_score`) \n\t\t\t\t\tVALUES (\n\t\t\t\t\t\t'" . date("Y-m-d") . "', \n\t\t\t\t\t\t'" . $agent_id . "', \n\t\t\t\t\t\t'" . $spanDate_id . "', \n\t\t\t\t\t\t'" . number_format($val["IB_Offered"], 0, '.', '') . "', \n\t\t\t\t\t\t'" . $val["IB_AHT"] . "', \n\t\t\t\t\t\t'" . number_format($val["OB"], 0, '.', '') . "', \n\t\t\t\t\t\t'" . $val["OB_AHT"] . "', \n\t\t\t\t\t\t'" . number_format($val["CA_Monitored"], 0, '.', '') . "', \n\t\t\t\t\t\t'" . number_format($val["Avg_Qual_Score"], 2, '.', '') . "');"; //echo $query."<br><br>"; $result = mysql_query($query) or die('Query failed: ' . $query . mysql_info()); $spanDate_id++; } }