public function createExercise($id) { if (!isMakerOfSeries($id, Auth::id())) { flash()->error('You must be logged in as the maker of this series in order to add exercises.')->important(); return redirect('series/' . $id); } $serie = loadSerieWithId($id)[0]; return view('exercises.create', compact('serie')); }
<!-- brunodd: Get data from database --> <?php $data = countUsersSucceededSeries(); // dd($data); $series = []; $num_finished = []; foreach ($data as $d) { array_push($series, loadSerieWithId($d->seriesId)[0]->title); array_push($num_finished, (int) $d->c); } ?> <!-- 3. Add the JavaScript with the Highchart options to initialize the chart --> <script type="text/javascript"> $(function () { $('#container_user_finished_per_series').highcharts({ chart: { type: 'column' }, title: { text: <?php echo '\'Number of users that succesfully completed series\''; ?> }, xAxis: { title: { text: 'Series' }, categories: <?php echo json_encode($series); ?>
private static function buildSystemNotifications($notification) { $string = ""; switch ($notification->type) { case "group request accepted": $groupname = loadGroup($notification->object_id)[0]->name; $group = '<a href=/groups/' . $notification->object_id . '>' . $groupname . '</a>'; $string = (object) array_merge((array) $notification, array('message' => 'Your request to join the group \'' . $group . '\' has been accepted.')); break; case "group request declined": $groupname = loadGroup($notification->object_id)[0]->name; $group = '<a href=/groups/' . $notification->object_id . '>' . $groupname . '</a>'; $string = (object) array_merge((array) $notification, array('message' => 'Your request to join the group \'' . $group . '\' has been declined.')); break; case "series updated": $seriesTitle = loadSerieWithId($notification->object_id)[0]->title; $series = '<a href=/series/' . $notification->object_id . '>' . $seriesTitle . '</a>'; $string = (object) array_merge((array) $notification, array('message' => 'The series \'' . $series . '\' has been updated, check it out!')); break; case "exercise referenced": $series = '<a href=/series/' . $notification->object_id . '>series</a>.'; $string = (object) array_merge((array) $notification, array('message' => 'An exercise of yours was referenced in another ' . $series)); break; case "exercise copied": $series = '<a href=/series/' . $notification->object_id . '>series</a>.'; $string = (object) array_merge((array) $notification, array('message' => 'An exercise of yours was copied to another ' . $series)); break; } return $string; }