/**
  * Lists all Action models.
  * @return mixed
  */
 public function actionIndex()
 {
     $model = new Data();
     if ($model->load(Yii::$app->request->post())) {
     }
     return $this->render('index', ['model' => $model, 'devices' => $model->getDevicesAll(), 'actions' => $model->getActions(), 'chart_types' => $model->getChartTypes(), 'chart_date' => $model->getChartDate(), 'chart_interval' => $model->getChartInterval(), 'chart_data' => $model->getChartData()]);
 }
 public function sqlLaporan()
 {
     $username = Yii::$app->user->identity->username;
     $connection = \Yii::$app->db;
     if (strtolower(Yii::$app->user->identity->level) == 'siswa') {
         $query = "SELECT  *  FROM siswa where email='{$username}';";
     }
     if (strtolower(Yii::$app->user->identity->level) == 'guru') {
         $nip = Data::nip_guru();
         $query = "SELECT  *  FROM matapelajaran_guru where nip='{$nip}';";
     }
     $model = $connection->createCommand($query);
     $data = $model->queryAll();
     $idkelas = null;
     $walikelas = Data::isWaliKelas();
     if ($walikelas) {
         $idkelas = $walikelas['id_kelas'];
     } else {
         $idkelas = $data[0]['id_kelas'];
     }
     if ($idkelas) {
         $query = "SELECT\n                nis,nama,kelas,minat,psikotes,tahun_ajaran,\n                -- group_concat(penjurusan) as penjurusan,\n                group_concat(penjurusan) as penjurusan,\n                 group_concat(bobot_nilai) as nilai_bobot,\n                 concat(minat,'<br>',bobot_minat) as nilai_bobot_minat,\n                 concat(minat,'<br>',bobot_psikotes) as nilai_bobot_psikotes,\n                 group_concat((bobot_nilai+bobot_minat+bobot_psikotes)) AS total,\n                 group_concat(penjurusan,'=',(bobot_nilai+bobot_minat+bobot_psikotes)) AS keputusan\n             FROM nilai_pembobotan_kriteria where id_kelas=" . $idkelas . " group by nis ORDER BY nis,penjurusan  DESC";
         $dataProvider = new SqlDataProvider(['sql' => $query]);
         return $dataProvider;
     } else {
         throw new NotFoundHttpException('Guru Belum Diberikan Akses Ke kelas.');
     }
 }
Пример #3
0
 public function halaman($slug)
 {
     $detail_halaman = Models\Data::where('slug_data', $slug)->first();
     $this->data['page'] = $detail_halaman;
     $this->data['title'] = $detail_halaman->title;
     $this->data['desc'] = strip_tags(substr($detail_halaman->content, 0, 200));
     return view('bappeda.halaman', $this->data);
 }
Пример #4
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     //
     \App\Models\Data::truncate();
     //清掉資料
     $faker = \Faker\Factory::create('zh_TW');
     foreach (range(1, 10) as $number) {
         //建立隨機變數數值
         $datas = new Data();
         $id = rand(1, 10);
         $datas->user_name = \APP\Models\Myuser::find($id)->users_name;
         //           $data->user_name = $faker->name;
         //            $data->data;
         $datas->description = $faker->text;
         $datas->save();
     }
 }
Пример #5
0
 public function actionCat($view = 'man')
 {
     if ($view == 'man') {
         $title = 'Мужские';
         $meta_d = 'купить мужские часы';
         $meta_k = 'купить, часы';
     } else {
         $title = 'Женские';
         $meta_d = 'Купить женские часы';
         $meta_k = 'купить, часы, женские';
     }
     $models = Data::find()->where(['cat' => $view])->all();
     return $this->render('categories', ['models' => $models, 'title' => $title, 'meta_d' => $meta_d, 'meta_k' => $meta_k]);
 }
Пример #6
0
 public function halaman($id)
 {
     switch ($id) {
         case 3.4:
             return $this->dataguru();
         case 3.5:
             return $this->datapegawai();
         case 4.1:
             return $this->datamahasiswa();
         case 5.1:
             return $this->persyaratan();
     }
     $this->data['page'] = Models\Data::with('menu')->where('data_id', $id)->first();
     $this->data['title'] = $this->data['page'] ? $this->data['page']->menu->title : 'Page Tidak Ditekemukan';
     return view('front.post', $this->data);
 }
