Ejemplo n.º 1
0
 /**
  * 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()));
 }
Ejemplo n.º 2
0
 public static function search($params)
 {
     $searchController = new SearchController();
     $results = $searchController->search($params);
     return $results;
 }
Ejemplo n.º 3
0
});
$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();
});
Ejemplo n.º 4
0
 public function actionIndex()
 {
     $this->render('index', array('callback' => SearchController::search(CHttpRequest::getQuery('text'))));
 }