Esempio n. 1
0
 public function teleprogramPage()
 {
     $lc = app()->getlocale();
     date_default_timezone_set('Asia/Bishkek');
     $now = date("d-m-Y H:i");
     $currentDate = date('d-m-Y');
     $currentTime = date('H:i');
     $weekDay = date('N', strtotime($now));
     $schedules = \Model\Schedule\ModelName::orderBy('created_at', 'desc')->get();
     for ($i = 1; $i <= 7; $i++) {
         if ($i < $weekDay) {
             $weekDayNew = date('d-m-Y', strtotime('-' . ($weekDay - $i) . ' day'));
             $week[] = $weekDayNew;
         } elseif ($i > $weekDay) {
             $weekDayNew = date('d-m-Y', strtotime('+' . ($i - $weekDay) . ' day'));
             $week[] = $weekDayNew;
         } else {
             $weekDayNew = date('d-m-Y', strtotime($now));
             $week[] = $weekDayNew;
         }
     }
     if (!empty($schedules)) {
         $programs = array();
         foreach ($schedules as $schedule) {
             $scheduleWeek = date('N', strtotime($schedule->date));
             for ($j = 0; $j < count($week); $j++) {
                 if (strtotime($week[$j]) == strtotime($schedule->date)) {
                     $program = json_decode($schedule->program);
                     $programNew = array_add($program, 'date', $schedule->date);
                     $programs[] = $programNew;
                 }
             }
         }
         $programs = array_reverse($programs);
     }
     //        dd($programs);
     $backgroundMain = \Model\Background\ModelName::where('published', '=', true)->first();
     return view('Front::pages.teleprogram', ['lc' => $lc, 'currentDate' => $currentDate, 'currentTime' => $currentTime, 'backgroundMain' => $backgroundMain, 'schedules' => $schedules, 'programs' => $programs, 'week' => $week]);
 }
Esempio n. 2
0
 public function ChannelTeleprogram($channel)
 {
     $lc = app()->getlocale();
     $backgroundMain = \Model\Background\ModelName::where('published', '=', true)->first();
     $channels = \Model\Channel\ModelName::take(8)->skip(1)->get();
     date_default_timezone_set('Asia/Bishkek');
     $now = date("d-m-Y H:i");
     $currentDate = date('d-m-Y');
     $currentTime = date('H:i');
     $weekDay = date('N', strtotime($now));
     $channel = \Model\Channel\ModelName::where('id', '=', $channel->id)->first();
     if ($channel) {
         $schedules = \Model\Schedule\ModelName::where('channel_id', '=', $channel->id)->orderBy('date', 'desc')->get();
         for ($i = 1; $i <= 7; $i++) {
             if ($i < $weekDay) {
                 $weekDayNew = date('d-m-Y', strtotime('-' . ($weekDay - $i) . ' day'));
                 $week[] = $weekDayNew;
             } elseif ($i > $weekDay) {
                 $weekDayNew = date('d-m-Y', strtotime('+' . ($i - $weekDay) . ' day'));
                 $week[] = $weekDayNew;
             } else {
                 $weekDayNew = date('d-m-Y', strtotime($now));
                 $week[] = $weekDayNew;
             }
         }
         if (!empty($schedules)) {
             $programs = array();
             for ($j = 0; $j < count($week); $j++) {
                 foreach ($schedules as $schedule) {
                     if (strtotime($week[$j]) == strtotime($schedule->date)) {
                         $program = json_decode($schedule->program);
                         $programNew = array_add($program, 'date', $schedule->date);
                         $programs[] = $programNew;
                     }
                 }
             }
             //                dd($programs);
             //                $programs = array_reverse($programs);
         }
     }
     //        dd($programs);
     return view('Front::pages.teleprogram', ['lc' => $lc, 'currentDate' => $currentDate, 'currentTime' => $currentTime, 'backgroundMain' => $backgroundMain, 'schedules' => $schedules, 'programs' => $programs, 'week' => $week, 'channels' => $channels, 'channel' => $channel, 'positionTop' => $this->positionTop, 'positionRight' => $this->positionRight, 'positionCenter' => $this->positionCenter, 'positionBottom' => $this->positionBottom, 'positionLeft' => $this->positionLeft]);
 }
Esempio n. 3
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy(Schedule $schedule)
 {
     $schedule->delete();
     return redirect()->route('admin.schedule.index');
 }
Esempio n. 4
0
 public function channel($channel)
 {
     $schedules = Schedule::where('channel_id', '=', $channel->id)->orderBy('date', 'asc')->get();
     //        dd($schedules);
     return view('Admin::schedule.channel', ['schedules' => $schedules, 'channel' => $channel]);
 }
Esempio n. 5
0
 public function broadcastsprogramm()
 {
     $channel = \Model\Channel\ModelName::where('name', '=', 'birinchi')->first();
     $lc = app()->getlocale();
     $backgroundMain = \Model\Background\ModelName::where('published', '=', true)->first();
     $lc = app()->getlocale();
     if ($lc == 'kg') {
         $birinchiProjects = \Model\Project\ModelName::where('published', '=', true)->where('birinchi', '=', 1)->where('name', '<>', '')->get();
     } else {
         $birinchiProjects = \Model\Project\ModelName::where('published', '=', true)->where('birinchi', '=', 1)->where('nameRu', '<>', '')->get();
     }
     date_default_timezone_set('Asia/Bishkek');
     $now = date("d-m-Y H:i");
     $currentDate = date('d-m-Y');
     $currentTime = date('H:i');
     $weekDay = date('N', strtotime($now));
     if ($channel) {
         $schedules = \Model\Schedule\ModelName::where('channel_id', '=', $channel->id)->orderBy('date', 'desc')->get();
         for ($i = 1; $i <= 7; $i++) {
             if ($i < $weekDay) {
                 $weekDayNew = date('d-m-Y', strtotime('-' . ($weekDay - $i) . ' day'));
                 $week[] = $weekDayNew;
             } elseif ($i > $weekDay) {
                 $weekDayNew = date('d-m-Y', strtotime('+' . ($i - $weekDay) . ' day'));
                 $week[] = $weekDayNew;
             } else {
                 $weekDayNew = date('d-m-Y', strtotime($now));
                 $week[] = $weekDayNew;
             }
         }
         if (!empty($schedules)) {
             $programs = array();
             foreach ($schedules as $schedule) {
                 $scheduleWeek = date('N', strtotime($schedule->date));
                 for ($j = 0; $j < count($week); $j++) {
                     if (strtotime($week[$j]) == strtotime($schedule->date)) {
                         $program = json_decode($schedule->program);
                         $programNew = array_add($program, 'date', $schedule->date);
                         $programs[] = $programNew;
                     }
                 }
             }
             $programs = array_reverse($programs);
         }
     }
     //        dd($programs);
     return view('Front::channel.birinchi.broadcastsprogramm', ['lc' => $lc, 'currentDate' => $currentDate, 'currentTime' => $currentTime, 'backgroundMain' => $backgroundMain, 'schedules' => $schedules, 'programs' => $programs, 'week' => $week, 'birinchiProjects' => $birinchiProjects]);
 }