Advertisement
Sdelkadrom

Untitled

Jun 4th, 2019
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.56 KB | None | 0 0
  1. public function search()
  2. {
  3. $criteria = new CDbCriteria;
  4.  
  5. $titlepagesField = 'titlepages_' . Yii::app()->language;
  6. $criteria->compare($this->getTableAlias() . '.' . $titlepagesField, $this->$titlepagesField, true);
  7.  
  8. $descriptionaboutField = 'descriptionabout_' . Yii::app()->language;
  9. $criteria->compare($this->getTableAlias() . '.' . $descriptionaboutField, $this->$descriptionaboutField, true);
  10.  
  11. $criteria->compare($this->getTableAlias() . '.id', $this->id, true);
  12. $criteria->compare($this->getTableAlias() . '.username', $this->username, true);
  13. $criteria->compare($this->getTableAlias() . '.email', $this->email, true);
  14. $criteria->compare($this->getTableAlias() . '.phone', $this->phone, true);
  15. $criteria->compare($this->getTableAlias() . '.type', $this->type);
  16. $criteria->compare($this->getTableAlias() . '.role', $this->role);
  17. $criteria->compare($this->getTableAlias() . '.balance', $this->balance, true);
  18. $criteria->compare($this->getTableAlias() . '.is_use_api', $this->is_use_api);
  19. $criteria->compare($this->getTableAlias() . '.agency_name', $this->agency_name);
  20. $criteria->compare($this->getTableAlias() . '.city', $this->city);
  21. $criteria->compare($this->getTableAlias() . '.useVkontakte', $this->useVkontakte);
  22. $criteria->compare($this->getTableAlias() . '.useTwitter', $this->useTwitter);
  23.  
  24. if ($this->date_created)
  25. $criteria->compare($this->getTableAlias() . '.date_created', $this->date_created, true);
  26.  
  27. if ($this->active != 'all')
  28. $criteria->compare('active', $this->active);
  29.  
  30. if (issetModule('tariffPlans') && issetModule('paidservices') && Yii::app()->user->checkAccess('tariff_plans_admin')) {
  31. //$criteria->with = array('userTariffPlan');
  32. $criteria->with = array(
  33. 'userTariffPlanAll' => array(
  34. 'select' => '{{users_tariff_plans}}.*',
  35. 'joinType' => 'LEFT OUTER JOIN',
  36. ),
  37. );
  38. $criteria->together = true;
  39.  
  40. return new CustomActiveDataProvider($this, array(
  41. 'criteria' => $criteria,
  42. 'sort' => array(
  43. 'attributes' => array(
  44. 'id',
  45. 'active',
  46. 'type',
  47. 'is_use_api',
  48. 'useVkontakte',
  49. 'useTwitter',
  50. 'role',
  51. 'username',
  52. 'agency_name',
  53. 'city',
  54. 'phone',
  55. 'email',
  56. 'searchWithTariffPlan' => array(
  57. 'asc' => 'userTariffPlanAll.date_end',
  58. 'desc' => 'userTariffPlanAll.date_end DESC',
  59. ),
  60. 'date_created',
  61. 'balance',
  62. ),
  63. 'defaultOrder' => $this->getTableAlias() . '.id DESC'
  64. ),
  65. 'pagination' => array(
  66. 'pageSize' => param('adminPaginationPageSize', 20),
  67. ),
  68. ));
  69. }
  70.  
  71. return new CustomActiveDataProvider($this, array(
  72. 'criteria' => $criteria,
  73. 'sort' => array('defaultOrder' => $this->getTableAlias() . '.id DESC'),
  74. 'pagination' => array(
  75. 'pageSize' => param('adminPaginationPageSize', 20),
  76. ),
  77. ));
  78. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement