public function actionCreate() { $request = Yii::app()->request->getIsPostRequest(); $ajaxRequest = Yii::app()->request->getIsAjaxRequest(); if ($request) { $berita = new Berita(); $kategori = new Kategori(); $tags = new Tags(); $image = new Image(); $postBerita = !empty($_POST['Berita']) ? $_POST['Berita'] : ""; $postKategori = !empty($_POST['Kategori']) ? $_POST['Kategori'] : ""; $postTags = !empty($_POST['Tags']) ? $_POST['Tags'] : ""; if ($kategori) { $kategori->setAttributes($postKategori); } if ($tags) { $tags->setAttributes($postTags); } if ($postBerita) { $berita->setAttributes($postBerita); $berita->setCreatetime($postBerita['tgl_create']); $berita->setUpdatetime($postBerita['tgl_update']); } } $jsonData = array(); if ($ajaxRequest) { echo CJSON::encode($jsonData); Yii::app()->end(); } else { $this->render("create", array()); } }
public function save() { if (Request::ajax()) { $data = new Kategori(); $data->cat_nama = Input::get("kategori"); $data->save(); return "berhasil"; } }
public function edit($KdJnsKategori) { $jnskategori = Jnskategori::find($KdJnsKategori); $kategori = Kategori::all(); $subkategori = SubKategori::all(); $satuan = Satuan::all(); return View::make('jns_kategori.edit_jnskategoris')->with('jnskategori', $jnskategori)->with('kategori', $kategori)->with('satuan', $satuan)->with('subkategori', $subkategori); }
public function pengadaan_edit($id) { $data = new stdclass(); $data = Proyek::where('id', $id)->first(); $kategori = Kategori::lists('cat_nama', 'id_cat'); $data->kategori = $kategori; /*print_r($data->kategori); exit;*/ $data->page = "edit"; return View::make('master', array('menu' => 'admin.admin_menu', 'page' => 'admin.permintaan.form'))->with('data', $data); }
public function actionCetak($id) { $this->layout = '//layouts/nolayout'; $model = $this->loadModel($id); // $model->TANGGAL_BAYAR = date('Y-m-d H:i:s'); // //$model->STATUS_BAYAR = Order::SUDAH_DIBAYAR; // //$model->PEMBAYARAN = $_GET['Order']['Order_PEMBAYARAN']; // $model->update(); $kategori = Kategori::listAll(); $this->render('invoice/_cetak_nota', array('model' => $model, 'kategori' => $kategori)); }
public function kategori($id) { $kategori = Kategori::all(); $koordinat = DB::Table('lokasi')->where('lokasi.id_kategori', '=', $id)->join('kategori', 'kategori.id_kategori', '=', 'lokasi.id_kategori')->get(); $config['center'] = "-6.885177, 109.135567"; $config['zoom'] = "13"; $config['map_type'] = "ROADMAP"; $config['trafficOverlay'] = true; Gmaps::initialize($config); foreach ($koordinat as $row) { $marker = array(); $marker['icon'] = URL::to('uploads/icon/' . $row->icon); $marker['infowindow_content'] = $row->nm_lokasi . "<hr><strong>Alamat : " . $row->alamat . "<br><strong>Kode Pos : </strong>" . $row->kode_pos . "<br><strong>Telp : </strong>" . $row->telp; $marker['position'] = $row->lat . ',' . $row->lng; $marker['animation'] = 'DROP'; Gmaps::add_marker($marker); } $map = Gmaps::create_map(); return View::make('web.index')->with('map', $map)->with('kategori', $kategori); }
<?php /** * Created by PhpStorm. * User: ekobudisusilo * Date: 04 /07 /15 * Time: 20.23 */ ob_start(); include 'class.Kategori.php'; $kategori = htmlspecialchars($_POST['kategori']); $isi = new Kategori(); switch ($_GET['p']) { case "add": $isi->AddKategori($kategori); header('location: ../main.php?m=010'); break; case "edit": break; case "del": $id = $_REQUEST['id']; $isi->AddDelete($id); header('location: ../main.php?m=010'); break; //default: echo "Not Founds"; } ob_end_flush();
public static function getNama() { return CHtml::listData(Kategori::model()->findAll(), 'id', 'nama'); }
$uploadOk = 0; #echo "3"; } else { $f = $_FILES['image']; $imgdir = "Image/" . date("YmdHis") . $f['name']; $uploadOk = 1; copy($f['tmp_name'], "../" . $imgdir); #echo "4"; } if ($uploadOk == 1) { $Pelaporan->newReport($_POST['report'], $imgdir, $_COOKIE['id'], $_POST['cat'], $_POST['dep']); $msg['success'] = "Data Berhasil Di input.."; } } require_once '../models/kategori.php'; $Kategori = new Kategori(); $cat = $Kategori->getKategori(); require_once '../models/departemen.php'; $Departemen = new Departemen(); $dep = $Departemen->getDepartemen(); require_once 'header.php'; require_once 'sidebar.php'; ?> <div id="page-wrapper"> <div class="container-fluid">
<?php /** * Created by PhpStorm. * User: ekobudisusilo * Date: 04 /07 /15 * Time: 20.24 */ ini_set('display_errors', 1); ini_set('display_startup_errors', 1); error_reporting(-1); include_once '/Applications/MAMP/htdocs/isias/classes/class.Kategori.php'; include_once '/Applications/MAMP/htdocs/isias/classes/paginator.class.php'; $cat = new Kategori(); $stmt = $cat->countAll(); $num_rows = $stmt->rowCount(); //if ($num_rows>0){ //$pages = new Paginator($num_rows, 19); /*if(isset($_POST['cari'])){ $cari = $_POST['cari']; $stmt = $cat->GetListKategori($pages->limit_start, $pages->limit_end); } else{ $stmt = $cat->GetListKategori($pages->limit_start, $pages->limit_end); }*/ //} ?> <div class="container"> <div class="row"> <a href="#myModal" role="button" class="btn btn-primary" data-toggle="modal" data-target="#add-Data">Nilai Baru</a> <div class="input-prepend pull-right">
<?php $this->breadcrumbs = array('Bukus' => array('index'), 'Manage'); $this->menu = array(array('label' => 'List Buku', 'url' => array('index')), array('label' => 'Create Buku', 'url' => array('create'))); Yii::app()->clientScript->registerScript('search', "\n\$('.search-button').click(function(){\n\t\$('.search-form').toggle();\n\treturn false;\n});\n\$('.search-form form').submit(function(){\n\t\$.fn.yiiGridView.update('buku-grid', {\n\t\tdata: \$(this).serialize()\n\t});\n\treturn false;\n});\n"); ?> <h1>Manajemen Buku</h1> <p> You may optionally enter a comparison operator (<b><</b>, <b><=</b>, <b>></b>, <b>>=</b>, <b><></b> or <b>=</b>) at the beginning of each of your search values to specify how the comparison should be done. </p> <?php echo CHtml::link('Advanced Search', '#', array('class' => 'search-button btn')); ?> <div class="search-form" style="display:none"> <?php $this->renderPartial('_search', array('model' => $model)); ?> </div><!-- search-form --> <?php $this->widget('bootstrap.widgets.TbGridView', array('id' => 'buku-grid', 'dataProvider' => $model->search(), 'filter' => $model, 'columns' => array(array('name' => 'judul', 'type' => 'raw', 'value' => 'CHtml::link(CHtml::encode($data->judul), $data->id)'), array('name' => 'kategori', 'type' => 'raw', 'value' => 'Kategori::getKategori($data->kategori)', 'filter' => Kategori::getNama()), array('class' => 'bootstrap.widgets.TbButtonColumn'))));
public function editKatalog() { $kat = Kategori::all(); $author = Author::all(); $act = 'edit'; $kategori = array(); foreach ($kat as $key => $value) { $kategori[$value->id] = $value->categoryname; } $year = array(); for ($i = (int) date('Y') - 30; $i <= (int) date('Y'); $i++) { $year[$i] = $i; } $publ = Publisher::all(); $publisher = array(); foreach ($publ as $key => $value) { $publisher[$value->id] = $value->publishername; } if (Input::has('submit')) { if (Input::has('youtube')) { $validator = array('title' => 'required', 'category' => 'required', 'summary' => 'required', 'release' => 'required', 'numpage' => 'required'); } else { $validator = array('title' => 'required', 'category' => 'required', 'summary' => 'required', 'release' => 'required', 'numpage' => 'required', 'file' => 'mimes:pdf,mp4|max:20000', 'cover' => 'mimes:jpg,jpeg,png|max:5000'); } $validator = Validator::make(Input::all(), $validator); if ($validator->passes()) { //file if (Input::hasFile('file')) { $doc = Input::file('file'); $filename = $doc->getClientOriginalName(); $nama = rand() . '_' . $filename; $size = Input::file('file')->getSize(); $type = Input::file('file')->getMimeType(); //$size = $_FILES['file']['size']; //$type = $_FILES['file']['type']; $destinationPath = public_path('file/'); $uploadSuccess = Input::file('file')->move($destinationPath, $nama); /*$file = $_FILES['file']; $nama = rand().'_'.$file['name']; move_uploaded_file($file['tmp_name'], 'file/'.$nama);*/ } else { $nama = Input::get('youtube'); $size = ''; $type = ''; } //kover if (Input::hasFile('cover')) { $doc = Input::file('cover'); $filename = $doc->getClientOriginalName(); $img = rand() . '_' . $filename; $destinationPath = public_path('image/cover/'); $uploadSuccess = Input::file('cover')->move($destinationPath, $img); } else { $img = ''; } $katalog = new Katalog(); $katalog->title = Input::get('title'); $katalog->category = Input::get('category'); $katalog->summary = Input::get('summary'); $katalog->filesize = $size; $katalog->filetype = $type; $katalog->release = Input::get('release'); $katalog->numpage = Input::get('numpage'); $katalog->ISBN = Input::get('isbn'); $katalog->file = $nama; $katalog->publisher = Input::get('publisher'); $katalog->img = $img; $katalog->like = 0; $katalog->save(); foreach (Input::get('author') as $key => $value) { $authkatalog = new AuthorKatalog(); $authkatalog->idKatalog = $katalog->id; $authkatalog->author = $value; $authkatalog->save(); } return Redirect::to('admin/rkmkatalog')->with('sukses', 'rekam katalog sukses'); } else { return Redirect::to('admin/rkmkatalog')->withInput()->withErrors($validator); } } else { return View::make('admin.katalog', compact('kategori', 'publisher', 'year', 'author', 'act')); } }
/** * Show the form for editing the specified resource. * * @param int $id * @return Response */ public function edit($id) { $berita = Berita::find($id); $kategori = Kategori::all(); return View::make('berita.edit')->with('berita', $berita)->with('kategori', $kategori); }
} ?> </div> </div> <div class="tab-pane" id="tab-2"> <div class="news"> <?php foreach ($randnews as $row) { ?> <div class="item"> <h3><a href="index.html"><?php echo $row->nama_sub_kategori; ?> </a></h3> <p><?php echo Kategori::dateindo($row->waktu_post); ?> // <?php echo $row->nama_kategori; ?> // <?php echo $row->username; ?> </p> <div class="clear"></div> </div> <?php } ?> </div> </div>
</div> <a href="?p=kategori-tambah" class="btn btn-primary center-block">Tambah Kategori</a> <div class="panel-body"> <div class="table-responsive"> <table class="table table-striped table-bordered table-hover" id="dataTables-example"> <thead> <tr> <th>Nama Kategori</th> <th>Detail</th> <th>Aksi</th> </tr> </thead> <tbody> <?php $sql = "SELECT * FROM `kategori`"; $kategori = Kategori::getKategori($sql); foreach ($kategori as $data => $r) { echo "\n\t\t\t\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t\t\t\t<td>{$r['1']}</td>\n\t\t\t\t\t\t\t\t\t\t\t\t<td>{$r['2']}</td>\n\t\t\t\t\t\t\t\t\t\t\t\t<td width=130px><a href='?p=kategori-edit-{$r['0']}' style='width: 60px' class='btn btn-success'>Edit</a> <a href='?p=kategori-delete-{$r['0']}' style='width: 60px' class='btn btn-danger'>Hapus</a> </td>\n\t\t\t\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t\t\t"; } ?> </tbody> </table> </div> </div> </div> <!--End Advanced Tables --> </div> </div> <?php
<form action="index.php?side=admin_kategorier" method="POST"> <label for="kategori">Ny kategori</label> <input type="text" name="kategori" id="kategori" maxlength="30" value="<?php echo $_POST['kategori']; ?> " required> <input type="submit" name="nykategori" id="nykategori" value="Registrer ny kategori"> </form> <?php if ($_POST['nykategori'] == "Registrer ny kategori") { $kategori = new Kategori(); echo $kategori->nyKategori($_POST['kategori']); } if (isset($_GET['slett'])) { $kategori = new Kategori(); $setOk = $kategori->setKategori($_GET['slett']); if ($setOk != null) { echo $setOk; } else { echo $kategori->slettKategori(); } } ?> <table> <tr> <th>Kategori</th> <th> </th> </tr> <?php
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { $berita = DB::table('berita')->where('id_kategori', '=', $id)->count(); if ($berita > 0) { Session::flash('pesan', "<div class='alert alert-danger'>Data Kategori\n\t\t\t\ttidak dapat dihapus karena masih memiliki relasi dengan data berita</div>"); return Redirect::to('admin/kategori'); } else { Kategori::find($id)->delete(); Session::flash('pesan', "<div class='alert alert-info'>Data berhasil dihapus</div>"); return Redirect::to('admin/kategori'); } }
public function getKategori() { return CHtml::listData(Kategori::model()->with('threads')->findAll(), 'id', 'kategori'); }
<?php echo $form->textFieldRow($model, 'penerbit', array('class' => 'span5', 'maxlength' => 128)); ?> <?php echo $form->textFieldRow($model, 'tahun_terbit', array('class' => 'span5')); ?> <?php echo $form->textAreaRow($model, 'review', array('rows' => 6, 'cols' => 50, 'class' => 'span8')); ?> <?php echo $form->dropDownListRow($model, 'kategori', Kategori::model()->getTypeOptions()); ?> <?php echo $form->fileFieldRow($model, 'cover', array('class' => 'span5')); ?> <!-- <?php //if($model->isNewRecord!='1'){ ?> <div class="row"> <?php //echo CHtml::image(Yii::app()->request->baseUrl.'/photo/book/'.$model->image,"image",array("width"=>200)); ?> // Image shown here if page is update page </div>*/
public function edit_komunitas($id) { $data['komunitas'] = Komunitas::where('id', '=', $id)->first(); $data['kategori'] = Kategori::get(); return View::make('edit_komunitas', $data); }
<?php /** * Created by PhpStorm. * User: ekobudisusilo * Date: 04 /07 /15 * Time: 20.24 */ ini_set('display_errors', 1); ini_set('display_startup_errors', 1); error_reporting(-1); include_once '/Applications/MAMP/htdocs/isias/classes/class.Kategori.php'; include_once '/Applications/MAMP/htdocs/isias/classes/paginator.class.php'; $cat = new Kategori(); $stmt = $cat->countAll(); $num_rows = $stmt->rowCount(); if ($num_rows > 0) { $pages = new Paginator($num_rows, 19); if (isset($_POST['cari'])) { $cari = $_POST['cari']; $stmt = $cat->GetListKategori($pages->limit_start, $pages->limit_end); } else { $stmt = $cat->GetListKategori($pages->limit_start, $pages->limit_end); } } ?> <div class="container"> <div class="row"> <a href="#myModal" role="button" class="btn btn-primary" data-toggle="modal" data-target="#add-Data">Kategori Baru</a> <div class="input-prepend pull-right"> <span class="add-on"><i class="icon-search"></i></span>
public function hapus() { if (Request::ajax()) { $kode = Input::get('kode'); $cek = DB::table('lokasi')->where('id_kategori', '=', $kode)->count(); if ($cek > 0) { $html = "Data Kategori tidak dapat dihapus karena masih memiliki Lokasi :"; $html .= "<ul>"; $lokasi = DB::table('lokasi')->where('id_kategori', '=', $kode)->get(); foreach ($lokasi as $row) { $html .= "<li>{$row->nm_lokasi}</li>"; } $html .= "</ul>"; Session::flash('pesan', "<hr><div class='alert alert-danger'>" . $html . "</div>"); } else { $kategori = Kategori::find($kode); if ($kategori->icon) { $fotolama = $kategori->icon; $filepath = public_path() . DIRECTORY_SEPARATOR . 'uploads/icon' . DIRECTORY_SEPARATOR . $kategori->icon; try { File::delete($filepath); } catch (FileNotFoundException $e) { } } $kategori->delete(); Session::flash('pesan', "<hr><div class='alert alert-info'>\n\t\t\t\t\tData Berhasil dihapus</div>"); } } }
<body> <div class="container" id="page"> <div id="header"> <div id="logo"><?php echo CHtml::encode(Yii::app()->name); ?> </div> </div><!-- header --> <div> <?php $kategoriAll = array(); $kategori = Kategori::model()->findAll(); foreach ($kategori as $i => $ii) { $kategoriAll[] = array('label' => $ii['kategori'], 'url' => array('/thread/index', 'id' => $ii['id'])); } $this->widget('ext.mbmenu.MbMenu', array('items' => array(array('label' => 'Home', 'url' => array('/site/index')), array('label' => 'Forum', 'url' => array('/kategori/index'), 'items' => $kategoriAll), array('label' => 'Kelola Kategori', 'url' => array('/kategori/admin'), 'visible' => Yii::app()->user->getLevel() <= 2), array('label' => 'Kelola Thread', 'url' => array('/thread/admin'), 'visible' => Yii::app()->user->getLevel() <= 2), array('label' => 'Kelola Komentar', 'url' => array('/comment/admin'), 'visible' => Yii::app()->user->getLevel() <= 2), array('label' => 'Kelola Berita', 'url' => array('/news/admin'), 'visible' => Yii::app()->user->getLevel() <= 2), array('label' => 'Register', 'url' => array('/user/create'), 'visible' => Yii::app()->user->isGuest), array('label' => 'Profile(' . Yii::app()->user->name . ')', 'url' => array('/user/view', 'id' => Yii::app()->user->id), 'visible' => !Yii::app()->user->isGuest), array('label' => 'Login', 'url' => array('/site/login'), 'visible' => Yii::app()->user->isGuest), array('label' => 'Logout', 'url' => array('/site/logout'), 'visible' => !Yii::app()->user->isGuest, 'linkOptions' => array('onclick' => 'return confirm("Anda ingin Keluar?")'))))); ?> </div><!-- mainmenu --> <?php if (isset($this->breadcrumbs)) { ?> <?php $this->widget('zii.widgets.CBreadcrumbs', array('links' => $this->breadcrumbs)); ?> <!-- breadcrumbs --> <?php }
/** * Resets all references to other model objects or collections of model objects. * * This method is a user-space workaround for PHP's inability to garbage collect * objects with circular references (even in PHP 5.3). This is currently necessary * when using Propel in certain daemon or large-volume/high-memory operations. * * @param boolean $deep Whether to also clear the references on all referrer objects. */ public function clearAllReferences($deep = false) { if ($deep && !$this->alreadyInClearAllReferencesDeep) { $this->alreadyInClearAllReferencesDeep = true; if ($this->collDetailBarangMasuks) { foreach ($this->collDetailBarangMasuks as $o) { $o->clearAllReferences($deep); } } if ($this->collDetailTransaksis) { foreach ($this->collDetailTransaksis as $o) { $o->clearAllReferences($deep); } } if ($this->collHargas) { foreach ($this->collHargas as $o) { $o->clearAllReferences($deep); } } if ($this->collLinkBarangRaks) { foreach ($this->collLinkBarangRaks as $o) { $o->clearAllReferences($deep); } } if ($this->collLogBarangs) { foreach ($this->collLogBarangs as $o) { $o->clearAllReferences($deep); } } if ($this->aKategori instanceof Persistent) { $this->aKategori->clearAllReferences($deep); } if ($this->aKemasan instanceof Persistent) { $this->aKemasan->clearAllReferences($deep); } if ($this->aProdusen instanceof Persistent) { $this->aProdusen->clearAllReferences($deep); } $this->alreadyInClearAllReferencesDeep = false; } // if ($deep) if ($this->collDetailBarangMasuks instanceof PropelCollection) { $this->collDetailBarangMasuks->clearIterator(); } $this->collDetailBarangMasuks = null; if ($this->collDetailTransaksis instanceof PropelCollection) { $this->collDetailTransaksis->clearIterator(); } $this->collDetailTransaksis = null; if ($this->collHargas instanceof PropelCollection) { $this->collHargas->clearIterator(); } $this->collHargas = null; if ($this->collLinkBarangRaks instanceof PropelCollection) { $this->collLinkBarangRaks->clearIterator(); } $this->collLinkBarangRaks = null; if ($this->collLogBarangs instanceof PropelCollection) { $this->collLogBarangs->clearIterator(); } $this->collLogBarangs = null; $this->aKategori = null; $this->aKemasan = null; $this->aProdusen = null; }
/** * Exclude object from result * * @param Kategori $kategori Object to remove from the list of results * * @return KategoriQuery The current query, for fluid interface */ public function prune($kategori = null) { if ($kategori) { $this->addUsingAlias(KategoriPeer::ID, $kategori->getId(), Criteria::NOT_EQUAL); } return $this; }
echo $form->labelEx($model, 'id_post'); ?> <?php echo $form->textField($model, 'id_post'); ?> <?php echo $form->error($model, 'id_post'); ?> </div> <div class="row"> <?php echo $form->labelEx($model, 'id_kategori'); ?> <?php echo $form->dropDownList($model, 'id_kategori', CHtml::listData(Kategori::model()->findAll(), 'id_kategori', 'nama_kategori'), array("empty" => "Pilih Kategori")); ?> <?php echo $form->error($model, 'id_kategori'); ?> </div> <div class="row"> <?php echo $form->labelEx($model, 'id_user'); ?> <?php echo $form->textField($model, 'id_user', array('size' => 5, 'maxlength' => 5)); ?> <?php echo $form->error($model, 'id_user');
<a href="#overview_<?php echo $i; ?> " data-toggle="tab"> <?php echo strtoupper($tipe); ?> </a> </li> <?php } ?> </ul> <div class="tab-content"> <?php foreach (Kategori::listAll() as $i => $tipe) { ?> <div class="tab-pane <?php echo $i == 1 ? 'active' : ''; ?> " id="overview_<?php echo $i; ?> "> <div class="row margin-bottom-40"> <div class="search-page search-content-3"> <div class="col-lg-12"> <div class="row"> <?php foreach (Item::ListBarangByKategori($i) as $dex => $item) { ?>
<?php echo $form->textArea($item, 'NAMA_ITEM', array('maxlength' => 100, 'class' => 'form-control input-large')); ?> <?php echo $form->error($item, 'NAMA_ITEM'); ?> </div> </div> <div class="form-group"> <?php echo $form->labelEx($item, 'ID_KATEGORI', array('class' => 'control-label col-md-3')); ?> <div class="col-md-4"> <?php echo $form->dropDownList($item, 'ID_KATEGORI', Kategori::listAll(), array('class' => 'bs-select form-control input-large', 'prompt' => '- Pilih Kategori -')); ?> <?php echo $form->error($item, 'ID_KATEGORI'); ?> </div> </div> <div class="form-group"> <?php echo $form->labelEx($item, 'HARGA_JUAL', array('class' => 'control-label col-md-3')); ?> <div class="col-md-4"> <div class="input-inline input-large"> <div class="input-group"> <span class="input-group-addon">Rp</span>
/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. * @param integer $id the ID of the model to be loaded * @return Kategori the loaded model * @throws CHttpException */ public function loadModel($id) { $model = Kategori::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
public function edit_profile() { $data['user'] = Users::find(Session::get('user_id')); $data['minat'] = Kategori::get(); $data['cal'] = Calendar::make(); $data['cal']->setDayLabels(array('Minggu', 'Senin', 'Selasa', 'Rabu', 'Kamis', 'Jumat', 'Sabtu')); $data['cal']->setMonthLabels(array('Januari', 'Februari', 'Maret', 'April', 'Mei', 'Jeni', 'Juli', 'Agustus', 'September', 'Oktober', 'November', 'Desember')); return View::make('edit_profile', $data); }