Пример #7
0
 public function sqlWaliKelas()
 {
     $nip = null;
     if (Yii::$app->user->identity->level == 'guru') {
         $nip = Data::nip_guru();
     }
     if (empty($nip)) {
         throw new NotFoundHttpException('Maaf Anda Tidak Diizinkan untuk mengakses halaman ini.');
     }
     $walikelas = Data::isWaliKelas();
     if (empty($walikelas)) {
         throw new NotFoundHttpException('Maaf Anda Tidak Diizinkan untuk mengakses halaman ini.');
     }
     if (empty($walikelas['id_kelas'])) {
         throw new NotFoundHttpException('Maaf Anda Tidak Diizinkan untuk mengakses halaman ini.');
     }
     $query = "SELECT n.`id_nilai`,n.`nis`,s.`id_kelas` ,concat(`k`.`kelas`, `k`.`sub_kls`) AS `kelas`\n                        ,s.`nama`,mp.`matapelajaran`,n.`nilai` FROM\n                        nilai n JOIN matapelajaran_guru mg ON n.`id_matapelajaran`=mg.`id_matapelajaran_guru`\n                        JOIN guru g ON mg.nip=g.`nip`\n                        JOIN siswa s ON s.`nis`=n.`nis`\n                        JOIN matapelajaran mp ON mp.`id_matapelajaran`=mg.`id_matapelajaran`\n                        join kelas k on k.id_kelas=s.id_kelas\n                        WHERE k.id_kelas=" . $walikelas['id_kelas'];
     $count = Yii::$app->db->createCommand($query)->queryScalar();
     $dataProvider = new SqlDataProvider(['sql' => $query, 'totalCount' => (int) $count, 'pagination' => ['pagesize' => 100]]);
     return $dataProvider;
 }
 /**
  * Creates a new Berita model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new Berita();
     if ($model->load(Yii::$app->request->post())) {
         $model->nip = \app\models\Data::nip_guru();
         $model->tgl_input = date('Y-m-d H:i:S');
         $model->isi_berita = $_POST['Berita']['isi_berita'];
         // echo '<pre>';
         // print_r($model);
         // die();
         if (!empty($model->nip)) {
             if ($model->save()) {
                 Yii::$app->session->setFlash('success', 'Simpan Berhasil');
             } else {
                 Yii::$app->session->setFlash('warning', 'Failed');
             }
         } else {
             Yii::$app->session->setFlash('warning', 'Maaf Anda Bukan Guru');
         }
     } else {
         Yii::$app->session->setFlash('danger', 'Error');
     }
     return $this->redirect(['index']);
 }
Пример #9
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     //
     $data = Data::find($id);
     if ($data->delete()) {
         return response()->json(array('success' => TRUE, 'msg' => 'Data Berhasil Dihapus'));
     }
 }
Пример #10
0
Route::post('API/fileUpLoadGo', function () {
    //       $file = Request::input('user_file');
    //              $fileName = \Carbon\Carbon::now().".".Request::file('user_file')->getClientOriginalExtension();//將檔名變成上傳時間now()
    //            $fileName =str_replace(":","-",$fileName);
    //            $fileName =str_replace(" ","-",$fileName);
    if (Request::hasFile('user_file')) {
        if (Request::file('user_file')->isValid()) {
            //               Request::file('user_file')->move(".",$fileName);//將上傳的檔案移到public資料牙
            $fileName = Request::file('user_file')->getRealPath();
            $image = Image::make($fileName)->encode('jpg', 100);
            //將圖片轉譯存入變數image
            $datas = \App\Models\Data::find(1);
            $datas->data = $image;
            $datas->save();
            //           return view('fileUploadSucces',['user_file'=>$fileName]);//上傳的圖片顯示在網頁
            $datas = \APP\Models\Data::find(1);
            $response = Response::make($datas->data, 200);
            $response->header('Content-Type', 'image/jpeg');
            //設定網頁資料格式
            return $response;
        } else {
            return "上傳失敗";
        }
    } else {
        return "上傳失敗";
    }
});
//Route::Post('API/login',function(){
//
//   try{
//
Пример #11
0
 /**
  * Update Document
  *
  * @param String $name
  * @param Int $id
  * @param Request $request
  * @return Response
  */
 public function putDocument($name, $id, Request $request)
 {
     if (!$this->appKeyAvailable($request)) {
         return $this->notAuthorized($request);
     }
     if (!$this->setSessionUser($request)) {
         $this->setResultError("Not logged in", 401);
     } elseif (!$this->isCollection($name)) {
         $this->setResultError("Collection '{$name}' doesn't exist", 404);
     } else {
         $document = Document::find($id);
         if (!$document) {
             $this->setResultError("Document is not found", 404);
         } elseif (!$this->isAllowed($request, 'document', $id, 'update') && !$this->isModerator()) {
             $this->setResultError("Unauthorized action", 403);
         } else {
             $data = $request->all();
             $document->data = json_encode($data);
             $document->save();
             foreach (Data::whereDocumentId($document->id)->get() as $row) {
                 $row->delete();
             }
             foreach ($data as $key => $value) {
                 Data::create(['document_id' => $document->id, 'key' => $key, 'value' => $value]);
             }
             $this->setResultOk();
             $this->setDocumentData($document);
         }
     }
     return $this->setResponse();
 }
