/** * This method Accepts user ID from user. * performs query. * return model for successful find else returns false. * * * @param int user id,array specialistTypeId. * @return model|false. */ public static function getSpecialistTypeByUserId($userId = null) { if ($userId) { $result = Specializations::model()->findAllBySql("SELECT id,specialist FROM specializations WHERE id IN\n (SELECT specialist_type_id FROM user_specialist_type WHERE user_id=:b)", array(':b' => $userId)); } else { $result = Specializations::model()->findAllBySql("SELECT id,specialist FROM specializations WHERE id IN\n (SELECT specialist_type_id FROM user_specialist_type)"); } if ($result) { return $result; } else { false; } }
<?php $this->endWidget(); ?> </div> <div id="searchtab4" class="right" style="display: none; "> <?php $form = $this->beginWidget('CActiveForm', array('id' => 'user-form', 'enableAjaxValidation' => false, 'action' => $this->specialisturl)); ?> <input type="hidden" name="keyword" value=''> <input type="hidden" name="search" value=''> <input type="hidden" name="mode" value="people"> <input type="hidden" name="user_type" value="specialist"> <table width="100%" border="0" cellspacing="0" cellpadding="0" style="margin-left:37px;"> <tbody><tr> <td><span style="text-align: right; padding: 0 50px 0 0px;">Search for</span> <?php $data = CHtml::listData(Specializations::model()->findAll(), 'id', 'specialist'); echo CHtml::dropdownList('specialist_type_id[]', '', $data, array('empty' => 'Select', 'class' => 'selectbox1')); ?> </td> </tr> <tr> <td><span style="text-align: right; padding: 0 85px 0 0px;">City</span> <?php echo $form->dropdownList($modelCity, 'city', $cityList, array('empty' => 'Select', 'id' => 'geo_city_wf', 'class' => 'selectbox1')); ?> </td> </tr> <tr><td> </td></tr>
} } </script> <?php $modelProperty = new Property(); $modelCity = new GeoCity(); $modelState = new GeoState(); $modelProfile = new UserProfiles(); $modelRequirement = new Requirement(); $specializations = new Specializations(); $stateCache = new CDbCacheDependency('SELECT MAX(updated_time) FROM geo_state'); $stateList = CHtml::listData(GeoState::model()->cache(1000, $stateCache)->findAll(), 'id', 'state'); $propertyTypeList = CHtml::listData(PropertyTypes::model()->with('category')->findAll(), 'id', 'property_type', 'category.category'); $cityCache = new CDbCacheDependency('SELECT MAX(updated_time) FROM geo_city'); $cityList = CHtml::listData(GeoCity::model()->with('state')->cache(1000, $cityCache)->findAll(), 'id', 'city', 'state.state'); $specializationList = Specializations::model()->findAll(); if ($this->beginCache('topmenu', array('duration' => 0))) { ?> <div id="menu-part"> <div id="menu"> <ul> <li class="home-icon"><a href="<?php echo Yii::app()->homeUrl; ?> "> <img src="<?php echo Yii::app()->theme->baseUrl; ?> /images/icon-home.png" alt="" /></a></li> <li id="menubox_search"><a class="drop" onclick="js:menuDrop('menubox_search')">Search</a> <!-- Begin Home Item -->
echo $form->labelEx($model, 'user_id'); ?> <?php echo $form->dropDownList($model, 'user_id', UserApi::getUserList(), array('empty' => 'Select')); ?> <?php echo $form->error($model, 'user_id'); ?> </div> <div class="row"> <?php echo $form->labelEx($model, 'specialist_type_id'); ?> <?php echo $form->dropDownList($model, 'specialist_type_id', CHtml::listData(Specializations::model()->findAll(), 'id', 'specialist'), array('empty' => 'Select')); ?> <?php echo $form->error($model, 'specialist_type_id'); ?> </div> <div class="row"> <?php echo $form->labelEx($model, 'project_name'); ?> <?php echo $form->textField($model, 'project_name', array('rows' => 6, 'cols' => 50)); ?> <?php echo $form->error($model, 'project_name');
echo $form->textArea($model, 'company_description', array('class' => 'txtarea')); ?> </li> <li class="error_message"><?php echo $form->error($model, 'company_description'); ?> </li> </ul> </fieldset> <fieldset><legend>Deals In</legend> <ul> <li><span><label for="Property_description" class="required">Specialization <span class="required">*</span></label></span> <div class="multi_checkbox avg"> <?php $specialists = isset($_POST['specialist_type_id']) ? $_POST['specialist_type_id'] : null; echo CHtml::checkBoxList('specialist_type_id', $specialists, CHtml::listData(Specializations::model()->findAll(), 'id', 'specialist')); ?> </div> </li> <li class="error_message"><?php echo $form->error($specialistType, 'specialist_type_id'); ?> </li> </ul> <?php if (isset($_POST['city_id'])) { $i = 0; $data = 'City'; foreach ($_POST['city_id'] as $i => $location) { if ($i > 0) { $data = ' ';
</div> </li> <li id="specialist" class="<?php echo $specialist_class; ?> "> <h3>Specialist Details</h3> <div class="acc-section"> <table width="92%" border="0" cellpadding="0" cellspacing="0" align="center"> <tr> <td><label>Specialist In</label> <br /> <div class="multi_checkbox med"> <?php $specialist_type_id = isset($_POST['specialist_type_id']) ? $_POST['specialist_type_id'] : null; echo CHtml::checkBoxList('specialist_type_id', $specialist_type_id, CHtml::listData(Specializations::model()->findAll(), 'id', 'specialist'), array('multiple' => 'multiple', 'id' => 'specialist_multi')); ?> </td> </tr> </table> </div> </li> <li> <h3>Location</h3> <div class="acc-section"> <table width="92%" border="0" cellpadding="0" cellspacing="0" align="center"> <tr> <td><label>Country</label> <?php echo $form->dropdownList($modelProfile, 'country_id', CHtml::listData(GeoCountry::model()->findAll(), 'id', 'country'), array('empty' => 'All', 'ajax' => array('type' => 'POST', 'url' => CController::createUrl('/location/state/getList'), 'update' => '#state_content', 'data' => 'js:jQuery(this).serialize()'))); ?>
/** * @return \yii\db\ActiveQuery */ public function getSpecs() { return $this->hasMany(Specializations::className(), ['Spec_ID' => 'Spec_ID'])->viaTable('CompSpecs', ['C_ID' => 'C_ID']); }
/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. * @param integer the ID of the model to be loaded */ public function loadModel($id) { $model = Specializations::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
/** * returns specialization list. * * @return model */ public static function getAll() { $criteria = new CDbCriteria(); $criteria->select = 'specialist'; $specialist = Specializations::model()->findAll($criteria); if ($specialist) { return $specialist; } else { return false; } }