本文整理汇总了PHP中Widget::Label方法的典型用法代码示例。如果您正苦于以下问题:PHP Widget::Label方法的具体用法?PHP Widget::Label怎么用?PHP Widget::Label使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Widget
的用法示例。
在下文中一共展示了Widget::Label方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: cbAppendPreferences
public function cbAppendPreferences($context)
{
$group = new XMLElement('fieldset');
$group->setAttribute('class', 'settings');
$group->appendChild(new XMLElement('legend', __('SMTP Email Library')));
$div = new XMLElement('div');
$div->setAttribute('class', 'group');
$label = Widget::Label(__('Host'));
$label->appendChild(Widget::Input('settings[smtp_email_library][host]', Symphony::Configuration()->get('host', 'smtp_email_library')));
$div->appendChild($label);
$label = Widget::Label(__('Port'));
$label->appendChild(Widget::Input('settings[smtp_email_library][port]', Symphony::Configuration()->get('port', 'smtp_email_library')));
$div->appendChild($label);
$group->appendChild($div);
$label = Widget::Label();
$input = Widget::Input('settings[smtp_email_library][auth]', '1', 'checkbox');
if (Symphony::Configuration()->get('auth', 'smtp_email_library') == '1') {
$input->setAttribute('checked', 'checked');
}
$label->setValue($input->generate() . ' Requires authentication');
$group->appendChild($label);
$group->appendChild(new XMLElement('p', 'Some SMTP connections require authentication. If that is the case, enter the username/password combination below.', array('class' => 'help')));
$div = new XMLElement('div');
$div->setAttribute('class', 'group');
$label = Widget::Label(__('Username'));
$label->appendChild(Widget::Input('settings[smtp_email_library][username]', Symphony::Configuration()->get('username', 'smtp_email_library')));
$div->appendChild($label);
$label = Widget::Label(__('Password'));
$label->appendChild(Widget::Input('settings[smtp_email_library][password]', Symphony::Configuration()->get('password', 'smtp_email_library')));
$div->appendChild($label);
$group->appendChild($div);
$context['wrapper']->appendChild($group);
}
示例2: displayPublishPanel
public function displayPublishPanel(&$wrapper, $data = null, $error = null, $prefix = null, $postfix = null)
{
$this->_driver->addPublishHeaders($this->_engine->Page);
$sortorder = $this->get('sortorder');
$element_name = $this->get('element_name');
$container = new XMLElement('div', $this->get('label'));
$container->setAttribute('class', 'label');
$container->appendChild(new XMLElement('i', __('Optional')));
$group = new XMLElement('div');
// From:
$label = Widget::Label(__('Date'));
$from = Widget::Input("fields{$prefix}[{$element_name}]{$postfix}[from]", General::sanitize($data['from_value']));
$label->appendChild($from);
$group->appendChild($label);
// To:
$label = Widget::Label(__('Until Date'));
$from = Widget::Input("fields{$prefix}[{$element_name}]{$postfix}[to]", General::sanitize($data['to_value']));
$label->appendChild($from);
$group->appendChild($label);
// Mode:
$options = array(array('entire-day', false, 'Entire Day'), array('entire-week', false, 'Entire Week'), array('entire-month', false, 'Entire Month'), array('entire-year', false, 'Entire Year'), array('until-date', false, 'Until Date'));
foreach ($options as &$option) {
if ($option[0] != $data['mode']) {
continue;
}
$option[1] = true;
break;
}
$label = Widget::Label(__('Mode'));
$from = Widget::Select("fields{$prefix}[{$element_name}]{$postfix}[mode]", $options);
$label->appendChild($from);
$group->appendChild($label);
$container->appendChild($group);
$wrapper->appendChild($container);
}
示例3: view
public function view()
{
$emergency = false;
if (isset($this->_context[0]) && in_array(strlen($this->_context[0]), array(6, 8))) {
if (!$this->__loginFromToken($this->_context[0])) {
if (Administration::instance()->isLoggedIn()) {
redirect(SYMPHONY_URL);
}
}
}
$this->Form = Widget::Form(SYMPHONY_URL . '/login/', 'post');
$this->Form->setAttribute('class', 'frame');
$this->Form->appendChild(new XMLElement('h1', __('Symphony')));
$fieldset = new XMLElement('fieldset');
if ($this->_context[0] == 'retrieve-password') {
$this->Form->setAttribute('action', SYMPHONY_URL . '/login/retrieve-password/');
if (isset($this->_email_sent) && $this->_email_sent) {
$fieldset->appendChild(new XMLElement('p', __('An email containing a customised login link has been sent. It will expire in 2 hours.')));
$this->Form->appendChild($fieldset);
} else {
$fieldset->appendChild(new XMLElement('p', __('Enter your email address to be sent a remote login link with further instructions for logging in.')));
$label = Widget::Label(__('Email Address'));
$label->appendChild(Widget::Input('email', $_POST['email'], 'text', array('autofocus' => 'autofocus')));
if (isset($this->_email_sent) && !$this->_email_sent) {
$label = Widget::Error($label, __('There was a problem locating your account. Please check that you are using the correct email address.'));
}
$fieldset->appendChild($label);
$this->Form->appendChild($fieldset);
$div = new XMLElement('div', NULL, array('class' => 'actions'));
$div->appendChild(new XMLElement('button', __('Send Email'), array('name' => 'action[reset]', 'type' => 'submit')));
$this->Form->appendChild($div);
}
} else {
$fieldset->appendChild(new XMLElement('legend', __('Login')));
$label = Widget::Label(__('Username'));
$username = Widget::Input('username', $_POST['username']);
if (!$this->_invalidPassword) {
$username->setAttribute('autofocus', 'autofocus');
}
$label->appendChild($username);
if (isset($_POST['action'], $_POST['action']['login']) && empty($_POST['username'])) {
$username->setAttribute('autofocus', 'autofocus');
$label = Widget::Error($label, __('No username was entered.'));
}
$fieldset->appendChild($label);
$label = Widget::Label(__('Password'));
$password = Widget::Input('password', NULL, 'password');
$label->appendChild($password);
if ($this->_invalidPassword) {
$password->setAttribute('autofocus', 'autofocus');
$label = Widget::Error($label, __('The supplied password was rejected.') . ' <br /><a href="' . SYMPHONY_URL . '/login/retrieve-password/">' . __('Retrieve password?') . '</a>');
}
$fieldset->appendChild($label);
$this->Form->appendChild($fieldset);
$div = new XMLElement('div', NULL, array('class' => 'actions'));
$div->appendChild(new XMLElement('button', __('Login'), array('name' => 'action[login]', 'type' => 'submit', 'accesskey' => 's')));
$this->Form->appendChild($div);
}
$this->Body->appendChild($this->Form);
}
示例4: displayPublishPanel
public function displayPublishPanel(&$wrapper, $data = null, $error = null, $prefix = null, $postfix = null)
{
$label = Widget::Label($this->get('label'));
$text = new XMLElement('div', $data['value']);
$wrapper->appendChild($label);
$wrapper->appendChild($text);
}
示例5: buildEditor
public static function buildEditor(XMLElement $wrapper, array &$errors = array(), array $settings = null, $handle = null)
{
Administration::instance()->Page->addScriptToHead(URL . '/extensions/section_schemas/assets/section_schemas.datasource.js', 100);
if (is_null($settings[self::getClass()]['fields'])) {
$settings[self::getClass()]['fields'] = array();
}
$fieldset = new XMLElement('fieldset');
$fieldset->setAttribute('class', 'settings contextual ' . __CLASS__);
$fieldset->setAttribute('data-context', General::createHandle(self::getName()));
$fieldset->appendChild(new XMLElement('legend', self::getName()));
$group = new XMLElement('div');
$group->setAttribute('class', 'two columns');
$options = array();
$sections = SectionManager::fetch();
foreach ($sections as $section) {
$options[] = array($section->get('handle'), $settings[self::getClass()]['section'] == $section->get('handle'), $section->get('name'));
}
$label = Widget::Label(__('Section'));
$label->setAttribute('class', 'column');
$label->appendChild(Widget::Select('fields[' . self::getClass() . '][section]', $options));
$group->appendChild($label);
foreach ($sections as $section) {
$fields = $section->fetchFields();
$options = array();
foreach ($fields as $field) {
$options[] = array($field->get('element_name'), in_array($field->get('element_name'), $settings[self::getClass()]['fields']), $field->get('label') . ' (' . $field->get('type') . ')');
}
$label = Widget::Label(__('Fields'));
$label->setAttribute('class', 'column fields fields-for-' . $section->get('handle'));
$label->appendChild(Widget::Select('fields[' . self::getClass() . '][fields][]', $options, array('multiple' => 'multiple')));
$group->appendChild($label);
}
$fieldset->appendChild($group);
$wrapper->appendChild($fieldset);
}
示例6: appendPreferences
/**
* Append maintenance mode preferences
*
* @param array $context
* delegate context
*/
public function appendPreferences($context)
{
// Create preference group
$group = new XMLElement('fieldset');
$group->setAttribute('class', 'settings');
$group->appendChild(new XMLElement('legend', __('Maintenance Mode')));
// Append settings
$label = Widget::Label();
$input = Widget::Input('settings[maintenance_mode][enabled]', 'yes', 'checkbox');
if (Symphony::Configuration()->get('enabled', 'maintenance_mode') === 'yes') {
$input->setAttribute('checked', 'checked');
}
$label->setValue($input->generate() . ' ' . __('Enable maintenance mode'));
$group->appendChild($label);
// Append help
$group->appendChild(new XMLElement('p', __('Maintenance mode will redirect all visitors, other than developers, to the specified maintenance page. To specify a maintenance page, give a page a type of <code>maintenance</code>'), array('class' => 'help')));
// IP White list
$label = Widget::Label(__('IP Whitelist'));
$label->appendChild(Widget::Input('settings[maintenance_mode][ip_whitelist]', Symphony::Configuration()->get('ip_whitelist', 'maintenance_mode')));
$group->appendChild($label);
// Append help
$group->appendChild(new XMLElement('p', __('Any user that has an IP listed above will be granted access. This eliminates the need to allow a user backend access. Separate each with a space.'), array('class' => 'help')));
// Append new preference group
$context['wrapper']->appendChild($group);
}
示例7: displayPublishPanel
public function displayPublishPanel(&$wrapper, $data = NULL, $flagWithError = NULL, $fieldnamePrefix = NULL, $fieldnamePostfix = NULL)
{
$value = General::sanitize($data['video_id']);
$label = Widget::Label($this->get('label'));
$video_id = new XMLElement('input');
$video_id->setAttribute('type', 'text');
$video_id->setAttribute('name', 'fields' . $fieldnamePrefix . '[' . $this->get('element_name') . ']' . $fieldnamePostfix);
$video_id->setAttribute('value', $value);
if ($this->get('required') != 'yes') {
$label->appendChild(new XMLElement('i', __('Optional')));
}
if (strlen($value) == 11 && is_null($flagWithError)) {
$video_id->setAttribute('class', 'hidden');
$video_container = new XMLElement('span');
$video_container->appendChild(self::createPlayer($value));
$description = new XMLElement('div');
$description->setAttribute('class', 'description');
$description->setValue($data['title'] . ' by <a href="' . $data['user_url'] . '" target="blank">' . $data['user_name'] . '</a> (' . $data['views'] . ' views)');
$change = new XMLElement('a', 'Remove Video');
$change->setAttribute('class', 'change');
$description->appendChild($change);
$video_container->appendChild($description);
$label->appendChild($video_container);
}
$label->appendChild($video_id);
if ($flagWithError != NULL) {
$wrapper->appendChild(Widget::wrapFormElementWithError($label, $flagWithError));
} else {
$wrapper->appendChild($label);
}
}
示例8: __addPreferences
/**
* Add site preferences
*/
public function __addPreferences($context)
{
// Get selected languages
$selection = Symphony::Configuration()->get('datetime');
if (empty($selection)) {
$selection = array();
}
// Build default options
$options = array();
foreach ($this->languages as $name => $codes) {
$options[$name] = array($name . '::' . $codes, array_key_exists($name, $selection) ? true : false, __(ucfirst($name)));
}
// Add custom options
foreach (array_diff_key($selection, $this->languages) as $name => $codes) {
$options[$name] = array($name . '::' . $codes, true, __(ucfirst($name)));
}
// Sort options
ksort($options);
// Add fieldset
$group = new XMLElement('fieldset', '<legend>' . __('Date and Time') . '</legend>', array('class' => 'settings'));
$select = Widget::Select('settings[datetime][]', $options, array('multiple' => 'multiple'));
$label = Widget::Label('Languages included in the Date and Time Data Source', $select);
$group->appendChild($label);
$help = new XMLElement('p', __('You can add more languages in you configuration file.'), array('class' => 'help'));
$group->appendChild($help);
$context['wrapper']->appendChild($group);
}
示例9: displayPublishPanel
public function displayPublishPanel(&$wrapper, $data = null, $error = null, $prefix = null, $postfix = null, $entry_id = null)
{
$sortorder = $this->get('sortorder');
$element_name = $this->get('element_name');
$classes = array();
$label = Widget::Label($this->get('label'));
$message = new XMLElement('span');
switch ($data['handle']) {
case 'none':
case 'completed':
return;
break;
case 'failed':
$value = __('Video failed to upload.');
break;
case 'queued':
$value = __('Video is waiting in queue.');
break;
case 'encoding':
$value = __('Video is being encoded.');
break;
case 'uploading':
$value = __('Video is being uploaded.');
break;
}
if (isset($value)) {
$message->setValue($value);
$label->appendChild($message);
$wrapper->appendChild($label);
}
}
示例10: addGuideBelowTextArea
public function addGuideBelowTextArea($context)
{
//only show guide when using markdown
$formatter = $context['field']->get('formatter');
$pattern = '/^markdown/';
if (!preg_match($pattern, $formatter)) {
return;
}
//append the textarea here so the guide will show after the textarea in the form
$context['label']->appendChild($context['textarea']);
//nullify the textarea to prevent another one being appended in field.textarea.php
$context['textarea'] = Widget::Label('');
//retrieve the guide and append it
switch ($formatter) {
case 'markdown':
$file = EXTENSIONS . '/markdown_guide/assets/markdown.php';
break;
case 'markdown_extra':
$file = EXTENSIONS . '/markdown_guide/assets/markdown_extra.php';
break;
case 'markdown_extra_with_smartypants':
$file = EXTENSIONS . '/markdown_guide/assets/markdown_extra_with_smartypants.php';
break;
case 'markdown_with_purifier':
$file = EXTENSIONS . '/markdown_guide/assets/markdown_with_purifier.php';
break;
}
include $file;
foreach ($description as $line) {
$contents .= "<strong>{$line[0]}:</strong> {$line[1]}<br />";
}
$guide = Widget::Label($contents, null, 'markdown_guide');
$context['label']->appendChild($guide);
}
示例11: appendPreferences
/**
* Append maintenance mode preferences
*
* @param array $context
* delegate context
*/
public function appendPreferences($context)
{
// Create preference group
$group = new XMLElement('fieldset');
$group->setAttribute('class', 'settings');
$group->appendChild(new XMLElement('legend', __('Maintenance Mode')));
// Append settings
$label = Widget::Label();
$input = Widget::Input('settings[maintenance_mode][enabled]', 'yes', 'checkbox');
if (Symphony::Configuration()->get('enabled', 'maintenance_mode') === 'yes') {
$input->setAttribute('checked', 'checked');
}
$label->setValue($input->generate() . ' ' . __('Enable maintenance mode'));
$group->appendChild($label);
// Append help
$group->appendChild(new XMLElement('p', __('Maintenance mode will redirect all visitors, other than developers, to the specified maintenance page. To specify a maintenance page, give a page a type of <code>maintenance</code>'), array('class' => 'help')));
// IP White list
$label = Widget::Label(__('IP Whitelist'));
$label->appendChild(Widget::Input('settings[maintenance_mode][ip_whitelist]', Symphony::Configuration()->get('ip_whitelist', 'maintenance_mode')));
$group->appendChild($label);
// Append help
$group->appendChild(new XMLElement('p', __('Any user that has an IP listed above will be granted access. This eliminates the need to allow a user backend access. Separate each with a space.'), array('class' => 'help')));
// Useragent White list
$label = Widget::Label(__('Useragent Whitelist'));
$whitelist = json_decode(Symphony::Configuration()->get('useragent_whitelist', 'maintenance_mode'));
if (is_array($whitelist) && !empty($whitelist)) {
$useragent = implode("\r\n", $whitelist);
}
$label->appendChild(Widget::Textarea('settings[maintenance_mode][useragent_whitelist]', 5, 50, $useragent));
$group->appendChild($label);
// Append help
$group->appendChild(new XMLElement('p', __('Any useragent that listed above will be granted access. This eliminates the need to allow a user backend access, useful when third party services need to access your site prior to launch. Insert in json array format eg ["useragent1","useragent2"].'), array('class' => 'help')));
// Append new preference group
$context['wrapper']->appendChild($group);
}
示例12: dashboardPanelOptions
public function dashboardPanelOptions($context)
{
if ($context['type'] != 'piwik') {
return;
}
$config = $context['existing_config'];
$fieldset = new XMLElement('fieldset');
$fieldset->setAttribute('class', 'settings');
$fieldset->appendChild(new XMLElement('legend', __('Piwik')));
$label = Widget::Label(__('Module'));
$select = Widget::Select('config[module]', $this->getModuleOptions(isset($config['module']) ? $config['module'] : null));
$label->appendChild($select);
$fieldset->appendChild($label);
$input = Widget::Input('config[columns]', isset($config['columns']) ? $config['columns'] : null);
$input->setAttribute('type', 'number');
$input->setAttribute('size', '3');
$label = Widget::Label(__('Show the first %s columns in table.', array($input->generate())));
$fieldset->appendChild($label);
$input = Widget::Input('config[entries]', isset($config['entries']) ? $config['entries'] : null);
$input->setAttribute('type', 'number');
$input->setAttribute('size', '3');
$label = Widget::Label(__('Show the first %s entries in table.', array($input->generate())));
$fieldset->appendChild($label);
$context['form'] = $fieldset;
}
示例13: __viewIndex
public function __viewIndex()
{
$this->_driver = $this->_Parent->ExtensionManager->create('section_schemas');
$this->setPageType('form');
$this->setTitle('Symphony – Section Schema data sources');
$this->appendSubheading('Section Schema data sources');
$container = new XMLElement('fieldset');
$container->setAttribute('class', 'settings');
$container->appendChild(new XMLElement('legend', 'Sections'));
$group = new XMLElement('div');
$group->setAttribute('class', 'group');
$sm = new SectionManager($this->_Parent);
$sections = $sm->fetch();
$options = array();
$dsm = new DatasourceManager($this->_Parent);
$datasources = $dsm->listAll();
foreach ($sections as $section) {
$selected = in_array('section_schema_' . str_replace('-', '_', $section->_data['handle']), array_keys($datasources));
$options[] = array($section->_data['handle'], $selected, $section->_data['name']);
}
$section = Widget::Label('Create data sources for these sections:');
$section->appendChild(Widget::Select('sections[]', $options, array('multiple' => 'multiple')));
$group->appendChild($section);
$container->appendChild($group);
$this->Form->appendChild($container);
//---------------------------------------------------------------------
$div = new XMLElement('div');
$div->setAttribute('class', 'actions');
$attr = array('accesskey' => 's');
$div->appendChild(Widget::Input('action[save]', 'Save Changes', 'submit', $attr));
$this->Form->appendChild($div);
}
示例14: __buildFormContent
private function __buildFormContent()
{
$fieldset = new XMLElement('fieldset');
// email was not send
// or first time here (email_sent == NULL)
if ($this->_email_sent !== true) {
$fieldset->appendChild(new XMLElement('p', __('Enter your email address to be sent a remote unban link with further instructions.')));
$label = Widget::Label(__('Email Address'));
$label->appendChild(Widget::Input('email', $_POST['email'], 'text', array('autofocus', 'autofocus')));
}
if (isset($this->_email_sent)) {
if ($this->_email_sent) {
$div = new XMLElement('div', __('Email sent. Follow the instruction in it.'));
$fieldset->appendChild($div);
} else {
$div = new XMLElement('div', NULL, array('class' => 'invalid'));
$div->appendChild($label);
$div->appendChild(new XMLElement('p', __('There was a problem locating your account. Please check that you are using the correct email address.')));
$fieldset->appendChild($div);
}
} else {
$fieldset->appendChild($label);
}
$this->Form->appendChild($fieldset);
if ($this->_email_sent !== true) {
$div = new XMLElement('div', NULL, array('class' => 'actions'));
$div->appendChild(new XMLElement('button', __('Send Email'), array('name' => 'action[send-email]', 'type' => 'submit')));
$this->Form->appendChild($div);
}
}
示例15: displayPublishPanel
function displayPublishPanel(XMLElement &$wrapper, $data = null, $flagWithError = null, $fieldnamePrefix = null, $fieldnamePostfix = null, $entry_id = null)
{
$note = isset($data['value']) ? $data['value'] : $this->get('note');
$editable = $this->get('editable');
# Add <div>
$div = new XMLElement("div", $note, array("id" => Lang::createHandle($this->get('label')), "class" => "publishnotes-note"));
$wrapper->appendChild($div);
# Editable
if (isset($editable) && $editable) {
$wrapper->setAttribute('class', $wrapper->getAttribute('class') . " editable");
$edit = new XMLElement("a", __("Edit note"), array("class" => "publishnotes-edit", "href" => "#edit"));
$wrapper->appendChild($edit);
# Add <textarea>
$label = Widget::Label("Edit: " . $this->get('label'), NULL, Lang::createHandle($this->get('label')));
$textarea = Widget::Textarea('fields' . $fieldnamePrefix . '[' . $this->get('element_name') . ']' . $fieldnamePostfix, 8, 50, strlen($note) != 0 ? General::sanitize($note) : NULL);
$label->appendChild($textarea);
$control = new XMLElement("div", '<input type="submit" value="Change note"/> or <a href="#">cancel</a>', array("class" => "control"));
$label->appendChild($control);
if ($flagWithError != NULL) {
$wrapper->appendChild(Widget::Error($label, $flagWithError));
} else {
$wrapper->appendChild($label);
}
}
}