public function actionSearchcollege()
 {
     //echo "university search by state and city ";die;
     // $unvname=$_POST['name'];
     //echo $state=$_POST['state'];
     //echo $city=$_POST['city'];die;
     if (isset($_POST['name']) && $_POST['name'] != '') {
         $model = University::find()->where(['name' => $_POST['name']])->all();
         return $this->render('index', ['model' => $model]);
     } else {
         if (isset($_POST['state']) && $_POST['state'] != '' && isset($_POST['city']) && $_POST['city'] != '') {
             $model = Address::find()->where(['state_id' => $_POST['state'], 'city_id' => $_POST['city']])->all();
             $universityID = array();
             foreach ($model as $val) {
                 array_push($universityID, $val->university_id);
             }
             $model = University::find()->where(['IN', 'id', $universityID])->all();
             return $this->render('index', ['model' => $model]);
         } else {
             if (isset($_POST['state']) && $_POST['state'] != '') {
                 $model = Address::find()->where(['state_id' => $_POST['state']])->all();
                 $universityID = array();
                 foreach ($model as $val) {
                     array_push($universityID, $val->university_id);
                 }
                 $model = University::find()->where(['IN', 'id', $universityID])->all();
                 return $this->render('index', ['model' => $model]);
             } else {
                 $model = University::find()->all();
                 return $this->render('index', ['model' => $model]);
             }
         }
     }
 }
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = University::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, 'establish' => $this->establish, 'important_links_id' => $this->important_links_id, 'download_links_id' => $this->download_links_id, 'is_verified' => $this->is_verified, 'is_featured' => $this->is_featured, 'status' => $this->status, 'created' => $this->created, 'updated' => $this->updated, 'statutory_body_id' => $this->statutory_body_id]);
     $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'description', $this->description])->andFilterWhere(['like', 'website', $this->website])->andFilterWhere(['like', 'logo', $this->logo])->andFilterWhere(['like', 'banner', $this->banner])->andFilterWhere(['like', 'image', $this->image]);
     return $dataProvider;
 }
Exemple #3
0
<?php

/* @var $this yii\web\View */
/* @var $form yii\bootstrap\ActiveForm */
/* @var $model \common\models\Group */
use common\models\City;
use common\models\University;
use yii\helpers\ArrayHelper;
use yii\helpers\Html;
use yii\bootstrap\ActiveForm;
$this->title = Yii::t('lbl', 'Add your organization');
$cities = ArrayHelper::map(City::find()->orderBy('name')->all(), 'id', 'name');
$universities = [];
if ($model->city_id) {
    $universities = ArrayHelper::map(University::find()->where(['city_id' => $model->city_id])->all(), 'id', 'name');
}
$tags = '[]';
if ($model->tag) {
    $tags = $model->tag;
    $model->tag = null;
}
$this->registerJs("\n    \$('textarea.tags').textext({\n        plugins: 'tags',\n        tags: {\n            items: " . $tags . "\n        }\n    });");
?>
<div class="site-signup">
    <h1 class="text-center"><?php 
echo $this->title;
?>
</h1>
    <?php 
$form = ActiveForm::begin();
?>
Exemple #4
0
<?php

use common\models\City;
use common\models\Tag;
use common\models\University;
use yii\bootstrap\ActiveForm;
use yii\bootstrap\Html;
use yii\helpers\ArrayHelper;
$cities = ArrayHelper::map(City::find()->orderBy('name')->all(), 'id', 'name');
$tags = ArrayHelper::map(Tag::find()->orderBy('name')->all(), 'id', 'name');
$universities = ArrayHelper::map(University::find()->orderBy('name')->all(), 'id', 'name');
?>

<h1><?php 
echo Yii::t('lbl', 'Find organizations');
?>
</h1>
<?php 
$form = ActiveForm::begin();
?>
    <article class="searchbox">
        <div class="row">
            <div class="col-xs-12 col-sm-6 col-md-5">
                <?php 
