public function actionGenHandler() { $num = $_POST['num']; $type = $_POST['type']; $arr_no = []; for ($i = 0; $i < $num; $i++) { $no = Util::next($type); if ($no >= 10 && $no < 100) { $no = '0' . $no; } else { if ($no < 10) { $no = '00' . $no; } } $no = $type . $no; $arr_no[] = $no; $card = new Card(); $card->no = $no; $card->type = $type; $card->status = 'A'; $card->create_dt = date('Y-m-d'); $card->create_by = \Yii::$app->user->id; $card->save(); $this->genBarCode($no); } $ty = Ref::getDesc('ctype', $type); $content = $this->renderPartial('daily_card', ['arr_no' => $arr_no, 'type' => $ty]); $pdf = new Pdf(['content' => $content, 'orientation' => Pdf::ORIENT_PORTRAIT, 'cssFile' => 'css/card.css', 'marginLeft' => 5, 'marginRight' => 5]); $pdf->render(); }
public function actionList() { $where = '1'; //comment here if (isset($_POST['tarikh'])) { $tarikh = $_POST['tarikh']; $module = $_POST['module']; if (!empty($module)) { $where .= " AND module = '{$module}'"; } if (!empty($tarikh)) { $where .= " AND event_dt LIKE '" . MyDate::dateFormat('dmy', 'ymd', $tarikh, '-') . "%'"; } } else { $module = '0'; $event_dt = ''; } $count = Audit::find()->where($where)->count(); $pages = new Pagination(['totalCount' => $count]); $pages->pageSize = 10; $data['pages'] = $pages; $data['module'] = $module; $data['event_dt'] = $event_dt; $audits = Audit::find()->where($where)->offset($pages->offset)->limit($pages->limit)->all(); $data['audits'] = $audits; $data['mod'] = Ref::getList('mod'); return $this->render('list', $data); }
public function actionSave() { $r = \Yii::$app->request; $input = $r->post('Ref'); if (!empty($input['id'])) { // create new $ref = Ref::findOne($input['id']); } else { // update $ref = new Ref(); } $ref->setAttributes($r->post('Ref')); if ($ref->save()) { // validation ok, save data \Yii::$app->session->setFlash('msg', 'Data telah disimpan'); return $this->redirect('index.php?r=ref/list&kat=' . $ref->cat); } else { // validation fails //var_dump($param); return $this->render('form', ['ref' => $ref]); } }
/** * Run the database seeds. * * @return void */ public function run() { DB::table('withdrawals')->truncate(); DB::table('payments')->truncate(); DB::table('banners')->truncate(); DB::table('banner_stream')->truncate(); $this->faker = FakerFactory::create(); $data = []; $data['languages'] = Ref::whereType('language')->get(); $data['games'] = Ref::whereType('game')->get(); $data['bannerTypes'] = Ref::whereType('banner_type')->get(); $this->data = $data; $this->addBanners(); }
/** * Run the database seeds. * * @return void */ public function run() { DB::table('streams')->truncate(); DB::table('stream_timelogs')->truncate(); DB::table('banner_stream')->truncate(); DB::table('user_transfers')->truncate(); DB::table('referrals')->truncate(); $this->faker = FakerFactory::create(); $data = []; $data['languages'] = Ref::whereType('language')->get(); $data['games'] = Ref::whereType('game')->get(); $data['bannerTypes'] = Ref::whereType('banner_type')->get(); $this->data = $data; for ($i = 0; $i <= 10; $i++) { $this->addStreams(); } $this->payStreams(); }
public function save(Request $request) { $rules = ['language' => 'required|numeric|exists:refs,id', 'banner_types' => 'required|array', 'games' => 'required|array']; $this->validate($request, $rules); $language = $request->get('language'); $language = Ref::find($language); if ($language && $language->type == 'language') { $this->user->language_id = $language->id; $this->user->save(); } else { return Redirect::back()->withErrors(['language' => 'You must select your language']); } $bannerTypes = $request->get('banner_types'); $bannersClean = []; foreach ($bannerTypes as $b) { $bannerType = Ref::find($b); if ($bannerType && $bannerType->type == 'banner_type') { $bannersClean[] = $b; } } if (count($bannersClean) == 0) { return Redirect::back()->withErrors(['banner_types' => 'You must select allowed banner types']); } $games = $request->get('games'); $gamesClean = []; foreach ($games as $b) { $game = Ref::find($b); if ($game && $game->type == 'game') { $gamesClean[] = $b; if ($game->pid > 0) { $gamesClean[] = $game->parent->id; } } } if (count($gamesClean) == 0) { return Redirect::back()->withErrors(['games' => 'You must select games you play']); } $gamesClean = array_unique($gamesClean); $this->user->refs()->sync(array_merge($bannersClean, $gamesClean)); return redirect('/user/twitcher/profile'); }
/** * Run the database seeds. * * @return void */ public function run() { DB::table('users')->truncate(); DB::table('user_profiles')->truncate(); DB::table('user_auth_token')->truncate(); DB::table('user_transfers')->truncate(); DB::table('ref_user')->truncate(); DB::table('notifications')->truncate(); DB::table('logs')->truncate(); DB::table('referrals')->truncate(); DB::table('coupon_user')->truncate(); $this->faker = FakerFactory::create(); $data = []; $data['languages'] = Ref::whereType('language')->get(); $data['games'] = Ref::whereType('game')->get(); $data['bannerTypes'] = Ref::whereType('banner_type')->get(); $this->data = $data; $this->admin(); $this->streamers(100); $this->clients(100); }
?> <tr> <td><?php echo $i++; ?> .</td> <td><?php echo $card->no; ?> </td> <td><?php echo Ref::getDesc('ctype', $card->type); ?> </td> <td><?php echo Ref::getDesc('status', $card->status); ?> </td> <td><?php echo $card->create_dt; ?> </td> <td><?php echo $card->create_by; ?> </td> <td align='center'><a href="index.php?r=card/print&id=<?php echo $card->id; ?> " target="window"><span class="glyphicon glyphicon-print"></span></a></td> </tr>
?> .</td> <td><?php echo $user->name; ?> </td> <td><?php echo $user->user_id; ?> </td> <td><?php echo $user->email; ?> </td> <td><?php echo Ref::getDesc('role', $user->role); ?> </td> <td align="center"> <a href="<?php echo URL::toRoute('user/edit'); ?> &id=<?php echo $user->user_id; ?> " title="Kemaskini" data-rel="tooltip"><span class="fa fa-pencil-square-o bigger-130"/></a> <a href="<?php echo URL::toRoute('user/delete'); ?> &id=<?php echo $user->user_id;
</tr> <?php $i = 1; foreach ($cms as $c) { ?> <tr> <td><?php echo $i++; ?> .</td> <td><?php echo $c->title; ?> </td> <td><?php echo Ref::getDesc('csts', $c->status); ?> </td> <td> <a href="<?php echo URL::toRoute('cms/edit'); ?> &id=<?php echo $c->id; ?> "><span class="glyphicon glyphicon-pencil"/></a> <a href="<?php echo URL::toRoute('cms/delete'); ?> &id=<?php echo $c->id;
public function show($bannerType) { $bannerType = Ref::findOrFail($bannerType); if ($bannerType->type != 'banner_type') { return redirect('/user/twitcher'); } $banners = BannerMapper::activeTwitcher($this->user, $bannerType->id); $requiredSizes = explode('*', $bannerType->title); return view('app.pages.user.twitcher.banner.show', compact('banners', 'bannerType', 'requiredSizes')); }
public function addRefs($refs, $type) { foreach ($refs as $r) { $ref = Ref::create(['type' => $type, 'title' => $r]); } }
public function actionRegIn() { $data['jab'] = Ref::getList('jab'); $data['purpose'] = Ref::getList('obj'); return $this->render('reg_in', $data); }
public function destroy($id) { $ref = Ref::findOrFail($id); if ($ref->children()->count() > 0) { return Redirect::back()->withErrors(['This ref has children and can not be removed.']); } $ref->delete(); return Redirect::back(); }
<div class="col col-sm-2">Pengesahan Katalaluan</div> <div class="col col-sm-8"><input type="password" name="User[confirm_password]" class="form-control" value="<?php echo $model->confirm_password; ?> "></div> </div> <div class="row"> <div class="col col-sm-2">Emel</div> <div class="col col-sm-8"><?php echo $form->field($model, 'email')->label(false); ?> </div> </div> <div class="row"> <div class="col col-sm-2">Peranan</div> <div class="col col-sm-8"><?php echo Html::dropDownList('User[role]', $model->role, Ref::getList('role'), ['class' => 'form-control']); ?> </div> </div> <div class="row"> <div class="col col-sm-2"></div> <div class="col col-sm-8"> <button class="btn btn-primary"><i class="fa fa-floppy-o bigger-130"></i> Simpan</button> <a href="index.php?r=user/list" class="btn btn-default"><i class="fa fa-backward"></i> Kembali</a> </div> </div> <?php ActiveForm::end(); ?> </div>
<div class="col col-sm-4 xlabel">Pengesahan Katalaluan</div> <div class="col col-sm-8"><input type="password" name="User[confirm_password]" value="<?php echo $model->password; ?> " class="form-control"></div> </div> <div class="row"> <div class="col col-sm-4 xlabel">Emel</div> <div class="col col-sm-8"><?php echo $form->field($model, 'email')->label(false); ?> </div> </div> <div class="row"> <div class="col col-sm-4 xlabel">Tahap Capaian</div> <div class="col col-sm-8"><?php echo Ref::getDesc('role', $model->role); ?> </div> </div> <div class="row"> <div class="col col-sm-4"></div> <div class="col col-sm-8"><?php echo Html::submitButton('Simpan', ['class' => 'btn btn-primary']); ?> </div> </div> <?php ActiveForm::end(); ?> </div>
} } }, tooltip: { headerFormat: '<span style="font-size:11px">{series.name}</span><br>', pointFormat: '<span style="color:{point.color}">{point.name}</span>: <b>{point.y:.2f}%</b> of total<br/>' }, series: [{ name: "Brands", colorByPoint: true, data: [ <?php foreach ($rs as $r) { ?> { name: "<?php echo Ref::getDesc('jab', $r['dept']); ?> ", y: <?php echo $r['bil']; ?> }, <?php } ?> ] }] }); }); </script>
use yii\helpers\Html; ?> <legend> Jana Kad Pelawat Harian </legend> <form method="post" action="index.php?r=card/daily-handler" target="window"> <div class="container col col-md-7 col-md-offset-1 well"> <div class="row"> <div class="col col-md-12">** Sila masukkan bilangan kad pelawat yang akan dijana</div> </div> <div class="row"> <div class="col col-md-2">Bilangan Kad</div> <div class="col col-md-2"> <?php echo Html::dropDownList('num', '', Ref::getList('card', false)); ?> </div> <div class="col col-md-1">Jenis</div> <div class="col col-md-4"> <?php echo Html::dropDownList('type', '', Ref::getList('ctype', false)); ?> </div> </div> <div class="row"> <div class="col col-md-2 col-md-offset-2"><input type="submit" class="btn btn-primary" value="Jana"></div> </div> </div> </form>
public static function allTypes() { return Ref::select('type')->distinct()->get(); }
?> </td> <td><?php echo $visit->pass_no; ?> </td> <td align='center'><?php echo $visit->num; ?> </td> <td><?php echo $visit->purpose; ?> </td> <td><?php echo Ref::getDesc('jab', $visit->dept); ?> </td> <td><?php echo $visit->to_meet; ?> </td> <td align='center'> <a class="dlg2" href="#" val="<?php echo $visit->id; ?> "><span class="glyphicon glyphicon-log-out"></span></a> </td> </tr> <?php }
<div class="col col-sm-8"><?php echo $form->field($model, 'content')->textarea(['rows' => 5])->label(false); ?> </div> </div> <div class="row"> <div class="col col-sm-2">Nama Unik</div> <div class="col col-sm-8"><?php echo $form->field($model, 'unique_name')->label(false); ?> </div> </div> <div class="row"> <div class="col col-sm-2">Status</div> <div class="col col-sm-8"><?php echo $form->field($model, 'status')->dropDownList(Ref::getList('csts'))->label(false); ?> </div> </div> <div class="row"> <div class="col col-sm-2"></div> <div class="col col-sm-8"><?php echo Html::submitButton('Simpan', ['class' => 'btn btn-primary']); ?> </div> </div> <?php ActiveForm::end(); ?> </div>