本文整理汇总了PHP中MailForm::addWidget方法的典型用法代码示例。如果您正苦于以下问题:PHP MailForm::addWidget方法的具体用法?PHP MailForm::addWidget怎么用?PHP MailForm::addWidget使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MailForm
的用法示例。
在下文中一共展示了MailForm::addWidget方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: MailForm
/**
* Generate a form for editing items in this list.
*
* @return object saf.MailForm object
*/
function &getEditForm($item)
{
loader_import('saf.MailForm');
$form = new MailForm();
$form->action = site_prefix() . '/index/usradm-edit-team-action';
$form->error_mode = 'all';
$form->addWidget('hidden', '_list');
$form->addWidget('hidden', '_key');
$w =& $form->addWidget('info', 'name');
$w->alt = intl_get('Name');
$w->addRule('not empty', intl_get('Team name may not be empty.'));
$w->setValue($item);
$w->extra = 'maxlength="48"';
$w =& $form->addWidget('select', 'disabled');
$w->alt = intl_get('Disabled');
$w->setValues(array('yes' => intl_get('Yes'), 'no' => intl_get('No')));
if (!$this->data[$item]['disabled']) {
$w->setValue('no');
} else {
$w->setValue('yes');
}
$w =& $form->addWidget('text', 'description');
$w->alt = intl_get('Description');
$w->addRule('not empty', intl_get('Description may not be empty.'));
$w->extra = 'size="40"';
$w->setValue($this->data[$item]['description']);
$w =& $form->addWidget('msubmit', 'submit_button');
$b =& $w->getButton();
$b->setValues(intl_get('Save'));
$b =& $w->addButton('cancel_button');
$b->setValues(intl_get('Cancel'));
$b->extra = 'onclick="window.location.href = \'' . site_prefix() . '/index/usradm-browse-action?list=teams\'; return false"';
return $form;
}
示例2: MailForm
}
page_title(intl_get('Application Settings') . ' - ' . $name);
if (!is_writeable(getcwd() . '/inc/app/' . $parameters['appname'] . '/conf/settings.ini.php')) {
echo '<p class="invalid">' . intl_getf('Warning: The settings file is not writeable. Please verify that the file %s is writeable by the web server user.', 'inc/app/' . $parameters['appname'] . '/conf/settings.ini.php') . '</p>';
return;
}
global $intl;
$old_intl_path = $intl->directory;
$intl->directory = 'inc/app/' . $parameters['appname'] . '/lang';
$intl->getIndex();
$intl->directory = $old_intl_path;
$settings = ini_parse(getcwd() . '/inc/app/' . $parameters['appname'] . '/conf/settings.ini.php', true);
global $cgi;
loader_import('saf.MailForm');
$form = new MailForm();
$w =& $form->addWidget('hidden', 'appname');
$w->setValue($parameters['appname']);
foreach ($settings as $k => $v) {
if (!isset($v['type'])) {
$v['type'] = 'text';
}
if (isset($v['value'])) {
$val = $v['value'];
unset($v['value']);
} else {
$val = false;
}
$w =& $form->createWidget($k, $v);
if ($val) {
$w->setValue($val);
}
示例3: editable
function editable($path, $types = array(), $template = '', $remember = array())
{
global $loader, $cgi, $intl;
$loader->import('saf.MailForm');
$form = new MailForm();
if (!empty($template)) {
$form->template = $template;
}
$res = $this->doc->query($path);
$res = array_shift($res);
if (!is_object($res)) {
$this->error = $this->doc->error;
return false;
}
$row = $res->makeObj();
foreach (get_object_vars($row) as $key => $value) {
if ($key == 'attrs') {
continue;
}
if (isset($types[$key])) {
$type = $types[$key];
} else {
$type = 'text';
}
$w =& $form->addWidget($type, $key);
$w->setValue($value);
}
foreach ($remember as $rem) {
$w =& $form->addWidget('hidden', $rem);
$w->setValue($cgi->{$rem});
}
$w =& $form->addWidget('msubmit', 'submit_button');
$b =& $w->getButton();
$b->setValues($intl->get('Update'));
$b =& $w->addButton('submit_button', $intl->get('Cancel'));
$b->extra = "onclick='window.history.go (-1); return false'";
if ($form->invalid($cgi)) {
$form->setValues($cgi);
return $form->show();
} else {
$form->setValues($cgi);
$vals = $form->getValues();
return $vals;
}
}
示例4: MailForm
$form = new MailForm();
ini_add_filter('ini_filter_split_comma_single', array('rule 0', 'rule 1', 'rule 2', 'rule 3', 'rule 4', 'rule 5', 'rule 6', 'rule 7', 'rule 8', 'button 0', 'button 1', 'button 2', 'button 3', 'button 4', 'button 5', 'button 6', 'button 7', 'button 8', 'submitButtons'));
foreach ($attrs as $attr) {
$w =& $form->createWidget($attr->name, ini_parse($attr->typedef, false));
if (isset($cgi->{$attr->name})) {
$w->setDefault($cgi->{$attr->name});
}
}
ini_clear();
if (isset($form->widgets['id'])) {
$form->widgets['id']->setValues(array_merge(array('' => '- ' . intl_get('SELECT') . ' -'), assocify($ids)));
}
if (isset($form->widgets['class'])) {
$form->widgets['class']->setValues(array_merge(array('' => '- ' . intl_get('SELECT') . ' -'), assocify($classes)));
}
$w =& $form->addWidget('hidden', 'ifname');
$w->setValue($cgi->ifname);
$w =& $form->addWidget('hidden', 'tag');
$w->setValue($cgi->tag);
$w =& $form->addWidget('template', 'tpl');
$w->template = 'properties.spt';
$w =& $form->addWidget('msubmit', 'submit_button');
$b1 =& $w->getButton();
$b1->setValues(intl_get('OK'));
//$b1->extra = 'onclick="return properties_ok (this.form)"';
$b2 =& $w->addButton('submit_button', intl_get('Cancel'));
$b2->extra = 'onclick="return properties_cancel (this.form)"';
page_title(intl_get('Editing Element') . ': ' . strtoupper($cgi->tag));
if ($form->invalid($cgi)) {
$form->setValues($cgi);
echo $form->show();
示例5: header
<?php
global $cgi;
if (empty($cgi->_table)) {
header('Location: ' . site_prefix() . '/index/myadm-app');
exit;
}
loader_import('saf.MailForm');
$tbl = db_table($cgi->_table);
$tbl->getInfo();
$form = new MailForm();
$form->widgets = $tbl->columns;
$w =& $form->addWidget('hidden', '_table');
$w =& $form->addWidget('msubmit', 'submit_button');
$b1 =& $w->getButton();
$b1->setValues('Add');
$b2 =& $w->addButton('cancel_button');
$b2->setValues('Cancel');
$b2->extra = 'onclick="history.go (-1); return false"';
$form->error_mode = 'all';
if ($form->invalid($cgi)) {
$form->setValues($cgi);
page_title('Database Manager - Adding item to "' . $cgi->_table . '"');
echo $form->show();
} else {
$form->setValues($cgi);
$vals = $form->getValues();
unset($vals['_table']);
unset($vals['submit_button']);
unset($vals['cancel_button']);
$res = $tbl->insert($vals);