本文整理汇总了PHP中Languages::update方法的典型用法代码示例。如果您正苦于以下问题:PHP Languages::update方法的具体用法?PHP Languages::update怎么用?PHP Languages::update使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Languages
的用法示例。
在下文中一共展示了Languages::update方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionUpdateLng
public function actionUpdateLng()
{
/* @var $language Languages */
$id = Yii::app()->request->getParam('id', null);
$label = Yii::app()->request->getParam('label', '');
$prefix = Yii::app()->request->getParam('prefix', DEFAULT_LANGUAGE);
$status = Yii::app()->request->getParam('status', Constants::STATUS_VISIBLE);
$original_name = Yii::app()->request->getParam('original_name', '');
$english_name = Yii::app()->request->getParam('english_name', '');
$russian_name = Yii::app()->request->getParam('russian_name', '');
$notification = Yii::app()->request->getParam('notification', '');
$language = Languages::model()->findByPk($id);
if ($language == null) {
$language = new Languages();
}
$language->label = $label;
$language->prefix = strtolower(substr($prefix, 0, 2));
$language->notification = strtoupper(substr($notification, 0, 2));
$language->status = $status;
$language->original_language_name = $original_name;
$language->english_language_name = $english_name;
$language->russian_language_name = $russian_name;
if ($language->isNewRecord) {
$language->priority = DwHelper::getNextPriority("Languages");
$language->save();
} else {
$language->update();
}
$this->redirect($this->createUrl('/admin/panel/languages'));
}