本文整理汇总了PHP中Languages::findAll方法的典型用法代码示例。如果您正苦于以下问题:PHP Languages::findAll方法的具体用法?PHP Languages::findAll怎么用?PHP Languages::findAll使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Languages
的用法示例。
在下文中一共展示了Languages::findAll方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: details
/**
* Show template details page
*
* @param void
* @return null
*/
function details()
{
if ($this->active_template->isNew()) {
$this->httpError(HTTP_ERR_NOT_FOUND);
}
// if
$template_data = $this->request->post('template');
if (!is_array($template_data)) {
$template_data = array('subject' => $this->active_template->getSubject(), 'body' => $this->active_template->getBody());
}
// if
$this->smarty->assign(array('template' => $template, 'template_data' => $template_data, 'languages' => Languages::findAll()));
if ($this->request->isSubmitted()) {
$this->active_template->setAttributes($template_data);
$save = $template->save();
if ($save && !is_error($save)) {
flash_success('Email template has been updated');
$this->redirectTo('admin_settings_email_templates');
} else {
$this->smarty->assign('errors', $save);
}
// if
}
// if
}
示例2: index
/**
* Show main languages page
*
* @param void
* @return null
*/
function index()
{
if (extension_loaded('xml') && function_exists('xml_parser_create')) {
$this->wireframe->addPageAction(lang('Import Language'), assemble_url('admin_languages_import'));
} else {
$this->wireframe->addPageMessage(lang('XML extension needs to be loaded in your PHP installation for activeCollab to be able to read XML language files. Please check <a href="http://www.php.net/manual/en/book.xml.php">this page</a> for details'), 'error');
}
// if
$this->smarty->assign(array('languages' => Languages::findAll(), 'default_language_id' => ConfigOptions::getValue('language')));
}
示例3: smarty_function_select_language
/**
* Render select language box
*
* @param array $params
* @param Smarty $smarty
* @return string
*/
function smarty_function_select_language($params, &$smarty)
{
$default_language_id = ConfigOptions::getValue('language');
$value = $default_language_id;
if (array_key_exists('value', $params)) {
$value = $params['value'];
unset($params['value']);
}
// if
$optional = false;
if (array_key_exists('optional', $params)) {
$optional = (bool) $params['optional'];
unset($params['optional']);
}
$default_language = null;
$languages = Languages::findAll();
if (is_foreachable($languages)) {
foreach ($languages as $language) {
if ($language->getId() == $default_language_id) {
$default_language = $language;
}
// if
}
// foreach
}
// if
$options = array();
if ($optional) {
if (instance_of($default_language, 'Language')) {
$options[] = option_tag(lang('-- System Default (:value) --', array('value' => $default_language->getName())), '');
} else {
$options[] = option_tag(lang('-- None --'), '');
}
// if
$options[] = option_tag('', '');
}
// if
if (is_foreachable($languages)) {
foreach ($languages as $language) {
$option_attributes = $language->getId() == $value ? array('selected' => true) : null;
$options[] = option_tag($language->getName(), $language->getId(), $option_attributes);
}
// foreach
}
// if
return select_box($options, $params);
}