Exemplo n.º 1
0
 /**
  * Lists all CsServices models.
  * @return mixed
  */
 public function actionIndex($entity = null, $title = null)
 {
     $request = Yii::$app->request;
     $session = Yii::$app->session;
     //$session->removeAll();
     $entity = $request->get('entity');
     $title = $request->get('title');
     if ($state = $request->get('st')) {
         $session->set('state', $state);
         if ($state == 'gl') {
             $session->remove('state');
         }
     }
     $q = $request->get('q');
     $queryObjects = $q ? new ActiveDataProvider(['query' => CsObjects::find()->joinWith(['t t'])->where(['like', 't.name', $q])->andWhere('cs_objects.class != "abstract"')->groupBy('cs_objects.id')]) : null;
     $queryIndustries = $q ? new ActiveDataProvider(['query' => CsIndustries::find()->joinWith(['t t'])->where(['like', 't.name', $q])->groupBy('cs_industries.id')]) : null;
     //$queryIndustries = ($q) ? $this->suggested_word($q) : null;
     $queryActions = $q ? new ActiveDataProvider(['query' => CsActions::find()->joinWith(['t t'])->where(['like', 't.name', $q])->groupBy('cs_actions.id')]) : null;
     $queryProducts = $q ? new ActiveDataProvider(['query' => CsProducts::find()->where(['like', 'name', $q])->andWhere(['or', 'level=1', 'level=2'])]) : null;
     $object = ($entity == 'o' and $title) ? $this->findObjectByTitle($title) : null;
     $industry = ($entity == 'i' and $title) ? $this->findIndustryByTitle($title) : null;
     $action = ($entity == 'a' and $title) ? $this->findActionByTitle($title) : null;
     $product = ($entity == 'p' and $title) ? $this->findProductByTitle($title) : null;
     $renderIndex = $object || $industry || $action || $product || $q ? false : true;
     $searchModel = new CsServicesSearch();
     $dataProvider = $searchModel->search(['CsServicesSearch' => ['name' => $q, 'industry_id' => $industry ? $industry->id : null, 'action_id' => $action ? $action->id : null, 'object_id' => $object ? $object->id : null]]);
     return $this->render('index', ['dataProvider' => $dataProvider, 'renderIndex' => $renderIndex, 'industry' => $industry, 'action' => $action, 'object' => $object, 'product' => $product, 'searchString' => $request->get('q'), 'queryObjects' => $queryObjects, 'queryIndustries' => $queryIndustries, 'queryActions' => $queryActions, 'queryProducts' => $queryProducts, 'countSearchResults' => $this->countSearchResults($dataProvider, $queryObjects, $queryIndustries, $queryActions, $queryProducts), 'countServicesResults' => $this->countServicesResults($dataProvider), 'countIndustriesResults' => $this->countIndustriesResults($queryIndustries), 'countActionsResults' => $this->countActionsResults($queryActions), 'countObjectsResults' => $this->countObjectsResults($queryObjects), 'countProductsResults' => $this->countProductsResults($queryProducts)]);
 }
Exemplo n.º 2
0
 /**
  * Finds the CsIndustries model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return CsIndustries the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = CsIndustries::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Exemplo n.º 3
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = CsIndustries::find();
     // add conditions that should always apply here
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     // grid filtering conditions
     $query->andFilterWhere(['id' => $this->id, 'category_id' => $this->category_id, 'file_id' => $this->file_id, 'hit_counter' => $this->hit_counter]);
     $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'status', $this->status]);
     return $dataProvider;
 }
Exemplo n.º 4
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getSimilarIndustry()
 {
     return $this->hasOne(CsIndustries::className(), ['id' => 'similar_industry_id']);
 }
Exemplo n.º 5
0
use yii\helpers\Url;
use kartik\widgets\ActiveForm;
use kartik\switchinput\SwitchInput;
use kartik\widgets\DatePicker;
use kartik\select2\Select2;
use yii\helpers\ArrayHelper;
use kartik\widgets\FileInput;
?>


<?php 
$form = kartik\widgets\ActiveForm::begin(['id' => 'form-horizontal', 'type' => ActiveForm::TYPE_HORIZONTAL, 'fullSpan' => 7, 'formConfig' => ['labelSpan' => 3, 'deviceSize' => ActiveForm::SIZE_MEDIUM], 'options' => ['enctype' => 'multipart/form-data']]);
?>

    <?php 
echo $form->field($model, 'industry_id')->widget(Select2::classname(), ['data' => ArrayHelper::map(\common\models\CsIndustries::find()->all(), 'id', 'name'), 'options' => ['placeholder' => 'Izaberite...'], 'language' => 'sr-Latn', 'changeOnReset' => false]);
?>

    <?php 
echo $form->field($model, 'property_id')->widget(Select2::classname(), ['data' => ArrayHelper::map(\common\models\CsProperties::find()->all(), 'id', 'name'), 'options' => ['placeholder' => 'Izaberite...'], 'language' => 'sr-Latn', 'changeOnReset' => false]);
?>

    <?php 
echo $form->field($model, 'value_default')->input('text');
?>

    <?php 
echo $form->field($model, 'value_min')->input('number');
?>

    <?php 
Exemplo n.º 6
0
    </div> 
    <div class="card_container record-650 grid-item fadeIn animated order-service-process" id="card_container" style="float:none;">
    <?php 
$form = kartik\widgets\ActiveForm::begin(['id' => 'signup-form', 'action' => Url::to('market')]);
?>
            <div class="primary-context small-margin">
                <div class="head lower">Brzo naručivanje usluga</div>
            </div>
            <div class="secondary-context cont">
                <p><i class="fa fa-lightbulb-o"></i>&nbsp;Birajte delatnost, zatim aktivnost i na kraju predmet usluge i naručite uslugu. 
                            Npr.: Treba mi... <b>arhitekta</b> za <b>projektovanje kuće</b></p>
            </div>
            <div class="secondary-context cont">
                
                <?php 
echo $form->field(new \common\models\CsServices(), 'industry_id')->widget(Select2::classname(), ['data' => ArrayHelper::map(\common\models\CsIndustries::find()->all(), 'id', 'name'), 'options' => ['placeholder' => 'Izaberi delatnost ...', 'id' => 'ind_id'], 'pluginOptions' => ['allowClear' => true]]);
?>

                <?php 
echo $form->field(new \common\models\CsServices(), 'action_id')->widget(DepDrop::classname(), ['options' => ['id' => 'act_id'], 'pluginOptions' => ['depends' => ['ind_id'], 'placeholder' => 'Izaberi akciju...', 'url' => Url::to(['/glob-nav-act-services'])]]);
?>
                <?php 
echo $form->field(new \common\models\CsServices(), 'object_id')->widget(DepDrop::classname(), ['options' => ['id' => 'obj_id'], 'pluginOptions' => ['depends' => ['act_id'], 'placeholder' => 'Izaberi predmet...', 'url' => Url::to(['/glob-nav-ser-objects'])]]);
?>
                
            </div>
            <div class="action-area right gray">
                <?php 
echo Html::submitButton('<i class="fa fa-shopping-cart"></i>&nbsp;' . Yii::t('app', 'Order'), ['class' => 'btn btn-info']);
?>
            </div>
Exemplo n.º 7
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getIndustries()
 {
     return $this->hasMany(CsIndustries::className(), ['category_id' => 'id']);
 }
Exemplo n.º 8
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getCsIndustries()
 {
     return $this->hasMany(CsIndustries::className(), ['file_id' => 'id']);
 }
Exemplo n.º 9
0
use yii\helpers\Html;
use kartik\widgets\ActiveForm;
use kartik\select2\Select2;
use yii\helpers\ArrayHelper;
/* @var $this yii\web\View */
/* @var $model frontend\models\CsServicesSearch */
/* @var $form yii\widgets\ActiveForm */
?>


    <?php 
