예제 #1
0
파일: gurudays.php 프로젝트: JozefAB/neoacu
 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 = guruModelguruDays::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 = guruModelguruDays::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;
 }