예제 #1
0
         if ($validator->fails()) {
             return Redirect::to('/account/view_title/' . $title_id)->withInput()->withErrors($validator)->with('message', '輸入錯誤,請檢查');
         } else {
             $data = Input::all();
             $title = Title::find($titleId);
             if ($title->update($data)) {
                 $message = '更新職稱《' . $data['title_name'] . '》完成';
             } else {
                 $message = '資料寫入錯誤';
             }
             return Redirect::to('/account/view_title/' . $titleId)->with('message', $message);
         }
     });
     // 執行刪除職稱
     Route::get('/delete_title/{titleId}', function ($titleId) {
         $title = Title::find($titleId);
         $message = '刪除《' . $title->title_name . '》完成';
         $title->delete();
         return Redirect::to('account/')->with('message', $message);
     });
 });
 /**
  * 班級、年級管理
  */
 Route::group(array('prefix' => 'class_year', 'before' => 'auth'), function () {
     // 讀取年級列表
     $GLOBALS['yearList'] = Year::orderBy('year_name')->get();
     // 顯示年級列表、年級新增表單
     Route::get('/', function () {
         return View::make('class_year')->with(array('yearList' => $GLOBALS['yearList'], 'year' => NULL));
     });
<?php

require_once __DIR__ . "/includes/root.php";
must_allow("modify titles");
$title = Title::find($_REQUEST["id"]);
if ($title == NULL) {
    $renderer->flash_alert("Unable to find the requested title");
    header("Location: title-list.php");
    exit;
}
$renderer->variable("pub", $title);
$renderer->variable("title", sprintf("Editing %s", $title->title));
$renderer->render("title-form");
예제 #3
0
 public function updateMovieBrokenLink()
 {
     $id = Input::get('id');
     $movie = Title::find($id);
     $movie->reindexed = 'Broken Link';
     $respuesta = $movie->save();
     $rows[] = array('id' => '1', 'value' => trans('main.errorMessageBrokenLink'));
     return json_encode($rows);
 }
예제 #4
0
파일: routes.php 프로젝트: samirios1/niter
Route::get('typeahead-actor/{query}', array('uses' => 'SearchController@castTypeAhead', 'as' => 'typeahead-cast'));
//homepage and footer
Route::get('/', array('as' => 'home', 'uses' => 'HomeController@index'));
Route::get(Str::slug(trans('main.privacyUrl')), array('uses' => 'HomeController@privacy', 'as' => 'privacy'));
Route::get(Str::slug(trans('main.tosUrl')), array('uses' => 'HomeController@tos', 'as' => 'tos'));
Route::get(Str::slug(trans('main.contactUrl')), array('uses' => 'HomeController@contact', 'as' => 'contact'));
Route::post(Str::slug(trans('main.contactUrl')), array('uses' => 'HomeController@submitContact', 'as' => 'submit.contact'));
//news
Route::resource(Str::slug(trans('main.news')), 'NewsController');
Route::post('news/external', array('uses' => 'NewsController@updateFromExternal', 'as' => 'news.ext'));
//movies/series
// Move this to MoviesController@updateMovieBrokenLink
// Route::get(Str::slug(trans('main.movies')) . '/updateMovieBrokenLink', 'MoviesController@updateMovieBrokenLink');
Route::get(Str::slug(trans('main.movies')) . '/updateMovieBrokenLink', function () {
    $id = Input::get('id');
    $movie = Title::find($id);
    $movie->reindexed = 'Broken Link';
    $respuesta = $movie->save();
    $rows[] = array('id' => '1', 'value' => trans('main.errorMessageBrokenLink'));
    return json_encode($rows);
    // return Input::get('id');
});
Route::resource(Str::slug(trans('main.movies')), 'MoviesController');
//lists(watchlist/favorites)
Route::controller('lists', 'ListsController');
//reviews
Route::resource(Str::slug(trans('main.movies')) . '.reviews', 'ReviewController', array('only' => array('store', 'destroy')));
Route::post(Str::slug(trans('main.movies')) . '/{title}/reviews', 'ReviewController@store');
//people
Route::resource(Str::slug(trans('main.people')), 'ActorController');
Route::get('actors', array('uses' => 'ActorController@index'));
예제 #5
0
 public function postFinaltitlestage()
 {
     $new_title_id = Input::get("title_id");
     // Gets this from a hidden input element
     if ($mode = Input::has('publish_title')) {
         $title = Title::find($new_title_id);
         $title->status_id = 3;
         // active status in statuses table
         $title->save();
         return Redirect::to('/title/list');
     } else {
         return Redirect::to('/title/list');
     }
 }
<?php

require_once __DIR__ . "/includes/root.php";
must_allow("modify titles");
$id = $_POST["id"];
if ($id == NULL || $id == "") {
    $title = new Title();
    $action = "new title";
} else {
    $title = Title::find($id);
    if ($title == NULL) {
        $renderer->flash_alert("Unable to find requested title; aborting edit");
        header("Location: title-list.php");
        exit(0);
    }
    $action = "edit title";
}
$audit_changes = array();
$fields = array("title", "embargoed", "rights", "is_historic");
if (!$title->validlccn || permitted(get_user(), "modify validated lccns")) {
    array_push($fields, "lccn");
}
if (permitted(get_user(), "modify title sftp")) {
    $fields = array_merge($fields, array("sftpdir", "sftpuser", "sftppass"));
}
$lccn_changed = FALSE;
foreach ($fields as $field) {
    $orig = $title->{$field};
    $new = $_POST[$field];
    if ($orig == $new) {
        continue;