Пример #12
0
                                                ['prompt'=>'Bulan...'])->label('Bulan'); ?>
            ?= $form->field($model, 'thn')->dropDownList(
                                                \app\models\Data::thn(1996,10), 
                                                ['prompt'=>'Tahun...'])->label('Tahun'); ?> -->        
        </div>
        <div class="col-sm-4">
            <?php 
//$form->field($model, 'id_kelas')
?>
            <!-- ?= $form->field($model, 'id_kelas')->dropDownList(
                                                \app\models\Data::Kelas(), 
                                                ['prompt'=>'Pilih Kelas...'])->label('Kelas'); ?> -->

            <?php 
// Normal select with ActiveForm & model
echo $form->field($model, 'id_kelas')->widget(Select2::classname(), ['data' => \app\models\Data::Kelas(), 'language' => 'en', 'options' => ['placeholder' => 'Pilih Kelas...'], 'pluginOptions' => ['allowClear' => true]])->label('Kelas');
?>
       
            <!-- ?php  echo $form->field($model, 'no_telp') ?> -->

           <!-- ?= $form->field($model, 'jns_kelamin')->radioList(
                                                \app\models\Data::jns_kelamin() 
                                                )->label('Jenis Kelamin'); ?> -->

            <?php 
//echo $form->field($model, 'alamat')
?>

            <?php 
//echo $form->field($model, 'foto')
?>
Пример #13
0
 public static function getAllData($id)
 {
     $products = Data::findOne($id);
     return $products;
 }
Пример #14
0
        </div>
        <div class="col-sm-3">
	    <?php 
//$form->field($model, 'minat')->textInput(['maxlength' => true])
?>
	    <?php 
echo $form->field($model, 'minat')->radioList(\app\models\Data::minat())->label('Minat Siswa');
?>
        </div>
        <div class="col-sm-3">
	    <?php 
//$form->field($model, 'psikotes')->textInput(['maxlength' => true])
?>
	    <?php 
echo $form->field($model, 'psikotes')->radioList(\app\models\Data::psikotes())->label('Hasil Psikotes');
?>
		</div>
    </div>

    <div class="form-group">
        <?php 
