$objReader = PHPExcel_IOFactory::createReader('Excel2007'); $objPHPExcel = $objReader->load($file); //$file --> your filepath and filename $counter = 0; foreach ($objPHPExcel->getWorksheetIterator() as $worksheet) { $worksheetTitle = $worksheet->getTitle(); if ($worksheetTitle == "31B") { break; } $highestColumn = $worksheet->getHighestColumn(); // e.g 'F' $highestColumnIndex = PHPExcel_Cell::columnIndexFromString($highestColumn); $detail_jadwal; for ($i = 5; $i < 50; $i = $i + 11) { echo "<BR/>"; $masterjadwal = new MJadwal(); $masterjadwal->KELAS = $worksheetTitle; $masterjadwal->WEEK = $worksheet->getCellByColumnAndRow(1, 1)->getValue(); $masterjadwal->TA = $worksheet->getCellByColumnAndRow(1, 2)->getValue(); $masterjadwal->ID_KUR = $worksheet->getCellByColumnAndRow(1, 3)->getValue(); echo $masterjadwal->KELAS . "<BR>"; $masterjadwal->TANGGAL = PHPExcel_Style_NumberFormat::ToFormattedString($worksheet->getCellByColumnAndRow(1, $i)->getValue(), "YYYY-MM-DD"); echo $masterjadwal->TANGGAL; $masterjadwal->save(); for ($j = $i + 2; $j < $i + 10; $j++) { for ($col = 0; $col < $highestColumnIndex; ++$col) { $detail_jadwal[$col] = $worksheet->getCellByColumnAndRow($col, $j)->getValue(); // echo $worksheet->getCellByColumnAndRow($col, $j)->getValue(); // echo "<BR>"; } // $this->cekMaster($masterjadwal);
<TD ALIGN="CENTER"><CENTER> <?php //echo $form->textFieldGroup($model,'ID_KUR',array('widgetOptions'=>array('htmlOptions'=>array('class'=>'span5')))); ?> <?php $kodemk = CHtml::listData(DJadwal::model()->findAll(), 'KODE_MK', 'KODE_MK'); echo $form->dropDownListGroup($djadwal, 'KODE_MK', array('wrapperHtmlOptions' => array('class' => 'col-sm-5'), 'widgetOptions' => array('data' => $kodemk, 'htmlOptions' => array()))); ?> </CENTER> </TD> <TD ALIGN="CENTER"><CENTER> <?php $kelas = CHtml::listData(MJadwal::model()->findAll(), 'KELAS', 'KELAS'); echo $form->dropDownListGroup($mjadwal, 'KELAS', array('wrapperHtmlOptions' => array('class' => 'col-sm-5'), 'widgetOptions' => array('data' => $kelas, 'htmlOptions' => array()))); ?> <CENTER> </TD> </TR> <TR > <TD ALIGN="CENTER" COLSPAN="4" ><CENTER> <div class="form-actions"> <?php $this->widget('booster.widgets.TbButton', array('buttonType' => 'submit', 'context' => 'primary', 'label' => $model->isNewRecord ? 'Search' : 'Save')); ?> </div> </CENTER> <TD> </TR>
/** * 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 = MJadwal::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }