public function actionAdmin() { $model = new Subdistrict('search'); $model->unsetAttributes(); if (isset($_GET['Subdistrict'])) { $model->setAttributes($_GET['Subdistrict']); } $this->render('admin', array('model' => $model)); }
echo CHtml::Button('...', array('onclick' => '$.fn.yiiGridView.update("kelurahan-grid");$("#kelurahan_dialog").dialog("open"); return false;')); ?> <?php echo $form->error($model, 'kelurahanid'); ?> </div> <div class="row"> <?php echo $form->labelEx($model, 'subdistrictid'); echo $form->hiddenField($model, 'subdistrictid'); ?> <input type="text" name="subdistrict_name" id="subdistrict_name" readonly > <?php $this->beginWidget('zii.widgets.jui.CJuiDialog', array('id' => 'subdistrict_dialog', 'options' => array('title' => Yii::t('app', 'Subdistrict'), 'width' => 'auto', 'autoOpen' => false, 'modal' => true))); $subdistrict = new Subdistrict('searchwstatus'); $subdistrict->unsetAttributes(); // clear any default values if (isset($_GET['Subdistrict'])) { $subdistrict->attributes = $_GET['Subdistrict']; } $this->widget('zii.widgets.grid.CGridView', array('id' => 'subdistrict-grid', 'dataProvider' => $subdistrict->Searchwstatus(), 'filter' => $subdistrict, 'template' => '{summary}{pager}<br>{items}{pager}{summary}', 'columns' => array(array('header' => '', 'type' => 'raw', 'value' => 'CHtml::Button("+", array("name" => "send_subdistrict", "id" => "send_subdistrict", "onClick" => "$(\\"#subdistrict_dialog\\").dialog(\\"close\\"); $(\\"#subdistrict_name\\").val(\\"$data->subdistrictname\\"); $(\\"#Customeraddress_subdistrictid\\").val(\\"$data->subdistrictid\\");"))'), array('name' => 'subdistrictid', 'visible' => false, 'value' => '$data->subdistrictid', 'htmlOptions' => array('width' => '1%')), 'subdistrictname'))); $this->endWidget('zii.widgets.jui.CJuiDialog'); echo CHtml::Button('...', array('onclick' => '$.fn.yiiGridView.update("subdistrict-grid");$("#subdistrict_dialog").dialog("open"); return false;')); ?> <?php echo $form->error($model, 'subdistrictid'); ?>
public function addSubdistrict(Subdistrict $l) { $this->collSubdistricts[] = $l; $l->setDistrict($this); }
<div class="row"> <?php echo $form->label($model, 'en_name'); ?> <?php echo $form->textField($model, 'en_name', array('maxlength' => 255)); ?> </div> <div class="row"> <?php echo $form->label($model, 'subdistrict_id'); ?> <?php echo $form->dropDownList($model, 'subdistrict_id', GxHtml::listDataEx(Subdistrict::model()->findAllAttributes(null, true)), array('prompt' => Yii::t('app', 'All'))); ?> </div> <div class="row"> <?php echo $form->label($model, 'ar_name'); ?> <?php echo $form->textField($model, 'ar_name', array('maxlength' => 255)); ?> </div> <div class="row buttons"> <?php echo GxHtml::submitButton(Yii::t('app', 'Search'));
/** * Remove the specified subdistrict from storage. * * @param int $id * @return Response */ public function destroy($id) { Subdistrict::destroy($id); return Redirect::route('subdistricts.index'); }
<?php echo $form->labelEx($model, 'en_name'); ?> <?php echo $form->textField($model, 'en_name', array('maxlength' => 255)); ?> <?php echo $form->error($model, 'en_name'); ?> </div><!-- row --> <div class="row"> <?php echo $form->labelEx($model, 'subdistrict_id'); ?> <?php echo $form->dropDownList($model, 'subdistrict_id', GxHtml::listDataEx(Subdistrict::model()->findAllAttributes(null, true))); ?> <?php echo $form->error($model, 'subdistrict_id'); ?> </div><!-- row --> <div class="row"> <?php echo $form->labelEx($model, 'ar_name'); ?> <?php echo $form->textField($model, 'ar_name', array('maxlength' => 255)); ?> <?php echo $form->error($model, 'ar_name'); ?>
/** * 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 the ID of the model to be loaded */ public function loadModel($id) { $model = Subdistrict::model()->findByPk((int) $id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
echo $form->textField($model, 'en_name', array('maxlength' => 255)); ?> <?php echo $form->error($model, 'en_name'); ?> </div><!-- row --> <div class="row"> <?php echo $form->labelEx($model, 'governerate_id'); ?> <?php echo $form->dropDownList($model, 'governerate_id', GxHtml::listDataEx(Governorate::model()->findAllAttributes(null, true))); ?> <?php echo $form->error($model, 'governerate_id'); ?> </div><!-- row --> <label><?php echo GxHtml::encode($model->getRelationLabel('subdistricts')); ?> </label> <?php echo $form->checkBoxList($model, 'subdistricts', GxHtml::encodeEx(GxHtml::listDataEx(Subdistrict::model()->findAllAttributes(null, true)), false, true)); ?> <?php echo GxHtml::submitButton(Yii::t('app', 'Save')); $this->endWidget(); ?> </div><!-- form -->
public function actionDownload() { parent::actionDownload(); $pdf = new PDF(); $pdf->title = 'Kelurahan List'; $pdf->AddPage('P'); $pdf->setFont('Arial', 'B', 12); // definisi font $pdf->setFont('Arial', 'B', 8); // menuliskan tabel $header = array('No', 'ID', 'Subdistrict', 'Kelurahan'); $model = new Kelurahan('searchwstatus'); $dataprovider = $model->searchwstatus(); $dataprovider->pagination = false; $data = $dataprovider->getData(); $cols = $dataprovider->getKeys(); $dataku = array(count($data)); //var_dump($dataku); $w = array(20, 25, 50, 50); $pdf->SetTableHeader(); //Header for ($i = 0; $i < count($header); $i++) { $pdf->Cell($w[$i], 7, $header[$i], 1, 0, 'C', true); } $pdf->Ln(); $pdf->SetTableData(); //Data $fill = false; $i = 0; foreach ($data as $datas) { $i = $i + 1; $pdf->Cell($w[0], 6, $i, 'LR', 0, 'L', $fill); $pdf->Cell($w[1], 6, $datas['kelurahanid'], 'LR', 0, 'L', $fill); $pdf->Cell($w[2], 6, Subdistrict::model()->findbypk($datas['subdistrictid'])->subdistrictname, 'LR', 0, 'L', $fill); $pdf->Cell($w[3], 6, $datas['kelurahanname'], 'LR', 0, 'L', $fill); $pdf->Ln(); $fill = !$fill; } $pdf->Cell(array_sum($w), 0, '', 'T'); // me-render ke browser $pdf->Output('kelurahan.pdf', 'D'); }
<?php $this->breadcrumbs = array($model->label(2) => array('index'), Yii::t('app', 'Manage')); $this->menu = array(array('label' => Yii::t('app', 'List') . ' ' . $model->label(2), 'url' => array('index')), array('label' => Yii::t('app', 'Create') . ' ' . $model->label(), '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('community-grid', {\n\t\tdata: \$(this).serialize()\n\t});\n\treturn false;\n});\n"); ?> <h1><?php echo Yii::t('app', 'Manage') . ' ' . GxHtml::encode($model->label(2)); ?> </h1> <p> You may optionally enter a comparison operator (<, <=, >, >=, <> or =) at the beginning of each of your search values to specify how the comparison should be done. </p> <?php echo GxHtml::link(Yii::t('app', 'Advanced Search'), '#', array('class' => 'search-button')); ?> <div class="search-form"> <?php $this->renderPartial('_search', array('model' => $model)); ?> </div><!-- search-form --> <?php $this->widget('zii.widgets.grid.CGridView', array('id' => 'community-grid', 'dataProvider' => $model->search(), 'filter' => $model, 'columns' => array('id', 'code', 'en_name', array('name' => 'subdistrict_id', 'value' => 'GxHtml::valueEx($data->subdistrict)', 'filter' => GxHtml::listDataEx(Subdistrict::model()->findAllAttributes(null, true))), 'ar_name', array('class' => 'CButtonColumn'))));
<?php $this->breadcrumbs = array(Subdistrict::label(2), Yii::t('app', 'Index')); $this->menu = array(array('label' => Yii::t('app', 'Create') . ' ' . Subdistrict::label(), 'url' => array('create')), array('label' => Yii::t('app', 'Manage') . ' ' . Subdistrict::label(2), 'url' => array('admin'))); ?> <h1><?php echo GxHtml::encode(Subdistrict::label(2)); ?> </h1> <?php $this->widget('zii.widgets.CListView', array('dataProvider' => $dataProvider, 'itemView' => '_view'));