示例#1
0
 public function actionCreate2()
 {
     $username = Yii::$app->user->identity->username;
     $users = User::find()->all();
     $scholars = Scholar::find()->all();
     $model2 = new Email();
     foreach ($users as $user) {
         foreach ($scholars as $scholar) {
             if ($user->username == $username && $user->id == $scholar->scholar_user_id) {
                 $model2->email_scholar_id = $scholar->scholar_id;
                 $model2->subject = "Low/Fail Grade";
                 if ($model2->load(Yii::$app->request->post())) {
                     if ($model->load(Yii::$app->request->post())) {
                         $to = "*****@*****.**";
                         $subject = "Low/Fail Grade";
                         $body = $model2->content . "\nfrom:" . $scholar->scholar_contact_email . PHP_EOL;
                         $headers = "from: root@localhost";
                         if (mail($to, $subject, $body, $headers)) {
                             \Yii::$app->getSession()->setFlash('error', 'The message is delivered');
                         } else {
                             \Yii::$app->getSession()->setFlash('error', 'Message failed');
                         }
                         return $this->redirect(['subject/index', 'id' => $model2->email_id]);
                         return $this->redirect(['create2', 'id' => $model2->email_id]);
                     } else {
                         return $this->render('create2', ['model2' => $model2]);
                     }
                 }
             }
         }
     }
 }
示例#2
0
 /**
  * Creates a new Upload model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $username = Yii::$app->user->identity->username;
     $users = User::find()->all();
     $scholars = Scholar::find()->all();
     $model = new Upload();
     foreach ($users as $user) {
         foreach ($scholars as $scholar) {
             if ($user->username == $username && $user->id == $scholar->scholar_user_id) {
                 $model->scholar_scholar_id = $scholar->scholar_id;
                 $model->scholar_school_school_id = $scholar->school_school_id;
                 if ($model->load(Yii::$app->request->post())) {
                     $model->file = UploadedFile::getInstance($model, 'file');
                     if ($model->file != null) {
                         $fileName = md5(time()) . $model->upload_file_name . "" . $model->scholar_scholar_id . "" . $model->file->name;
                         $model->file->saveAs('Forms/' . $fileName);
                         $model->upload_form = 'Forms/' . $fileName;
                     }
                     $model->save();
                     return $this->redirect(['index', 'id' => $model->upload_id]);
                 } else {
                     return $this->render('create', ['model' => $model]);
                 }
             }
         }
     }
 }
 /**
  * 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));
 }
示例#4
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));
 }
示例#5
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Scholar::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(['scholar_id' => $this->scholar_id, 'school_school_id' => $this->school_school_id, 'scholar_year_level' => $this->scholar_year_level]);
     $query->andFilterWhere(['like', 'scholar_first_name', $this->scholar_first_name])->andFilterWhere(['like', 'scholar_middle_name', $this->scholar_middle_name])->andFilterWhere(['like', 'scholar_last_name', $this->scholar_last_name])->andFilterWhere(['like', 'scholar_gender', $this->scholar_gender])->andFilterWhere(['like', 'scholar_address', $this->scholar_address])->andFilterWhere(['like', 'scholar_course', $this->scholar_course])->andFilterWhere(['like', 'scholar_graduate_status', $this->scholar_graduate_status])->andFilterWhere(['like', 'scholar_contact_email', $this->scholar_contact_email])->andFilterWhere(['like', 'scholar_contact_number', $this->scholar_contact_number])->andFilterWhere(['like', 'scholar_vendor_code', $this->scholar_vendor_code])->andFilterWhere(['like', 'scholar_cash_card_number', $this->scholar_cash_card_number])->andFilterWhere(['like', 'scholar_type', $this->scholar_type])->andFilterWhere(['like', 'scholar_sponsor', $this->scholar_sponsor])->andFilterWhere(['like', 'allowance_allowance_area', $this->allowance_allowance_area]);
     return $dataProvider;
 }
 /**
  * Lists all Incentive models.
  * @return mixed
  */
 public function actionIndex()
 {
     $username = Yii::$app->user->identity->username;
     $users = User::find()->all();
     $scholars = Scholar::find()->all();
     $model = new Incentive();
     foreach ($users as $user) {
         foreach ($scholars as $scholar) {
             if ($user->username == $username && $user->id == $scholar->scholar_user_id) {
                 $model->scholar_scholar_id = $scholar->scholar_id;
                 $searchModel = new IncentiveSearch($model);
                 $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
                 return $this->render('index', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider]);
             }
         }
     }
 }
 /**
  * Creates a new Optionalwork model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $username = Yii::$app->user->identity->username;
     $users = User::find()->all();
     $scholars = Scholar::find()->all();
     $model = new Optionalwork();
     foreach ($users as $user) {
         foreach ($scholars as $scholar) {
             if ($user->username == $username && $user->id == $scholar->scholar_user_id) {
                 $model->scholar_scholar_id = $scholar->scholar_id;
                 $model->scholar_school_school_id = $scholar->school_school_id;
                 if ($model->load(Yii::$app->request->post()) && $model->save()) {
                     return $this->redirect(['index', 'id' => $model->optionalwork_id]);
                 } else {
                     return $this->render('create', ['model' => $model]);
                 }
             }
         }
     }
 }
 /**
  * Finds the Scholar model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Scholar the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Scholar::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
示例#9
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getScholars()
 {
     return $this->hasMany(Scholar::className(), ['school_school_id' => 'school_id']);
 }
 /**
  * Updates an existing Deduction model.
  * If update is successful, the browser will be redirected to the 'view' page.
  * @param integer $deduction_id
  * @param integer $scholar_scholar_id
  * @param integer $scholar_school_school_id
  * @return mixed
  */
 public function actionUpdate($id)
 {
     $model = $this->findModel($id);
     if ($model->load(Yii::$app->request->post())) {
         $selectSchool = ArrayHelper::map(Scholar::find()->where(['scholar_id' => $model->scholar_scholar_id])->all(), 'school_school_id', 'school_school_id');
         $schoolID = array_values($selectSchool)[0];
         $model->scholar_school_school_id = $schoolID;
         $model->save();
         return $this->redirect(['view', 'id' => $model->deduction_id]);
     } else {
         return $this->render('update', ['model' => $model]);
     }
 }
