本文整理汇总了PHP中Yum::getAvailableLanguages方法的典型用法代码示例。如果您正苦于以下问题:PHP Yum::getAvailableLanguages方法的具体用法?PHP Yum::getAvailableLanguages怎么用?PHP Yum::getAvailableLanguages使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Yum
的用法示例。
在下文中一共展示了Yum::getAvailableLanguages方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionUpdate
public function actionUpdate($category = null, $message = null, $language = null)
{
$models = array();
foreach (Yum::getAvailableLanguages() as $language) {
$models[] = $this->loadModel($category, $message, $language);
}
if (isset($_POST['YumTranslation'])) {
$category = $_POST['YumTranslation']['category'];
$message = $_POST['YumTranslation']['message'];
foreach ($_POST as $key => $translation) {
if (substr($key, 0, 11) == 'translation') {
$lang = explode('_', $key);
if (isset($lang[1])) {
$lang = $lang[1];
foreach (Yum::getAvailableLanguages() as $language) {
if ($language == $lang) {
$model = YumTranslation::model()->find('category = :category and message = :message and language = :language ', array(':category' => $category, ':message' => $message, ':language' => $lang));
if (!$model) {
$model = new YumTranslation();
}
if ($translation != '') {
$model->message = $message;
$model->category = $category;
$model->translation = $translation;
$model->language = $lang;
$model->save();
}
}
}
}
}
}
Yum::setFlash('Translations have been saved');
$this->redirect(array('admin'));
}
$this->render('update', array('models' => $models));
}
示例2: array
<?php
$this->breadcrumbs = array(Yum::t('Translation') => array('admin'), Yum::t('Manage'));
?>
<h1><?php
echo Yum::t('Manage Translations');
?>
</h1>
<?php
$this->widget('zii.widgets.grid.CGridView', array('id' => 'category-grid', 'dataProvider' => $model->search(), 'filter' => $model, 'columns' => array(array('name' => 'language', 'filter' => Yum::getAvailableLanguages()), array('name' => 'message', 'type' => 'raw'), array('name' => 'category', 'type' => 'raw'), array('name' => 'translation', 'type' => 'raw'), array('class' => 'CButtonColumn', 'template' => '{update}', 'updateButtonUrl' => 'Yii::app()->controller->createUrl("update", array(
"message" => $data->message,
"category" => $data->category,
"language" => $data->language))'))));
?>
<?php
echo CHtml::link(Yum::t('Create new Translation'), array('create'));