本文整理汇总了PHP中Period::toString方法的典型用法代码示例。如果您正苦于以下问题:PHP Period::toString方法的具体用法?PHP Period::toString怎么用?PHP Period::toString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Period
的用法示例。
在下文中一共展示了Period::toString方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionCreate
/**
* Creates a new model.
* If creation is successful, the browser will be redirected to the 'show' page.
*/
public function actionCreate()
{
$model = new Period();
if (isset($_POST['Period'])) {
$model->attributes = $_POST['Period'];
$model->dateStart = User::parseDate($model->dateStart);
$model->dateEnd = User::parseDate($model->dateEnd);
$model->companyId = Yii::app()->user->getState('selectedCompanyId');
if ($model->save()) {
ChangeLog::addLog('ADD', 'Period', $model->toString());
if (Yii::app()->user->getState('selectedPeriodId') == 0) {
$usersModel = User::model()->findbyPk(Yii::app()->user->id);
$usersModel->selectedPeriodId = $model->id;
$usersModel->confirmPassword = $usersModel->password;
$usersModel->save();
$usersModel->setStates(true);
$this->redirect(array('accountType/create'));
} else {
$this->redirect(array('admin', 'id' => $model->id));
}
}
}
$model->dateStart = User::getDateFormatted(date('Y') . '-01-01');
$model->dateEnd = User::getDateFormatted(date('Y') . '-12-31');
$model->dateChanged = User::getDateFormatted(date('Y-m-d'));
$this->render('create', array('model' => $model));
}