/**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new Ranks();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Ranks'])) {
         $model->attributes = $_POST['Ranks'];
         if ($model->save()) {
             $this->redirect(array('view', 'id' => $model->id));
         }
     }
     $this->render('create', array('model' => $model));
 }
 protected function processPage($url, $pageContent)
 {
     $bookPage = $pageContent;
     list($rank_best_sell, $info_best_sell, $info_ranks, $title, $isbn_10, $isbn_13) = $this->getPageInfos($bookPage);
     if (empty($title) || empty($rank_best_sell)) {
         return false;
     }
     if (empty($isbn_13) && empty($isbn_10)) {
         printf("This has not isbn:\"%s\"\n", $url);
         return false;
     }
     list($main_image, $thumb_image) = $this->getImages($bookPage);
     $rank = Ranks::model()->find('url=:url', array('url' => $url));
     if (empty($rank)) {
         $rank = new Ranks();
     }
     $rank->url = $url;
     $rank->rank_best_sell = $rank_best_sell;
     $rank->info_best_sell = $info_best_sell;
     $rank->info_ranks = $info_ranks;
     $rank->title = $title;
     $rank->isbn_10 = $isbn_10;
     $rank->isbn_13 = $isbn_13;
     $rank->main_image = $main_image;
     $rank->thumb_image = $thumb_image;
     $rank->utime = date("Y-m-d H:i:s");
     try {
         $rank->save();
     } catch (Exception $e) {
         $this->printException($e);
     }
     return true;
 }