本文整理汇总了PHP中Widget::label方法的典型用法代码示例。如果您正苦于以下问题:PHP Widget::label方法的具体用法?PHP Widget::label怎么用?PHP Widget::label使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Widget
的用法示例。
在下文中一共展示了Widget::label方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
function index(&$Page, &$Contents, $fields)
{
global $warnings;
global $notices;
global $languages;
$Form = new XMLElement('form');
$Form->setAttribute('action', kINSTALL_FILENAME . ($_GET['lang'] ? '?lang=' . $_GET['lang'] : ''));
$Form->setAttribute('method', 'post');
/**
*
* START ENVIRONMENT SETTINGS
*
**/
$Environment = new XMLElement('fieldset');
$Environment->appendChild(new XMLElement('legend', __('Environment Settings')));
$Environment->appendChild(new XMLElement('p', __('Symphony is ready to be installed at the following location.')));
$class = NULL;
if (defined('kENVIRONMENT_WARNING') && kENVIRONMENT_WARNING == true) {
$class = 'warning';
}
$Environment->appendChild(Widget::label(__('Root Path'), Widget::input('fields[docroot]', $fields['docroot']), $class));
if (defined('ERROR') && defined('kENVIRONMENT_WARNING')) {
$Environment->appendChild(new XMLElement('p', $warnings[ERROR], array('class' => 'warning')));
}
$Form->appendChild($Environment);
/** END ENVIRONMENT SETTINGS **/
/**
*
* START LOCALE SETTINGS
*
**/
$Environment = new XMLElement('fieldset');
$Environment->appendChild(new XMLElement('legend', __('Website Preferences')));
// $Environment->appendChild(new XMLElement('p', '.'));
$Environment->appendChild(Widget::label(__('Name'), Widget::input('fields[general][sitename]', $fields['general']['sitename'])));
$Fieldset = new XMLElement('fieldset');
$Fieldset->appendChild(new XMLElement('legend', __('Date and Time')));
$Fieldset->appendChild(new XMLElement('p', __('Customise how Date and Time values are displayed throughout the Administration interface.')));
$options = array();
$groups = array();
$system_tz = isset($fields['region']['timezone']) ? $fields['region']['timezone'] : date_default_timezone_get();
foreach (timezone_identifiers_list() as $tz) {
if (preg_match('/\\//', $tz)) {
$parts = preg_split('/\\//', $tz, 2, PREG_SPLIT_NO_EMPTY);
$groups[$parts[0]][] = $parts[1];
} else {
$groups[$tz] = $tz;
}
}
foreach ($groups as $key => $val) {
if (is_array($val)) {
$tmp = array('label' => $key, 'options' => array());
foreach ($val as $zone) {
$tmp['options'][] = array("{$key}/{$zone}", "{$key}/{$zone}" == $system_tz, str_replace('_', ' ', $zone));
}
$options[] = $tmp;
} else {
$options[] = array($key, $key == $system_tz, str_replace('_', ' ', $key));
}
}
$Fieldset->appendChild(Widget::label(__('Region'), Widget::Select('fields[region][timezone]', $options)));
//$Div->appendChild(Widget::label('Date Format', Widget::input('fields[general][sitename]', $fields['general']['sitename'])));
//$Div->appendChild(Widget::label('Time Format', Widget::input('fields[general][sitename]', $fields['general']['sitename'])));
$dateformat = $fields['region']['date_format'];
$label = Widget::Label(__('Date Format'));
$dateFormats = array(array('Y/m/d', $dateformat == 'Y/m/d', DateTimeObj::get('Y/m/d')), array('m/d/Y', $dateformat == 'm/d/Y', DateTimeObj::get('m/d/Y')), array('m/d/y', $dateformat == 'm/d/y', DateTimeObj::get('m/d/y')), array('d F Y', $dateformat == 'd F Y', DateTimeObj::get('d F Y')));
$label->appendChild(Widget::Select('fields[region][date_format]', $dateFormats));
$Fieldset->appendChild($label);
$timeformat = $fields['region']['time_format'];
$label = Widget::Label(__('Time Format'));
//$label->setAttribute('title', __('Local') . (date('I') == 1 ? ' daylight savings' : '') . ' time for ' . date_default_timezone_get());
//if(date('I') == 1) $label->appendChild(new XMLElement('i', __('Daylight savings time')));
$timeformats = array(array('H:i:s', $timeformat == 'H:i:s', DateTimeObj::get('H:i:s')), array('H:i', $timeformat == 'H:i', DateTimeObj::get('H:i')), array('g:i:s a', $timeformat == 'g:i:s a', DateTimeObj::get('g:i:s a')), array('g:i a', $timeformat == 'g:i a', DateTimeObj::get('g:i a')));
$label->appendChild(Widget::Select('fields[region][time_format]', $timeformats));
$Fieldset->appendChild($label);
$Environment->appendChild($Fieldset);
$Form->appendChild($Environment);
/** END LOCALE SETTINGS **/
/**
*
* START DATABASE SETTINGS
*
**/
$Database = new XMLElement('fieldset');
$Database->appendChild(new XMLElement('legend', __('Database Connection')));
$Database->appendChild(new XMLElement('p', __('Please provide Symphony with access to a database.')));
$class = NULL;
if (defined('kDATABASE_VERSION_WARNING') && kDATABASE_VERSION_WARNING == true) {
$class = ' warning';
}
## fields[database][name]
$label = Widget::label(__('Database'), Widget::input('fields[database][name]', $fields['database']['name']), $class);
$Database->appendChild($label);
if (defined('ERROR') && defined('kDATABASE_VERSION_WARNING')) {
$Database->appendChild(new XMLElement('p', $warnings[ERROR], array('class' => 'warning')));
}
$class = NULL;
if (defined('kDATABASE_CONNECTION_WARNING') && kDATABASE_CONNECTION_WARNING == true) {
$class = ' warning';
}
//.........这里部分代码省略.........
示例2: viewConfiguration
protected function viewConfiguration()
{
/* -----------------------------------------------
* Populating fields array
* -----------------------------------------------
*/
$fields = isset($_POST['fields']) ? $_POST['fields'] : $this->_params['default-config'];
/* -----------------------------------------------
* Welcome
* -----------------------------------------------
*/
$div = new XMLElement('div');
$div->appendChild(new XMLElement('h2', __('Find something sturdy to hold on to because things are about to get awesome.')));
$div->appendChild(new XMLElement('p', __('Think of this as a pre-game warm up. You know you\'re going to kick-ass, so you\'re savouring every moment before the show. Welcome to the Symphony install page.')));
$this->Form->appendChild($div);
if (!empty($this->_params['errors'])) {
$this->Form->appendChild(Widget::Error(new XMLElement('p'), __('Oops, a minor hurdle on your path to glory! There appears to be something wrong with the details entered below.')));
}
/* -----------------------------------------------
* Environment settings
* -----------------------------------------------
*/
$fieldset = new XMLElement('fieldset');
$div = new XMLElement('div');
$this->__appendError(array('no-write-permission-root', 'no-write-permission-workspace'), $div);
if ($div->getNumberOfChildren() > 0) {
$fieldset->appendChild($div);
$this->Form->appendChild($fieldset);
}
/* -----------------------------------------------
* Website & Locale settings
* -----------------------------------------------
*/
$Environment = new XMLElement('fieldset');
$Environment->appendChild(new XMLElement('legend', __('Website Preferences')));
$label = Widget::label(__('Name'), Widget::Input('fields[general][sitename]', $fields['general']['sitename']));
$this->__appendError(array('general-no-sitename'), $label);
$Environment->appendChild($label);
$Fieldset = new XMLElement('fieldset', null, array('class' => 'frame'));
$Fieldset->appendChild(new XMLElement('legend', __('Date and Time')));
$Fieldset->appendChild(new XMLElement('p', __('Customise how Date and Time values are displayed throughout the Administration interface.')));
// Timezones
$options = DateTimeObj::getTimezonesSelectOptions(isset($fields['region']['timezone']) && !empty($fields['region']['timezone']) ? $fields['region']['timezone'] : date_default_timezone_get());
$Fieldset->appendChild(Widget::label(__('Region'), Widget::Select('fields[region][timezone]', $options)));
// Date formats
$options = DateTimeObj::getDateFormatsSelectOptions($fields['region']['date_format']);
$Fieldset->appendChild(Widget::Label(__('Date Format'), Widget::Select('fields[region][date_format]', $options)));
// Time formats
$options = DateTimeObj::getTimeFormatsSelectOptions($fields['region']['time_format']);
$Fieldset->appendChild(Widget::Label(__('Time Format'), Widget::Select('fields[region][time_format]', $options)));
$Environment->appendChild($Fieldset);
$this->Form->appendChild($Environment);
/* -----------------------------------------------
* Database settings
* -----------------------------------------------
*/
$Database = new XMLElement('fieldset');
$Database->appendChild(new XMLElement('legend', __('Database Connection')));
$Database->appendChild(new XMLElement('p', __('Please provide Symphony with access to a database.')));
// Database name
$label = Widget::label(__('Database'), Widget::Input('fields[database][db]', $fields['database']['db']), $class);
$this->__appendError(array('database-incorrect-version', 'unknown-database'), $label);
$Database->appendChild($label);
// Database credentials
$Div = new XMLElement('div', null, array('class' => 'two columns'));
$Div->appendChild(Widget::label(__('Username'), Widget::Input('fields[database][user]', $fields['database']['user']), 'column'));
$Div->appendChild(Widget::label(__('Password'), Widget::Input('fields[database][password]', $fields['database']['password'], 'password'), 'column'));
$this->__appendError(array('database-invalid-credentials'), $Div);
$Database->appendChild($Div);
// Advanced configuration
$Fieldset = new XMLElement('fieldset', null, array('class' => 'frame'));
$Fieldset->appendChild(new XMLElement('legend', __('Advanced Configuration')));
$Fieldset->appendChild(new XMLElement('p', __('Leave these fields unless you are sure they need to be changed.')));
// Advanced configuration: Host, Port
$Div = new XMLElement('div', null, array('class' => 'two columns'));
$Div->appendChild(Widget::label(__('Host'), Widget::Input('fields[database][host]', $fields['database']['host']), 'column'));
$Div->appendChild(Widget::label(__('Port'), Widget::Input('fields[database][port]', $fields['database']['port']), 'column'));
$this->__appendError(array('no-database-connection'), $Div);
$Fieldset->appendChild($Div);
// Advanced configuration: Table Prefix
$label = Widget::label(__('Table Prefix'), Widget::Input('fields[database][tbl_prefix]', $fields['database']['tbl_prefix']));
$this->__appendError(array('database-table-clash'), $label);
$Fieldset->appendChild($label);
$Database->appendChild($Fieldset);
$this->Form->appendChild($Database);
/* -----------------------------------------------
* Permission settings
* -----------------------------------------------
*/
$Permissions = new XMLElement('fieldset');
$Permissions->appendChild(new XMLElement('legend', __('Permission Settings')));
$Permissions->appendChild(new XMLElement('p', __('Symphony needs permission to read and write both files and directories.')));
$Div = new XMLElement('div', null, array('class' => 'two columns'));
$Div->appendChild(Widget::label(__('Files'), Widget::Input('fields[file][write_mode]', $fields['file']['write_mode']), 'column'));
$Div->appendChild(Widget::label(__('Directories'), Widget::Input('fields[directory][write_mode]', $fields['directory']['write_mode']), 'column'));
$Permissions->appendChild($Div);
$this->Form->appendChild($Permissions);
/* -----------------------------------------------
* User settings
* -----------------------------------------------
//.........这里部分代码省略.........
示例3: index
function index(&$Page, &$Contents, $fields)
{
global $warnings;
global $notices;
$Form = new XMLElement('form');
$Form->setAttribute('action', 'install.php');
$Form->setAttribute('method', 'post');
/**
*
* START ENVIRONMENT SETTINGS
*
**/
/*
<fieldset>
<legend>Environment Settings</legend>
<p>Symphony is ready to be installed at the following location.</p>
<label class="warning">Root Path <input name="" value="/users/21degre/public_html/" /></label>
<p class="warning">No <code>/symphony</code> directory was found at this location. Please upload the contents of Symphony's install package here.</p>
<p class="note">An existing <code>/workspace</code> directory was found at this location. Symphony will use this workspace.</p>
<p class="warning">Symphony does not have write permission to the existing <code>/workspace</code> directory. Please modify permission settings on this directory and its contents to allow this, such as with a recursive <code>chmod -R</code> command.</p>
<p class="warning">Symphony does not have write permission to the <code>/manifest</code> directory. Please modify permission settings on this directory and its contents to allow this, such as with a recursive <code>chmod -R</code> command.</p>
</fieldset>
*/
$Environment = new XMLElement('fieldset');
$Environment->addChild(new XMLElement('legend', 'Environment Settings'));
$Environment->addChild(new XMLElement('p', 'Symphony is ready to be installed at the following location.'));
$class = NULL;
if (defined('kENVIRONMENT_WARNING') && kENVIRONMENT_WARNING == true) {
$class = 'warning';
}
$Environment->addChild(Widget::label('Root Path', Widget::input('fields[docroot]', $fields['docroot']), $class));
if (defined('ERROR') && defined('kENVIRONMENT_WARNING')) {
$Environment->addChild(Widget::warning($warnings[ERROR]));
}
## CHECK FOR AN EXISTING WORKSPACE FOLDER
if (!defined('ERROR') && @is_file($fields['docroot'] . '/workspace/workspace.conf')) {
$Environment->addChild(Widget::note($notices['existing-workspace']));
}
$Form->addChild($Environment);
/** END ENVIRONMENT SETTINGS **/
/**
*
* START DATABASE SETTINGS
*
**/
/*
<fieldset>
<legend>Database Connection</legend>
<p>Please provide Symphony with access to a database.</p>
<label class="warning">Database <input name="" /></label>
<div class="group warning">
<label>Username <input name="" /></label>
<label>Password <input name="" type="password" /></label>
</div>
<p class="warning">Symphony was unable to connect to the specified database. You may need to modify host or port settings.</p>
...
</fieldset>
*/
$Database = new XMLElement('fieldset');
$Database->addChild(new XMLElement('legend', 'Database Connection'));
$Database->addChild(new XMLElement('p', 'Please provide Symphony with access to a database.'));
$class = NULL;
if (defined('kDATABASE_CONNECTION_WARNING') && kDATABASE_CONNECTION_WARNING == true) {
$class = ' warning';
}
## fields[database][name]
$Database->addChild(Widget::label('Database', Widget::input('fields[database][name]', $fields['database']['name'])));
$Div = new XMLElement('div');
$Div->setAttribute('class', 'group' . $class);
## fields[database][username]
$Div->addChild(Widget::label('Username', Widget::input('fields[database][username]', $fields['database']['username'])));
## fields[database][password]
$Div->addChild(Widget::label('Password', Widget::input('fields[database][password]', $fields['database']['password'], NULL, 'password')));
$Database->addChild($Div);
if (defined('ERROR') && defined('kDATABASE_CONNECTION_WARNING')) {
$Database->addChild(Widget::warning($warnings[ERROR]));
}
/*
...
<fieldset>
<legend>Advanced Configuration</legend>
<p>Leave these fields unless you are sure they need to be changed.</p>
<div class="group">
<label>Host <input name="" value="localhost" /></label>
<label>Port <input name="" value="3306" /></label>
</div>
<label class="warning">Table Prefix <input name="" value="sym_" /></label>
<p class="warning">The table prefix <code>sym_</code> is already in use. Please choose a different prefix to use with Symphony.</p>
<label class="option"><input name="" type="checkbox" /> Use compatibility mode</label>
<p>Symphony normally specifies UTF-8 character encoding for database entries. With compatibility mode enabled, Symphony will instead use the default character encoding of your database.</p>
</fieldset>
*/
$Fieldset = new XMLElement('fieldset');
$Fieldset->addChild(new XMLElement('legend', 'Advanced Configuration'));
$Fieldset->addChild(new XMLElement('p', 'Leave these fields unless you are sure they need to be changed.'));
$Div = new XMLElement('div');
//.........这里部分代码省略.........