Пример #1
0
 /**
  * Lists all Compile models.
  * @return mixed
  */
 public function actionIndex()
 {
     $schools = School::find()->all();
     $users = User::find()->all();
     $scholars = Scholar::find()->all();
     $allowances = Allowance::find()->all();
     $grades = Grade::find()->all();
     return $this->render('index', array('users' => $users, 'scholars' => $scholars, 'schools' => $schools, 'allowances' => $allowances, 'grades' => $grades));
 }
Пример #2
0
 public function actionIndex()
 {
     $grades = Grade::find()->all();
     $schools = School::find()->all();
     $users = User::find()->all();
     $scholars = Scholar::find()->all();
     $tuitions = Tuition::find()->all();
     return $this->render('index', array('users' => $users, 'scholars' => $scholars, 'schools' => $schools, 'grades' => $grades, 'tuition' => $tuitions));
 }
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = School::find();
     $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;
     }
     $query->andFilterWhere(['id' => $this->id]);
     $query->andFilterWhere(['like', 'school_name', $this->school_name])->andFilterWhere(['like', 'location', $this->location]);
     return $dataProvider;
 }
Пример #4
0
 public function search($params)
 {
     $query = School::find();
     $dataProvider = new ActiveDataProvider(['query' => $query, 'sort' => ['defaultOrder' => ['id' => SORT_DESC]], 'pagination' => ['pageSize' => 20]]);
     // load the seach form data and validate
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $dateBegin = strtotime($this->date);
     $dateEnd = $dateBegin + 86400;
     // adjust the query by adding the filters
     $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['>=', 'created_at', $this->date ? $dateBegin : null])->andFilterWhere(['<', 'created_at', $this->date ? $dateEnd : null]);
     return $dataProvider;
 }
Пример #5
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = School::find();
     $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;
     }
     $query->andFilterWhere(['school_id' => $this->school_id]);
     $query->andFilterWhere(['like', 'school_name', $this->school_name])->andFilterWhere(['like', 'school_area', $this->school_area])->andFilterWhere(['like', 'school_address', $this->school_address])->andFilterWhere(['like', 'school_contact_emails', $this->school_contact_emails])->andFilterWhere(['like', 'school_contact_numbers', $this->school_contact_numbers])->andFilterWhere(['like', 'school_vendor_code', $this->school_vendor_code]);
     return $dataProvider;
 }
Пример #6
0
 public function getAllSchools($lastIds = [], $lastDate = 0, $orderBy = self::ORDER_BY_LIKE_SHOW, $dateCreateType = self::DATE_CREATE_ALL, $userId = false, $limit = false)
 {
     $query = School::find()->from(["t" => School::tableName()])->andWhere('t.deleted = 0')->addSelect('*');
     if ($lastDate != 0) {
         if ($dateCreateType == self::DATE_CREATE_AFTER) {
             $query = $query->andWhere('t.date >= :date', [':date' => $lastDate]);
         } elseif ($dateCreateType != self::DATE_CREATE_ALL) {
             $query = $query->andWhere('t.date <= :date', [':date' => $lastDate]);
         }
         if (!empty($lastIds)) {
             $query = $query->andWhere(['not in', 'id', $lastIds]);
         }
     }
     // Определяем сортировку
     if ($orderBy == self::ORDER_BY_ID) {
         $query = $query->orderBy('id DESC');
     } elseif ($orderBy == self::ORDER_BY_DATE) {
         if ($dateCreateType == self::DATE_CREATE_AFTER) {
             $query = $query->orderBy('date ASC');
         } else {
             $query = $query->orderBy('date DESC');
         }
     } elseif ($orderBy == self::ORDER_BY_LIKE) {
         $query = $query->orderBy('like_count DESC');
     } elseif ($orderBy == self::ORDER_BY_SHOW) {
         $query = $query->orderBy('show_count DESC');
     } elseif ($orderBy == self::ORDER_BY_LIKE_SHOW) {
         $query = $query->addSelect(['(like_count * 15 + show_count) as like_show_count'])->orderBy('like_show_count DESC');
     }
     // Определяем за какой период будем показывать
     if (!empty($limit)) {
         $query = $query->limit((int) $limit);
     } elseif ($dateCreateType == self::DATE_CREATE_ALL) {
         $query = $query->limit(self::DEFAULT_LIMIT);
     } elseif ($dateCreateType == self::DATE_CREATE_BEFORE) {
         $query = $query->andWhere('t.date <= :date', [':date' => time()])->limit(self::DEFAULT_LIMIT);
     } elseif ($dateCreateType == self::DATE_CREATE_AFTER) {
         $query = $query->andWhere('t.date >= :date', [':date' => time()])->limit(self::DEFAULT_LIMIT);
     }
     if (!empty($userId)) {
         $query = $query->andWhere('user_id = :userId', [':userId' => $userId]);
     }
     $query = $query->with(['tagEntity', 'tagEntity.tags', 'locations']);
     return $query->all();
 }
