本文整理汇总了PHP中CFormModel::afterConstruct方法的典型用法代码示例。如果您正苦于以下问题:PHP CFormModel::afterConstruct方法的具体用法?PHP CFormModel::afterConstruct怎么用?PHP CFormModel::afterConstruct使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFormModel
的用法示例。
在下文中一共展示了CFormModel::afterConstruct方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: afterConstruct
protected function afterConstruct()
{
$this->gs_list = Gs::model()->getOpenServers();
if (count($this->gs_list) == 1) {
$this->gs_id = key($this->gs_list);
}
parent::afterConstruct();
}
示例2: afterConstruct
/**
* (non-PHPdoc)
* @see yii/base/CModel#afterConstruct()
*/
protected function afterConstruct()
{
$this->forceSSL = Yii::app()->settings->get(Setting::FORCE_SSL);
$this->recentEntryWidgetEnabled = Yii::app()->settings->get(Setting::RECENT_ENTRIES_WIDGET_ENABLED);
$this->recentEntryWidgetCount = Yii::app()->settings->get(Setting::RECENT_ENTRIES_WIDGET_COUNT);
$this->mostViewedEntriesWidgetEnabled = Yii::app()->settings->get(Setting::MOST_VIEWED_ENTRIES_WIDGET_ENABLED);
$this->mostViewedEntriesWidgetCount = Yii::app()->settings->get(Setting::MOST_VIEWED_ENTRIES_WIDGET_COUNT);
return parent::afterConstruct();
}
示例3: afterConstruct
public function afterConstruct()
{
$dependency = new CDbCacheDependency("SELECT COUNT(0), MAX(UNIX_TIMESTAMP(updated_at)) FROM {{gs}} WHERE status = :status");
$dependency->params = array('status' => ActiveRecord::STATUS_ON);
$dependency->reuseDependentData = TRUE;
$res = Gs::model()->cache(3600 * 24, $dependency)->opened()->findAll();
if ($res) {
foreach ($res as $gs) {
$this->gs_list[$gs['id']] = $gs;
}
}
unset($res);
if (count($this->gs_list) == 1) {
$this->gs_id = key($this->gs_list);
}
parent::afterConstruct();
}
示例4: afterConstruct
/**
* This event is raised after the model instance is created by new operator.
*/
protected function afterConstruct()
{
parent::afterConstruct();
if ($this->scenario == 'test1') {
$this->ce_lat = 58.3844382319306;
$this->ce_lon = 26.7022705078125;
$this->zoom = 5;
$this->sw_lat = 58.23785;
$this->sw_lon = 24.38965;
$this->ne_lat = 59.46518;
$this->ne_lon = 27.07031;
}
if ($this->scenario == 'test2') {
$this->ce_lat = null;
$this->ce_lon = null;
$this->zoom = null;
$this->sw_lat = 58.23785;
$this->sw_lon = 24.38965;
$this->ne_lat = 59.46518;
$this->ne_lon = 27.07031;
}
}
示例5: afterConstruct
/**
* @retunr void
*/
protected function afterConstruct()
{
/* @var SettingsComponent $settings */
/** @noinspection PhpUndefinedFieldInspection */
$settings = Yii::app()->settings;
$this->forceSSL = $settings->get(Setting::FORCE_SSL);
$this->recentEntryWidgetEnabled = $settings->get(Setting::RECENT_ENTRIES_WIDGET_ENABLED);
$this->recentEntryWidgetCount = $settings->get(Setting::RECENT_ENTRIES_WIDGET_COUNT);
$this->mostViewedEntriesWidgetEnabled = $settings->get(Setting::MOST_VIEWED_ENTRIES_WIDGET_ENABLED);
$this->mostViewedEntriesWidgetCount = $settings->get(Setting::MOST_VIEWED_ENTRIES_WIDGET_COUNT);
parent::afterConstruct();
}
示例6: afterConstruct
/**
* Switch to the password scenario, when we dealing with passwords
*/
public function afterConstruct()
{
parent::afterConstruct();
if (isset($_POST) && !empty($_POST[__CLASS__]['password'])) {
$this->scenario .= '_pass';
}
}
示例7: afterConstruct
/**
* The after construct event, sets the default value of $this->rememberMe
* @see CFormModel::afterConstruct()
*/
public function afterConstruct()
{
parent::afterConstruct();
$this->rememberMe = Yii::app()->getModule("users")->autoLoginByDefault;
}