本文整理汇总了PHP中Theme::getSelected方法的典型用法代码示例。如果您正苦于以下问题:PHP Theme::getSelected方法的具体用法?PHP Theme::getSelected怎么用?PHP Theme::getSelected使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Theme
的用法示例。
在下文中一共展示了Theme::getSelected方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __toString
/**
* Display the parameter
*
* @return string The HTML result to display
*/
public function __toString()
{
if ($this->notDisplayed) {
return '';
}
return View::make(Theme::getSelected()->getView(Form::VIEWS_DIR . 'form-fieldset.tpl'), array('fieldset' => $this));
}
示例2: edit
/**
* Edit a role
*/
public function edit()
{
$param = array('id' => 'edit-role-form', 'model' => 'Role', 'reference' => array('id' => $this->roleId), 'fieldsets' => array('form' => array('nofieldset' => true, new HiddenInput(array('field' => 'removable', 'default' => 1, 'readonly' => true)), new TextInput(array('field' => 'name', 'maxlength' => 32, 'label' => Lang::get('roles.form-name-label'), 'required' => true)), new ColorInput(array('field' => 'color', 'label' => Lang::get('roles.form-color-label'), 'default' => '#000'))), '_submits' => array(new SubmitInput(array('name' => 'valid', 'value' => Lang::get('main.valid-button'))), new DeleteInput(array('name' => 'delete', 'value' => Lang::get('main.delete-button'), 'notDisplayed' => $this->roleId == -1)), new ButtonInput(array('name' => 'cancel', 'value' => Lang::get('main.cancel-button'), 'onclick' => 'app.dialog("close")')))), 'onsuccess' => 'app.dialog("close"); app.load(app.getUri("list-roles"), {selector : "#admin-roles-tab"});');
foreach (Language::getAll() as $language) {
$param['fieldsets']['form'][] = new TextInput(array('name' => "translation[{$language->tag}]", "independant" => true, 'required' => $language->tag == LANGUAGE, "label" => Lang::get("roles.role-label-label", array('lang' => $language->tag)), "default" => Lang::exists("roles.role-" . $this->roleId . "-label") ? Lang::get("roles.role-" . $this->roleId . "-label", array(), 0, $language->tag) : ''));
}
$form = new Form($param);
if (!$form->submitted()) {
return View::make(Theme::getSelected()->getView("dialogbox.tpl"), array('icon' => 'user', 'title' => Lang::get('roles.form-title'), 'page' => $form));
} else {
if ($form->submitted() == "delete") {
$form->delete(Form::NO_EXIT);
if ($key) {
$key->delete();
}
return $form->response(Form::STATUS_SUCCESS);
} else {
if ($form->check()) {
try {
$roleId = $form->register(Form::NO_EXIT);
// Create the language key for the translations of the role name
foreach (App::request()->getBody('translation') as $tag => $translation) {
Language::getByTag($tag)->saveTranslations(array('roles' => array("role-{$roleId}-label" => $translation)));
}
return $form->response(Form::STATUS_SUCCESS);
} catch (Exception $e) {
return $form->response(Form::STATUS_ERROR, DEBUG_MODE ? $e->getMessage() : "");
}
}
}
}
}
示例3: make
/**
* Display the tab
*
* @param array $data The data to inject in the view
*
* @return string The generated HTML
*/
public static function make($data)
{
if (is_array($data['page']) && isset($data['page']['content'])) {
$data['page'] = $data['page']['content'];
}
return parent::make(Theme::getSelected()->getView('tabs-layout/tabs-no-sidebar.tpl'), $data);
}
示例4: display
/**
* Display the input
*
* @return string The dislayed HTML
*/
public function display()
{
if (!empty($this->notDisplayed)) {
return '';
}
$param = get_object_vars($this);
$param["class"] .= " form-button";
if (empty($param['icon']) && isset(self::$defaultIcons[$this->name])) {
$param['icon'] = self::$defaultIcons[$this->name];
}
$param = array_filter($param, function ($v) {
return !empty($v);
});
if (!isset($param['label'])) {
$param['label'] = $this->value;
}
$param['type'] = static::TYPE;
if (!empty($param['href'])) {
$param['data-href'] = $param['href'];
unset($param['href']);
}
if (!empty($param['target'])) {
$param['data-target'] = $param['target'];
unset($param['target']);
}
$param = array_intersect_key($param, array_flip(array('id', 'class', 'icon', 'label', 'type', 'name', 'onclick', 'style', 'data-href', 'data-target', 'title')));
$param = array_merge($param, $this->attributes);
/*** Set the attribute and text to the span inside the button ***/
return View::make(Theme::getSelected()->getView('button.tpl'), array('class' => isset($param['class']) ? $param['class'] : '', 'param' => $param, 'icon' => isset($param['icon']) ? $param['icon'] : '', 'label' => isset($param['label']) ? $param['label'] : '', 'textStyle' => isset($param['textStyle']) ? $param['textStyle'] : ''));
}
示例5: make
/**
* Display the tab
*
* @param array $data The data to inject in the view
*
* @return string The generated HTML
*/
public static function make($data)
{
if (!isset($data['sidebar']['class'])) {
$data['sidebar']['class'] = 'col-md-3 col-lg-2';
}
if (!isset($data['page']['class'])) {
$data['page']['class'] = 'col-md-9 col-lg-10';
}
return parent::make(Theme::getSelected()->getView('tabs-layout/tabs-sidebar-left.tpl'), $data);
}
示例6: make
/**
* Display the panem
*
* @param array $data The data to inject in the view
*
* @return string The generated HTML
*/
public static function make($data)
{
if (empty($data['id'])) {
$data['id'] = uniqid();
}
if (empty($data['type'])) {
$data['type'] = 'info';
}
return parent::make(Theme::getSelected()->getView('panel.tpl'), $data);
}
示例7: make
/**
* Display the icon
*
* @param array $data The data to inject in the view
*
* @return string The generated HTML
*/
public static function make($data)
{
if (!isset($data['size'])) {
$data['size'] = '';
}
if (!isset($data['class'])) {
$data['class'] = '';
}
$data['param'] = $data;
unset($data['param']['size'], $data['param']['class'], $data['param']['icon']);
return parent::make(Theme::getSelected()->getView('icon.tpl'), $data);
}
示例8: make
/**
* Display the tabset
*
* @param array $data The data to inject in the view
*
* @return string The generated HTML
*/
public static function make($data)
{
if (empty($data['id'])) {
$data['id'] = uniqid();
}
foreach ($data['tabs'] as $i => &$tab) {
if (empty($tab['id'])) {
$tab['id'] = uniqid();
}
if (empty($data['selected'])) {
$data['selected'] = $i;
}
}
return parent::make(Theme::getSelected()->getView('tabs.tpl'), $data);
}
示例9: make
/**
* Display the accordion
*
* @param array $data The data to inject in the view
*
* @return string The generated HTML
*/
public static function make($data)
{
if (empty($data['id'])) {
$data['id'] = uniqid();
}
foreach ($data['panels'] as $i => &$panel) {
if (empty($panel['id'])) {
$panel['id'] = uniqid();
}
if (empty($data['selected'])) {
$data['selected'] = $i;
}
}
return parent::make(Theme::getSelected()->getView('accordion.tpl'), $data);
}
示例10: edit
/**
* Create or edit an user
*/
public function edit()
{
$roles = array_map(function ($role) {
return $role->getLabel();
}, Role::getAll('id'));
$user = User::getByUsername($this->username);
$param = array('id' => 'user-form', 'upload' => true, 'model' => 'User', 'reference' => array('username' => $this->username), 'fieldsets' => array('general' => array('nofieldset' => true, new TextInput(array('name' => 'username', 'required' => true, 'unique' => true, 'readonly' => $user && $user->id !== App::session()->getUser()->id, 'insert' => !$user || $user->id === App::session()->getUser()->id, 'label' => Lang::get($this->_plugin . '.user-form-username-label'))), new EmailInput(array('name' => 'email', 'required' => true, 'unique' => true, 'readonly' => $user && $user->id !== App::session()->getUser()->id, 'insert' => !$user || $user->id !== App::session()->getUser()->id, 'label' => Lang::get($this->_plugin . '.user-form-email-label'))), new CheckboxInput(array('name' => 'active', 'label' => Lang::get($this->_plugin . '.user-form-active-label'))), new SelectInput(array('name' => 'roleId', 'options' => $roles, 'label' => Lang::get($this->_plugin . '.user-form-roleId-label'))), $user ? null : new PasswordInput(array('name' => 'password', 'required' => true, 'label' => Lang::get($this->_plugin . '.user-form-password-label'), 'encrypt' => array('Hawk\\Crypto', 'saltHash'))), $user ? null : new PasswordInput(array('name' => 'passagain', 'label' => Lang::get($this->_plugin . '.user-form-passagain-label'), 'required' => true, 'compare' => 'password', 'independant' => true)), new HiddenInput(array('name' => 'createTime', 'default' => time()))), '_submits' => array(new SubmitInput(array('name' => 'valid', 'value' => Lang::get('main.valid-button'))), new DeleteInput(array('name' => 'delete', 'value' => Lang::get('main.delete-button'), 'notDisplayed' => !($user && $user->isRemovable()))), new ButtonInput(array('name' => 'cancel', 'value' => Lang::get('main.cancel-button'), 'onclick' => 'app.dialog("close")')))), 'onsuccess' => 'app.dialog("close"); app.lists["admin-users-list"].refresh();');
$form = new Form($param);
if (!$form->submitted()) {
return View::make(Theme::getSelected()->getView("dialogbox.tpl"), array('page' => $form, 'title' => Lang::get($this->_plugin . '.user-form-title'), 'icon' => 'user'));
} else {
if ($form->submitted() == "delete") {
$this->remove();
} else {
if ($form->check()) {
return $form->register();
}
}
}
}
示例11: display
/**
* Display the widget
*
* @return string The generated HTML
*/
public function display()
{
$form = new Form(array('id' => 'search-themes-form', 'method' => 'get', 'action' => App::router()->getUri('search-themes'), 'inputs' => array(new TextInput(array('name' => 'search', 'required' => true, 'default' => App::request()->getParams('search'), 'placeholder' => Lang::get('admin.search-theme-form-search-label'))), new SubmitInput(array('name' => 'valid', 'value' => Lang::get('admin.search-theme-form-submit-btn'), 'icon' => 'search')))));
return View::make(Theme::getSelected()->getView('box.tpl'), array('content' => $form, 'title' => Lang::get('admin.search-theme-form-title'), 'icon' => 'search'));
}
示例12: getViews
/**
* Get the list views files
*/
private function getViews()
{
if (empty($this->tpl)) {
$this->tpl = Theme::getSelected()->getView('item-list/container.tpl');
}
if (empty($this->navigationBarTpl)) {
$this->navigationBarTpl = Theme::getSelected()->getView('item-list/navigation-bar.tpl');
}
if (empty($this->listTpl)) {
$this->listTpl = Theme::getSelected()->getView('item-list/list.tpl');
}
if (empty($this->resultTpl)) {
$this->resultTpl = Theme::getSelected()->getView('item-list/result.tpl');
}
}
示例13: display
/**
* Display the widget
*
* @return string The generated HTML
*/
public function display()
{
$filters = $this->getFilters();
$form = new Form(array('id' => 'user-filter-form', 'fieldsets' => array('form' => array(new RadioInput(array('name' => 'status', 'labelWidth' => '100%', 'label' => Lang::get('admin.user-filter-status-label'), 'layout' => 'vertical', 'value' => isset($filters['status']) ? $filters['status'] : -1, 'options' => array('-1' => Lang::get('admin.user-filter-status-all'), '1' => Lang::get('admin.user-filter-status-active'), '0' => Lang::get('admin.user-filter-status-inactive'))))))));
return View::make(Theme::getSelected()->getView("box.tpl"), array('content' => $form, 'title' => Lang::get('admin.user-filter-legend'), 'icon' => 'filter'));
}
示例14: exception
/**
* Handle an non catched exception
*
* @param Exception $e The throwed exception
*/
public function exception($e)
{
$param = array('level' => 'danger', 'icon' => 'excalamation-circle', 'title' => get_class($e), 'message' => $e->getMessage(), 'trace' => $e->getTrace());
App::logger()->error($e->getMessage());
if (App::request()->getWantedType() === "json") {
throw new InternalErrorException($e->getMessage());
} else {
throw new InternalErrorException(View::make(Theme::getSelected()->getView('error.tpl'), $param));
}
}
示例15: displayCell
/**
* Get the displayed value
*
* @param array $lineIndex The index of the line in the list results to display
*
* @return string The HTML result to display
*/
public function displayCell($lineIndex)
{
$line = $this->list->results[$lineIndex];
$name = $this->name;
$cell = new \StdClass();
foreach (self::$callableProperties as $prop) {
if (!is_null($this->{$prop}) && is_callable($this->{$prop})) {
$func = $this->{$prop};
$cell->{$prop} = $func(isset($line->{$name}) ? $line->{$name} : null, $this, $line);
} else {
$cell->{$prop} = $this->{$prop};
}
}
// Compute the cell content
if (isset($cell->display)) {
$cell->content = $cell->display;
} else {
$cell->content = isset($line->{$name}) ? $line->{$name} : '';
}
// Add a unit to the displayed value
if ($cell->unit && !$cell->content) {
$cell->content .= ' ' . $cell->unit;
}
return View::make(Theme::getSelected()->getView('item-list/result-cell.tpl'), array('cell' => $cell, 'field' => $this));
}