本文整理汇总了PHP中Languages::lists方法的典型用法代码示例。如果您正苦于以下问题:PHP Languages::lists方法的具体用法?PHP Languages::lists怎么用?PHP Languages::lists使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Languages
的用法示例。
在下文中一共展示了Languages::lists方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _setLanguages
/**
* Sets a list of languages to the view which can be used in selects
*
* @deprecated No fallback provided, use the Utils plugin in your app directly
* @param string $viewVar View variable name, default is languages
* @throws MissingPluginException
* @return void
* @link https://github.com/CakeDC/utils
*/
protected function _setLanguages($viewVar = 'languages')
{
$this->_pluginLoaded('Utils');
$Languages = new Languages();
$this->set($viewVar, $Languages->lists('locale'));
}
示例2: _setLanguages
/**
* Sets a list of languages to the view which can be used in selects
*
* @deprecated No fallback provided, use the Utils plugin in your app directly
* @param string View variable name, default is languages
* @return void
* @link https://github.com/CakeDC/utils
*/
protected function _setLanguages($viewVar = 'languages')
{
if (!App::import('Lib', 'Utils.Languages')) {
throw new MissingPluginException(array('plugin' => 'Utils'));
}
$Languages = new Languages();
$this->set($viewVar, $Languages->lists('locale'));
}
示例3: _setLanguages
/**
* Sets a list of languages to the view which can be used in selects
*
* @param string View variable name, default is languages
* @return void
*/
protected function _setLanguages($viewVar = 'languages')
{
App::import('Lib', 'Utils.Languages');
$Languages = new Languages();
$this->set($viewVar, $Languages->lists('locale'));
}
示例4: admin_edit
/**
* Admin edit for category.
*
* @param string $id, category id
*/
public function admin_edit($id = null)
{
try {
$actualLanguages = $this->Category->getSupportedLanguages();
App::uses('Languages', 'Utils.Lib');
$Languages = new Languages();
$languages = $Languages->lists('locale');
$this->set(compact('languages', 'actualLanguages'));
$result = $this->Category->edit($id, null, $this->request->data);
if ($result === true) {
$this->Session->setFlash(__d('categories', 'Category saved'));
$this->redirect(array('action' => 'view', $this->Category->data[$this->Category->alias]['slug']));
} else {
$this->request->data = $result;
}
} catch (OutOfBoundsException $e) {
$this->Session->setFlash($e->getMessage());
$this->redirect('/');
}
$categories = $this->Category->find('list');
$users = $this->Category->User->find('list');
$this->set(compact('categories', 'users'));
}