function validar() { $errores = false; echo "<script type='text/javascript'>"; echo "with (window.parent.document) {"; echo "var errores = '';"; if ($_POST["texto"] == "") { echo "errores+= '- El campo Texto es obligatorio.<br />';"; $errores = true; } if ($_POST["fileImg"] == "") { echo "errores+= '- El campo Imagen es obligatorio.<br />';"; $errores = true; } if ($_POST["vigenciaDesde"] == "") { echo "errores+= '- El campo Vigencia Desde es obligatorio.<br />';"; $errores = true; } elseif (!isFechaValida($_POST["vigenciaDesde"])) { echo "errores+= '- El campo Vigencia Desde debe ser una fecha válida.<br />';"; $errores = true; } if ($_POST["vigenciaHasta"] == "") { echo "errores+= '- El campo Vigencia Hasta es obligatorio.<br />';"; $errores = true; } elseif (!isFechaValida($_POST["vigenciaHasta"])) { echo "errores+= '- El campo Vigencia Hasta debe ser una fecha válida.<br />';"; $errores = true; } if (dateDiff($_POST["vigenciaHasta"], $_POST["vigenciaDesde"]) > 0) { echo "errores+= '- La Vigencia Hasta debe ser mayor a la Vigencia Desde.<br />';"; $errores = true; } if ($errores) { echo "body.style.cursor = 'default';"; echo "getElementById('btnGuardar').style.display = 'inline';"; echo "getElementById('imgProcesando').style.display = 'none';"; echo "getElementById('errores').innerHTML = errores;"; echo "getElementById('divErroresForm').style.display = 'block';"; echo "getElementById('foco').style.display = 'block';"; echo "getElementById('foco').focus();"; echo "getElementById('foco').style.display = 'none';"; } else { echo "getElementById('divErroresForm').style.display = 'none';"; } echo "}"; echo "</script>"; return !$errores; }
function getPengaduanSatker($satker = false) { if ($satker) { $cond = " WHERE disposisi = '{$satker}'"; } else { $cond = ""; } $sql = "SELECT *, CONVERT(VARCHAR(19),tanggal,106) AS tanggalformat FROM bsn_pengaduan {$cond}"; $res = $this->fetch($sql, 1); foreach ($res as $key => $val) { $sql = "SELECT name,email,hp FROM bsn_users WHERE idUser = '******'idUser']}'"; $user = $this->fetch($sql, 0); $res[$key]['nameUser'] = $user['name']; $res[$key]['emailUser'] = $user['email']; $res[$key]['hpUser'] = $user['hp']; $sisaWaktu = $this->getStdWaktu(); if ($val['status'] == 4) { $res[$key]['sisaWaktu'] = "-"; } else { $endDate = date('Y-m-d', strtotime($val['tanggal'] . ' +' . $sisaWaktu['value'] . ' day')); $nowDate = date("Y-m-d"); $res[$key]['sisaWaktu'] = dateDiff($nowDate, $endDate); } } return $res; }
public function should_refresh() { $last_refresh = Settings::get('last_notification_refresh'); if (empty($last_refresh) or dateDiff($last_refresh, NULL, 'day') > 0) { return TRUE; } return FALSE; }
function dobToAgeNumber($dob) { # Converts date of birth to age in years without appendin string " years" $today = date("m-d-Y"); $dob_array = explode("-", $dob); # gives Y-m-d $dob_formatted = $dob_array[1] . "-" . $dob_array[2] . "-" . $dob_array[0]; $diff = round(dateDiff("-", $today, $dob_formatted), 0); return $diff; }
/** * If the two teams have both played recently * Then reduce the likelyhood that they will hit the over * * @see StrategyAbstract::applyStrategy() */ public function applyStrategy() { // Find all the most recent game played between the two teams $lastGame = FindLastGamePlayed($this->game->homeTeam, $this->game->awayTeam); if (!isset($lastGame) || dateDiff($lastGame, $this->game) > '24 hours') { return new Exception('No recent game between the two teams'); } // There was a recent game, so return true return 1; }
function checkParamValue($paramValue, $pName) { global $root_path, $patient; $txt = ''; $dobDiff = dateDiff("-", date("Y-m-d"), $patient['date_birth']); switch ($dobDiff) { case $dobDiff >= 1 and $dobDiff <= 30: if ($pName->fields['hi_bound_n'] && $paramValue > $pName->fields['hi_bound_n']) { $txt .= '<img ' . createComIcon($root_path, 'arrow_red_up_sm.gif', '0', '', TRUE) . '> <font color="red">' . htmlspecialchars($paramValue) . '</font>'; } elseif ($paramValue < $pName->fields['lo_bound_n']) { $txt .= '<img ' . createComIcon($root_path, 'arrow_red_dwn_sm.gif', '0', '', TRUE) . '> <font color="red">' . htmlspecialchars($paramValue) . '</font>'; } else { $txt .= htmlspecialchars($paramValue); } break; case $dobDiff >= 31 and $dobDiff <= 360: if ($pName->fields['hi_bound_y'] && $paramValue > $pName->fields['hi_bound_y']) { $txt .= '<img ' . createComIcon($root_path, 'arrow_red_up_sm.gif', '0', '', TRUE) . '> <font color="red">' . htmlspecialchars($paramValue) . '</font>'; } elseif ($paramValue < $pName->fields['lo_bound_y']) { $txt .= '<img ' . createComIcon($root_path, 'arrow_red_dwn_sm.gif', '0', '', TRUE) . '> <font color="red">' . htmlspecialchars($paramValue) . '</font>'; } else { $txt .= htmlspecialchars($paramValue); } break; case $dobDiff >= 361 and $dobDiff <= 5040: if ($pName->fields['hi_bound_c'] && $paramValue > $pName->fields['hi_bound_c']) { $txt .= '<img ' . createComIcon($root_path, 'arrow_red_up_sm.gif', '0', '', TRUE) . '> <font color="red">' . htmlspecialchars($paramValue) . '</font>'; } elseif ($paramValue < $pName->fields['lo_bound_c']) { $txt .= '<img ' . createComIcon($root_path, 'arrow_red_dwn_sm.gif', '0', '', TRUE) . '> <font color="red">' . htmlspecialchars($paramValue) . '</font>'; } else { $txt .= htmlspecialchars($paramValue); } break; case $dobDiff > 5040: if ($patient['sex'] == 'm') { if ($pName->fields['hi_bound'] && $paramValue > $pName->fields['hi_bound']) { $txt .= '<img ' . createComIcon($root_path, 'arrow_red_up_sm.gif', '0', '', TRUE) . '> <font color="red">' . htmlspecialchars($paramValue) . '</font>'; } elseif ($paramValue < $pName->fields['lo_bound']) { $txt .= '<img ' . createComIcon($root_path, 'arrow_red_dwn_sm.gif', '0', '', TRUE) . '> <font color="red">' . htmlspecialchars($paramValue) . '</font>'; } else { $txt .= htmlspecialchars($paramValue); } } elseif ($patient['sex'] == 'f') { if ($pName->fields['hi_bound_f'] && $paramValue > $pName->fields['hi_bound_f']) { $txt .= '<img ' . createComIcon($root_path, 'arrow_red_up_sm.gif', '0', '', TRUE) . '> <font color="red">' . htmlspecialchars($paramValue) . '</font>'; } elseif ($paramValue < $pName->fields['lo_bound_f']) { $txt .= '<img ' . createComIcon($root_path, 'arrow_red_dwn_sm.gif', '0', '', TRUE) . '> <font color="red">' . htmlspecialchars($paramValue) . '</font>'; } else { $txt .= htmlspecialchars($paramValue); } } break; } return $txt; }
function get_time_past($created_date) { $differences = dateDiff(time(), $created_date); if (isset($differences["year"]) || isset($differences["years"])) { if (isset($differences["year"])) { return $differences["year"] . " year"; } if (isset($differences["years"])) { return $differences["years"] . " years"; } } if (isset($differences["month"]) || isset($differences["months"])) { if (isset($differences["month"])) { return $differences["month"] . " month"; } if (isset($differences["months"])) { return $differences["months"] . " months"; } } if (isset($differences["day"]) || isset($differences["days"])) { if (isset($differences["day"])) { return $differences["day"] . " day"; } if (isset($differences["days"])) { return $differences["days"] . " days"; } } if (isset($differences["hour"]) || isset($differences["hours"])) { if (isset($differences["hour"])) { return $differences["hour"] . " hour"; } if (isset($differences["hours"])) { return $differences["hours"] . " hours"; } } if (isset($differences["minute"]) || isset($differences["minutes"])) { if (isset($differences["minute"])) { return $differences["minute"] . " minute"; } if (isset($differences["minutes"])) { return $differences["minutes"] . " minutes"; } } if (isset($differences["second"]) || isset($differences["seconds"])) { if (isset($differences["second"])) { return $differences["second"] . " second"; } if (isset($differences["seconds"])) { return $differences["seconds"] . " seconds"; } } }
function isMileyLegal($datetime = false, $rss = false) { global $legalage; if (!$datetime) { $datetime = currentDateTime(); } $id = $datetime->format('Ymd'); $timestamp1 = $datetime->format('U'); $timestamp2 = $legalage->format('U'); $legal = dateComp($timestamp1, $timestamp2); switch ($legal) { case 1: $title = "NO"; $descr = "Miley will be legal in "; break; case 2: $title = "YES"; $descr = "Miley has been legal for "; break; case 3: $title = "YES"; $descr = "Miley became legal today!"; $result = array($id, $title, $descr); break; default: return false; } list($y, $m, $d, $h, $i, $s, $e) = dateDiff($timestamp1, $timestamp2); if ($rss) { $d++; } $short = $descr . ($y == 0 ? "" : "{$y} year" . ($y == 1 ? "" : "s") . ", ") . ($m == 0 ? "" : "{$m} month" . ($m == 1 ? "" : "s") . ", ") . ($d == 0 ? "" : "{$d} day" . ($d == 1 ? "" : "s") . ", "); $long = $short . ($h == 0 ? "" : "{$h} hour" . ($h == 1 ? "" : "s") . ", ") . ($i == 0 ? "" : "{$i} minute" . ($i == 1 ? "" : "s") . ", "); $descr = $rss ? $short : $long; if (strrpos($descr, ",") !== false) { $descr = substr_replace($descr, ".", strrpos($descr, ",")); } if (strrpos($descr, ",") !== false) { $descr = substr_replace($descr, " and", strrpos($descr, ","), 1); } $result = array($id, $title, $descr); return $result; }
function printLastLoc($unitname, $expand) { $result = cachedSQL("SELECT * FROM `" . $unitname . "` order BY time DESC LIMIT 1"); if ($row = mysql_fetch_array($result)) { do { # CALCULATE TIME DIFFERENCE $today = mktime(); $stamp = strtotime($row['time']); dateDiff($today, $stamp); if ($expand == "1") { echo ' (<a href="javascript:GEvent.trigger(exml.gmarkers[0],\'click\')">show on map</a>)'; } if ($expand == "newest") { echo ' (<a href="livemap.php?newest">show on map</a>)'; } echo "<br>"; echo "<b>Message:</b> " . $row['type'] . " <b>Time:</b> " . $row['time'] . " <b>Position:</b> " . $row['lng'] . ", " . $row['lat']; } while ($row = mysql_fetch_array($result)); } else { print "Sorry, no records were found!"; } }
function ValidarFechas($fechaIngreso, $fechaInicio) { // $fechaIngreso = formatDateSeparador("d/m/Y", $fechaIngreso, '-' ); // $fechaInicio = formatDateSeparador("d/m/Y", $fechaInicio, '-' ); // date_format($fechaInicio,"d/m/Y"); if (!isFechaValida($fechaIngreso)) { return 'Fecha Ingreso Invalida ' . $fechaIngreso; } if (!isFechaValida($fechaInicio)) { return 'Fecha Inicio Invalida ' . $fechaInicio; } $dias = dateDiff($fechaIngreso, $fechaInicio); if ($dias < 0) { return 'Fecha Inicio de la exposicion, Debe ser mayor/igual a la fecha de Ingreso a la empresa. '; } $hoy = date("d/m/Y"); $dias = dateDiff($fechaInicio, $hoy); if ($dias < 0) { return 'Fecha Inicio de la exposicion, Debe ser menor/igual a la fecha actual. '; } return ''; }
/** * Function to get the approximate difference between two date time values as string */ function dateDiffAsString($d1, $d2) { global $currentModule; $dateDiff = dateDiff($d1, $d2); $years = $dateDiff['years']; $months = $dateDiff['months']; $days = $dateDiff['days']; $hours = $dateDiff['hours']; $minutes = $dateDiff['minutes']; $seconds = $dateDiff['seconds']; if ($years > 0) { $diffString = "{$years} " . getTranslatedString('LBL_YEARS', $currentModule); } elseif ($months > 0) { $diffString = "{$months} " . getTranslatedString('LBL_MONTHS', $currentModule); } elseif ($days > 0) { $diffString = "{$days} " . getTranslatedString('LBL_DAYS', $currentModule); } elseif ($hours > 0) { $diffString = "{$hours} " . getTranslatedString('LBL_HOURS', $currentModule); } elseif ($minutes > 0) { $diffString = "{$minutes} " . getTranslatedString('LBL_MINUTES', $currentModule); } else { $diffString = "{$seconds} " . getTranslatedString('LBL_SECONDS', $currentModule); } return $diffString; }
$scielo->loadPreviousUrlWhichContainsOldPid(); $CACHE_STATUS = $scielo->_def->getKeyValue("CACHE_STATUS"); $MAX_DAYS = $scielo->_def->getKeyValue("MAX_DAYS"); $MAX_SIZE = $scielo->_def->getKeyValue("MAX_SIZE"); $DIVULGA = $scielo->_def->getKeyValue("ENABLE_DIVULGACAO"); if ($CACHE_STATUS == 'on' && $MAX_DAYS > 0) { $filenamePage = $scielo->GetPageFile(); } $filenamePage = ""; $pageContent = ""; $GRAVA = false; if ($filenamePage) { if (file_exists($filenamePage)) { echo "<!-- EXISTE {$filenamePage} -->"; $lastChange = date("F j Y g:i:s", filemtime($filenamePage)); $diff = dateDiff($interval = "d", $lastChange, date("F j Y g:i:s")); if ($diff <= $MAX_DAYS) { echo "<!-- dentro do prazo {$time} -->"; $fp = fopen($filenamePage, "r"); if ($fp) { $pageContent = fread($fp, filesize($filenamePage)); $pageContent .= "\n" . '<!-- Cache File name: ' . $filenamePage . '-->'; fclose($fp); } } else { echo "<!-- fora do prazo {$time} -->"; $GRAVA = true; } } else { /* tratar quando não existe espaço:
function get_subtasks($parent, $level = 1, $type = "", $where = "", $orderby = "", $bg = "", $preview = false) { //echo "$orderby<br />"; global $db, $slave, $priorities, $parent_task_id, $expand_collapse, $target_path, $total_tasks; if ($orderby != "") { $parent = null; } //if (!is_null($parent)) echo "parent is $parent"; $expand_collapse = array("expand", "collapse"); $creator_id = $_SESSION['user_id']; if ($_SESSION['project_user_id']) { $creator_id = $_SESSION['project_user_id']; } if (($_GET['today'] or $_GET['user_id'] or $_GET['week']) and ($_GET['action'] != "complete" and $_GET['action'] != "log")) { $where2 = "LEFT OUTER JOIN Task_Acknowledgement as A ON T.Task_ID=A.Task_ID WHERE (A.Accepted=1 OR T.Creator_ID=" . $creator_id . ") AND "; } else { $where2 = "LEFT OUTER JOIN Task_Acknowledgement as A ON T.Task_ID=A.Task_ID WHERE "; } //$where2="WHERE "; if (!is_null($parent)) { if (strlen($where) == 4) { $where = ""; } if ($parent === 0) { if ($_GET['assign']) { $where2 = $where2 . "(Parent_Task_ID={$parent} OR Parent_Task_ID NOT IN (SELECT Task_ID FROM Tasks as T2 LEFT OUTER JOIN User_Departments as D2 ON T2.Department_ID=D2.Department_ID LEFT OUTER JOIN Users as L2 ON D2.User_ID=L2.User_ID WHERE " . str_replace(".", "2.", substr($where, 4)) . ")) {$where}"; } else { $where2 = $where2 . "(Parent_Task_ID={$parent} OR Parent_Task_ID NOT IN (SELECT Task_ID FROM Tasks as T2 LEFT OUTER JOIN User_Departments as D2 ON T2.Department_ID=D2.Department_ID LEFT OUTER JOIN Users as U2 ON D2.User_ID=U2.User_ID WHERE " . str_replace(".", "2.", substr($where, 4)) . ")) {$where}"; } } else { $where2 = $where2 . "Parent_Task_ID={$parent} {$where}"; } } else { $where2 = $where2 . substr($where, 4); } //$where2=$where2."T.Task_ID NOT IN (SELECT Parent_Task_ID FROM Tasks) $where"; //if (is_null($parent) AND $subtasks[$t]['Parent_Task_ID']>0) if ($type == "complete" and $orderby == "") { $orderby = "Log_date DESC, Task_Name"; } //else if ($orderby=="" and $parent==0) $orderby="Task_Name"; //else if ($orderby!="") $orderby=$orderby." Task_Name"; if ($orderby and !strstr($orderby, "Task_Name")) { $orderby = "ORDER BY " . $orderby . " Task_Name"; } if ($orderby and !strstr($orderby, "ORDER BY")) { $orderby = "ORDER BY " . $orderby; } if (!$orderby and $parent == 0) { $orderby2 = "ORDER BY Finish_Date IS NULL, Finish_Date"; } if (!strstr($where, "L.User_ID")) { $log = "AND L.Log_Progress=100"; } if (strstr($orderby, "Request_Username")) { $orderby = str_replace("Request_Username", "RL.Username", $orderby); $query = "SELECT T.*, Project_Name, Log_Date, AD.Department_Name as Affected_Department_Name, RL.Username FROM Login as RL, Users as U, Tasks as T LEFT OUTER JOIN Departments as AD ON T.Affected_Department=AD.Department_ID LEFT OUTER JOIN Projects as P ON T.Project_ID=P.Project_ID LEFT OUTER JOIN Task_Logs as L ON T.Task_ID=L.Task_ID {$log} LEFT OUTER JOIN User_Departments as D ON T.Department_ID=D.Department_ID LEFT OUTER JOIN Departments as M ON D.Department_ID=M.Department_ID LEFT OUTER JOIN Login as G ON T.User_ID=G.User_ID {$where2} AND U.User_ID=T.Request_User_ID AND U.User_ID=RL.User_ID GROUP BY T.Task_ID {$orderby} {$orderby2}"; //echo $query; } elseif (strstr($orderby, "Username")) { $query = "SELECT T.*, Project_Name, Log_Date, AD.Department_Name as Affected_Department_Name FROM Tasks as T LEFT OUTER JOIN Departments as AD ON T.Affected_Department=AD.Department_ID LEFT OUTER JOIN Projects as P ON T.Project_ID=P.Project_ID LEFT OUTER JOIN Task_Logs as L ON T.Task_ID=L.Task_ID {$log} LEFT OUTER JOIN User_Departments as D ON T.Department_ID=D.Department_ID LEFT OUTER JOIN Departments as M ON D.Department_ID=M.Department_ID LEFT OUTER JOIN Users as U ON D.User_ID=U.User_ID LEFT OUTER JOIN Login as G ON T.User_ID=G.User_ID {$where2} GROUP BY T.Task_ID {$orderby} {$orderby2}"; } else { $query = "SELECT T.*, Project_Name, Log_Date, AD.Department_Name as Affected_Department_Name FROM Tasks as T LEFT OUTER JOIN Departments as AD ON T.Affected_Department=AD.Department_ID LEFT OUTER JOIN Projects as P ON T.Project_ID=P.Project_ID LEFT OUTER JOIN Task_Logs as L ON T.Task_ID=L.Task_ID {$log} LEFT OUTER JOIN User_Departments as D ON T.Department_ID=D.Department_ID LEFT OUTER JOIN Users as U ON D.User_ID=U.User_ID {$where2} GROUP BY T.Task_ID {$orderby} {$orderby2}"; } //echo $query; //exit; $subtasks = $slave->select($query); //where parents are not assigned to user if (is_null($parent)) { $query = "SELECT T.*, Project_Name, Log_Date, AD.Department_Name as Affected_Department_Name FROM Tasks as T LEFT OUTER JOIN Departments as AD ON T.Affected_Department=AD.Department_ID LEFT OUTER JOIN Projects as P ON T.Project_ID=P.Project_ID LEFT OUTER JOIN Task_Logs as L ON T.Task_ID=L.Task_ID {$log} LEFT OUTER JOIN User_Departments as D ON T.Department_ID=D.Department_ID LEFT OUTER JOIN Users as U ON D.User_ID=U.User_ID {$where2} GROUP BY T.Task_ID {$orderby} {$orderby2}"; } /* $query="SELECT T.*, Project_Name, Log_Date FROM Tasks as T LEFT OUTER JOIN Projects as P ON T.Project_ID=P.Project_ID LEFT OUTER JOIN Task_Logs as L ON T.Task_ID=L.Task_ID $log LEFT OUTER JOIN User_Departments as D ON T.Department_ID=D.Department_ID LEFT OUTER JOIN Users as U ON D.User_ID=U.User_ID $where2 AND Finish_Date IS NULL GROUP BY T.Task_ID ORDER BY $orderby Task_Name"; $subtasks2 = $slave->select($query); if ($subtasks2) { if ($subtasks) $subtasks=array_merge($subtasks,$subtasks2); else $subtasks=$subtasks2; } */ //if ($_SESSION['user_id']==6) print_r($subtasks); $expand = true; if ($level == 0 and $type != "option") { if ($type == "date") { echo "<form action=\"tasks.php\" method=\"GET\" onSubmit=\"this.today.value=this.today.value.replace(/(\\d\\d)\\/(\\d\\d)\\/(\\d\\d\\d\\d)/, '\$3-\$1-\$2')\">\n"; echo "View Date <input name=\"today\" type=\"text\" value=\"" . display_date($_GET['today']) . "\" onfocus=\"this.select();lcs(this)\" onclick=\"event.cancelBubble=true;this.select();lcs(this)\"/>"; echo "<input type=\"submit\" value=\"Go\">"; echo "</form>\n"; } if ($type != "complete") { echo "<div id=\"expand\">"; $expand = false; if ($_SESSION['expand']['all'] == 1) { echo "<a href=\"" . clean_url($expand_collapse) . "expand=none\"><img src=\"" . CDN . "img/collapse.png\" alt=\"Collapse\" /></a>"; } else { echo "<a href=\"" . clean_url($expand_collapse) . "expand=all\"><img src=\"" . CDN . "img/expand.png\" alt=\"Expand\" /></a>"; } echo " all</div>\n"; } } if ($subtasks) { if ($level == 0 and $type != "option") { echo "<table><tr>"; //if ($type!="complete") echo "<th><a href=".get_order_url('T.Progress',$dir).">Work</a></th>"; echo "<th> </th>"; echo "<th><a href=" . get_order_url('T.Priority', $dir) . ">Severity</a></th>"; echo "<th><a href=" . get_order_url('T.Task_ID', $dir) . ">ID</a></th>"; echo "<th><a href=" . get_order_url('Task_Name', $dir) . ">Task</a></th>"; echo "<th><a href=" . get_order_url('Project_Name', $dir) . ">Project</a></th>"; echo "<th><a href=" . get_order_url('Affected_Department_Name', $dir) . ">Department</a></th>"; echo "<th>File</th>"; echo "<th><a href=" . get_order_url('Username', $dir) . ">Assigned</a></th>"; echo "<th>Last</th>"; echo "<th><a href=" . get_order_url('Request_Username', $dir) . ">Request</a></th>"; echo "<th nowrap><a href=" . get_order_url('T.Request_Date', $dir) . ">Req Date</a></th>"; if ($type == "complete") { echo "<th><a href=" . get_order_url('L.Log_Date', $dir) . ">Completed</a></th>"; } else { echo "<th><a href=" . get_order_url('T.Finish_Date', $dir) . ">Due</a></th>"; } if ($type != "complete") { echo "<th>Days</th>"; } echo "</tr>\n"; } $space = str_repeat(' ', $level); $ptid = 0; for ($t = 0; $t < count($subtasks); $t++) { $total_tasks[$priorities[$subtasks[$t]['Priority']]['Name']]++; if ($type != "option" and $type != "complete" and (is_null($parent) or $parent === 0) and $subtasks[$t]['Parent_Task_ID'] > 0 and $subtasks[$t]['Parent_Task_ID'] != $ptid) { $ptid = $subtasks[$t]['Parent_Task_ID']; echo "<tr {$bg} class=\"gray\">"; echo "<td> </td>"; echo "<td> </td>"; echo "<td> </td>"; echo "<td colspan=\"10\"><small>"; get_parent($ptid, true); echo "</small></td>"; echo "</tr>\n"; } else { $ptid = $subtasks[$t]['Parent_Task_ID']; } $small_img = $use_file = ""; $expand = false; if ($preview == true or !$_SESSION['expand'] or $_SESSION['expand']['all'] == 1 and (!isset($_SESSION['expand'][$subtasks[$t]['Task_ID']]) or $_SESSION['expand'][$subtasks[$t]['Task_ID']] != 0) or $_SESSION['expand']['all'] == 0 and $_SESSION['expand'][$subtasks[$t]['Task_ID']] == 1) { $expand = true; } if ($type == "option") { echo "<option value=\"" . $subtasks[$t]['Task_ID'] . "\""; if ($subtasks[$t]['Task_ID'] == $parent_task_id) { echo " selected"; } echo ">" . $space . $subtasks[$t]['Task_Name'] . "</option>\n"; } else { $num_sub = 0; $percent_sub = $subtasks[$t]['Progress']; if ($type == "complete") { $finish_date = $subtasks[$t]['Log_Date']; } else { $finish_date = $subtasks[$t]['Finish_Date']; } //if (!is_null($parent)) list($num_sub, $percent_sub, $finish_date) = get_percent($subtasks[$t]['Task_ID'], $num_sub, $percent_sub, $finish_date); //$finish_date=$subtasks[$t]['Finish_Date']; //if ($subtasks[$t]['Log_Date']) $finish_date=$subtasks[$t]['Log_Date']; //if ($level==0) { // if ($t%2==0) $bg="class=\"highlight\""; // else $bg=""; //} //$haschildren=$slave->select("SELECT * FROM Tasks WHERE Parent_Task_ID=".$subtasks[$t]['Task_ID']); //$users=$slave->select("SELECT IF (UD.User_ID IS NOT NULL, UD.User_ID, U.User_ID) AS User_ID, Username, U.First_Name, U.Last_Name, Department_Name FROM Task_Users as T LEFT OUTER JOIN User_Departments as UD ON T.Department_ID=UD.Department_ID AND UD.User_ID=6 LEFT OUTER JOIN Departments as D ON UD.Department_ID=D.Department_ID LEFT OUTER JOIN Users as U ON T.User_ID=U.User_ID AND U.User_ID=6 LEFT OUTER JOIN Login as L ON U.User_ID=L.User_ID WHERE Task_ID=".$subtasks[$t]['Task_ID']." ORDER BY IF (Department_Name IS NOT NULL, Department_Name, Username)"); //if ((!$haschildren AND $user) OR ($haschildren)) { echo "<tr {$bg}>"; //if ($type!="complete") { echo "<td align='right' nowrap>"; if (!$preview and $num_sub > 0) { //echo number_format($percent_sub/$num_sub,1)."% "; if ($expand == true) { echo "<a href=\"" . clean_url($expand_collapse) . "collapse=" . $subtasks[$t]['Task_ID'] . "\" class=\"expand\"><img src=\"" . CDN . "img/collapse.png\" alt=\"Collapse\" /></a>"; } else { echo "<a href=\"" . clean_url($expand_collapse) . "expand=" . $subtasks[$t]['Task_ID'] . "\" class=\"expand\"><img src=\"" . CDN . "img/expand.png\" alt=\"Expand\" /></a>"; } } //else if ($type=="complete") echo $percent_sub."%"; //else echo $percent_sub."%"; //if ($percent_sub<100) echo " | <a href=\"tasks.php?work=".$subtasks[$t]['Task_ID']."\">Add</a>"; echo "</td>"; //} if ($preview) { echo "<td></td><td></td>\n"; } else { echo "<td nowrap><small>"; if ($subtasks[$t]['High_Priority']) { echo "<img src=\"" . CDN . "img/fire.png\" alt=\"High Priority\" />\n"; } echo $subtasks[$t]['Priority'] . " " . $priorities[$subtasks[$t]['Priority']]['Name'] . "</small></td>"; echo "<td><small>" . $subtasks[$t]['Task_ID'] . "</small></td>"; } echo "<td>"; if ($preview) { echo "<small>"; } if ($type != "complete" and $level > 0) { echo "{$space} - "; } elseif (is_null($parent) and $subtasks[$t]['Parent_Task_ID'] > 0) { echo "{$space} - "; //echo "…"; } echo "<a href=\"tasks.php?task_id=" . $subtasks[$t]['Task_ID'] . "\""; if ($subtasks[$t]['Parent_Task_ID'] > 0) { $pname = $slave->select("SELECT Task_Name FROM Tasks WHERE Task_ID=" . $subtasks[$t]['Parent_Task_ID']); echo "title=\"" . $pname[0]['Task_Name'] . "\""; } if ($subtasks[$t]['Progress'] == 100) { echo "><strike>" . $subtasks[$t]['Task_Name'] . "</strike></a>"; } else { echo ">" . $subtasks[$t]['Task_Name'] . "</a>"; } //get_child($subtasks[$t]['Task_ID'],true); if ($preview) { echo "</small>"; } echo "</td>"; echo "<td nowrap>"; if ($subtasks[$t]['Project_ID']) { echo "<small><a href=\"projects.php?project_id=" . $subtasks[$t]['Project_ID'] . "\">" . $subtasks[$t]['Project_Name'] . "</a></small></td>"; } else { echo "<small>Non Project Ticket</small>"; } echo "</td>"; echo "<td nowrap><small>"; if ($subtasks[$t]['Affected_Department'] > 0) { //$afdep=$slave->select("SELECT Department_Name FROM Departments WHERE Department_ID=".$subtasks[$t]['Affected_Department']); echo $subtasks[$t]['Affected_Department_Name']; } else { echo "No Department"; } echo "</small></td>"; echo "<td align=\"center\">"; /* if ($handle = opendir($target_path)) { while (false !== ($file = readdir($handle))) { if (preg_match('/^'.$subtasks[$t]['Task_ID'].'.+/',$file)) { if (strstr($file,'_sm.jpg')) $small_img=$file; else $use_file=$file; } } closedir($handle); } else echo "could not open"; if ($small_img) echo "<a href=\"${target_path}$use_file\" target=\"_blank\"><img src=\"".CDN."img/icons/111.png\" border=0 /></a>"; else if ($use_file) echo "<a href=\"${target_path}$use_file\" target=\"_blank\"><img src=\"".CDN."img/icons/3.png\" border=0 /></a>"; */ $files = $slave->select("SELECT * FROM Files as F, File_Types as T WHERE F.File_Type_ID=T.File_Type_ID AND Task_ID=" . $subtasks[$t]['Task_ID'] . " ORDER BY Image"); if ($files) { $img = $multi = ""; foreach ($files as $f) { if ($img != $f['Image'] or $img == 0) { $img = $f['Image']; if ($f['Image'] == 1) { $icon = "111.png"; echo "<a href=\"" . CDN . "img.php?id=" . $subtasks[$t]['Task_ID'] . "\" alt=\"\" target=\"_blank\"><img src=\"" . CDN . "img/icons/{$icon}\" border=0 /></a>"; } else { $icon = "3.png"; echo "<a href=\"{$target_path}" . $f['File_ID'] . "." . $f['Extention'] . "\" alt=\"\" target=\"_blank\"><img src=\"" . CDN . "img/icons/{$icon}\" border=0 /></a>"; } } elseif ($img == 1) { $mult = "+"; } } echo $mult; } echo "</td>"; echo "<td><small>"; $users = $slave->select("SELECT IF (UD.User_ID IS NOT NULL, UD.User_ID, U.User_ID) AS User_ID, Username, U.First_Name, U.Last_Name, Department_Name FROM Tasks as T LEFT OUTER JOIN User_Departments as UD ON T.Department_ID=UD.Department_ID LEFT OUTER JOIN Departments as D ON UD.Department_ID=D.Department_ID LEFT OUTER JOIN Users as U ON T.User_ID=U.User_ID LEFT OUTER JOIN Login as L ON U.User_ID=L.User_ID WHERE Task_ID=" . $subtasks[$t]['Task_ID'] . " ORDER BY IF (Department_Name IS NOT NULL, Department_Name, Username)"); if ($users) { $dep = ""; for ($u = 0; $u < count($users); $u++) { if ($u > 0 && ($users[$u]['Department_Name'] == "" or $users[$u]['Department_Name'] != $dep)) { echo ", "; } if ($users[$u]['Department_Name']) { if ($users[$u]['Department_Name'] != $dep) { $dep = $users[$u]['Department_Name']; echo $users[$u]['Department_Name']; } } else { echo $users[$u]['Username']; } } } else { echo "none"; } echo "</small></td>"; echo "<td><small>"; $users = $slave->select("SELECT U.User_ID, Username, U.First_Name, U.Last_Name FROM Tasks as T, Task_Logs as L, Users as U, Login as O WHERE T.Task_ID=L.Task_ID AND L.User_ID=U.User_ID AND O.User_ID=U.User_ID AND T.Task_ID=" . $subtasks[$t]['Task_ID'] . " ORDER BY Log_ID DESC LIMIT 1"); if (!$users) { $users = $slave->select("SELECT U.User_ID, Username, U.First_Name, U.Last_Name FROM Tasks as T, Users as U, Login as O WHERE T.Creator_ID=U.User_ID AND O.User_ID=U.User_ID AND T.Task_ID=" . $subtasks[$t]['Task_ID']); } if ($users) { echo $users[0]['Username']; } else { echo "none"; } echo "</small></td>"; echo "<td><small>"; $users = $slave->select("SELECT U.User_ID, Username, U.First_Name, U.Last_Name FROM Tasks as T, Users as U, Login as L WHERE U.User_ID=L.User_ID AND T.Request_User_ID=U.User_ID AND Task_ID=" . $subtasks[$t]['Task_ID']); if ($users) { echo $users[0]['Username']; } else { echo "none"; } echo "</small></td>"; if (display_date($subtasks[$t]['Request_Date']) == "00/00/0000" or display_date($subtasks[$t]['Request_Date']) == "NULL") { echo "<td>Not Set</td>"; } else { echo "<td><small>" . display_date($subtasks[$t]['Request_Date']) . "</small></td>"; } //echo "<td>".$subtasks[$t]['Durration']."</td>"; //$isparent=$slave->select("SELECT Task_ID FROM Tasks WHERE Parent_Task_ID=".$subtasks[$t]['Task_ID']); //if ($isparent) { // echo "<td> </td>"; //} else if (display_date($finish_date) == "NULL") { echo "<td><small>Not Set</small></td>"; if ($type != "complete") { echo "<td>-</td>"; } } else { echo "<td><small>" . display_date($finish_date) . "</small></td>"; if ($type != "complete" and $subtasks[$t]['Progress'] < 100) { echo "<td><small>" . dateDiff(date("Y-m-d"), $finish_date) . "</small></td>"; } } echo "</tr>\n"; if ($expand == true and ($_GET['today'] or $_GET['week']) and !isset($parent_task_id)) { get_subtasks($subtasks[$t]['Task_ID'], $level + 1, "", "AND T.Progress<100", "", "class=\"gray\"", true); } if ($expand == true and $parent === 0) { get_subtasks($subtasks[$t]['Task_ID'], $level + 1, "", "AND T.Progress<100 AND NOT (T.User_ID=" . $_SESSION['user_id'] . " OR U.User_ID=" . $_SESSION['user_id'] . ")", "", "class=\"gray\"", true); } //} } if ($expand === true and !is_null($parent) and !$preview) { get_subtasks($subtasks[$t]['Task_ID'], $level + 1, $type, $where, $orderby, $bg); } //if ($add=="no") //$space=str_replace('/ $/','',$space); } if ($level == 0 and $type != "option") { echo "</table>"; echo "<p>"; $totaltt = 0; foreach ($total_tasks as $tk => $tv) { echo "Total {$tk} Tasks: {$tv}<br />"; $totaltt = $totaltt + $tv; } echo "Grand Total: {$totaltt}"; echo "</p>\n"; } } else { if ($level == 0 and $type != "option") { echo "<h2 align=\"center\">No Tasks</h2>"; } return false; } }
<?php //print_r($_POST); if (isset($_POST[txtDeviceId]) && $_POST[txtDeviceId] != '') { $sql = "SELECT * FROM tb_device_insurance_info WHERE tdii_deviceId =" . $_POST[txtDeviceId]; $rows = $db->query($sql); $deviceRecord = $db->fetch_array($rows); $expDate = $deviceRecord[tdii_policyExpDate]; $remDate = $deviceRecord[tdii_alertDate]; $rmd = dateDiff($expDate, $remDate); //print_r($deviceRecord); $readonly = 'readonly="readonly"'; } function dateDiff($endDate, $beginDate) { //explode the date by "-" and storing to array $date_parts1 = explode("-", $beginDate); $date_parts2 = explode("-", $endDate); //gregoriantojd() Converts a Gregorian date to Julian Day Count $start_date = gregoriantojd($date_parts1[1], $date_parts1[2], $date_parts1[0]); $end_date = gregoriantojd($date_parts2[1], $date_parts2[2], $date_parts2[0]); return $end_date - $start_date; } if ($recordUserInfo[ci_clientType] == "Client" && $recordUserInfo[ui_isAdmin] == "1") { $devices_query = "SELECT * FROM tb_deviceinfo,tb_client_subscription WHERE tcs_isActive = 1 AND tcs_deviceId = di_id AND di_clientId =" . $_SESSION[clientID] . " AND di_status = 1 ORDER BY di_deviceName,di_deviceId ASC"; } else { if ($recordUserInfo[ci_clientType] == "Client" && $recordUserInfo[ui_isAdmin] == "0" && $recordUserInfo[ui_roleId] == "1") { $devices_query = "SELECT * FROM tb_deviceinfo,tb_client_subscription WHERE tcs_isActive = 1 AND tcs_deviceId = di_id AND di_status = 1 AND di_clientId=" . $_SESSION[clientID] . " AND di_assignedUserId = " . $_SESSION[userID] . " ORDER BY di_deviceName,di_deviceId ASC"; } } $devices_resp = mysql_query($devices_query);
$db = new db ( ); $db->connect (); $controle = $validations->validNumeric ( $_GET ['c'] ); $sql = "SELECT l.nome AS vendedor, c.txtnome AS txtnomecliente, mvm.estornado AS estorno, SUM(mvm.quant) AS quantidade, SUM(mvm.vr_total) as valortotal, mvv.vr_totalvenda FROM mv_vendas_movimento AS mvm JOIN mv_vendas AS mvv ON (mvm.controle = mvv.controle) LEFT JOIN cliente AS c ON mvm.id_cliente=c.idcliente LEFT JOIN cad_login AS l ON mvm.id_login=l.id WHERE mvm.controle='" . $controle . "' GROUP BY mvm.controle"; $query = $db->query ( $sql ); if ($db->num_rows ( $query )) { $row = $db->fetch_assoc ( $query ); $datacontrole = timestamp_converte ( $controle, 0 ); $confere_diferenca = dateDiff ( date ( 'd-m-Y', $controle ), date ( 'd-m-Y' ) ); $estornados = 0; $quantidade_produtos = ( int ) $row ['quantidade']; $sql = "SELECT SUM(mv_vendas.vr_totalvenda), SUM(quant) AS quantidade, SUM(vr_total) as valortotal FROM mv_vendas_movimento JOIN mv_vendas on (mv_vendas.controle = mv_vendas_movimento.controle) WHERE mv_vendas_movimento.controle='" . $controle . "' AND estornado=1 "; $queryestornos = $db->query ( $sql ); $rowestornos = $db->fetch_assoc ( $queryestornos ); $quantidade_produtos_estorno = ($rowestornos ['quantidade']) ? ( int ) $rowestornos ['quantidade'] : 0; ; $valor_estornos = ($rowestornos ['valortotal']) ? $rowestornos ['valortotal'] : 0; ?> <table> <?
function isDateAvailable($propertyid, $adate, $fdate) { $isbusy = 0; $bsdate = ''; $bedate = ''; try { $calendar_id = getCalendarIdFromProperty($propertyid); $stdatecp = strtotime($adate); $arrivaldate = date('Y-m-d', $stdatecp); $departuredate = date('Y-m-d', strtotime($fdate) - 86400); $row_credential = getGoogleCredential(); include_once 'src/Google_Client.php'; include_once 'src/contrib/Google_CalendarService.php'; $client = new Google_Client(); $client->setClientId($row_credential['ClientId']); $client->setClientSecret($row_credential['ClientSecret']); $client->setRedirectUri($row_credential['RedirectUri']); $client->setDeveloperKey($row_credential['DeveloperKey']); $cal = new Google_CalendarService($client); $client->setAccessToken($row_credential['AccessToken']); if ($client->getAccessToken()) { $freebusy = new Google_FreeBusyRequest(); $freebusy->setCalendarExpansionMax(1); $freebusy->setGroupExpansionMax(1); $freebusy->setItems(array(array('id' => $calendar_id))); $freebusy->setTimeMax($departuredate . 'T23:59:59Z'); $freebusy->setTimeMin($arrivaldate . 'T00:00:00Z'); $freebusy->setTimeZone(''); $fcalList = $cal->freebusy->query($freebusy); $freebusylist = $fcalList['calendars'][$calendar_id]['busy']; if (count($freebusylist)) { /* $isbusy = 1; $bsdate = $freebusylist[0]['start']; $bedate = $freebusylist[0]['end']; */ $response = $freebusylist; /* foreach($response as $respd){ $startdc = $respd['start']; $enddc = $respd['end']; $startt = strtotime($respd['start']); $endtt = strtotime($respd['end']); //1413712800 $gcsdc = date('Y-m-d',$startt); //google calendar start date compare $gcedc = date('Y-m-d',$endtt); //google calendar end date compare $gcstt = strtotime($gcsdc); $gcett = strtotime($gcedc); //strtotime of Y-m-d formate if(($stdatecp != $endtt && $stdatecp != $gcett) || ($stdatecp == $gcett && $stdatecp == $endtt) || ($gcstt == $gcett && $startt == $endtt) ){ //It is not end/checkout date $isbusy = 1; $bsdate = $respd['start']; $bedate = $respd['end']; } } */ foreach ($response as $respd) { $startdc = $respd['start']; $enddc = $respd['end']; $start_tis = strtotime($respd['start']); $end_tis = strtotime($respd['end']); //1413712800 $gc_bsd = date('Y-m-d', $start_tis); //google calendar start date compare $gc_bed = date('Y-m-d', $end_tis); //google calendar end date compare $gc_sdtis = strtotime($gc_bsd); $gc_edtis = strtotime($gc_bed); //strtotime of Y-m-d formate $gcdecmp = $gc_bed . 'T23:59:59Z'; $gcsdcmp = strstr($startdc, 'T'); $gc_etstp = strstr($enddc, 'T'); $flag = 0; if ($stdatecp != $end_tis && $stdatecp != $gc_edtis && $gcsdcmp == 'T00:00:00Z' && $gc_etstp == 'T23:59:59Z') { $flag = 1; } elseif ($stdatecp == $gc_edtis && $stdatecp == $end_tis) { $flag = 2; } elseif ($gc_sdtis == $gc_edtis && $start_tis == $end_tis) { $flag = 3; } elseif ($gc_sdtis <= $gc_edtis && $enddc == $gcdecmp) { $gd_ddswc = dateDiff($startdc, $enddc, true); if ($gd_ddswc['days'] || !$gd_ddswc['days'] && $gcsdcmp == 'T00:00:00Z') { $flag = 4; } elseif (!$gd_ddswc['days'] && ($gcsdcmp == 'T08:00:00Z' || $gcsdcmp == 'T07:00:00Z') && $gc_etstp == 'T23:59:59Z') { // T07:00:00Z for PDT $flag = 6; } } elseif ($gc_sdtis <= $gc_edtis && $gcsdcmp == $gc_etstp && $gcsdcmp != 'T00:00:00Z' && $gc_etstp != 'T00:00:00Z' && $gcsdcmp != 'T23:59:59Z' && $gc_etstp != 'T23:59:59Z') { $flag = 5; } if ($flag) { $isbusy = 1; $bsdate = $respd['start']; $bedate = $respd['end']; } } } } } catch (Exception $e) { /* echo '<pre>'; print_r($e); echo '</pre>'; exit; */ } return array('busy' => $isbusy, 'bsdate' => $bsdate, 'bedate' => $bedate); }
</tr> </thead> <tbody> <?php $x = 0; ?> @foreach($fetch as $row) <tr> <td class="text-right">{{ ++$x }}.</td> <td>{{ $row->po_no }}</td> <td>{{ $row->sup_nama }}</td> <td class="text-center">{{ to_indDate($row->po_tgl_kedatangan) }}</td> <td class="text-center">{{ to_indDate($row->pener_date) }}</td> <td class="text-center"><?php echo dateDiff($row->po_tgl_kedatangan, $row->pener_date); ?> </td> <td class="text-right"> <ul class="actions"> <li><span><i class="fa fa-angle-down"></i></span> <ul> <li><a href="{{ url('material/acceptance/show/' . $row->po_id) }}" class="view-detail"><i class="fa fa-eye"></i>Lihat detail</a></li> </ul> </li> </ul> </td> </tr> @endforeach </tbody>
</thead> </table> <div style="height:240px;overflow:auto;width:418px"> <table style="width:400px"> <colgroup> <col width="50"> <col width="50"> <col width="70"> <col width="100"> <col width="100"> <col width="100"> </colgroup> <tbody> <?php foreach ($RCD2 as $R) { $day = dateDiff($R['reservation_date'], date('Y-m-d')); if ($day <= 2 && $p == 1 && $R['reservation_date'] > 0) { $add1 = explode("||", $R[add1]); $add2 = explode("||", $R[add2]); $add3 = explode("||", $R[add3]); $add4 = explode("||", $R[add4]); $add5 = explode("||", $R[add5]); $add6 = explode("||", $R[add6]); $add7 = explode("||", $R[add7]); $add8 = explode("||", $R[add8]); $add9 = explode("||", $R[add9]); $add10 = explode("||", $R[add10]); $add11 = explode("||", $R[add11]); ?> <?php $R['mobile'] = isMobileConnect($R['agent']);
$newdate = date("m/d/Y h:i:s A"); //echo "----$newdate---"; $unidad = "D"; switch ($unidad) { case "H": $date1 = time(); $tt = explode(' ', $hora_d); $date2 = mktime(0, 0, 0, substr($fecha_d, 4, 2), substr($fecha_d, 6, 2), substr($fecha_d, 0, 4)); $newdate = date("m/d/Y h:i:s A"); // $fecha_d= ."/".."/".." ".$hora_p; // $atraso=dateDiff("/", $newdate, $fecha_d); break; case "D": $newdate = date("m/d/Y"); $fecha_d = substr($fecha_d, 4, 2) . "/" . substr($fecha_d, 6, 2) . "/" . substr($fecha_d, 0, 4); $atraso = dateDiff("/", $newdate, $fecha_d); break; } // echo "<p>Atraso= $atraso $unidad<br>"; // echo "<p>".$Mfn; $ValorCapturado = "0001X\n"; //echo "<xmp>$Mfn //".$ValorCapturado."</xmp>"; $ValorCapturado = urlencode($ValorCapturado); $IsisScript = $xWxis . "actualizar_registro.xis"; $Formato = ""; $query = "&base=trans&cipar={$db_path}" . "par/trans.par&login="******"login"] . "&Mfn=" . $Mfn . "&ValorCapturado=" . $ValorCapturado; include "../common/wxis_llamar.php"; } $cu = ""; if (isset($arrHttp["usuario"]) and !isset($cod_usuario)) {
public function applied_list($_id, $_page = 1) { header("Location: /benefit/applied_list/" . $_id . "/" . $_page); if (!$_SESSION["s"]) { $_SESSION["msg"] = "로그인 후 이용하실 수 있습니다."; header("Location: /"); } if (!$_id) { header("Location: /error_404"); } $pagesize = 10; $sort = $_REQUEST["sort"]; if (!$sort) { $sort = 1; } $res = $this->Program->get($_id); $where = "ca.program_id = " . $_id; $list = $this->Program_apply->list_out($_page, $pagesize, $where, ""); for ($i = 0; $i < sizeof($list); $i++) { $u = $this->Members->get($list[$i]["user_id"]); $list[$i]["ids"] = $u["ids"]; $list[$i]["name"] = $u["name"]; $list[$i]["memail"] = $u["email"]; $list[$i]["bio"] = $u["bio"]; $list[$i]["picture"] = $u["picture"]; } // dashboard $_sDate = str_replace(".", "-", substr($res["a_start"], 0, 10)); $_eDate = str_replace(".", "-", substr($res["a_end"], 0, 10)); if ($_eDate > date("Y-m-d")) { $_eDate = date("Y-m-d"); } $term = dateDiff($_eDate, $_sDate, "-"); // echo $term; for ($d = 0; $d < $term + 1; $d++) { $day = date("Y-m-d", strtotime("+{$d} day", strtotime($_sDate))); $d_list[$d]["day"] = str_replace("-", ".", $day); $d_list[$d]["all"] = $this->Program_apply->cnt_out("ca.date_created like '" . $day . "%' and ca.program_id = " . $_id); } $this->assigns["d_list"] = array_reverse($d_list); $this->assigns["alig"] = $_REQUEST["alig"]; $list_cnt = $this->Program_apply->cnt_out($where); $this->assigns["res"] = $res; $this->assigns["list"] = $list; $this->assigns["page"] = $_page; $this->assigns["pagesize"] = $pagesize; $this->assigns["list_cnt"] = $list_cnt; $this->assigns["list_cnt_reject"] = $this->Program_apply->cnt_out("ca.status = 2 and ca.program_id = " . $_id); $this->assigns["paging"] = get_paging_dot2($_page, $list_cnt, $pagesize); $this->assigns["sort"] = abs($sort); $this->assigns["tab"] = $_REQUEST["tab"]; $this->assigns["m_list"] = $this->Program->get_list(1, 5, "c.user_id = " . $_SESSION["s"]["id"]); $this->assigns["a_list"] = $this->Program_apply->list_all(1, 5, "ca.user_id = " . $_SESSION["s"]["id"]); if ($_SESSION["s"]["id"] != $res["user_id"]) { header("Location: /error_404"); } }
<!-- DC Columns CSS --> <link href="http://cdn.dcodes.net/2/columns/css/dc_columns.css" rel="stylesheet" type="text/css"> <!-- DC Social Icons CSS --> <link href="http://cdn.dcodes.net/2/social_icons/dc_social_icons.css" type="text/css" rel="stylesheet"> <!-- DC Flat Buttons CSS --> <link href="http://cdn.dcodes.net/2/flat_buttons/css/dc_flat_buttons.css" rel="stylesheet" type="text/css"> <h1 class="gap90" style="font-family: "Oxygen"; font-size: 33px; color: rgb(28, 28, 28);">World Music Listing</h1> <?php if ($data['musicListing']) { foreach ($data['musicListing'] as $key => $value) { $date = $value['created_date']; $today = date('Y-m-d H:i:s', time()); $olddays = dateDiff($date, $today); $art_id = $value['id']; $art_name = $value['aname']; $art_add = $value['address'] != '' ? $value['address'] . ', ' : ''; $art_city = $value['city'] != '' ? $value['city'] . ', ' : ''; $art_state = $value['state'] != '' ? $value['state'] . ', ' : ''; $art_nation = $value['country'] != '' ? $value['country'] : ''; $isExistImg = checkImagexists('../uploads/', 'artistcover_' . $art_id); $imgurl = $isExistImg ? '../uploads/artistcover_' . $art_id . '.jpg' : '../directorypage/music.png'; if (isset($value['properties'])) { $properties = $value['properties']; $genre = isset($properties['genre']) ? $properties['genre'] : ''; $field = isset($properties['field']) ? $properties['field'] : ''; $genre = is_array($genre) ? implode(', ', $genre) : ''; $field = is_array($field) ? implode(', ', $field) : ''; }
public function get_service($_id) { $_page = $_REQUEST["page"]; $_type = $_REQUEST["type"]; $_opt = $_REQUEST["opt"]; $pagesize = 10; // $where = 'status_bz = 1 and user_id_bz IS NOT NULL'; // if ($_type == 'archived') { // if ($_REQUEST["opt"]) { // $where = $where.' and category_id = '.$_REQUEST["opt"]; // $res = $this->Startup_service->get_by_cat_date($_page, $pagesize, $where, 'date_updated DESc'); // } // else { // $res = $this->Startup_service->list_('', $where, 'date_updated DESc', $_page, $pagesize); // } // } // else if ($_type == 'just_launched') { // $where = $where.' and date <= "'.date("Y.m.d").'" and date >= "'.date('Y.m.d',strtotime('-1 month')).'"'; // $where_c = 'service_id IN (' // .'SELECT sd.service_id FROM startup_service s, startup_service_date sd ' // .'WHERE s.id = sd.service_id AND '.$where.' GROUP BY sd.service_id ORDER BY DATE DESC' // .') AND category_id = '; // // result // if ($_REQUEST["opt"]) { // $where_c = 'service_id IN (' // .'SELECT sd.service_id FROM startup_service s, startup_service_date sd ' // .'WHERE s.id = sd.service_id AND '.$where.' GROUP BY sd.service_id ORDER BY DATE DESC' // .') AND category_id = '; // $res = $this->Startup_service->get_cnt_cat('', '', $where_c.$_REQUEST["opt"]); // } // else { // $res = $this->Startup_service->get_by_date_cat($_page, $pagesize, $where); // } // } // else if ($_type == 'startup') { // $res = $this->Startup_service->list_($_opt); // } // for ($r=0; $r<sizeof($res); $r++) { // if ($_type == 'just_launched') // $res[$r] = $this->Startup_service->get($res[$r]["service_id"]); // $res[$r]["cats"] = $this->Startup_service->get_category($res[$r]["id"]); // $res[$r]["s"] = $this->Startup->get($res[$r]["startup_id"]); // $res[$r]["com"] = $this->Board->cnt("p_type = 9 and p_id = ".$res[$r]["id"]); // $dates = $this->Startup_service->get_last_date($res[$r]["id"]); // $res[$r]["date"] = $dates["date"]; // $res[$r]["type"] = $dates["type"]; // $res[$r]["diff"] = dateDiff(date("Y.m.d"), $res[$r]["date"], '.'); // $res[$r]["update"] = $this->Startup_service->get_dates($res[$r]["id"], 1); // $res[$r]["art"] = $this->Startup_service->get_article($res[$r]["id"]); // } // $where = 'status_bz = 1 and user_id_bz IS NOT NULL and user_id_bz != 0'; $where = 'status_bz = 1 and user_id_bz IS NOT NULL'; if ($_type == 'archived') { $where = $where . " and date < '" . date('Y.m.d', strtotime('-1 month')) . "'"; $t = $this->Startup_service->get_ser_date('', '', $where); $tot = sizeof($t); if ($_opt) { $where = $where . ' and category_id = ' . $_opt; $res = $this->Startup_service->get_list_ser_cat($_page, $pagesize, $where, 'date DESC'); } else { $res = $this->Startup_service->get_ser_date($_page, $pagesize, $where, 'date DESC'); } } else { if ($_type == 'ready') { $where = $where . " and date > '" . date("Y.m.d") . "'"; $t = $this->Startup_service->get_ser_date('', '', $where); $tot = sizeof($t); if ($_opt) { $where = $where . ' and category_id = ' . $_opt; $res = $this->Startup_service->get_list_ser_cat($_page, $pagesize, $where, 'date DESC'); } else { $res = $this->Startup_service->get_ser_date($_page, $pagesize, $where, 'date DESC'); } } else { if ($_type == 'just_launched') { $where = $where . ' and date <= "' . date("Y.m.d") . '" and date >= "' . date('Y.m.d', strtotime('-1 month')) . '"'; // result if ($_opt) { $where_c = 'service_id IN (' . 'SELECT sd.service_id FROM startup_service s, startup_service_date sd ' . 'WHERE s.id = sd.service_id AND ' . $where . ' GROUP BY sd.service_id ORDER BY DATE DESC' . ') AND category_id = '; $res = $this->Startup_service->get_cnt_cat('', '', $where_c . $_opt); } else { $res = $this->Startup_service->get_by_date_cat($_page, $pagesize, $where); } $t = $this->Startup_service->get_by_date_cat('', '', $where); $tot = sizeof($t); } else { if ($_type == 'startup') { $res = $this->Startup_service->list_($_opt); } } } } for ($r = 0; $r < sizeof($res); $r++) { $date = $res[$r]["date"]; if ($_type != 'startup') { $res[$r] = $this->Startup_service->get($res[$r]["service_id"]); } if ($_type == 'startup' or $res[$r]["status_bz"] == 1) { $res[$r]["cats"] = $this->Startup_service->get_category($res[$r]["id"]); $res[$r]["s"] = $this->Startup->get($res[$r]["startup_id"]); $res[$r]["com"] = $this->Board->cnt("p_type = 9 and p_id = " . $res[$r]["id"]); $res[$r]["update"] = $this->Startup_service->get_dates($res[$r]["id"], 1); $res[$r]["art"] = $this->Startup_service->get_article($res[$r]["id"]); if ($_type == 'just_launched') { $dates = $this->Startup_service->get_last_date($res[$r]["id"]); $res[$r]["date"] = $dates["date"]; $res[$r]["type"] = $dates["type"]; $res[$r]["diff"] = dateDiff(date("Y.m.d"), $res[$r]["date"], '.'); } else { $res[$r]["date"] = $date; } } else { unset($res[$r]); } } $this->assigns["type"] = $_type; $this->assigns["res"] = $res; $this->assigns["target"] = $_id; $this->assigns["today"] = date("Y.m.d"); }
<tr bgcolor="#E2FFC6"> <td> <div align="center"><font color="#FF0000"><strong><font size="3"><?php echo $FolioNumber; ?></font></strong></font></div></td> <td> <div align="center"><font color="#FF0000"><strong><font size="3"><?php echo $CertificateNumber; ?></font></strong></font></div></td> <td> <div align="center"><font color="#FF0000"><strong><font size="3"><?php echo $FromUnit; ?></font></strong></font></div></td> <td> <div align="center"><font color="#FF0000"><strong><font size="3"><?php echo $ToUnit; ?></font></strong></font></div></td> <td> <div align="center"><font color="#FF0000"><strong><font size="3"><?php echo $Units; ?></font></strong></font></div></td> </tr> </table> </p> <p><font size="2" face="Arial, Helvetica, sans-serif" color="#FF0000"><strong><?php echo "Your Service AS On 14-Aug-2009 : "; if($DOJoiningYMD<"2009-08-14") {echo dateDiff("2009-08-14" , $DOJoiningYMD) . "\n";} else echo 0; echo '<br>'; $date1 = "$DOJoiningYMD"; $date2 = "2009-08-14"; $diff = (abs(strtotime($date2) - strtotime($date1)))/(365*60*60*24); if($DOJoiningYMD<"2009-08-14") { if(round($diff,0)>20) { echo "According to length of Service your's BESOS Units Should be 20"; } elseif(round($diff,0)<=3) { echo "According to length of Service your's BESOS Units Should be "; echo round($diff,0);echo '<br>';echo ". Only if you were Regular and On the Strength of NTDC As On 14-Aug-2009.";
mysql_connect("localhost", "root", ""); mysql_select_db("idsr"); function dateDiff($start, $end) { $start_ts = strtotime($start); $end_ts = strtotime($end); $diff = $end_ts - $start_ts; return round($diff / 86400); } $dateArray = array(); //$districts = array(); $counter = 0; $dateSql = "select reportingtime, deadline, district from dashboarddemo"; $dateQuery = mysql_query($dateSql) or die(mysql_error()); while ($dateResults = mysql_fetch_assoc($dateQuery)) { $dateArray[$counter][1] = dateDiff($dateResults['reportingtime'], $dateResults['deadline']); $dateArray[$counter][2] = $dateResults['district']; $counter++; } echo "<p align=center><b> Timeliness </b></p>"; $strXML = "<chart formatNumberScale='0'>"; foreach ($dateArray as $dates) { $strXML .= "<set label='" . $dates[2] . "' value='" . $dates[1] . "' />"; } $strXML .= "<trendlines><line startValue='0' isTrendZone='0' displayValue='Deadline 30-06-2011' color='ff0000'/></trendlines>"; $strXML .= "</chart>"; echo renderChart("FusionCharts/Bar2D.swf", "", $strXML, "", 800, 500, false, false); ?> </body> </html>
<h5><p>Please Remind The Applicant For Answering.</p><p>Please Check You Already Done For Mailing to Applicant</p></h5></td> </tr> <?php } ?> <tr> <td class="center">Expired Date:</td> <td class="center"> <?php //echo $expire_date = date('m-d-y', strtotime($row["Expired_Date"])); if ($now > $expire_date) { echo $row['Expired_Date'] . "<h5>The Remains Date For Examination is 0 Day\n</h5>"; } else { echo $row['Expired_Date'] . "<h5>The Remains Date For Examination is " . dateDiff($today_d, $row['Expired_Date']) . "\n</h5>"; } ?> </td> </tr> <tr> <td>Remark:</td> <td class="center"><textarea name="remark" col="150" rows="5" style="width:400px;"></textarea></td> </tr> <tr> <td colspan="2" align="center"> <a href="onprocess.php" class="btn btn-warning">Cancel</a> <?php $my_date = date('m-d-y', strtotime($row["Expired_Date"]));
/** * Works out the time since the given date * * @param int|string timestamp or datetime string * @param string $stop year,month,week,day,hour,minute,second * @param string $format input format respecting date() syntax * @param bool $with_text append "ago" or "in the future" * @param bool $with_weeks * @return string */ function time_since($original, $stop = 'minute', $format = null, $with_text = true, $with_week = true) { $date = str2DateTime($original, $format); if (!$date) { return l10n('N/A'); } $now = new DateTime(); $diff = dateDiff($now, $date); $chunks = array('year' => $diff->y, 'month' => $diff->m, 'week' => 0, 'day' => $diff->d, 'hour' => $diff->h, 'minute' => $diff->i, 'second' => $diff->s); // DateInterval does not contain the number of weeks if ($with_week) { $chunks['week'] = (int) floor($chunks['day'] / 7); $chunks['day'] = $chunks['day'] - $chunks['week'] * 7; } $j = array_search($stop, array_keys($chunks)); $print = ''; $i = 0; foreach ($chunks as $name => $value) { if ($value != 0) { $print .= ' ' . l10n_dec('%d ' . $name, '%d ' . $name . 's', $value); } if (!empty($print) && $i >= $j) { break; } $i++; } $print = trim($print); if ($with_text) { if ($diff->invert) { $print = l10n('%s ago', $print); } else { $print = l10n('%s in the future', $print); } } return $print; }
function doGraph($paramValue, $pName, $valueBuff, $cols = 1) { global $patient, $root_path, $sid, $lang, $sessbuf; $txt = ''; $diff = dateDiff("-", date("Y-m-d"), $patient['date_birth']); switch ($diff) { case $diff >= 1 and $diff <= 30: echo $txt . '<img src="' . $root_path . 'main/imgcreator/labor-datacurve.php?sid=' . $sid . '&lang=' . $lang . '&cols=' . $cols . '&lo=' . $pName->fields['lo_bound_n'] . '&hi=' . $pName->fields['hi_bound_n'] . '&d=' . $valueBuff . '" border=0>'; break; case $diff >= 31 and $diff <= 360: echo $txt . '<img src="' . $root_path . 'main/imgcreator/labor-datacurve.php?sid=' . $sid . '&lang=' . $lang . '&cols=' . $cols . '&lo=' . $pName->fields['lo_bound_y'] . '&hi=' . $pName->fields['hi_bound_y'] . '&d=' . $valueBuff . '" border=0>'; break; case $diff >= 361 and $diff <= 5040: echo $txt . '<img src="' . $root_path . 'main/imgcreator/labor-datacurve.php?sid=' . $sid . '&lang=' . $lang . '&cols=' . $cols . '&lo=' . $pName->fields['lo_bound_c'] . '&hi=' . $pName->fields['hi_bound_c'] . '&d=' . $valueBuff . '" border=0>'; break; case $diff > 5040: if ($patient['sex'] == 'm') { echo $txt . '<img src="' . $root_path . 'main/imgcreator/labor-datacurve.php?sid=' . $sid . '&lang=' . $lang . '&cols=' . $cols . '&lo=' . $pName->fields['lo_bound'] . '&hi=' . $pName->fields['hi_bound'] . '&d=' . $valueBuff . '" border=0>'; } elseif ($patient['sex'] == 'f') { echo $txt . '<img src="' . $root_path . 'main/imgcreator/labor-datacurve.php?sid=' . $sid . '&lang=' . $lang . '&cols=' . $cols . '&lo=' . $pName->fields['lo_bound_f'] . '&hi=' . $pName->fields['hi_bound_f'] . '&d=' . $valueBuff . '" border=0>'; } break; } return $txt; }
$start_dir = $docRoot . "/" . $backupdir; // backup directory in production server if (is_dir($start_dir)) { $level = 1; $last = 1; $dirs = array(); $files = array(); readpath($start_dir, $level, $last, $dirs, $files); sort($files); foreach ($files as $file) { $filename = $file; $fname = explode("/", $filename); $fname = end($fname); $name = substr($fname, 14, 2); // day part of date string $file_date = substr($fname, 12, 2) . "-" . substr($fname, 14, 2) . "-" . substr($fname, 8, 4); //mm-dd-yyyy if (file_exists($filename)) { $date_comp = dateDiff("-", $date_today, $file_date); if ($date_comp > 0 && $name != '01') { //echo "unlinked"; //unlink($filename); } else { //echo "not unlinked"; } } else { echo "File not Found"; } } } echo '\\n +DONE \\n';
print " total shares: "; print $totalShares; print " shares: "; print $shares; print " price: "; print $price; print " cost: "; print $cost; print "<br>"; } $tranCount++; } elseif ($tradeType == 'SELL') { //$soldValue = $shares * $price; $soldValue = $totalShares * $price; $soldDate = $tradeDate; $holdingPeriod = dateDiff($firstPurchaseDate, $soldDate); $pl = $soldValue - $cost; print " SOLD: "; print "symbol: "; print $key; print " cost: "; print $cost; print " shares sold: "; print $shares; print " total shares: "; print $totalShares; print "sold value: "; print $soldValue; print " price: "; print $price; print " pl: ";
} // here we should check if pic is featured and like ebay get the minithumb for the first 10 or 20 offers... not implemented yet if ($total_pics > 0) { $auction_offer_picture = $images['icon_auction_pic']; $auction_offer_picture_alt = $lang['auction_offer_picture_attached'] . ": " . $total_pics; } else { $auction_offer_picture = $images['icon_auction_no_pic']; $auction_offer_picture_alt = $lang['auction_offer_no_picture_attached']; } if ($auction_offer_rowset[$i]['auction_offer_bold'] == 1 && $auction_config_data['auction_offer_allow_bold'] == 1) { $auction_offer_title = "<b>" . $auction_offer_title . "</b>"; } if ($auction_offer_rowset[$i]['auction_offer_special'] == 1 && $auction_config_data['auction_offer_allow_special'] == 1) { $template->assign_block_vars('offer_special', array('AUCTION_OFFER_OFFERER' => $offerer, 'AUCTION_OFFER_TIME_STOP' => create_date($board_config['default_dateformat'], $auction_offer_rowset[$i]['auction_offer_time_stop'], $board_config['board_timezone']) . "</br>" . dateDiff(time(), $auction_offer_rowset[$i]['auction_offer_time_stop']), 'AUCTION_OFFER_TITLE' => $auction_offer_title, 'AUCTION_OFFER_VIEWS' => $views, 'AUCTION_OFFER_PICTURE' => $auction_offer_picture, 'L_AUCTION_OFFER_PICTURE_ALT' => $auction_offer_picture_alt, 'AUCTION_OFFER_FIRST_PRICE' => $auction_offer_rowset[$i]['auction_offer_price_start'] . " " . $auction_config_data['currency'], 'AUCTION_OFFER_LAST_BID_PRICE' => $auction_offer_rowset[$i]['auction_offer_last_bid_price'] == 0 ? $lang['auction_no_bid'] : $auction_offer_rowset[$i]['auction_offer_last_bid_price'], 'AUCTION_OFFER_LAST_BID_USER' => $auction_offer_rowset[$i]['maxbidder_user_id'] == 0 ? $lang['auction_no_bid'] : "<a href=\"" . append_sid("profile." . $phpEx . "?mode=viewprofile&" . POST_USERS_URL . "=" . $auction_offer_rowset[$i]['maxbidder_user_id']) . "\">" . $auction_offer_rowset[$i]['maxbidder_user_name'] . "</a>", 'U_VIEW_AUCTION_OFFER' => $view_auction_offer_url)); } elseif ($auction_offer_rowset[$i]['auction_offer_on_top'] == 1 && $auction_config_data['auction_offer_allow_on_top'] == 1) { $template->assign_block_vars('offer_on_top', array('AUCTION_OFFER_OFFERER' => $offerer, 'AUCTION_OFFER_TIME_STOP' => create_date($board_config['default_dateformat'], $auction_offer_rowset[$i]['auction_offer_time_stop'], $board_config['board_timezone']) . "</br>" . dateDiff(time(), $auction_offer_rowset[$i]['auction_offer_time_stop']), 'AUCTION_OFFER_TITLE' => $auction_offer_title, 'AUCTION_OFFER_VIEWS' => $views, 'AUCTION_OFFER_PICTURE' => $auction_offer_picture, 'L_AUCTION_OFFER_PICTURE_ALT' => $auction_offer_picture_alt, 'AUCTION_OFFER_FIRST_PRICE' => $auction_offer_rowset[$i]['auction_offer_price_start'] . " " . $auction_config_data['currency'], 'AUCTION_OFFER_LAST_BID_PRICE' => $auction_offer_rowset[$i]['auction_offer_last_bid_price'] == 0 ? $lang['auction_no_bid'] : $auction_offer_rowset[$i]['auction_offer_last_bid_price'], 'AUCTION_OFFER_LAST_BID_USER' => $auction_offer_rowset[$i]['maxbidder_user_id'] == 0 ? $lang['auction_no_bid'] : "<a href=\"" . append_sid("profile." . $phpEx . "?mode=viewprofile&" . POST_USERS_URL . "=" . $auction_offer_rowset[$i]['maxbidder_user_id']) . "\">" . $auction_offer_rowset[$i]['maxbidder_user_name'] . "</a>", 'U_VIEW_AUCTION_OFFER' => $view_auction_offer_url)); } else { $template->assign_block_vars('offer', array('AUCTION_OFFER_OFFERER' => $offerer, 'AUCTION_OFFER_TIME_STOP' => create_date($board_config['default_dateformat'], $auction_offer_rowset[$i]['auction_offer_time_stop'], $board_config['board_timezone']) . "</br>" . dateDiff(time(), $auction_offer_rowset[$i]['auction_offer_time_stop']), 'AUCTION_OFFER_TITLE' => $auction_offer_title, 'AUCTION_OFFER_VIEWS' => $views, 'AUCTION_OFFER_PICTURE' => $auction_offer_picture, 'L_AUCTION_OFFER_PICTURE_ALT' => $auction_offer_picture_alt, 'AUCTION_OFFER_FIRST_PRICE' => $auction_offer_rowset[$i]['auction_offer_price_start'] . " " . $auction_config_data['currency'], 'AUCTION_OFFER_LAST_BID_PRICE' => $auction_offer_rowset[$i]['auction_offer_last_bid_price'] == 0 ? $lang['auction_no_bid'] : $auction_offer_rowset[$i]['auction_offer_last_bid_price'], 'AUCTION_OFFER_LAST_BID_USER' => $auction_offer_rowset[$i]['maxbidder_user_id'] == 0 ? $lang['auction_no_bid'] : "<a href=\"" . append_sid("profile." . $phpEx . "?mode=viewprofile&" . POST_USERS_URL . "=" . $auction_offer_rowset[$i]['maxbidder_user_id']) . "\">" . $auction_offer_rowset[$i]['maxbidder_user_name'] . "</a>", 'U_VIEW_AUCTION_OFFER' => $view_auction_offer_url)); } } } else { // No topics $no_offer = $auction_room_row['auction_room_state'] == AUCTION_ROOM_LOCKED ? $lang['auction_room_locked'] : $lang['no_offer']; $template->assign_vars(array('L_NO_OFFER' => $no_offer)); $template->assign_block_vars('no_offer', array()); } // Parse the page and print $template->pparse('body'); // Page footer include $phpbb_root_path . 'auction/auction_footer.' . $phpEx; include $phpbb_root_path . 'includes/page_tail.' . $phpEx;