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
<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
<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 Hoge extends CActiveRecord | |
{ | |
... | |
/** | |
* Gets the all models. | |
* @param string $q | |
* @return array | |
*/ | |
public function getAll($q) |
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 Hoge extends CActiveRecord | |
{ | |
... | |
public function getAll($q) | |
{ | |
$c = new CDbCriteria(); | |
$c->addSearchCondition('t.fuga', $q); | |
return new CActiveDataProvider(get_class($this), 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
<?php | |
/* protected/config/main.php | |
-----------------------------------------------------------*/ | |
return array( | |
... | |
'components' => array( | |
'mailer' => array( | |
'class' => 'ext.mailer.EMailer', | |
'CharSet' => 'iso-2022-jp', |
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 Item extends CActiveRecord | |
{ | |
const ALLOW_TYPES = 'jpg, png, gif'; | |
public $image; | |
... | |
/** |
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 | |
$c = new CDbCriteria(); | |
Hoge::model()->findAll($c); | |
// SELECT * FROM `hoge` `t` | |
$c = new CDbCriteria(); | |
$c->addSearchCondition('t.fuga', null); // null, false, ''などは無視されるようです | |
Hoge::model()->findAll($c); |
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 Forum extends ActiveRecord | |
{ | |
public $max_number; | |
public $max_create_time; | |
... | |
public function getLatestAll() | |
{ | |
$c = new CDbCriteria(); |
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 A | |
{ | |
private $test; | |
public function __get($name) | |
{ | |
$getter = 'get' . $name; | |
if (method_exists($this, $getter)) { | |
return $this->$getter(); |