This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="form"> | |
<?php if ($item->scenario !== 'update'): ?> | |
<?php echo CHtml::statefulForm('', 'post', array('enctype' => 'multipart/form-data')); ?> | |
<?php echo CHtml::hiddenField('MAX_FILE_SIZE', '1000000'); ?> | |
<?php else: ?> | |
<?php echo CHtml::statefulForm(); ?> | |
<?php endif; ?> | |
<?php echo CHtml::errorSummary($item); ?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class ItemController extends Controller | |
{ | |
... | |
/** | |
* Creates a new item. | |
*/ | |
public function actionCreate() | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Item class file. | |
*/ | |
class Item extends CActiveRecord | |
{ | |
... | |
/** | |
* @see CModel::rules() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* ImageUploadBehavior class file. | |
*/ | |
class ImageUploadBehavior extends CActiveRecordBehavior | |
{ | |
/** | |
* @var string the file upload column name | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
'import' => array( | |
... | |
'application.helpers.*', | |
), | |
'modules' => array( | |
... | |
), | |
'components' => array( | |
'file' => array( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
webroot/ | |
... | |
images/ | |
empty.jpg | |
tmp/ | |
thumb/ | |
hoge/ | |
thumb/ | |
... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
... | |
'components' => array( | |
'user' => array( | |
'class' => 'WebUser', // この行を書かない場合は、デフォルトのCWebUserが使われる | |
... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class WebUser extends CWebUser | |
{ | |
protected function afterLogin($fromCookie) | |
{ | |
$model = User::model()->findByPk(Yii::app()->user->id); | |
$model->last_ip = Yii::app()->request->userHostAddress; | |
$model->last_login = new CDbExpression('NOW()'); | |
$model->save(true, array('last_ip', 'last_login')); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
for ($i = 0; $i < 10000; $i++) | |
echo $model->actionId; | |
// or echo $model->getActionId(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class LoginForm extends CFormModel | |
{ | |
... | |
/** | |
* アクション名を返すメソッド | |
*/ | |
public function getActionId() | |
{ | |
return Yii::app()->controller->action->id; |