Пример #7
0
/* @var $searchModel frontend\models\GradeSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->params['breadcrumbs'][] = $this->title;
?>


<div class="grades-index">

    <?php 
// echo $this->render('_search', ['model' => $searchModel]);
?>
	<?php 
$username = Yii::$app->user->identity->username;
$users = User::find()->all();
$scholars = Scholar::find()->all();
$schools = School::find()->all();
foreach ($users as $ctr) {
    if ($ctr->username == $username) {
        foreach ($scholars as $scholarctr) {
            foreach ($schools as $school) {
                if ($scholarctr->scholar_user_id == $ctr->id && $scholarctr->school_school_id == $school->school_id) {
                    echo '<center><img src="img/school.png" height=100px width=100px></img><h2><font color=#005ab2><strong>' . $school->school_name . '</strong></font></h2><h4>' . $school->school_address . '</h4></center><table border=2 width=100%><tr><td></td></tr></table><br><table border=1 width=100%><tr><td> <b><font color=#005ab2>School Area:</font></b><center> ' . $school->school_area . '</center></td><td><b><font color=#005ab2>School Email:</font></b><center> ' . $school->school_contact_emails . '</center></td><td><b><font color=#005ab2>School Contact Number:</font></b><center> ' . $school->school_contact_numbers . '</center></td></tr></table>';
                }
            }
        }
    }
}
?>

</div>
Пример #8
0
/* @var $this yii\web\View */
/* @var $searchModel common\models\ScholarSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = 'Scholars';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="scholar-index">

    <h1><?php 
echo Html::encode($this->title);
?>
</h1>
    <?php 
// echo $this->render('_search', ['model' => $searchModel]);
$exportedValues = [['class' => 'kartik\\grid\\SerialColumn'], ['class' => 'kartik\\grid\\EditableColumn', 'attribute' => 'scholar_id'], ['class' => 'kartik\\grid\\EditableColumn', 'attribute' => 'scholar_first_name'], ['class' => 'kartik\\grid\\EditableColumn', 'attribute' => 'scholar_middle_name'], ['class' => 'kartik\\grid\\EditableColumn', 'attribute' => 'scholar_last_name'], ['class' => 'kartik\\grid\\EditableColumn', 'attribute' => 'scholar_gender', 'editableOptions' => ['inputType' => 'dropDownList', 'pluginOptions' => ['allowClear' => true], 'data' => ["Male" => "Male", "Female" => "Female"], 'widgetClass' => 'kartik\\select2\\Select2']], ['class' => 'kartik\\grid\\EditableColumn', 'attribute' => 'scholar_course'], ['class' => 'kartik\\grid\\EditableColumn', 'attribute' => 'school_school_id', 'editableOptions' => ['inputType' => '\\kartik\\select2\\Select2', 'options' => ['data' => ArrayHelper::map(School::find()->all(), 'school_id', 'school_name')]], 'value' => 'schoolSchool.school_name'], ['class' => 'kartik\\grid\\EditableColumn', 'attribute' => 'scholar_year_level'], ['class' => 'kartik\\grid\\EditableColumn', 'attribute' => 'scholar_graduate_status', 'editableOptions' => ['inputType' => 'dropDownList', 'pluginOptions' => ['allowClear' => true], 'data' => ["Not Graduated" => "Not Graduated", "Graduated" => "Graduated"], 'widgetClass' => 'kartik\\select2\\Select2']], ['class' => 'kartik\\grid\\EditableColumn', 'attribute' => 'scholar_address'], ['class' => 'kartik\\grid\\EditableColumn', 'attribute' => 'scholar_vendor_code'], ['class' => 'kartik\\grid\\EditableColumn', 'attribute' => 'scholar_contact_email'], ['class' => 'kartik\\grid\\EditableColumn', 'attribute' => 'scholar_contact_number'], ['class' => 'kartik\\grid\\EditableColumn', 'attribute' => 'scholar_cash_card_number'], ['class' => 'kartik\\grid\\EditableColumn', 'attribute' => 'scholar_sponsor'], ['class' => 'kartik\\grid\\EditableColumn', 'attribute' => 'scholar_type', 'editableOptions' => ['inputType' => 'dropDownList', 'pluginOptions' => ['allowClear' => true], 'data' => ["SMFI" => "SMFI", "My Scholar A" => "My Scholar A", "Kabayan Scholar" => "Kabayan Scholar", "Kabayan Scholar" => "Kabayan Scholar", "My Scholar B" => "My Scholar B", "ICA Grant Scholar" => "ICA Grant Scholar"], 'widgetClass' => 'kartik\\select2\\Select2']], 'allowance_allowance_area', ['class' => 'kartik\\grid\\ActionColumn']];
$gridColumns = [['class' => 'kartik\\grid\\SerialColumn'], ['class' => 'kartik\\grid\\EditableColumn', 'attribute' => 'scholar_id'], ['class' => 'kartik\\grid\\EditableColumn', 'attribute' => 'scholar_first_name'], ['class' => 'kartik\\grid\\EditableColumn', 'attribute' => 'scholar_middle_name'], ['class' => 'kartik\\grid\\EditableColumn', 'attribute' => 'scholar_last_name'], ['class' => 'kartik\\grid\\EditableColumn', 'attribute' => 'scholar_gender', 'editableOptions' => ['inputType' => 'dropDownList', 'pluginOptions' => ['allowClear' => true], 'data' => ["Male" => "Male", "Female" => "Female"], 'widgetClass' => 'kartik\\select2\\Select2']], ['class' => 'kartik\\grid\\EditableColumn', 'attribute' => 'school_school_id', 'editableOptions' => ['inputType' => '\\kartik\\select2\\Select2', 'options' => ['data' => ArrayHelper::map(School::find()->all(), 'school_id', 'school_name')]], 'value' => 'schoolSchool.school_name'], ['class' => 'kartik\\grid\\EditableColumn', 'attribute' => 'scholar_year_level'], ['class' => 'kartik\\grid\\EditableColumn', 'attribute' => 'scholar_graduate_status', 'editableOptions' => ['inputType' => 'dropDownList', 'pluginOptions' => ['allowClear' => true], 'data' => ["Not Graduated" => "Not Graduated", "Graduated" => "Graduated"], 'widgetClass' => 'kartik\\select2\\Select2']], ['class' => 'kartik\\grid\\EditableColumn', 'attribute' => 'scholar_type', 'editableOptions' => ['inputType' => 'dropDownList', 'pluginOptions' => ['allowClear' => true], 'data' => ["SMFI" => "SMFI", "My Scholar A" => "My Scholar A", "Kabayan Scholar" => "Kabayan Scholar", "Kabayan Scholar" => "Kabayan Scholar", "My Scholar B" => "My Scholar B", "ICA Grant Scholar" => "ICA Grant Scholar"], 'widgetClass' => 'kartik\\select2\\Select2']], ['class' => 'kartik\\grid\\ActionColumn']];
$export = ExportMenu::widget(['dataProvider' => $dataProvider, 'columns' => $exportedValues, 'noExportColumns' => [18], 'exportConfig' => ['Excel5' => false, 'Excel2007' => false], 'columnSelectorOptions' => ['label' => 'Columns', 'class' => 'btn btn-danger'], 'target' => '_blank', 'fontAwesome' => true, 'dropdownOptions' => ['label' => 'Export', 'class' => 'btn btn-success']]);
?>
    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'pjax' => true, 'rowOptions' => function ($model) {
    if (strcasecmp($model->allowance_allowance_area, 'NCR') != 0) {
        return ['class' => 'provincial-row'];
    } else {
        if (strcasecmp($model->allowance_allowance_area, 'NCR') == 0) {
            return ['class' => 'ncr-row'];
        }
    }
}, 'columns' => $gridColumns, 'toolbar' => [['content' => Html::a('Create Scholar', ['create'], ['class' => 'btn btn-success'])], '{toggleData}', $export], 'export' => ['fontAwesome' => true, 'label' => 'Export', 'target' => '_blank'], 'panel' => ['type' => GridView::TYPE_PRIMARY, 'heading' => 'Scholar List']]);
?>

</div>
Пример #9
0
<?php

use yii\helpers\Html;
use kartik\grid\GridView;
use kartik\export\ExportMenu;
use yii\helpers\ArrayHelper;
use common\models\School;
$exportedValues = [['class' => 'kartik\\grid\\SerialColumn'], ['class' => 'kartik\\grid\\EditableColumn', 'attribute' => 'school_school_id', 'editableOptions' => ['inputType' => '\\kartik\\select2\\Select2', 'options' => ['data' => ArrayHelper::map(School::find()->all(), 'school_id', 'school_name')]], 'value' => 'schoolSchool.school_name'], ['class' => 'kartik\\grid\\EditableColumn', 'attribute' => 'equivalence_numerical_grade'], ['class' => 'kartik\\grid\\EditableColumn', 'attribute' => 'equivalence_letter_grade'], ['class' => 'kartik\\grid\\EditableColumn', 'attribute' => 'equivalence_percentile_lower'], ['class' => 'kartik\\grid\\EditableColumn', 'attribute' => 'equivalence_percentile_upper'], ['class' => 'kartik\\grid\\EditableColumn', 'attribute' => 'equivalence_school_rating'], ['class' => 'kartik\\grid\\EditableColumn', 'attribute' => 'equivalence_foundation_rating', 'editableOptions' => ['inputType' => 'dropDownList', 'pluginOptions' => ['allowClear' => true], 'data' => ["PASS" => "PASS", "FAIL" => "FAIL"], 'widgetClass' => 'kartik\\select2\\Select2']], ['class' => 'kartik\\grid\\ActionColumn']];
$export = ExportMenu::widget(['dataProvider' => $dataProvider, 'columns' => $exportedValues, 'exportConfig' => ['Excel5' => false, 'Excel2007' => false], 'noExportColumns' => [8], 'columnSelectorOptions' => ['label' => 'Columns', 'class' => 'btn btn-danger'], 'target' => '_blank', 'fontAwesome' => true, 'dropdownOptions' => ['label' => 'Export', 'class' => 'btn btn-success']]);
/* @var $this yii\web\View */
/* @var $searchModel common\models\EquivalenceSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = 'Equivalences';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="equivalence-index">

    <h1><?php 
echo Html::encode($this->title);
?>
</h1>
    <?php 
// echo $this->render('_search', ['model' => $searchModel]);
echo Html::a('Group By School', ['index'], ['class' => 'btn btn-success']);
echo Html::a('Show Only Equivalences', ['index2'], ['class' => 'btn btn-success']);
?>

	<?php 
// echo $this->render('_search', ['model' => $searchModel]);
?>
Пример #10
0
use kartik\select2\Select2;
use yii\helpers\ArrayHelper;
use common\models\School;
/* @var $this yii\web\View */
/* @var $model common\models\Equivalence */
/* @var $form yii\widgets\ActiveForm */
?>