$form = ActiveForm::begin(['action' => ['index'], 'method' => 'get', 'type' => ActiveForm::TYPE_HORIZONTAL, 'fullSpan' => 11, 'formConfig' => ['labelSpan' => 2, 'deviceSize' => ActiveForm::SIZE_SMALL]]);
?>

        <?php 
echo $form->field($model, 'industry_id')->widget(Select2::classname(), ['data' => ArrayHelper::map(\common\models\CsIndustries::find()->all(), 'id', 'name'), 'options' => ['placeholder' => 'Izaberi uslužnu delatnost ...'], 'pluginOptions' => ['allowClear' => true, 'width' => '100%']]);
?>

        <?php 
echo $form->field($model, 'object_id')->widget(Select2::classname(), ['data' => ArrayHelper::map(\common\models\CsObjects::find()->all(), 'id', 'name'), 'options' => ['placeholder' => 'Izaberi predmet usluge ...'], 'pluginOptions' => ['allowClear' => true, 'width' => '100%']]);
?>

        <div class="form-group">
            <div class="col-sm-offset-2 col-sm-9">
                <?php 
echo Html::submitButton(Yii::t('app', 'Traži'), ['class' => 'btn btn-default']);
?>
            </div>
        </div>

    <?php 
Exemplo n.º 10
0
 /**
  * Lists all CsServices models.
  * @return mixed
  */
 public function actionIndex()
 {
     $request = Yii::$app->request;
     $post = $request->post('CsServicesSearch');
     // industry
     if (isset($post['industry_id']) && $post['industry_id'] != null && $post['industry_id'] != '') {
         $industry = CsIndustries::findOne($post['industry_id']);
         return $this->redirect(['/services/i/' . slug($industry->tName)]);
     }
     // object
     if (isset($post['object_id']) && $post['object_id'] != null && $post['object_id'] != '') {
         $object = CsObjects::findOne($post['object_id']);
         return $this->redirect(['/services/o/' . slug($object->tName)]);
     }
     // product
     if (isset($post['product_id']) && $post['product_id'] != null && $post['product_id'] != '') {
         $product = CsProducts::findOne($post['product_id']);
         return $this->redirect(['/services/p/' . slug($product->name)]);
     }
     // action
     if (isset($post['action_id']) && $post['action_id'] != null && $post['action_id'] != '') {
         $action = CsActions::findOne($post['action_id']);
         return $this->redirect(['/services/a/' . slug($action->tName)]);
     }
     // service
     if (isset($post['id']) && $post['id'] != null && $post['id'] != '') {
         $service = CsServices::findOne($post['id']);
         return $this->redirect(['/s/' . slug($service->tName)]);
     }
     // tags
     if (isset($post['tag_id']) && $post['tag_id'] != null && $post['tag_id'] != '') {
         $tag = CsTags::findOne($post['tag_id']);
         switch ($tag->entity) {
             case 'action':
                 return $this->redirect(['/services', 'a' => $tag->entity_id]);
                 break;
             case 'object':
                 return $this->redirect(['/services', 'o' => $tag->entity_id]);
                 break;
             case 'industry':
                 return $this->redirect(['/services', 'i' => $tag->entity_id]);
                 break;
             case 'service':
                 $service = CsServices::findOne($tag->entity_id);
                 return $this->redirect(['/s/' . slug($service->tName)]);
                 break;
             default:
                 return $this->redirect(['/services']);
                 break;
         }
     }
     if (isset($post['name']) && $post['name'] != null && $post['name'] != '') {
         return $this->redirect(['/services', 'q' => $post['name']]);
     }
 }