echo $form->field($model, 'name', ['inputOptions' => ['autofocus' => 'autofocus', 'placeholder' => Yii::t('lbl', 'Name')]])->textInput()->label(false);
?>
            </div>
            <div class="col-xs-12 col-sm-6 col-md-5">
                <?php 
echo $form->field($model, 'city_id')->dropDownList($cities, ['prompt' => Yii::t('lbl', 'City')])->label(false);
?>
Exemple #5
0
$contactsmodel = new Contacts();
$implink = new ImportantLink();
$downloadlink = new DownloadLink();
?>
<div class="college-form">

<?php 
$form = ActiveForm::begin(['id' => 'college-form', 'enableAjaxValidation' => false, 'enableClientValidation' => true, 'validateOnSubmit' => true, 'options' => ['enctype' => 'multipart/form-data']]);
?>

    <?php 
echo $form->field($model, 'name')->textInput(['maxlength' => true]);
?>
        
    <?php 
$university = University::find()->distinct('name', TRUE)->all();
$universitylist = ArrayHelper::map($university, 'id', 'name');
?>
   <?php 
echo $form->field($model, 'university_id')->dropDownList($universitylist, ['prompt' => 'Select University', 'class' => 'singleSelectBox', 'data-tags' => true]);
?>
    <?php 
echo $form->field($model, 'description')->textarea(['rows' => 6]);
?>

    <?php 
echo $form->field($model, 'website')->textInput(['maxlength' => true]);
?>
    
    <?php 
