getAllUserTrainings(); $trainings_data = array(); foreach ($user_trainings as $user_training) { $training = $fitness->loadType("training", $user_training->id); $php_training_date = strtotime($user_training->training_date); $training_date = date("Y-m-d", $php_training_date); $start_date = $training_date . "T" .$training->getBeginningTime(). "Z"; $end_date = $training_date . "T" .$training->getEndingTime(). "Z"; $training_data = array( "title" => $training->getTitle(), "start" => $start_date, "end" => $end_date, "allDay" => false, "url" => $training->getURL() ); $trainings_data []= $training_data; } $encoded = json_encode($trainings_data); echo($encoded); ?>