$time = calc_duration(ceil($master[100 + $i]['y_intercept'] + $master[100 + $i]['level_mult'] * $level)); $results['moderate_runs'][] = array('i' => $i, 'time' => $time); } for ($i = 1; $i <= 3; $i++) { $time = calc_duration(ceil($master[100 + $i]['y_intercept'] + $master[100 + $i]['level_mult'] * $level)); $results['long_runs'][] = array('i' => $i, 'time' => $time); } for ($i = 2; $i <= 4; $i++) { $time = calc_duration(ceil($master[100 + $i]['y_intercept'] + $master[100 + $i]['level_mult'] * $level)); $results['tempo_runs'][] = array('i' => $i, 'time' => $time); } for ($i = 1; $i <= 18; $i++) { $time = ceil($master[$i]['y_intercept'] + $master[$i]['level_mult'] * $level); if (in_array($i, array(8, 9))) { $time = $time / (1609.344 / 1000); } elseif (in_array($i, array(10, 11, 12, 13))) { $time = $time / (1609.344 / 400); } elseif (in_array($i, array(14))) { $time = $time / (1609.344 / 100); } $time_1 = calc_duration($time * 1.05); $time_2 = calc_duration($time * 1.02); $time_3 = calc_duration($time * 1.0); $time_4 = calc_duration($time * 0.98); $time_5 = calc_duration($time * 0.95); $results['training_goals'][] = array('i' => $i, 'time_1' => $time_1, 'time_2' => $time_2, 'time_3' => $time_3, 'time_4' => $time_4, 'time_5' => $time_5); } if (isset($_GET['callback'])) { echo $_GET["callback"]; } echo "(" . json_encode($results) . ")";
db_exec($sql); $dia = substr($obj->task_log_date, 0, 10); $dia = str_replace('-', '', $dia); $f = $task->task_end_date_ir; $fe = str_replace("-", "", $f); $f_fin = substr($fe, 0, 8); $porciento = dPgetParam($_POST, "task_percent_complete", ""); if ($porciento == 100) { $task->task_duration_ir = calc_duration($task->task_start_date_ir, substr($obj->task_log_date, 0, 10) . ' 08:00:00'); $task->task_end_date_ir = substr($obj->task_log_date, 0, 10) . ' 08:00:00'; } elseif ($dia > $f_fin) { //estamos metiendo una accion a una tarea que se supone que deberia haber terminado y aun no esta completada, //por lo tanto, vamos a alargar la duracion real de esta tarea en funcion del porcentaje completado. $duracion = $task->task_duration; //duracion presupuestada de la tarea $dur = calc_duration($task->task_start_date_ir, substr($obj->task_log_date, 0, 10) . ' 08:00:00') - 1; $nueva_duracion = (100 - $porciento) * $duracion / 100; //duracion a partir de hoy en funcion de lo completado $task->task_duration_ir = round($nueva_duracion) + $dur; $task->task_end_date_ir = calc_end_date($task->task_start_date_ir, $task->task_duration_ir, $task->task_duration_type); } if ($msg = $task->store()) { $AppUI->setMsg($msg, UI_MSG_ERROR, true); } // Check if we need to email the task log to anyone. $email_assignees = dPgetParam($_POST, 'email_assignees', null); $email_task_contacts = dPgetParam($_POST, 'email_task_contacts', null); $email_project_contacts = dPgetParam($_POST, 'email_project_contacts', null); $email_others = dPgetParam($_POST, 'email_others', null); $email_extras = dPgetParam($_POST, 'email_extras', null); $email_dep = dPgetParam($_POST, 'email_dep_list', '');