/**
     * Creates data provider instance with search query applied
     *
     * @param array $params
     *
     * @return ActiveDataProvider
     */
    public function search($params)
    {
        $query = Employee::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([
            'employee_id' => $this->employee_id,
            'user_id' => $this->user_id,
        ]);

        $query->andFilterWhere(['like', 'emp_firstname', $this->emp_firstname])
            ->andFilterWhere(['like', 'emp_lastname', $this->emp_lastname])
            ->andFilterWhere(['like', 'emp_midname', $this->emp_midname])
            ->andFilterWhere(['like', 'emp_position', $this->emp_position])
            ->andFilterWhere(['like', 'emp_department', $this->emp_department]);

        return $dataProvider;
    }
Beispiel #2
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getEmployeeEmployee()
 {
     return $this->hasOne(Employee::className(), ['employee_id' => 'employee_employee_id']);
 }
Beispiel #3
0
				//['label' => 'Migration', 'url' => ['/migrated-alumni/index']],
				['label' => 'Testimonials', 'url' => ['/testimonials/index']],
				['label' => 'Users', 'url' => ['/user/index']],
				[ 
                    'label' => 'Logout (' . Yii::$app->user->identity->username . ')',
                    'url' => ['/site/logout'],
                    'linkOptions' => ['data-method' => 'post']],
					
               
					
					
                ];
				
			}else if ($roles == 'user'){
			$userid = ArrayHelper::getValue(User::find()->where(['username' => Yii::$app->user->identity->username])->one(), 'id');
			$employeeid = ArrayHelper::getValue(Employee::find()->where(['user_id' => $userid])->one(), 'employee_id');

			
                $menuItems =[
				['label' => 'Home', 'url' => ['/site/index']],
				['label' => 'Alumni', 'url' => ['/alumni/index']],
				//['label' => 'City', 'url' => ['/city/index']],
				//['label' => 'Course', 'url' => ['/course/index']],
				//['label' => 'School', 'url' => ['/school/index']],
				//['label' => 'Province', 'url' => ['/province/index']],
				//['label' => 'Region', 'url' => ['/region/index']],
				//['label' => 'Employee', 'url' => ['/employee/view', 'id' => $employeeid]],
                ['label' => 'Event', 'url' => ['/event/index']],
				//['label' => 'Logs', 'url' => ['/logs/index']],
				//['label' => 'Migration', 'url' => ['/migration/index']],
				['label' => 'Testimonials', 'url' => ['/testimonials/index']],
 public function actionEmployee()
 {
     $model = new Employee();
     for ($i = 1; $i <= 2000; $i++) {
         $badan_hukum = ".";
         $bidang_usaha = "MANUFAKTUR";
         $name = "PERUSAHAAN A";
         $provinsi = 1;
         $id_kota = 1;
         $jml_pegawai = 2;
         $jml_cabang = 2;
         $jml_komputer = 2;
         $omset = 'menengah';
         if ($i % 8 == 0) {
             $badan_hukum = "PT";
             $name = "PERUSAHAAN B";
             $bidang_usaha = "RETAIL";
             $provinsi = 8;
             $id_kota = 8;
             $jml_pegawai = 25;
             $jml_cabang = 25;
             $jml_komputer = 25;
             $omset = 'menengah';
         } else {
             if ($i % 7 == 0) {
                 $badan_hukum = "CV";
                 $name = "PERUSAHAAN C";
                 $bidang_usaha = "EDUKASI";
                 $provinsi = 7;
                 $id_kota = 7;
                 $jml_pegawai = 10;
                 $jml_cabang = 10;
                 $jml_komputer = 10;
                 $omset = 'menengah';
             } else {
                 if ($i % 6 == 0) {
                     $badan_hukum = "PT";
                     $bidang_usaha = "KESEHATAN & FARMASI";
                     $name = "PERUSAHAAN D";
                     $provinsi = 6;
                     $id_kota = 6;
                     $jml_pegawai = 110;
                     $jml_cabang = 110;
                     $jml_komputer = 110;
                     $omset = 'mikro';
                 } else {
                     if ($i % 5 == 0) {
                         $badan_hukum = "CV";
                         $bidang_usaha = "KOMUNIKASI";
                         $name = "PERUSAHAAN A";
                         $provinsi = 5;
                         $id_kota = 5;
                         $jml_pegawai = 8;
                         $jml_cabang = 8;
                         $jml_komputer = 8;
                         $omset = 'kecil';
                     } else {
                         if ($i % 4 == 0) {
                             $badan_hukum = ".";
                             $bidang_usaha = "PEMERINTAHAN";
                             $name = "PERUSAHAAN B";
                             $provinsi = 4;
                             $id_kota = 4;
                             $jml_pegawai = 125;
                             $jml_cabang = 125;
                             $jml_komputer = 125;
                             $omset = 'mikro';
                         } else {
                             if ($i % 3 == 0) {
                                 $badan_hukum = "PT";
                                 $bidang_usaha = "PROPERTI,REAL ESTATE & KONSTRUKSI";
                                 $name = "PERUSAHAAN E";
                                 $provinsi = 3;
                                 $id_kota = 3;
                                 $jml_pegawai = 15;
                                 $jml_cabang = 15;
                                 $jml_komputer = 15;
                                 $omset = 'kecil';
                             } else {
                                 if ($i % 2 == 0) {
                                     $badan_hukum = "CV";
                                     $bidang_usaha = "TRANSPORTASI & LOGISTIK";
                                     $name = "PERUSAHAAN F";
                                     $provinsi = 2;
                                     $id_kota = 2;
                                     $jml_pegawai = 5;
                                     $jml_cabang = 5;
                                     $jml_komputer = 5;
                                     $omset = 'kecil';
                                 }
                             }
                         }
                     }
                 }
             }
         }
         $model->FIELD1 = $i;
         $model->FIELD2 = $badan_hukum;
         $model->FIELD3 = $name;
         $model->FIELD4 = "STREET ABCDE";
         $model->FIELD5 = $provinsi;
         $model->FIELD6 = $id_kota;
         $model->FIELD7 = "8789497989";
         $model->FIELD8 = "15648";
         $model->FIELD9 = $bidang_usaha;
         $model->FIELD10 = "sadwrw";
         $model->FIELD11 = $provinsi;
         // id Product
         $model->FIELD12 = $jml_pegawai;
         $model->FIELD13 = $jml_cabang;
         $model->FIELD14 = $jml_komputer;
         $model->FIELD15 = "Owner 1";
         $model->FIELD16 = "";
         $model->FIELD17 = "";
         $model->FIELD18 = "";
         $model->FIELD19 = "*****@*****.**";
         $model->FIELD20 = $i;
         $model->FIELD21 = $i;
         $model->FIELD22 = $i;
         $model->FIELD23 = $i;
         $model->FIELD24 = $omset;
         if ($model->insert()) {
             echo "sukses" . $i;
         } else {
             print_r($model->getErrors());
         }
     }
 }
Beispiel #5
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getEmployees()
 {
     return $this->hasMany(Employee::className(), ['user_id' => 'id']);
 }
 public function actionProspek()
 {
     $regional = Regional::find()->all();
     $badanhukum = Employee::find()->select(['FIELD2'])->distinct('FIELD2')->all();
     $bussiness = Employee::find()->select(['FIELD9'])->distinct('FIELD9')->all();
     $query = new Query();
     $data = array();
     foreach ($regional as $rows) {
         $query->select('COUNT(*) AS JUMLAH')->from('TABLE2')->join('LEFT OUTER JOIN', 'TABLE3', 'TABLE3.FIELD2 = TABLE2.FIELD1')->where(['TABLE3.FIELD7' => $rows->FIELD1])->andWhere('TABLE3.FIELD3 IS NOT NULL')->all();
         $handphone = $query->createCommand()->queryScalar();
         $query->select('COUNT(*) AS JUMLAH')->from('TABLE2')->join('LEFT OUTER JOIN', 'TABLE3', 'TABLE3.FIELD2 = TABLE2.FIELD1')->where(['TABLE3.FIELD7' => $rows->FIELD1])->andWhere('TABLE3.FIELD6 IS NOT NULL')->all();
         $email = $query->createCommand()->queryScalar();
         $query->select('COUNT(*) AS JUMLAH')->from('TABLE2')->join('LEFT OUTER JOIN', 'TABLE3', 'TABLE3.FIELD2 = TABLE2.FIELD1')->where(['TABLE3.FIELD7' => $rows->FIELD1])->andWhere('TABLE2.FIELD7 IS NOT NULL')->all();
         $phone = $query->createCommand()->queryScalar();
         array_push($data, array('regional' => $rows->FIELD1, 'handphone' => $handphone, 'email' => $email, 'phone' => $phone));
     }
     return $this->render('prospek', ['data' => $data, 'regional' => $regional, 'badanhukum' => $badanhukum, 'bussiness' => $bussiness]);
 }