function toArray($type, $content) { //standardize on \n for eol character $content = preg_replace("/\r\n|\r|\n/m", "\n", trim($content)); $cues = explode("\n\n", $content); $n = 0; // counter of kept cues if (sizeof($cues) > 1) { if (trim(strtoupper($cues[0])) == 'WEBVTT') { //spec requires WEBVTT on the first line $i = 1; while ($i < sizeof($cues)) { $cue = explode("\n", $cues[$i]); if (sizeof($cue) >= 2) { // this seems to be a valid cue. Keep it $times = explode(' --> ', $cue[0]); $c['type'][$n] = $type; $c['start'][$n] = toSeconds(trim($times[0])); $c['end'][$n] = toSeconds(trim($times[1])); $cueText = $cue[1]; if (sizeof($cue) > 2) { // this is a multi-line cue $j = 2; while ($j < sizeof($cue)) { // ensure there's one space between cues, but not more than one $cueText .= ' ' . trim($cue[$j]); $j++; } } $c['text'][$n] = $cueText; $n++; } $i++; } } else { echo '2'; // this is not a WebVTT file } } else { echo '3'; // too few cues were found } return $c; }
but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenBookings.org; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ require_once "config.php"; require_once "connect_db.php"; require_once "functions.php"; $update_status = "disabled"; CheckCookie(); // Resets app to the index page if timeout is reached. This function is implemented in functions.php if (isset($_POST["action_"])) { $booking_start = dateFormat($_POST["start_date"], "", "Y-m-d") . " " . $_POST["start_hour"] . "00"; $booking_duration = toSeconds($_POST["duration_days"], $_POST["duration_hours"], $_POST["duration_minutes"]); $booking_end = date("Y-m-d H:i:s", strtotime("+" . $booking_duration . " seconds", $booking_start)); switch ($_POST["action_"]) { case "insert_booking": insertBooking("insert", $_POST["book_id"], $_POST["booker_id"], $_POST["object_id"], $booking_start, $booking_end, $_POST["misc_info"], $validated); break; case "update_booking": insertBooking("update", $_POST["book_id"], $_POST["booker_id"], $_POST["object_id"], $booking_start, $booking_end, $_POST["misc_info"], $validated); break; } } else { $sql = "SELECT activity_start, activity_end, activity_step FROM rs_data_objects WHERE object_id = " . $_REQUEST["object_id"] . ";"; $object = db_query($database_name, $sql, "no", "no"); $object_ = fetch_array($object); $activity_step = $object_["activity_step"]; if ($_REQUEST["book_id"] == "0") {
<hr> </div> <div class="container-fluid"> <div class="row"> <div class="col-md-12"> @if ($project->title) <h1>{{ $project->title }}</h1> <?php $timing = projectPhaseTracker($project->id); if ($timing != "Task not started") { $elapseTime = secondsToTimeSimple(toSeconds($timing)); } else { $elapseTime = "0 : 00 : 00 s"; } ?> <small> <span class="glyphicon glyphicon-calendar blue" aria-hidden="true"></span> {{ $project->created_at->diffForHumans() }} </small> <small> <span class="glyphicon glyphicon-time blue" aria-hidden="true"></span> @if($elapseTime != "0 : 00 : 00 s" ) Elapsed Time: {{ $elapseTime }} @else
function calculNoturnas($noturno, $h_not_noite) { /*$tempo_noturno = 0; $temp_old = 0; foreach($noturno->result() as $row) { $continu = true; $temp = toSeconds($row->horas); $dia = date($row->dia); if($temp < MANHA_NOT && $temp > LAST_TIME_SEC) { $tempo_noturno += MANHA_NOT - $temp; $temp_old = 0; $continu = false; } if($h_not_noite < $temp && $temp < (LAST_TIME_SEC + 86400) && $continu) { if($temp_old != 0) { //se o dia é o mesmo é que faço isso if(strtotime($dia) > strtotime($old_dia)) { $tempo_noturno += $temp - $temp_old; }else{ $tempo_noturno += $temp - $temp_old - ($temp_old - $h_not_noite); } $temp_old = $temp; $continu = false; }else{ $tempo_noturno += $temp - $h_not_noite; $temp_old = $temp; $continu = false; } } if($temp < LAST_TIME_SEC && $temp_old != 0 && $continu) { $tempo_noturno += ($temp + 86400) - $temp_old; $temp_old = $temp + 86400; $continu = false; } if($continu) { $temp_old = 0; } $old_dia = $dia; }*/ $tempo_noturno = 0; $i = true; $picagem_number = 0; $ar_picnum = array(3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25); $tempoinf = 0; $temposup = 0; $newdia = false; $old_dia = ''; foreach ($noturno->result() as $row) { //$dia = new DateTime($row->dia); $dia = date($row->dia); $cont_cal = true; if (strtotime($dia) > strtotime($old_dia) && $old_dia != '' && toSeconds($row->horas) > LAST_TIME_SEC) { $newdia = true; } //echo ' av '.var_export($newdia); if ($newdia) { //echo ' ENTREI '; $tempoinf = 0; $temposup = 0; $i = true; $picagem_number = 0; $newdia = false; } //echo ' dp '.var_export($newdia); if ($i) { /*echo ' '.$row->horas.' ';*/ $tempoinf = toSeconds($row->horas); $picagem_number++; $i = false; if ($tempoinf > $temposup && $temposup != 0 && $dia > $old_dia) { $temposup = 0; $picagem_number = 1; $cont_cal = false; } /*echo ' dia '.$dia.' '; echo ' old '.$old_dia.' '; if(strtotime($dia) > strtotime($old_dia)) echo ' supppppppppppp ';*/ if ($cont_cal && $tempoinf < $temposup && strtotime($dia) > strtotime($old_dia) && $old_dia != '') { //echo ' '.$picagem_number.' '; /*echo ' '.$row->horas.' '; echo $tempoinf.' ';*/ $temposup = 0; $picagem_number = 1; $cont_cal = false; } } else { $temposup = toSeconds($row->horas); $picagem_number++; $i = true; //aqui vou fazer como se fosse para mudar de dia if ($temposup < $tempoinf && $temposup < LAST_TIME_SEC) { //aqui acrescento 24h $temposup = $temposup + 86400; $newdia = true; } } if ($temposup != 0) { if ($temposup > $h_not_noite || $tempoinf > $h_not_noite) { if (in_array($picagem_number, $ar_picnum)) { //se é uma picagem a verificar if ($tempoinf - $temposup < PAUSA) { //$tempo_noturno += $tempoinf - $temposup; /*if($tempoinf > $h_not_noite) {*/ if ($temposup > $h_not_noite) { $tempo_noturno += $tempoinf - $temposup; } else { $tempo_noturno += $tempoinf - $h_not_noite; } /*}else{ $tempo_noturno += $temposup - $h_not_noite; }*/ } } else { if ($tempoinf > $h_not_noite) { $tempo_noturno += $temposup - $tempoinf; } else { $tempo_noturno += $temposup - $h_not_noite; } } } } else { //aqui é para contar as horas da manha caso seja o caso if ($tempoinf < MANHA_NOT && $tempoinf > LAST_TIME_SEC) { $tempo_noturno += MANHA_NOT - $tempoinf; } } $old_dia = $dia; } return toTime($tempo_noturno); }
public function picagemResumosemanal() { $this->load->helper('myfunction_helper'); $datefirst = $this->input->post('datefirst'); $datesecond = $this->input->post('datesecond'); $departamento = $this->input->post('departamento'); $result = $this->picagem_model->getresumopicagem($departamento, $datefirst, $datesecond); //print_r($result); if ($result) { $message_tb_head = '<table class="table table-hover picagens display" id="picagens"><thead><tr><th>Nº</th><th>Nome</th><th>Dias Trab.</th><th>Contracto</th><th>Horas Trab.</th></tr></thead><tbody>'; $message = ''; foreach ($result as $row) { $result2 = $this->user_model->get($row['Userid']); if ($row['Name'] != 'Total') { if ($result2['Contracto'] == '') { $message .= '<tr><td>' . $row['Userid'] . '</td><td>' . $row['Name'] . '</td><td>' . $row['Dias'] . '</td><td>Não Foi Preenchido</td><td class="text-center">' . $row['HTrabalhadas'] . '</td></tr>'; } else { $hcontracto = intval($result2['Contracto']) * 3600; if ($row['HTrabalhadas'] == 'Faltam picagens') { $htrab = 'Faltam Picagens'; } else { $htrab = toSeconds($row['HTrabalhadas']); } if ($htrab == 'Faltam Picagens') { $message .= '<tr><td>' . $row['Userid'] . '</td><td>' . $row['Name'] . '</td><td>' . $row['Dias'] . '</td><td>' . $result2['Contracto'] . ' h</td><td class="text-center text-danger">' . $row['HTrabalhadas'] . '</td></tr>'; } else { if ($htrab < $hcontracto - 900 || $htrab > $hcontracto + 3600) { $message .= '<tr><td>' . $row['Userid'] . '</td><td>' . $row['Name'] . '</td><td>' . $row['Dias'] . '</td><td>' . $result2['Contracto'] . ' h</td><td class="text-center text-danger">' . $row['HTrabalhadas'] . '</td></tr>'; } else { $message .= '<tr><td>' . $row['Userid'] . '</td><td>' . $row['Name'] . '</td><td>' . $row['Dias'] . '</td><td>' . $result2['Contracto'] . ' h</td><td class="text-center">' . $row['HTrabalhadas'] . '</td></tr>'; } } } } } $message = $message_tb_head . $message . '</tbody></table>'; $return = array('return' => 'success', 'message' => $message); echo json_encode($return); return true; } else { $return = array('return' => 'error', 'message' => 'Não foi possível obter dados, se o problema persistir contactar o administrador'); echo json_encode($return); return true; } }
public function viewPicagens($firstdate, $seconddate, $result, $userid) { $message = ''; $olddate = ''; $datefirst = date_create($firstdate . '00:00:00.000'); $datesecond = date_create($seconddate . '00:00:00.000'); foreach ($result as $row) { $newdate = date_create($row['CheckTime']); $hora = toSeconds(date_format($newdate, 'H:i:s')); while (date_format($datefirst, 'y-m-d') < date_format($newdate, 'y-m-d')) { //class="danger" if (date('w', strtotime(date_format($datefirst, 'Ymd'))) == 0) { $message .= '<tr class="danger" onclick="corrigirPicagens(' . date_format($datefirst, 'Ymd') . ')"><td>' . date_format($datefirst, 'd-m-y') . '</td><td></td></tr>'; } else { $message .= '<tr onclick="corrigirPicagens(' . date_format($datefirst, 'Ymd') . ')"><td>' . date_format($datefirst, 'd-m-y') . '</td><td></td></tr>'; } $datefirst->add(new DateInterval('P1D')); } if ($olddate == '' && date_format($datefirst, 'y-m-d') == date_format($newdate, 'y-m-d')) { if (date('w', strtotime(date_format($datefirst, 'Ymd'))) == 0) { $message .= '<tr class="danger" onclick="corrigirPicagens(' . date_format($newdate, 'Ymd') . ')"><td>' . date_format($newdate, 'd-m-y') . '</td>'; } else { $message .= '<tr onclick="corrigirPicagens(' . date_format($newdate, 'Ymd') . ')"><td>' . date_format($newdate, 'd-m-y') . '</td>'; } $datefirst->add(new DateInterval('P1D')); } if ($olddate != '' && date_format($newdate, 'y-m-d') > date_format($olddate, 'y-m-d') && date_format($datefirst, 'y-m-d') == date_format($newdate, 'y-m-d')) { if ($hora < LAST_TIME_SEC) { $message .= '<td>' . date_format($newdate, 'H:i:s') . '</td>'; if (date('w', strtotime(date_format($datefirst, 'Ymd'))) == 0) { $message .= '</tr><tr class="danger" onclick="corrigirPicagens(' . date_format($newdate, 'Ymd') . ')"><td>' . date_format($newdate, 'd-m-y') . '</td>'; } else { $message .= '</tr><tr onclick="corrigirPicagens(' . date_format($newdate, 'Ymd') . ')"><td>' . date_format($newdate, 'd-m-y') . '</td>'; } } else { if (date('w', strtotime(date_format($datefirst, 'Ymd'))) == 0) { $message .= '</tr><tr class="danger" onclick="corrigirPicagens(' . date_format($newdate, 'Ymd') . ')"><td>' . date_format($newdate, 'd-m-y') . '</td>'; } else { $message .= '</tr><tr onclick="corrigirPicagens(' . date_format($newdate, 'Ymd') . ')"><td>' . date_format($newdate, 'd-m-y') . '</td>'; } $message .= '<td>' . date_format($newdate, 'H:i:s') . '</td>'; } $datefirst->add(new DateInterval('P1D')); } else { /*if($olddate != '') {*/ $message .= '<td>' . date_format($newdate, 'H:i:s') . '</td>'; /*}else{ $message .= date_format($newdate,'H:i:s'); }*/ } $olddate = $newdate; } while (date_format($datefirst, 'y-m-d') <= date_format($datesecond, 'y-m-d')) { if (date('w', strtotime(date_format($datefirst, 'Ymd'))) == 0) { $message .= '<tr onclick="corrigirPicagens(' . date_format($datefirst, 'Ymd') . ')"><td>' . date_format($datefirst, 'd-m-y') . '</td><td></td></tr>'; } else { $message .= '<tr onclick="corrigirPicagens(' . date_format($datefirst, 'Ymd') . ')"><td>' . date_format($datefirst, 'd-m-y') . '</td><td></td></tr>'; } $datefirst->add(new DateInterval('P1D')); } return $message; }
function finalTime($date1, $date2, $date3) { if ($date1 != 'Task not started' && $date2 != 'Task not started' && $date3 != 'Task not started') { return toSeconds($date1) + toSeconds($date2) + toSeconds($date3); } if ($date1 == 'Task not started' && $date2 != 'Task not started' && $date3 != 'Task not started') { return toSeconds($date2) + toSeconds($date3); } if ($date1 != 'Task not started' && $date2 != 'Task not started' && $date3 == 'Task not started') { return toSeconds($date1) + toSeconds($date2); } if ($date1 != 'Task not started' && $date2 == 'Task not started' && $date3 != 'Task not started') { return toSeconds($date1) + toSeconds($date3); } if ($date1 == 'Task not started' && $date2 == 'Task not started' && $date3 != 'Task not started') { return toSeconds($date3); } if ($date1 == 'Task not started' && $date2 != 'Task not started' && $date3 == 'Task not started') { return toSeconds($date2); } if ($date1 != 'Task not started' && $date2 == 'Task not started' && $date3 == 'Task not started') { return toSeconds($date1); } }