echo Html::submitButton($model->isNewRecord ? 'INPUT' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
?>
    </div>

    <?php 
ActiveForm::end();
?>

</div>
Пример #15
0
?>
        </div>
        <div class="col-sm-3">
        <!-- ?= $form->field($model,'id_kelas')->dropDownList(
                                                \app\models\Data::kelas_pilih(),
                                                ['prompt'=>'Pilih Kelas...'])->label('Kelas'); ?> -->

        <?php 
// Normal select with ActiveForm & model
echo $form->field($model, 'id_kelas')->widget(Select2::classname(), ['data' => \app\models\Data::kelas_pilih(), 'language' => 'en', 'options' => ['placeholder' => 'Pilih Kelas...'], 'pluginOptions' => ['allowClear' => true]])->label('Kelas');
?>
        <?php 
//$form->field($model, 'sub_kls1')->textInput(['maxlength' => true])
?>
        <?php 
echo $form->field($model, 'subkls')->checkboxList(\app\models\Data::sub_kls1())->label('Sub Kelas');
?>
        <?php 
//$form->field($model, 'sub_kls2')->textInput(['maxlength' => true])
?>
        </div>
        <div class="col-sm-3">
        <?php 
//$form->field($model, 'sub_kls3')->textInput(['maxlength' => true])
?>

        <?php 
//$form->field($model, 'sub_kls4')->textInput(['maxlength' => true])
?>

        <?php 
Пример #16
0
    ?>
</li>
          <!-- <li class="list-group-item"><?php 
    echo Html::a('PENGAMPU', ['/matapelajaran-guru'], ['class' => 'btn btn-sm btn-primary btn-block']);
    ?>
</li> -->
          <li class="list-group-item"><?php 
    echo Html::a('NILAI', ['/nilai'], ['class' => 'btn btn-sm btn-primary btn-block']);
    ?>
</li>
          <li class="list-group-item"><?php 
    echo Html::a('BERITA', ['/berita'], ['class' => 'btn btn-sm btn-primary btn-block']);
    ?>
</li>
          <?php 
    if (\app\models\Data::isWaliKelas()) {
        ?>
            <li class="list-group-item"><?php 
        echo Html::a('PENJURUSAN', ['/hasil-pembobotan'], ['class' => 'btn btn-sm btn-primary btn-block']);
        ?>
</li>
            <li class="list-group-item"><?php 
        echo Html::a('NILAI SISWA KELAS', ['/nilai/walikelas'], ['class' => 'btn btn-sm btn-primary btn-block']);
        ?>
</li>
          <?php 
    }
    ?>
        </ul>

      <?php 
Пример #17
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getDatas()
 {
     return $this->hasMany(Data::className(), ['id_mother' => 'id']);
 }
Пример #18
0
        <?php 
// Normal select with ActiveForm & model
echo $form->field($model, 'nis')->widget(Select2::classname(), ['data' => \app\models\Data::nis(), 'language' => 'en', 'options' => ['placeholder' => 'Pilih...'], 'pluginOptions' => ['allowClear' => true]])->label('NAMA');
?>
            

        <?php 
//$form->field($model, 'id_matapelajaran')->textInput()
?>
        <!-- ?= $form->field($model,'id_matapelajaran')->dropDownList(
                                                \app\models\Data::matapelajaranGuru(), 
                                                ['prompt'=>'Pilih Mata Pelajaran...'])->label('Mata Pelajaran'); ?>  -->
        <?php 
// Normal select with ActiveForm & model
echo $form->field($model, 'id_matapelajaran')->widget(Select2::classname(), ['data' => \app\models\Data::matapelajaranGuru(), 'language' => 'en', 'options' => ['placeholder' => 'Pilih Mata Pelajaran...'], 'pluginOptions' => ['allowClear' => true]])->label('Mata Pelajaran');
?>
            

        </div>
        
        <div class="col-sm-3">

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

        <?php 
//$form->field($model, 'tahun_ajaran')->textInput(['maxlength' => true])
?>
        <!-- ?= $form->field($model, 'tahun_ajaran')->dropDownList(
Пример #19
0
 public function userFromPhotos($user)
 {
     $user = \App\Models\Data::where('user_name', '=', $user)->first()->myusers;
     return view('userFromPhoto', ['data' => $user]);
 }
Пример #20
0
        <?php 
// Normal select with ActiveForm & model
echo $form->field($model, 'thn')->widget(Select2::classname(), ['data' => \app\models\Data::thn(1995, 10), 'language' => 'en', 'options' => ['placeholder' => 'Pilih Tahun...'], 'pluginOptions' => ['allowClear' => true]])->label('Tahun');
?>
     
        
        </div>
    
        <div class="col-sm-3">
        <?php 
echo $form->field($model, 'no_telp')->textInput(['maxlength' => true]);
?>

        <!-- ?php //$form->field($model, 'jns_kelamin')->dropDownList([ 'L' => 'L', 'P' => 'P', ], ['prompt' => '']) ?> -->
        <?php 
echo $form->field($model, 'jns_kelamin')->radioList(\app\models\Data::jns_kelamin())->label('Jenis Kelamin');
?>
        </div>
    
    <div class="row">
        <div class="col-sm-3">
        <?php 
echo $form->field($model, 'alamat')->textarea(['rows' => 6]);
?>

        <?php 
echo $form->field($model, 'foto')->fileInput();
?>

        <!-- ?= $form->field($nilai, 'tahun_ajaran')->dropDownList(
                                                \app\models\Data::tahun_ajaran(),