本文整理汇总了PHP中Html::el方法的典型用法代码示例。如果您正苦于以下问题:PHP Html::el方法的具体用法?PHP Html::el怎么用?PHP Html::el使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Html
的用法示例。
在下文中一共展示了Html::el方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct(DbTable\Oznam $oznam, DbTable\Registracia $registracia, DbTable\Ikonka $ikonka, User $user)
{
$this->oznam = $oznam;
$this->ikonka = $ikonka;
$this->urovneReg = $registracia->hladaj_urovne(0, $user->isLoggedIn() ? $user->getIdentity()->id_registracia : 0)->fetchPairs('id', 'nazov');
}
/**
* Formular pre editaciu oznamu
* @param int $oznam_ucast Povolenie potvrdenia ucasti
* @param boolean $send_e_mail_news Povolenie zasielania info e-mailov
* @param boolean $oznam_title_image_en Povolenie titulneho obrazka
* @param string $nazov_stranky Nazov stranky
* @return Form
*/
public function create($oznam_ucast, $send_e_mail_news, $oznam_title_image_en, $nazov_stranky)
{
$form = new Form();
$form->addProtection();
$form->addHidden("id");
$form->addHidden("id_user_profiles");
$form->addHidden("datum_zadania");
$form->addDatePicker('datum_platnosti', 'Dátum platnosti')->addRule(Form::FILLED, 'Dátum platnosti musí byť zadaný!');
$form->addText('nazov', 'Nadpis:', 50, 80)->addRule(Form::MIN_LENGTH, 'Nadpis musí mať spoň %d znakov!', 3)->setRequired('Názov musí byť zadaný!');
$form->addSelect('id_registracia', 'Povolené prezeranie pre min. úroveň:', $this->urovneReg);
if ($oznam_ucast) {
$form->addCheckbox('potvrdenie', ' Potvrdenie účasti');
} else {
$form->addHidden('potvrdenie');
}
if ($send_e_mail_news) {
$form->addCheckbox('posli_news', ' Posielatie NEWS o tejto aktualite');
} else {
$form->addHidden("posli_news", FALSE);
}
if (!$oznam_title_image_en) {
//$this->oznam_title_image_en
示例2: formatOptions
/**
* allows 'nested options' with only 1 html optgroup (valid)
* options are indented by 4 spaces per level
*
* @param array
* @param FormControl
* @param int nesting level
*/
private function formatOptions($options, &$control, $level = 1)
{
$option = Html::el('option');
$indentation = str_repeat(" ", ($level - 1) * 4);
foreach ($options as $key => $value) {
if (!is_array($value)) {
$value = array($key => $value);
$dest = $control;
} else {
// no nested optgroups allowed -> using disabled options indented by space
if ($level > 1) {
$dest = $control;
// simulate optgroup
if (is_array($value)) {
$dest->add((string) $option->disabled(true)->setHtml($this->translate($key)));
}
} else {
$dest = $control->create('optgroup')->label($key);
}
}
foreach ($value as $key2 => $value2) {
if ($value2 instanceof Html) {
$dest->add((string) $value2->selected(isset($this->selected[$key2])));
// multidimensional array -> nested optgroups - must by styled with CSS to see hierarchy
} elseif (is_array($value2)) {
$this->formatOptions(array($key2 => $value2), $dest, $level + 1);
} elseif ($this->areKeysUsed()) {
$dest->add((string) $option->disabled(false)->value($key2)->selected(isset($this->selected[$key2]))->setText($indentation . $this->translate($value2)));
} else {
$dest->add((string) $option->disabled(false)->selected(isset($this->selected[$value2]))->setText($indentation . $this->translate($value2)));
}
}
}
}
示例3: getControl
/**
* Generates control's HTML element.
* @return Html
* <span id="ns" class="ui-stepper">
<input type="text" name="ns_textbox" size="2" autocomplete="off" class="ui-stepper-textbox" />
<button type="submit" name="ns_button_1" class="ui-stepper-plus">+</button>
<button type="submit" name="ns_button_2" class="ui-stepper-minus">-</button>
</span>
*/
public function getControl()
{
$control = parent::getControl();
$updown = Html::el('span')->class('ui-stepper')->add($control)->add(Html::el('input')->type('button')->class('ui-stepper-plus'))->add(Html::el('button')->class('ui-stepper-minus'));
//$control->class = 'numericUpDown';
return $updown;
}
示例4: createComponentUsers
protected function createComponentUsers()
{
$grid = new DataGrid();
$grid->bindDataTable(UsersModel::getUsers());
$grid->addColumn('userName', 'Uživatelské jméno')->addFilter();
$grid->addColumn('firstName', 'Jméno')->addFilter();
$grid->addColumn('surname', 'Přijmení')->addFilter();
$grid->addColumn('email', 'E-mail')->addFilter();
$grid->addColumn('icq', 'ICQ')->addFilter();
$grid->addColumn('mobile', 'Mobilní telefon')->addFilter();
$grid->addColumn('active', 'Aktivní')->addSelectboxFilter(array(1 => 'Yes', 0 => 'No'));
$grid->addColumn('holiday', 'Dovolená')->addSelectboxFilter(array(1 => 'Yes', 0 => 'No'));
$grid->multiOrder = FALSE;
// order by one column only
$grid['holiday']->replacement['1'] = 'Ano';
$grid['holiday']->replacement['0'] = 'Ne';
$grid['active']->replacement['1'] = 'Ano';
$grid['active']->replacement['0'] = 'Ne';
$grid->displayedItems = array(10, 20, 50, 75, 100, 500, 1000);
// roletka pro výběr počtu řádků na stránku
$grid->addActionColumn('Actions');
$grid->keyName = 'id';
$grid->addAction('Aktivovat/Deaktivovat', 'userActivateChange!', Html::el('span')->setText('Aktivace/Deaktivace'), $useAjax = TRUE);
$grid->addAction('Dovolená', 'userHolidayChange!', Html::el('span')->setText('Dovolená'), $useAjax = TRUE);
$grid->addAction('Editovat', 'userChangeRedirect', Html::el('span')->setText('Editovat'), $useAjax = FALSE);
$grid->addAction('Změnit heslo', 'userPasswordChangeRedirect', Html::el('span')->setText('Změnit heslo'), $useAjax = FALSE);
$grid->addAction('Smazat', 'confirmForm:confirmUserDelete!', Html::el('span')->setText('Smazat'), $useAjax = TRUE);
return $grid;
}
示例5: showLi
public static function showLi($object, $deep = 1, $maxDeep = 0, $hrefFunc = null, $order = [])
{
$count = 0;
$isset = false;
$class = get_class($object);
$item = $hrefFunc ? $hrefFunc($object) : "<a href='#'> {$object->name()}</a> ";
$attributes = [];
if (is_array($item)) {
$attributes = $item['attributes'];
$item = $item['text'];
}
if (!isset($attributes['id'])) {
$attributes['id'] = str_replace('\\', '_', get_class($object)) . "-{$object->pk()}";
}
if (!$maxDeep || $deep < $maxDeep) {
$items = $class::getList(['where' => ['parent_id', $object->pk()], 'order' => $order]);
$count += count($items);
foreach ($items as $objectChild) {
if (!$isset) {
$isset = true;
echo \Html::el('li', $attributes, $item, true);
echo '<ul>';
}
$count += static::showLi($objectChild, $deep + 1, $maxDeep, $hrefFunc, $order);
}
}
if ($isset) {
echo '</ul></li>';
} else {
echo \Html::el('li', $attributes, $item);
}
return $count;
}
示例6: placeLink
public function placeLink(Html $row, DibiRow $data, $pres)
{
foreach ($row->getChildren() as $cell) {
$inside = $cell->getText();
$cell->setText('');
$cell->add(Html::el('a')->href($this->link(":Front:{$pres}:", $data['link']))->setText($inside));
}
}
示例7: __construct
/**
* @param string caption
*/
public function __construct($caption = NULL)
{
parent::__construct();
$this->control = Html::el('input');
$this->label = Html::el('label');
$this->caption = $caption;
$this->rules = new Rules($this);
}
示例8: formatContent
/**
* Formats cell's content.
* @param mixed
* @param DibiRow|array
* @return string
*/
public function formatContent($value, $data = NULL)
{
$checkbox = Html::el('input')->type('checkbox')->disabled('disabled');
if ($value) {
$checkbox->checked = TRUE;
}
return (string) $checkbox;
}
示例9: getTab
/**
* Returns the code for the panel tab.
* @return string
*/
public function getTab()
{
$tab = Html::el('span');
$image = $tab->create('img')->src($this->getIconSrc('flag_blue.png'))->id('TranslationPanel-icon');
$tab->add('Translations');
$tab->create('script')->type('text/javascript')->setHtml('translationPanel.init();');
return (string) $tab;
}
示例10: __construct
/**
* @param string caption
*/
public function __construct($caption = NULL)
{
$this->monitor('Nette\\Forms\\Form');
parent::__construct();
$this->control = Html::el('input');
$this->label = Html::el('label');
$this->caption = $caption;
$this->rules = new Rules($this);
}
示例11: __construct
public function __construct($parent = NULL, $name = NULL)
{
parent::__construct($parent, $name);
$this->form = new AppForm($this, 'form');
$this->form->addSubmit('yes', _('Yes'))->onClick[] = array($this, 'confirmClicked');
$this->form->addSubmit('no', _('No'))->onClick[] = array($this, 'cancelClicked');
$this->form->addHidden('token');
$this->question = Html::el('p');
$this->session = Environment::getSession('ConfirmationDialog/tokens');
}
示例12: createComponentCategoriesGrid
public function createComponentCategoriesGrid($name)
{
$grid = new DataGrid($this, $name);
$ds = $this->model('categories')->getDs();
$grid->bindDataTable($ds);
$grid->keyName = 'id';
$grid->addColumn('title', 'Title')->addFilter();
$grid->addActionColumn('Actions');
$grid->addAction('Edit', 'editCategory!', Html::el('span')->class('icon icon-edit'), $useAjax = TRUE);
$grid->addAction('Delete', 'confirmForm:confirmDelete!', Html::el('span')->class('icon icon-delete'), $useAjax = TRUE);
return $grid;
}
示例13: __construct
/**
* Data grid column constructor.
* @param string textual caption of column
* @param int maximum number of dislayed characters
*/
public function __construct($caption = NULL, $maxLength = NULL)
{
parent::__construct();
$this->addComponent(new ComponentContainer(), 'filters');
$this->header = Html::el();
$this->cell = Html::el();
$this->caption = $caption;
if ($maxLength !== NULL) {
$this->maxLength = $maxLength;
}
$this->monitor('DataGrid');
}
示例14: editorLink
/**
* Returns link to editor.
* @return Html
*/
public static function editorLink($file, $line)
{
if (Debugger::$editor && is_file($file)) {
$dir = dirname(strtr($file, '/', DIRECTORY_SEPARATOR));
$base = isset($_SERVER['SCRIPT_FILENAME']) ? dirname(dirname(strtr($_SERVER['SCRIPT_FILENAME'], '/', DIRECTORY_SEPARATOR))) : dirname($dir);
if (substr($dir, 0, strlen($base)) === $base) {
$dir = '...' . substr($dir, strlen($base));
}
return Html::el('a')->href(strtr(Debugger::$editor, array('%file' => rawurlencode($file), '%line' => $line)))->title("{$file}:{$line}")->setHtml(htmlSpecialChars(rtrim($dir, DIRECTORY_SEPARATOR)) . DIRECTORY_SEPARATOR . '<b>' . htmlSpecialChars(basename($file)) . '</b>');
} else {
return Html::el('span')->setText($file);
}
}
示例15: exampleForm
private function exampleForm()
{
$countries = array('Select your country', 'Europe' => array('CZ' => 'Czech Republic', 'FR' => 'France', 'DE' => 'Germany', 'GR' => 'Greece', 'HU' => 'Hungary', 'IE' => 'Ireland', 'IT' => 'Italy', 'NL' => 'Netherlands', 'PL' => 'Poland', 'SK' => 'Slovakia', 'ES' => 'Spain', 'CH' => 'Switzerland', 'UA' => 'Ukraine', 'GB' => 'United Kingdom'), 'AU' => 'Australia', 'CA' => 'Canada', 'EG' => 'Egypt', 'JP' => 'Japan', 'US' => 'United States', '?' => 'other');
$sex = array('m' => 'male', 'f' => 'female');
// Step 1: Define form with validation rules
$form = new Form();
// group Personal data
$form->addGroup('Personal data')->setOption('description', 'We value your privacy and we ensure that the information you give to us will not be shared to other entities.');
$form->addText('name', 'Your name:', 35)->addRule(Form::FILLED, 'Enter your name');
$form->addText('age', 'Your age:', 5)->addRule(Form::FILLED, 'Enter your age')->addRule(Form::INTEGER, 'Age must be numeric value')->addRule(Form::RANGE, 'Age must be in range from %.2f to %.2f', array(9.9, 100));
$form->addRadioList('gender', 'Your gender:', $sex);
$form->addText('email', 'E-mail:', 35)->setEmptyValue('@')->addCondition(Form::FILLED)->addRule(Form::EMAIL, 'Incorrect E-mail Address');
// ... then check email
// group Shipping address
$form->addGroup('Shipping address')->setOption('embedNext', TRUE);
$form->addCheckbox('send', 'Ship to address')->addCondition(Form::EQUAL, TRUE)->toggle('sendBox');
// toggle div #sendBox
// subgroup
$form->addGroup()->setOption('container', Html::el('div')->id('sendBox'));
$form->addText('street', 'Street:', 35);
$form->addText('city', 'City:', 35)->addConditionOn($form['send'], Form::EQUAL, TRUE)->addRule(Form::FILLED, 'Enter your shipping address');
$form->addSelect('country', 'Country:', $countries)->skipFirst()->addConditionOn($form['send'], Form::EQUAL, TRUE)->addRule(Form::FILLED, 'Select your country');
// group Your account
$form->addGroup('Your account');
$form->addPassword('password', 'Choose password:', 20)->addRule(Form::FILLED, 'Choose your password')->addRule(Form::MIN_LENGTH, 'The password is too short: it must be at least %d characters', 3);
$form->addPassword('password2', 'Reenter password:', 20)->addConditionOn($form['password'], Form::VALID)->addRule(Form::FILLED, 'Reenter your password')->addRule(Form::EQUAL, 'Passwords do not match', $form['password']);
$form->addFile('avatar', 'Picture:')->addCondition(Form::FILLED)->addRule(Form::MIME_TYPE, 'Uploaded file is not image', 'image/*');
$form->addHidden('userid');
$form->addTextArea('note', 'Comment:', 30, 5);
// group for buttons
$form->addGroup();
$form->addSubmit('submit1', 'Send');
// Step 2: Check if form was submitted?
if ($form->isSubmitted()) {
// Step 2c: Check if form is valid
if ($form->isValid()) {
echo '<h2>Form was submitted and successfully validated</h2>';
$values = $form->getValues();
Debug::dump($values);
// this is the end, my friend :-)
if (empty($disableExit)) {
exit;
}
}
} else {
// not submitted, define default values
$defaults = array('name' => 'John Doe', 'userid' => 231, 'country' => 'CZ');
$form->setDefaults($defaults);
}
return $form;
}