function find_link_text_for_day_resume_button($day_array, $task_array, $status) { //$day_array = $status_line->days; $day_array = explode(';', $day_array); $how_many_days = count($day_array) - 1; $day_id_to_get_started_array = explode(',', $day_array[0]); //$task_array = $status_line->tasks; $task_array = explode(';', $task_array); $task_id_array = explode('-', $task_array[0]); $task_id_to_get_started_array = explode(',', $task_id_array[0]); // we find the id for the first day who isn't completed if ($status == '1') { $first_day_uncompleted = guruModelguruProgram::find_id_for_first_uncompleted_day($day_array); $first_day_uncompleted = explode(',', $first_day_uncompleted); $id_for_first_day_uncompleted = $first_day_uncompleted[0]; $ordering_for_first_day_uncompleted = $first_day_uncompleted[1]; $first_task_uncompleted = guruModelguruProgram::find_id_for_first_uncompleted_task(explode('-', $task_array[$ordering_for_first_day_uncompleted - 1])); $first_task_uncompleted = explode(',', $first_task_uncompleted); $id_for_first_task_uncompleted = $first_task_uncompleted[0]; $ordering_for_first_task_uncompleted = $first_task_uncompleted[1]; } if ($status == '0' && isset($task_id_to_get_started_array[0]) && $task_id_to_get_started_array[0] > 0 && isset($day_id_to_get_started_array[0]) && $day_id_to_get_started_array[0] > 0) { $link_for_resume = 'index.php?option=com_guru&view=guruTasks&task=view&cid=1&pid=' . $day_id_to_get_started_array[0]; $text_for_resume = JText::_('GURU_MYPROGRAMS_ACTION_GETSTARTED'); } if ($status == '1' && isset($id_for_first_task_uncompleted) && $id_for_first_task_uncompleted > 0 && isset($id_for_first_day_uncompleted) && $id_for_first_day_uncompleted > 0) { $link_for_resume = 'index.php?option=com_guru&view=guruTasks&task=view&cid=' . $ordering_for_first_task_uncompleted . '&pid=' . $id_for_first_day_uncompleted; $text_for_resume = JText::_('GURU_DAYS_RESUME_BUTTON'); } if ($status == '2' && isset($task_id_to_get_started_array[0]) && $task_id_to_get_started_array[0] > 0 && isset($day_id_to_get_started_array[0]) && $day_id_to_get_started_array[0] > 0) { $link_for_resume = 'index.php?option=com_guru&view=guruTasks&task=view&cid=1&pid=' . $day_id_to_get_started_array[0] . '&s=0'; $text_for_resume = JText::_('GURU_MYPROGRAMS_ACTION_STARTAGAIN'); } if ($status == '-1') { $the_day_id = $day_id_to_get_started_array[0]; $db = JFactory::getDBO(); $sql = "SELECT pid FROM #__guru_days \r\n\t\t\t\tWHERE id = " . $the_day_id; $db->setQuery($sql); $result = $db->loadResult(); $link_for_resume = 'index.php?option=com_guru&view=guruProfile&task=buy&cid=' . $result; $text_for_resume = JText::_('GURU_MYPROGRAMS_ACTION_BUYAGAIN'); } return $link_for_resume . '$$$$$' . $text_for_resume; }
$p_start_date = ""; // for each started program we must show the starting date ; DEFAULT is NOTHING $p_end_date = ""; // for each started program we must show the ending date ; DEFAULT is NOTHING $day_array = $prog->days; $day_array = explode(';', $day_array); $how_many_days = count($day_array) - 1; $day_id_to_get_started_array = explode(',', $day_array[0]); //if($s=='0') $p_days = JText::_('GURU_PROGRAM_DETAILS_DAY').' 0 '.JText::_('GURU_MYPROGRAMS_DAYS_OF').' '.$how_many_days; $task_array = $prog->tasks; $task_array = explode(';', $task_array); $task_id_array = explode('-', $task_array[0]); $task_id_to_get_started_array = explode(',', $task_id_array[0]); // we find the id for the first day who isn't completed if ($s == '1') { $first_day_uncompleted = guruModelguruProgram::find_id_for_first_uncompleted_day($day_array); $first_day_uncompleted = explode(',', $first_day_uncompleted); $id_for_first_day_uncompleted = $first_day_uncompleted[0]; $ordering_for_first_day_uncompleted = $first_day_uncompleted[1]; $p_days = JText::_('GURU_PROGRAM_DETAILS_DAY') . ' ' . $ordering_for_first_day_uncompleted . ' ' . JText::_('GURU_MYPROGRAMS_DAYS_OF') . ' ' . $how_many_days; $first_task_uncompleted = guruModelguruProgram::find_id_for_first_uncompleted_task(explode('-', $task_array[$ordering_for_first_day_uncompleted - 1])); $first_task_uncompleted = explode(',', $first_task_uncompleted); $id_for_first_task_uncompleted = $first_task_uncompleted[0]; $ordering_for_first_task_uncompleted = $first_task_uncompleted[1]; $how_many_tasks = count(explode('-', $task_array[$ordering_for_first_day_uncompleted - 1])) - 1; $p_tasks = JText::_('GURU_DAYS_TASK') . ' ' . $ordering_for_first_task_uncompleted . ' ' . JText::_('GURU_MYPROGRAMS_DAYS_OF') . ' ' . $how_many_tasks; $p_start_date = date($config[0]->datetype, strtotime($prog->startdate)); } if ($s == '2') { $p_days = JText::_('GURU_MYPROGRAMS_COMPLETED'); $p_tasks = JText::_('GURU_MYPROGRAMS_COMPLETED');