/**
  * Manages all models.
  */
 public function actionIndex()
 {
     $model = new BanersElements('search');
     $model->attachBehavior('dateComparator', array('class' => 'DateComparator'));
     $model->unsetAttributes();
     // clear any default values
     // set attributes from get
     if (isset($_GET['BanersElements'])) {
         $model->attributes = $_GET['BanersElements'];
     }
     $param = array();
     $data['sort'] = array('defaultOrder' => 'id DESC');
     $data['Pagination'] = array('PageSize' => 100);
     if ($settingsModel = SiteModuleSettings::model()->find('site_module_id = 15')) {
         $data['Pagination'] = array('PageSize' => (int) $settingsModel->elements_page_admin > 0 ? $settingsModel->elements_page_admin : 100);
     }
     $provider = new CActiveDataProvider('BanersElements', $data);
     $param = implode(" AND ", $param);
     $provider->criteria = $model->search($param);
     $root = BanersRubrics::getRoot(new BanersRubrics());
     $catalog = $root->descendants()->findAll($root->id);
     $this->render('list', array('model' => $model, 'provider' => $provider, 'root' => $root, 'catalog' => $catalog));
 }