echo $form->field($implink, 'name')->textInput(['maxlength' => true]);
 /**
  * Finds the University model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return University the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = University::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Exemple #7
0
Yii::$app->urlManager->getBaseUrl(true);
?>
/images/banner-1.jpg" alt="">
  </div>
</div>
    <div class="banner-content">
        <div class="container">
        	<div class="row">
            	<div class="col-lg-12">
                	<h1>Find your dream college <br />and get accepted</h1>
       				<p>Learn all about your dream university.</p>
                    <div class="home-search">
                        <?php 
$data = array();
$model = new University();
$universityName = University::find()->select('name')->distinct()->all();
foreach ($universityName as $name) {
    array_push($data, $name->name);
}
//echo "<pre>"; print_r($data);die;
$form = ActiveForm::begin(['id' => 'search-form', 'enableAjaxValidation' => false, 'enableClientValidation' => true, 'validateOnSubmit' => true, 'action' => Yii::$app->urlManager->createUrl('university/searchcollege')]);
echo TypeaheadBasic::widget(['name' => 'name', 'id' => 'university-name', 'data' => $data, 'scrollable' => true, 'dataset' => ['limit' => 1000], 'options' => ['placeholder' => 'Search colleges by name'], 'pluginOptions' => ['highlight' => true]]);
?>
                        <?php 
echo Html::submitButton('search', ['class' => 'btn']);
?>
                        <?php 
ActiveForm::end();
?>
                        
                    </div>
Exemple #8
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getUniversity()
 {
     return $this->hasOne(University::className(), ['id' => 'university_id']);
 }
Exemple #9
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getUniversities()
 {
     return $this->hasMany(University::className(), ['city_id' => 'id']);
 }
 public function actionCreate()
 {
     $img_move_to = \Yii::$app->basePath . '/web/images/uploads/';
     $model = new Event();
     $linksmodel = new \common\models\ImportantLink();
     $videomodel = new \common\models\EventVideo();
     $quickinfomodel = new \common\models\EventQuickInformation();
     $docmodel = new \common\models\Documents();
     $university = University::find()->all();
     if (isset($_POST['Event']) && $_POST['EventVideo'] && $_POST['ImportantLink']) {
         $model->attributes = $_POST['Event'];
         $model->created = new \yii\db\Expression('NOW()');
         $start_date = explode('/', $_POST['Event']['start_date']);
         $model->start_date = $start_date[2] . '-' . $start_date[1] . '-' . $start_date[0];
         $close_date = explode('/', $_POST['Event']['close_date']);
         $model->close_date = $close_date[2] . '-' . $close_date[1] . '-' . $close_date[0];
         $linksmodel->attributes = $_POST['ImportantLink'];
         $videomodel->attributes = $_POST['EventVideo'];
         $quickinfomodel->attributes = $_POST['EventQuickInformation'];
         $docmodel->attributes = $_POST['Documents'];
         $banner = UploadedFile::getInstance($model, 'banner');
         $ext = end(explode('.', $banner->name));
         $bannername = Yii::$app->security->generateRandomString('30') . '.' . $ext;
         $model->banner = 'images/uploads/' . $bannername;
         $createddate = new \yii\db\Expression('NOW()');
         ///echo "<pre>";print_r($videomodel->attributes);die;
         if ($model->validate()) {
             if ($model->save()) {
                 $i = 0;
                 // saveing event multiple video links that comes in array
                 foreach ($videomodel->name as $vdata) {
                     $videomodel->url = $videomodel['url'][$i];
                     \Yii::$app->db->createCommand()->insert('tlb_event_video', ['event_id' => $model->id, 'name' => $vdata, 'url' => $videomodel['url'], 'created' => $createddate])->execute();
                     $videomodel->attributes = $_POST['EventVideo'];
                     $i++;
                 }
                 //END saveing event multiple video links that comes in array
                 $i = 0;
                 //saveing event multiple Important links that comes in array
                 foreach ($linksmodel->name as $vdata) {
                     $linksmodel->url = $linksmodel['url'][$i];
                     \Yii::$app->db->createCommand()->insert('tlb_important_link', ['event_id' => $model->id, 'name' => $vdata, 'url' => $linksmodel['url'], 'is_live' => 1, 'created' => $createddate])->execute();
                     $linksmodel->attributes = $_POST['ImportantLink'];
                     $i++;
                 }
                 //END saveing event multiple Important links that comes in array
                 //saveing event quickinformation links that comes in array
                 $i = 0;
                 foreach ($quickinfomodel->title as $infodata) {
                     $quickinfomodel->url = $quickinfomodel['url'][$i];
                     \Yii::$app->db->createCommand()->insert('tbl_event_quick_information', ['event_id' => $model->id, 'title' => $infodata, 'url' => $quickinfomodel['url'], 'created' => $createddate])->execute();
                     $quickinfomodel->attributes = $_POST['EventQuickInformation'];
                     $i++;
                 }
                 //END saveing event quickinformation links that comes in array
                 $i = 0;
                 //saveing event quickinformation links that comes in array
                 foreach ($docmodel->title as $docdata) {
                     $docmodel->url = $docmodel['url'][$i];
                     \Yii::$app->db->createCommand()->insert('tbl_documents', ['event_id' => $model->id, 'title' => $docdata, 'url' => $docmodel['url'], 'created' => $createddate])->execute();
                     $docmodel->attributes = $_POST['Documents'];
                     $i++;
                 }
                 //END saveing event quickinformation links that comes in array
                 //echo "<pre>";print_r($quickinfomodel->attributes);die;
                 // $videomodel->event_id=$model->id;
                 //$linksmodel->event_id=$model->id;
                 //$videomodel->created=new \yii\db\Expression('NOW()');
                 //$linksmodel->created=new \yii\db\Expression('NOW()');
                 //$videomodel->save();
                 //$linksmodel->save();
                 $banner->saveAs($img_move_to . $bannername);
             }
         }
     }
     return $this->render('create', ['model' => $model, 'university' => $university]);
 }
Exemple #11
0
 public function actionGetUniversities()
 {
     $city_id = Yii::$app->request->post('city_id');
     if (!Yii::$app->request->isAjax) {
         throw new MethodNotAllowedHttpException();
     }
     return json_encode(ArrayHelper::map(University::find()->where(['city_id' => $city_id])->orderBy('name')->all(), 'id', 'name'));
 }