/** * Import movies */ public function actionImport() { if ($movies = CHttpRequest::getPost('movies', false)) { foreach (explode("\n", $movies) as $key => $movie) { if (!ImportLog::model()->find('import_name=:movie', array(':movie' => $movie))) { if (substr($movie, -2) == 02) { continue; } // 2nd part $search = SearchController::search(str_replace(array('-', '01'), ' ', $movie)); $log = new ImportLog(); $log->import_name = $movie; $log->search_id = $search->id; $log->save(); } } } $this->render('import', array('imported_movies' => ImportLog::model()->findAll())); }
public static function search($params) { $searchController = new SearchController(); $results = $searchController->search($params); return $results; }
}); $routes->get('/institution/:id/update', function ($id) { InstitutionController::edit($id); }); $routes->post('/institution/:id/update', function ($id) { InstitutionController::update($id); }); $routes->post('/institution/:id/delete', function ($id) { InstitutionController::delete($id); }); $routes->get('/suggestions', function () { SuggestionController::index(); }); $routes->get('/suggestion/new', function () { SuggestionController::create(); }); $routes->post('/suggestion/new', function () { SuggestionController::store(); }); $routes->post('/suggestion/:id/update', function ($id) { SuggestionController::toggleProcessed($id); }); $routes->post('/suggestion/:id/delete', function ($id) { SuggestionController::delete($id); }); $routes->get('/search', function () { SearchController::index(); }); $routes->post('/search', function () { SearchController::search(); });
public function actionIndex() { $this->render('index', array('callback' => SearchController::search(CHttpRequest::getQuery('text')))); }