public function scheduleformAction() { try { $this->checkLogin(); $schedule = new Schedule(); $this->view->assign('regist_schedule', $schedule->get('regist')); $this->view->assign('impression_schedule', $schedule->get('impre')); $this->view->assign('root_url', ROOT_URL); $this->view->display('admin/admin_scheduleform.tpl'); } catch (Exception $e) { $this->displayErrorView($e->getMessage()); } }
function schedule_controller() { global $session, $route, $mysqli, $user; $result = false; require "Modules/schedule/schedule_model.php"; $schedule = new Schedule($mysqli, $user->get_timezone($session['userid'])); if ($route->format == 'html') { if ($route->action == "view" && $session['write']) { $result = view("Modules/schedule/Views/schedule_view.php", array()); } if ($route->action == 'api') { $result = view("Modules/schedule/Views/schedule_api.php", array()); } } if ($route->format == 'json') { if ($route->action == 'list') { if ($session['userid'] > 0 && $session['userid'] && $session['read']) { $result = $schedule->get_list($session['userid']); } } elseif ($route->action == "create") { if ($session['userid'] > 0 && $session['write']) { $result = $schedule->create($session['userid']); } } else { $scheduleid = (int) get('id'); if ($schedule->exist($scheduleid)) { $scheduleget = $schedule->get($scheduleid); // if public or belongs to user if ($session['read'] && ($scheduleget['public'] || $session['userid'] > 0 && $scheduleget['userid'] == $session['userid'])) { if ($route->action == "get") { $result = $scheduleget; } if ($route->action == "expression") { $result = $schedule->get_expression($scheduleid); } if ($route->action == "test") { $result = $schedule->test_expression($scheduleid); } } // if public if (isset($session['write']) && $session['write'] && $session['userid'] > 0 && $scheduleget['userid'] == $session['userid']) { if ($route->action == "delete") { $result = $schedule->delete($scheduleid); } if ($route->action == 'set') { $result = $schedule->set_fields($scheduleid, get('fields')); } } } else { $result = array('success' => false, 'message' => 'Schedule does not exist'); } } } return array('content' => $result); }
# Admin Schedules Route::get('/', function () { $schedules = Schedule::get(); return View::make('backend.schedules')->with('schedules', $schedules); }); # Admin Add Schedules; Route::get('/add', function () { $user = Sentry::getUser(); return View::make('backend.addschedules')->with('user', $user); }); # Admin Status Change Schedules; Route::get('/status/{status}/{id}', function ($status, $id) { $user = Sentry::getUser(); $scObj = new Schedule(); $update = $scObj->changeStatus($id, $status, $user->id); $schedules = Schedule::get(); return View::make('backend.schedules')->with('schedules', $schedules); }); # Admin Delete Schedules; Route::get('/delete/{id}', function ($id) { $scObj = Schedule::find($id); //dd($scObj); $delobj = $scObj->delete(); if ($delobj) { echo 1; } else { echo 0; } }); Route::post('/add', array('uses' => 'RainTvController@postNewshedule')); # Admin edit Schedules