Inheritance: extends Model
 private function search($searchValue)
 {
     $model = new ModelSearch();
     $tmp = $model->search($searchValue)->fetchAll(PDO::FETCH_OBJ);
     foreach ($tmp as $row) {
         $row->profile_picture = $GLOBALS['working_dir'] . $row->profile_picture;
         $row->banner_picture = $GLOBALS['working_dir'] . $row->banner_picture;
     }
     return $tmp;
 }
Exemplo n.º 2
0
 /**
  * Sets up search on all listed elements
  */
 public function searchAll()
 {
     $searchArray = array('type' => 'compare', 'compare_to' => array());
     $searchFirst = '';
     foreach ($this->listFields as $field) {
         if (method_exists($this->model, 'get_' . $field)) {
             //we don't currently support searching on magic attributes not from the DB so continue
             continue;
         }
         if ($searchFirst === '') {
             $searchFirst = $field;
         } else {
             $searchArray['compare_to'][] = $field;
         }
     }
     $this->search->addSearchItem($searchFirst, $searchArray);
 }
Exemplo n.º 3
0
<?php

use fedemotta\datatables;
use yii\grid\GridView;
?>

<?php 
$searchModel = new ModelSearch();
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
echo DataTables::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], ['class' => 'yii\\grid\\ActionColumn']]]);
Exemplo n.º 4
0
 public function actionInstitutions($id = false)
 {
     Audit::add('admin-Institution', 'list');
     $search = new ModelSearch(Institution::model());
     $search->addSearchItem('name', array('type' => 'compare', 'compare_to' => array('remote_id', 'short_name')));
     $search->addSearchItem('active', array('type' => 'boolean'));
     $this->render('/admin/institutions', array('pagination' => $search->initPagination(), 'institutions' => $search->retrieveResults(), 'search' => $search));
 }