本文整理匯總了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'));
}