本文整理汇总了PHP中BackendModel::getThemes方法的典型用法代码示例。如果您正苦于以下问题:PHP BackendModel::getThemes方法的具体用法?PHP BackendModel::getThemes怎么用?PHP BackendModel::getThemes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BackendModel
的用法示例。
在下文中一共展示了BackendModel::getThemes方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: loadForm
/**
* Load the form
*
* @return void
*/
private function loadForm()
{
// create form
$this->frm = new BackendForm('settingsThemes');
// theme
$this->frm->addDropdown('theme', BackendModel::getThemes(), BackendModel::getModuleSetting('core', 'theme', 'core'));
}
示例2: loadData
/**
* Load necessary data.
*
* @return void.
*/
private function loadData()
{
// get data
$this->selectedTheme = $this->getParameter('theme', 'string');
// build available themes
$this->availableThemes = BackendModel::getThemes();
// determine selected theme, based upon submitted form or default theme
$this->selectedTheme = SpoonFilter::getValue($this->selectedTheme, array_keys($this->availableThemes), BackendModel::getModuleSetting('core', 'theme', 'core'));
}
示例3: loadForm
/**
* Load the form
*
* @return void
*/
private function loadForm()
{
// create form
$this->frm = new BackendForm('edit');
// init var
$maximumBlocks = 30;
$defaultId = BackendModel::getModuleSetting($this->getModule(), 'default_template');
// create elements
$this->frm->addDropdown('theme', BackendModel::getThemes(), BackendModel::getModuleSetting('core', 'theme', 'core'));
$this->frm->addText('label', $this->record['label']);
$this->frm->addText('file', str_replace('core/layout/templates/', '', $this->record['path']));
$this->frm->addDropdown('num_blocks', array_combine(range(1, $maximumBlocks), range(1, $maximumBlocks)), $this->record['num_blocks']);
$this->frm->addTextarea('format', str_replace('],[', "],\n[", $this->record['data']['format']));
$this->frm->addCheckbox('active', $this->record['active'] == 'Y');
$this->frm->addCheckbox('default', $this->record['id'] == $defaultId);
// if this is the default template we can't alter the active/default state
if ($this->record['id'] == $defaultId) {
$this->frm->getField('active')->setAttributes(array('disabled' => 'disabled'));
$this->frm->getField('default')->setAttributes(array('disabled' => 'disabled'));
}
// if the template is in use we cant alter the active state
if (BackendPagesModel::isTemplateInUse($this->id)) {
$this->frm->getField('active')->setAttributes(array('disabled' => 'disabled'));
}
// init vars
$names = array();
$blocks = array();
$widgets = array();
$extras = BackendPagesModel::getExtras();
// loop extras to populate the default extras
foreach ($extras as $item) {
if ($item['type'] == 'block') {
$blocks[$item['id']] = ucfirst(BL::lbl($item['label']));
if (isset($item['data']['extra_label'])) {
$blocks[$item['id']] = ucfirst($item['data']['extra_label']);
}
} elseif ($item['type'] == 'widget') {
$widgets[$item['id']] = ucfirst(BL::lbl(SpoonFilter::toCamelCase($item['module']))) . ': ' . ucfirst(BL::lbl($item['label']));
if (isset($item['data']['extra_label'])) {
$widgets[$item['id']] = ucfirst(BL::lbl(SpoonFilter::toCamelCase($item['module']))) . ': ' . $item['data']['extra_label'];
}
}
}
// sort
asort($blocks, SORT_STRING);
asort($widgets, SORT_STRING);
// create array
$defaultExtras = array('' => array('editor' => BL::lbl('Editor')), ucfirst(BL::lbl('Modules')) => $blocks, ucfirst(BL::lbl('Widgets')) => $widgets);
// add some fields
for ($i = 1; $i <= $maximumBlocks; $i++) {
// grab values
$name = isset($this->record['data']['names'][$i - 1]) ? $this->record['data']['names'][$i - 1] : null;
$extra = isset($this->record['data']['default_extras'][$i - 1]) ? $this->record['data']['default_extras'][$i - 1] : null;
// build array
$names[$i]['i'] = $i;
$names[$i]['formElements']['txtName'] = $this->frm->addText('name_' . $i, $name);
$names[$i]['formElements']['ddmType'] = $this->frm->addDropdown('type_' . $i, $defaultExtras, $extra);
}
// assign
$this->tpl->assign('names', $names);
}