/** * @inheritdoc */ public function queryMethods() { if ($presMethods = Yii::$app->request->get('PresentationMethods') and $service = $this->service) { //echo '<pre>'; //print_r($presSpecs); die(); $arrMeth = ''; foreach ($presMethods as $key => $presMethod) { if (is_array($presMethod) and (isset($presMethod['value']) and $presMethod['value'] != '' or isset($presMethod['method_models']) and $presMethod['method_models'] != '')) { $property = \common\models\CsProperties::findOne($key); $arrMeth .= '(presentation_action_properties.action_property_id=' . $presMethod['method_id'] . ' AND '; if ($property->type == 1 or $property->type == 5) { if ($presMethod['value'] != '') { // ako je provajderov predmet, onda je range $arrMeth .= '(presentation_action_properties.value>' . $presMethod['value'] . ' OR presentation_action_properties.value IS NULL)'; } else { $arrMeth .= '1=1'; } } if ($property->type == 2 or $property->type == 21 or $property->type == 3 or $property->type == 4 or $property->type == 41) { if (isset($presMethod['method_models']) and $presMethod['method_models'] != '') { $arrMethPref = '('; foreach ($presMethod['method_models'] as $mth_mdl) { $arrMethPref .= 'presentation_action_property_values.property_value_id=' . $mth_mdl . ' OR '; } $arrMethPref = substr($arrMethPref, 0, -4); $arrMethPref .= ')'; $arrMeth .= $arrMethPref; } else { $arrMeth .= '1=1'; } } $arrMeth .= ') OR '; } } return $arrMeth != '' ? substr($arrMeth, 0, -4) : []; } return []; }
/** * Finds the CsProperties model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return CsProperties the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = CsProperties::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
/** * Kreira Modele PresentationSpecs za sve izabrane specifikacije. */ public function loadPresentationSpecificationsIndex($model_object_properties) { if ($model_object_properties) { foreach ($model_object_properties as $key => $model_object_property) { $property = \common\models\CsProperties::findOne($key); $model_object_property->theObjectProperty = $model_object_property->objectProperty; $model_object_property->property = $property; $model_object_property->service = $this->pService; $model_object_property->checkUserObject = $this->checkUserObjectsExist($this->pService, $this->objectModels) ? 0 : 1; } return $model_object_properties; } return null; }