本文整理匯總了PHP中app\models\Property::getLanguages方法的典型用法代碼示例。如果您正苦於以下問題:PHP Property::getLanguages方法的具體用法?PHP Property::getLanguages怎麽用?PHP Property::getLanguages使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類app\models\Property
的用法示例。
在下文中一共展示了Property::getLanguages方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: actionUpdate
/**
* Updates an existing Banner model.
* If update is successful, the browser will be redirected to the 'view' page.
* @param integer $id
* @return mixed
*/
public function actionUpdate($id)
{
$model = $this->findModel($id);
if ($model->load(Yii::$app->request->post()) && $model->save()) {
foreach (Property::getLanguages() as $lang) {
$file = UploadedFile::getInstanceByName('image_' . $lang);
if (!is_null($file)) {
ImageManager::addBannerImage($model->id, $file, $lang);
}
}
return $this->redirect(['view', 'id' => $model->id]);
} else {
return $this->render('update', ['model' => $model]);
}
}
示例2: foreach
?>
"><img src="<?php
echo Yii::getAlias('@web/images/logo.png');
?>
"></a>
</div>
<div class="col-md-7" id="top-search">
<div style="text-align: right;display: none">
<?php
echo Menu::widget(['items' => $topLinks, 'options' => ['id' => 'top-links']]);
?>
</div>
<div style="text-align: right;margin-top: 20px;">
<ul id="top-langs">
<?php
foreach (\app\models\Property::getLanguages() as $lang) {
?>
<?php
if (Yii::$app->language == $lang) {
?>
<li><span class="flag flag-<?php
echo $lang;
?>
selected"><?php
echo $languages[$lang];
?>
</span></li>
<?php
} else {
?>
<li><a href="<?php
示例3: from_array
public function from_array($arr)
{
$this->setAttributes($arr);
if ($this->save()) {
foreach (Property::getLanguages() as $lang) {
$pLang = $this->getProductLang($lang, true);
if (array_key_exists($lang . ':name', $arr)) {
$pLang->name = $arr[$lang . ':name'];
}
if (array_key_exists($lang . ':description', $arr)) {
$pLang->description = $arr[$lang . ':description'];
}
if (array_key_exists($lang . ':information', $arr)) {
$pLang->information = $arr[$lang . ':information'];
}
$pLang->save();
}
return true;
} else {
return false;
}
}