<div class="equivalence-form">

    <?php 
$form = ActiveForm::begin();
?>

	<?php 
echo $form->field($model, 'school_school_id')->widget(Select2::classname(), ['data' => ArrayHelper::map(School::find()->all(), 'school_id', 'school_name'), 'language' => 'en', 'options' => ['placeholder' => 'Select School Name'], 'pluginOptions' => ['allowClear' => true]]);
?>

    <?php 
echo $form->field($model, 'equivalence_numerical_grade')->textInput(['maxlength' => true]);
?>

    <?php 
echo $form->field($model, 'equivalence_letter_grade')->textInput(['maxlength' => true]);
?>

    <?php 
echo $form->field($model, 'equivalence_percentile_lower')->textInput(['maxlength' => true]);
?>

    <?php 
Пример #11
0
 public function actionSitemap()
 {
     // проверяем есть ли закэшированная версия sitemap
     $urls = array();
     $items = Item::find()->where(['deleted' => 0])->all();
     $events = \common\models\Event::find()->where(['deleted' => 0])->all();
     $schools = School::find()->where(['deleted' => 0])->all();
     foreach ($items as $item) {
         /** @var Item $item */
         $urls[] = ['url' => $item->getUrl(true), 'priority' => 0.5];
     }
     foreach ($events as $event) {
         /** @var \common\models\Event $event */
         $urls[] = ['url' => $event->getUrl(true), 'priority' => 0.5];
     }
     foreach ($schools as $school) {
         /** @var School $school */
         $urls[] = ['url' => $school->getUrl(true), 'priority' => 0.8];
     }
     Yii::$app->response->format = \yii\web\Response::FORMAT_XML;
     echo '<?xml version="1.0" encoding="UTF-8"?>' . PHP_EOL;
     echo '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">';
     foreach ($urls as $url) {
         echo '<url>';
         echo '<loc>' . $url['url'] . '</loc>';
         echo '<changefreq>weekly</changefreq>';
         echo '<priority>' . $url['priority'] . '</priority>';
         echo '</url>';
     }
     echo '</urlset>';
 }
