Skip to content

Instantly share code, notes, and snippets.

@hugodotlau
hugodotlau / gist:2881252
Created June 6, 2012 10:47
Using PHPExcel with Yii
<?php
public function actionImport()
{
$message = '';
if (!empty($_POST))
{
$file = CUploadedFile::getInstanceByName('import');
$spec = Yii::app()->basePath.'/data/imports/'.$file->name;
$file->saveAs($spec);
spl_autoload_unregister(array('YiiBase','autoload'));
@hugodotlau
hugodotlau / gist:2880403
Created June 6, 2012 07:20
Datetime comparing when validating a Yii form
<?php
public function rules()
{
return array(
array(
'end_time',
'compare',
'compareAttribute'=>'start_time',
'operator'=>'>',
'on'=>'insert',