当前位置: 首页>>代码示例>>PHP>>正文


PHP Yum::getAvailableLanguages方法代码示例

本文整理汇总了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));
 }
开发者ID:Canyian,项目名称:yii-user-management-facebook,代码行数:37,代码来源:YumTranslationController.php

示例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'));
开发者ID:kumarsivarajan,项目名称:yii-user-management,代码行数:19,代码来源:admin.php


注:本文中的Yum::getAvailableLanguages方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。