Пример #12
0
 public function beforeSave($insert)
 {
     if (parent::beforeSave($insert)) {
         if ($this->alias == "") {
             $title = $this->encodestring($this->title);
             $alias = $this->toAscii($title);
             $baseAlias = substr($alias, 0, 250);
             $alias = $baseAlias;
             $i = 1;
             $wheres = ['alias = :alias'];
             $params[':alias'] = $alias;
             if (!is_null($this->id)) {
                 $wheres[] = 'id <> :id';
                 $params = [':id' => $this->id];
             }
             $where = join(' AND ', $wheres);
             while ($findSchool = School::find()->where($where, $params)->one()) {
                 $alias = $baseAlias . '-' . $i;
                 $params[':alias'] = $alias;
                 $i++;
                 if ($i > 30) {
                     $alias = '';
                     break;
                 }
             }
             $this->alias = $alias;
         }
         return true;
     }
     return false;
 }
Пример #13
0
 public function actionData()
 {
     $schools = School::find()->from(["t" => School::tableName()])->andWhere('t.deleted = 0')->addSelect('*')->addSelect(['(like_count * 15 + show_count) as like_show_count'])->orderBy('like_show_count DESC')->with(['locations'])->all();
     $data = [];
     foreach ($schools as $school) {
         $locations = $school->locations;
         foreach ($locations as $location) {
             $value = ['lat' => $location->lat, 'lng' => $location->lng, 'zoom' => $location->zoom, 'title' => $location->title, 'title-url' => $school->getUrl(), 'site-url' => $school->site, 'type' => $location->getTypeLocal(), 'description' => $location->getDescription(), 'school-title' => $school->getTitle()];
             $data[] = $value;
         }
     }
     return json_encode($data);
 }