示例#11
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getScholarScholar()
 {
     return $this->hasOne(Scholar::className(), ['scholar_id' => 'scholar_scholar_id']);
 }
示例#12
0
 public function actionGroupcreate()
 {
     $username = Yii::$app->user->identity->username;
     $users = User::find()->all();
     $scholars = Scholar::find()->all();
     $model = new Subject();
     $modelCustomer = new Grade();
     $modelsAddress = [new Grade()];
     foreach ($users as $user) {
         foreach ($scholars as $scholar) {
             if ($user->username == $username && $user->id == $scholar->scholar_user_id) {
                 $model->subject_scholar_scholar_id = $scholar->scholar_id;
                 if ($modelCustomer->load(Yii::$app->request->post())) {
                     $modelsAddress = GroupGrade::createMultiple(Grade::classname());
                     GroupGrade::loadMultiple($modelsAddress, Yii::$app->request->post());
                     // ajax validation
                     if (Yii::$app->request->isAjax) {
                         Yii::$app->response->format = Response::FORMAT_JSON;
                         return ArrayHelper::merge(ActiveForm::validateMultiple($modelsAddress), ActiveForm::validate($modelCustomer));
                     }
                     // validate all models
                     $valid = $modelCustomer->validate();
                     $valid = GroupGrade::validateMultiple($modelsAddress) && $valid;
                     if ($valid) {
                         $transaction = \Yii::$app->db->beginTransaction();
                         try {
                             // if($flag = $modelCustomer->save(false)){
                             foreach ($modelsAddress as $modelAddress) {
                                 $modelAddress->scholar_scholar_id = $modelCustomer->scholar_scholar_id;
                                 $modelAddress->grade_school_year_start = $modelCustomer->grade_school_year_start;
                                 $modelAddress->grade_school_year_end = $modelCustomer->grade_school_year_end;
                                 $selectSchool = ArrayHelper::map(Scholar::find()->where(['scholar_id' => $modelAddress->scholar_scholar_id])->all(), 'school_school_id', 'school_school_id');
                                 $schoolID = array_values($selectSchool)[0];
                                 $modelAddress->subject_scholar_school_school_id = $schoolID;
                                 if (!($flag = $modelAddress->save(false))) {
                                     $transaction->rollBack();
                                     break;
                                 }
                             }
                             // }
                             if ($flag) {
                                 if ($modelCustomer->subject_subject_id == null) {
                                     $sql = "DELETE FROM grade WHERE subject_subject_id is null;";
                                     Yii::$app->db->createCommand($sql)->execute();
                                 }
                                 if ($modelCustomer->grade_raw_grade != null) {
                                     $sql = "DELETE FROM grade WHERE grade_id=max(grade_id)-1";
                                     Yii::$app->db->createCommand($sql)->execute();
                                 }
                                 $transaction->commit();
                                 return $this->redirect(['index']);
                             }
                         } catch (Exception $e) {
                             $transaction->rollBack();
                         }
                     }
                 }
                 return $this->render('groupcreate', ['modelCustomer' => $modelCustomer, 'modelsAddress' => empty($modelsAddress) ? [new Grade()] : $modelsAddress]);
             }
         }
     }
 }
 /**
  * Creates a new Withholding model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new Withholding();
     if ($model->load(Yii::$app->request->post())) {
         $selectSchool = ArrayHelper::map(Scholar::find()->where(['scholar_id' => $model->scholar_scholar_id])->all(), 'school_school_id', 'school_school_id');
         $schoolID = array_values($selectSchool)[0];
         $model->scholar_school_school_id = $schoolID;
         $selectArea = ArrayHelper::map(Scholar::find()->where(['scholar_id' => $model->scholar_scholar_id])->all(), 'allowance_allowance_area', 'allowance_allowance_area');
         $area = array_values($selectArea)[0];
         $model->scholar_allowance_allowance_area = $area;
         $model->save();
         return $this->redirect(['view', 'id' => $model->withholding_id]);
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }
示例#14
0
 if (Yii::$app->request->isAjax) {
     Yii::$app->response->format = Response::FORMAT_JSON;
     return ArrayHelper::merge(ActiveForm::validateMultiple($modelsAddress), ActiveForm::validate($modelCustomer));
 }
 // validate all models
 $valid = $modelCustomer->validate();
 $valid = GroupGrade::validateMultiple($modelsAddress) && $valid;
 if ($valid) {
     $transaction = \Yii::$app->db->beginTransaction();
     try {
         // if($flag = $modelCustomer->save(false)){
         foreach ($modelsAddress as $modelAddress) {
             $modelAddress->subject_scholar_scholar_id = $modelCustomer->subject_scholar_scholar_id;
             $modelAddress->grade_school_year_start = $modelCustomer->grade_school_year_start;
             $modelAddress->grade_school_year_end = $modelCustomer->grade_school_year_end;
             $selectSchool = ArrayHelper::map(Scholar::find()->where(['scholar_id' => $modelAddress->subject_scholar_scholar_id])->all(), 'school_school_id', 'school_school_id');
             $schoolID = array_values($selectSchool)[0];
             $modelAddress->subject_scholar_school_school_id = $schoolID;
             if (!($flag = $modelAddress->save(false))) {
                 $transaction->rollBack();
                 break;
             }
         }
         // }
         if ($flag) {
             if ($modelCustomer->subject_subject_id == null) {
                 $sql = "DELETE FROM grade WHERE subject_subject_id is null;";
                 Yii::$app->db->createCommand($sql)->execute();
             }
             $transaction->commit();
             return $this->redirect(['index']);
示例#15
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getScholars()
 {
     return $this->hasMany(Scholar::className(), ['allowance_allowance_area' => 'allowance_area']);
 }
示例#16
0
/* @var $this yii\web\View */
/* @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>
示例#17
0
use kartik\select2\Select2;
use yii\helpers\ArrayHelper;
use common\models\Scholar;
/* @var $this yii\web\View */
/* @var $model common\models\Tuition */
/* @var $form yii\widgets\ActiveForm */
?>

<div class="tuition-form">

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

	<?php 
echo $form->field($model, 'scholar_scholar_id')->widget(Select2::classname(), ['data' => ArrayHelper::map(Scholar::find()->all(), 'scholar_id', 'scholar_last_name', 'scholar_id'), 'language' => 'en', 'options' => ['placeholder' => 'Select Scholar ID'], 'pluginOptions' => ['allowClear' => true]]);
?>

    <?php 
echo $form->field($model, 'tuition_term')->textInput();
?>

    <?php 
echo $form->field($model, 'tuition_school_year_start')->textInput();
?>

    <?php 
echo $form->field($model, 'tuition_school_year_end')->textInput();
?>

    <?php 
示例#18
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getScholarAllowanceAllowanceArea()
 {
     return $this->hasOne(Scholar::className(), ['allowance_allowance_area' => 'scholar_allowance_allowance_area']);
 }