Inheritance: extends CComponent
Exemple #1
0
 /**
  * @param $path
  * @throws CHttpException
  */
 public function actionView($path)
 {
     $category = StoreCategory::model()->published()->findByPath($path);
     if (null === $category) {
         throw new CHttpException(404);
     }
     $data = Yii::app()->getRequest()->getQueryString() ? $this->productRepository->getByFilter($this->attributeFilter->getMainAttributesForSearchFromQuery(Yii::app()->getRequest(), [AttributeFilter::MAIN_SEARCH_PARAM_CATEGORY => [$category->id]]), $this->attributeFilter->getTypeAttributesForSearchFromQuery(Yii::app()->getRequest())) : $this->productRepository->getListForCategory($category);
     $this->render('view', ['dataProvider' => $data, 'category' => $category]);
 }
 /**
  *
  */
 public function actionIndex()
 {
     $typesSearchParam = $this->attributeFilter->getTypeAttributesForSearchFromQuery(Yii::app()->getRequest());
     $mainSearchParam = $this->attributeFilter->getMainAttributesForSearchFromQuery(Yii::app()->getRequest(), [AttributeFilter::MAIN_SEARCH_PARAM_NAME => Yii::app()->getRequest()->getQuery(AttributeFilter::MAIN_SEARCH_QUERY_NAME)]);
     if (!empty($mainSearchParam) || !empty($typesSearchParam)) {
         $data = $this->productRepository->getByFilter($mainSearchParam, $typesSearchParam);
     } else {
         $data = $this->productRepository->getListForIndexPage();
     }
     $this->render('index', ['dataProvider' => $data]);
 }
Exemple #3
0
 public function GetFilter()
 {
     $filter = new SqlFilterNull();
     if (!empty($this->username)) {
         $filter->_And(new SqlFilterEquals(ColumnNames::USERNAME, $this->username));
     }
     if (!empty($this->email)) {
         $filter->_And(new SqlFilterEquals(ColumnNames::EMAIL, $this->email));
     }
     if (!empty($this->firstName)) {
         $filter->_And(new SqlFilterEquals(ColumnNames::FIRST_NAME, $this->firstName));
     }
     if (!empty($this->lastName)) {
         $filter->_And(new SqlFilterEquals(ColumnNames::LAST_NAME, $this->lastName));
     }
     if (!empty($this->phone)) {
         $filter->_And(new SqlFilterEquals(ColumnNames::PHONE_NUMBER, $this->phone));
     }
     if (!empty($this->organization)) {
         $filter->_And(new SqlFilterEquals(ColumnNames::ORGANIZATION, $this->organization));
     }
     if (!empty($this->position)) {
         $filter->_And(new SqlFilterEquals(ColumnNames::POSITION, $this->position));
     }
     if (!empty($this->attributes)) {
         $attributeFilter = AttributeFilter::Create(TableNames::USERS_ALIAS . '.' . ColumnNames::USER_ID, $this->attributes);
         if ($attributeFilter != null) {
             $filter->_And($attributeFilter);
         }
     }
     foreach ($this->_and as $and) {
         $filter->_And($and);
     }
     return $filter;
 }
Exemple #4
0
 public function GetFilter()
 {
     $filter = new SqlFilterNull();
     if (!empty($this->startDate)) {
         $filter->_And(new SqlFilterGreaterThan(ColumnNames::RESERVATION_START, $this->startDate->ToDatabase(), true));
     }
     if (!empty($this->endDate)) {
         $filter->_And(new SqlFilterLessThan(ColumnNames::RESERVATION_END, $this->endDate->AddDays(1)->ToDatabase(), true));
     }
     if (!empty($this->referenceNumber)) {
         $filter->_And(new SqlFilterEquals(ColumnNames::REFERENCE_NUMBER, $this->referenceNumber));
     }
     if (!empty($this->scheduleId)) {
         $filter->_And(new SqlFilterEquals(new SqlFilterColumn(TableNames::RESOURCES, ColumnNames::SCHEDULE_ID), $this->scheduleId));
     }
     if (!empty($this->resourceId)) {
         $filter->_And(new SqlFilterEquals(new SqlFilterColumn(TableNames::RESOURCES, ColumnNames::RESOURCE_ID), $this->resourceId));
     }
     if (!empty($this->userId)) {
         $filter->_And(new SqlFilterEquals(new SqlFilterColumn(TableNames::USERS, ColumnNames::USER_ID), $this->userId));
     }
     if (!empty($this->statusId)) {
         $filter->_And(new SqlFilterEquals(new SqlFilterColumn(TableNames::RESERVATION_SERIES_ALIAS, ColumnNames::RESERVATION_STATUS), $this->statusId));
     }
     if (!empty($this->resourceStatusId)) {
         $filter->_And(new SqlFilterEquals(new SqlFilterColumn(TableNames::RESOURCES, ColumnNames::RESOURCE_STATUS_ID), $this->resourceStatusId));
     }
     if (!empty($this->resourceStatusReasonId)) {
         $filter->_And(new SqlFilterEquals(new SqlFilterColumn(TableNames::RESOURCES, ColumnNames::RESOURCE_STATUS_REASON_ID), $this->resourceStatusReasonId));
     }
     if (!empty($this->attributes)) {
         $attributeFilter = AttributeFilter::Create(TableNames::RESERVATION_SERIES_ALIAS . '.' . ColumnNames::SERIES_ID, $this->attributes);
         if ($attributeFilter != null) {
             $filter->_And($attributeFilter);
         }
     }
     foreach ($this->_and as $and) {
         $filter->_And($and);
     }
     return $filter;
 }