本文整理汇总了PHP中HTML_QuickForm::defaultRenderer方法的典型用法代码示例。如果您正苦于以下问题:PHP HTML_QuickForm::defaultRenderer方法的具体用法?PHP HTML_QuickForm::defaultRenderer怎么用?PHP HTML_QuickForm::defaultRenderer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HTML_QuickForm
的用法示例。
在下文中一共展示了HTML_QuickForm::defaultRenderer方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: drawLogin
/**
* function_description
*
* @author John.meng
* @since version - Jan 5, 2006
* @param datatype paramname description
* @return datatype description
*/
function drawLogin()
{
global $__Lang__, $UrlParameter, $SiteDB, $AddIPObj, $FlushPHPObj, $form, $smarty;
include_once PEAR_DIR . 'HTML/QuickForm.php';
$form = new HTML_QuickForm('firstForm');
$replace_str = "../";
$html_code = str_replace(ROOT_DIR, $replace_str, THEMES_DIR);
echo "<link href='" . $html_code . "style.css' rel='stylesheet' type='text/css'>";
$renderer =& $form->defaultRenderer();
$renderer->setFormTemplate("\n<form{attributes}>\n<table border=\"0\" class=\"log_table\" align=\"center\">\n{content}\n</table>\n</form>");
$renderer->setHeaderTemplate("\n\t<tr>\n\t\t<td class=\"log_table_head\" align=\"left\" valign=\"top\" colspan=\"2\" ><b>{header}</b></td>\n\t</tr>");
$form->addElement('header', null, "<img src=\"" . $html_code . "images/logo.gif\" border=\"0\" >");
$form->addElement('text', 'user_name', $__Lang__['langMenuUser'] . $__Lang__['langGeneralName'] . ' : ');
$form->addElement('password', 'user_passwd', $__Lang__['langMenuUser'] . $__Lang__['langGeneralPassword'] . ' : ');
$form->addRule('user_name', $__Lang__['langGeneralPleaseEnter'] . " " . $__Lang__['langMenuUser'] . " " . $__Lang__['langGeneralName'], 'required');
$form->addRule('user_passwd', $__Lang__['langGeneralPleaseEnter'] . " " . $__Lang__['langMenuUser'] . " " . $__Lang__['langGeneralPassword'], 'required');
$form->addElement('hidden', 'Action', 'LOGON');
$form->setDefaults(array('user_name' => $_COOKIE['UserName']));
$form->addElement('submit', null, $__Lang__['langGeneralSubmit']);
$form->addElement('static', 'login_message');
if ($form->validate() && $_POST['Action'] == 'LOGON') {
$user_name = $_POST['user_name'];
$user_password = md5($_POST['user_passwd']);
$this->checkAuth($user_name, $user_password);
}
$form->display();
exit;
}
示例2: __construct
public function __construct()
{
parent::__construct('delete_interest', 'Delete Interest', 'Admin/delete_interest.php');
if ($this->loginError) {
return;
}
$form = new HTML_QuickForm('deleter');
$interest_list = new pdAuthInterests($this->db);
$form->addElement('select', 'interests', 'Select interest(s) to delete:', $interest_list->list, array('multiple' => 'multiple', 'size' => 15));
$form->addGroup(array(HTML_QuickForm::createElement('button', 'cancel', 'Cancel', array('onclick' => 'history.back()')), HTML_QuickForm::createElement('submit', 'submit', 'Delete')), null, null, ' ', false);
if ($form->validate()) {
$values = $form->exportValues();
foreach ($values['interests'] as $interest_id) {
$names[] = $interest_list->list[$interest_id];
}
$interest_list->dbDelete($this->db, $values['interests']);
echo 'You have successfully removed the following interest from the ', 'database: <br/><b>', implode(', ', $names), '</b></p>', '<br><a href="', $_SERVER['PHP_SELF'], '">Delete another interest</a>';
} else {
$renderer =& $form->defaultRenderer();
$form->accept($renderer);
$this->form =& $form;
$this->renderer =& $renderer;
echo '<h3>Delete Interest </h3>';
}
}
示例3: opAdd
/**
* function_description
*
* @author John.meng
* @since version - Jan 19, 2006
* @param datatype paramname description
* @return datatype description
*/
function opAdd()
{
global $__Lang__, $UrlParameter, $SiteDB, $AddIPObj, $__SITE_VAR__, $form, $FlushPHPObj, $thisDAO, $smarty, $class_path;
include_once PEAR_DIR . 'HTML/QuickForm.php';
$form = new HTML_QuickForm('firstForm', 'post', '', '_self', "onsubmit='save_in_textarea_all();'");
$renderer =& $form->defaultRenderer();
$renderer->setFormTemplate("\n<form{attributes}>\n<table border=\"0\" class=\"new_table\" width='100%'>\n{content}\n</table>\n</form>");
$renderer->setHeaderTemplate("\n\t<tr>\n\t\t<td class=\"grid_table_head\" align=\"left\" valign=\"top\" colspan=\"2\"><b>{header}</b></td>\n\t</tr>");
$Content = $_POST['Content'];
if ($_REQUEST['Action'] == 'Update') {
$this_data = $this->_DAO->getRowByID(SITE_NEWS_TABLE, "NewsID", $_REQUEST['ID']);
$form->setDefaults(array("Title" => $this_data['Title'], "Summary" => $this_data['Summary'], "Source" => $this_data['Source'], "Author" => $this_data['Author']));
$Content = $this_data['Content'];
$form->addElement('hidden', 'ID', $this_data['NewsID']);
}
$class_path = INCLUDE_DIR . "editor/";
$CurrentUserPathImages = HTML_IMAGES_DIR;
$SiteCssFile = CURRENT_HTML_DIR . "style.css";
$ed_4 =& new rich("", 'Content', $Content, "380", "350", "../../" . $CurrentUserPathImages, "../../" . $CurrentUserPathImages, false, false);
$ed_4->set_default_stylesheet($SiteCssFile);
$ed_4->myModule(true);
$editors = $ed_4->draw();
$smarty->assign("class_path_editor", $class_path);
$form->addElement('header', null, $__Lang__['langGeneralAdd'] . " " . $__Lang__['langSiteModuleNews']);
$form->addElement('text', 'Title', $__Lang__['langModuleNewsTitle'] . ' : ', array('size' => 40));
$form->addElement('textarea', 'Summary', $__Lang__['langModuleNewsSummary'] . ' : ', array('rows' => 5, 'cols' => 40));
$form->addElement('static', 'Content', NULL, $editors);
$form->addElement('text', 'Source', $__Lang__['langModuleNewsSource'] . ' : ', array('size' => 30));
$form->addElement('text', 'Author', $__Lang__['langModuleNewsAuthor'] . ' : ', array('size' => 20));
$form->addElement('submit', null, $__Lang__['langGeneralSubmit']);
$form->addRule('Title', $__Lang__['langGeneralPleaseEnter'] . " " . $__Lang__['langModuleNewsTitle'], 'required');
$form->addElement('hidden', 'Module', $_REQUEST['Module']);
$form->addElement('hidden', 'Page', $_REQUEST['Page']);
$form->addElement('hidden', 'Action', $_REQUEST['Action']);
$form->addElement('hidden', 'MenuID', $_GET['MenuID']);
if ($form->validate()) {
if (get_magic_quotes_gpc()) {
$record["Content"] = stripslashes($_POST['Content']);
} else {
$record["Content"] = $_POST['Content'];
}
$record["Title"] = $_POST['Title'];
$record["Summary"] = $_POST['Summary'];
$record["Source"] = $_POST['Source'];
$record["Author"] = $_POST['Author'];
$record["SiteMenuID"] = $_POST['MenuID'];
$record = $record + $this->_DAO->baseField();
if ($_POST['ID'] && $_POST['Action'] == 'Update') {
$this->_DAO->opUpdate(SITE_NEWS_TABLE, $record, " NewsID = " . $_POST['ID']);
} else {
$this->_DAO->opAdd(SITE_NEWS_TABLE, $record);
}
echo "<SCRIPT LANGUAGE='JavaScript'>opener.window.location.reload();window.close();</SCRIPT>";
}
$html_code = "<link rel=\"StyleSheet\" type=\"text/css\" href=\"" . $class_path . "rich_files/rich.css\"><script language=\"JScript.Encode\" src=\"" . $class_path . "rich_files/rich.js\"></script>" . $form->toHTML();
$smarty->assign("Main", str_replace(ROOT_DIR, "../", $html_code));
}
示例4: viewList
/**
* View list
*
* @author John.meng
* @since version - Dec 23, 2005
* @param datatype paramname description
* @return datatype description
*/
function viewList()
{
global $__Lang__, $UrlParameter, $FlushPHPObj, $table, $page_data, $all_data, $links, $form, $smarty;
include_once PEAR_DIR . 'HTML/QuickForm.php';
include_once PEAR_DIR . "HTML/Table.php";
require_once PEAR_DIR . 'Pager/Pager.php';
$form = new HTML_QuickForm('viewList');
$renderer =& $form->defaultRenderer();
$renderer->setFormTemplate("\n<form{attributes}>\n<table border=\"0\" width=\"99%\" cellpadding=\"0\" cellspacing=\"0\" align=\"center\">\n{content}\n</table>\n</form>");
$tableAttrs = array("class" => "grid_table");
$table = new HTML_Table($tableAttrs);
$table->setAutoGrow(true);
// $table->setAutoFill("n/a");
$hrAttrs = array("class" => "grid_table_head");
$table->setRowAttributes(0, $hrAttrs, true);
$params = array('itemData' => $all_data, 'perPage' => 10, 'delta' => 3, 'append' => true, 'separator' => ' . ', 'clearIfVoid' => false, 'urlVar' => 'entrant', 'useSessions' => true, 'closeSession' => true, 'mode' => 'Jumping', 'prevImg' => $__Lang__['langPaginationPrev'], 'nextImg' => $__Lang__['langPaginationNext']);
$pager =& Pager::factory($params);
$page_data = $pager->getPageData();
$links = $pager->getLinks();
$selectBox = $pager->getPerPageSelectBox();
}
示例5: __construct
public function __construct()
{
parent::__construct('tag_non_ml');
if ($this->loginError) {
return;
}
$this->loadHttpVars();
$pubs =& $this->getNonMachineLearningPapers();
$form = new HTML_QuickForm('tag_non_ml_form', 'post', './tag_ml_submit.php');
$form->addElement('header', null, 'Citation</th><th style="width:7%">Is ML');
$count = 0;
foreach ($pubs as &$pub) {
$pub->dbLoad($this->db, $pub->pub_id, pdPublication::DB_LOAD_VENUE | pdPublication::DB_LOAD_CATEGORY | pdPublication::DB_LOAD_AUTHOR_FULL);
++$count;
$form->addGroup(array(HTML_QuickForm::createElement('static', null, null, $pub->getCitationHtml() . ' ' . getPubIcons($this->db, $pub, 0x7)), HTML_QuickForm::createElement('advcheckbox', 'pub_tag[' . $pub->pub_id . ']', null, null, null, array('no', 'yes'))), 'tag_ml_group', $count, '</td><td>', false);
}
$form->addElement('submit', 'submit', 'Submit');
$renderer =& $form->defaultRenderer();
$form->accept($renderer);
$this->renderer =& $renderer;
}
示例6: opLeftTop
/**
* function_description
*
* @author John.meng
* @since version - Jan 18, 2006
* @param datatype paramname description
* @return datatype description
*/
function opLeftTop()
{
global $__Lang__, $UrlParameter, $SiteDB, $AddIPObj, $__SITE_VAR__, $form, $FlushPHPObj, $thisDAO, $smarty, $class_path;
include_once PEAR_DIR . 'HTML/QuickForm.php';
$form = new HTML_QuickForm('firstForm', 'post', '', '_self', "onsubmit='save_in_textarea_all();'");
$renderer =& $form->defaultRenderer();
$renderer->setFormTemplate("\n<form{attributes}>\n<table border=\"0\" class=\"new_table\">\n{content}\n</table>\n</form>");
$renderer->setHeaderTemplate("\n\t<tr>\n\t\t<td class=\"grid_table_head\" align=\"left\" valign=\"top\" colspan=\"2\"><b>{header}</b></td>\n\t</tr>");
$class_path = INCLUDE_DIR . "editor/";
$CurrentUserPathImages = HTML_IMAGES_DIR;
$SiteCssFile = CURRENT_HTML_DIR . "style.css";
$Content = $this->_DAO->getSiteVarValue($__SITE_VAR__['SITE_LEFT_TOP'], SITE_LARGE_CONFIG_TABLE);
$ed_4 = new rich("", 'SiteQuickLink', $Content, "450", "350", "../../" . $CurrentUserPathImages, "../../" . $CurrentUserPathImages, false, false);
$ed_4->set_default_stylesheet($SiteCssFile);
$ed_4->myModule(true);
$editors = $ed_4->draw();
$smarty->assign("class_path_editor", $class_path);
$form->addElement('header', null, $__Lang__['langGeneralUpdate'] . " " . $__Lang__['langBaseInfo']);
$form->addElement('static', 'SiteQuickLink', NULL, $editors);
//array('rows' => 8, 'cols' => 40)
$form->addElement('submit', null, $__Lang__['langGeneralSubmit']);
$form->addElement('hidden', 'Module', $_REQUEST['Module']);
$form->addElement('hidden', 'Page', $_REQUEST['Page']);
$form->addElement('hidden', 'Action', $_REQUEST['Action']);
$form->addElement('hidden', 'Step', 'Step3');
if ($form->validate()) {
if (get_magic_quotes_gpc()) {
$record["VarValue"] = stripslashes($_POST['SiteQuickLink']);
} else {
$record["VarValue"] = $_POST['SiteQuickLink'];
}
$record["VarName"] = $__SITE_VAR__['SITE_LEFT_TOP'];
$record = $record + $this->_DAO->baseField();
$this->_DAO->autoInsertOrUpdate(SITE_LARGE_CONFIG_TABLE, $record, array('VersionCode', 'VarName'));
echo "<SCRIPT LANGUAGE='JavaScript'>opener.window.location.reload();window.close();</SCRIPT>";
}
$html_code = "<link rel=\"StyleSheet\" type=\"text/css\" href=\"" . $class_path . "rich_files/rich.css\"><script language=\"JScript.Encode\" src=\"" . $class_path . "rich_files/rich.js\"></script>" . $form->toHTML();
$smarty->assign("Main", str_replace(ROOT_DIR, "../", $html_code));
}
示例7: toHtml
/**
* renders the element
*
* @return string the HTML for the element
*/
function toHtml()
{
if (!isset($this->_renderer) || !is_a($this->_renderer, 'HTML_QuickForm_Renderer_Default')) {
$this->_renderer = clone HTML_QuickForm::defaultRenderer();
}
$this->_renderer->_html = $this->_renderer->_hiddenHtml = $this->_renderer->_groupTemplate = $this->_renderer->_groupWrap = '';
$this->_renderer->_groupElements = array();
$this->_renderer->_inGroup = false;
$this->_renderer->setFormTemplate(preg_replace('!</?form[^>]*>!', '', $this->_renderer->_formTemplate));
$this->_subForm->accept($this->_renderer);
return $this->_renderer->toHtml();
}
示例8: __construct
public function __construct()
{
parent::__construct('add_category');
$this->loadHttpVars();
if ($this->loginError) {
return;
}
$category = new pdCategory();
if (isset($this->cat_id)) {
if (!is_numeric($this->cat_id)) {
$this->pageError = true;
return;
}
$result = $category->dbLoad($this->db, $this->cat_id);
if (!$result) {
$this->pageError = true;
return;
}
}
if (isset($this->numNewFields)) {
if (!is_numeric($this->numNewFields)) {
$this->pageError = true;
return;
}
} else {
$this->numNewFields = 0;
}
if ($category->cat_id != '') {
$label = 'Edit Category';
} else {
$label = 'Add Category';
}
$this->pageTitle = $label;
$form = new HTML_QuickForm('catForm');
$form->addElement('header', null, $this->helpTooltip($label, 'addCategoryPageHelp', 'helpHeading'));
$form->addElement('text', 'catname', 'Category Name:', array('size' => 50, 'maxlength' => 250));
$form->addRule('catname', 'category name cannot be empty', 'required', null, 'client');
// info list
$label = 'Related Fields:';
$info_list = pdInfoList::create($this->db);
foreach ($info_list as $info_id => $name) {
$form->addElement('advcheckbox', 'info[' . $info_id . ']', $label, $name, null, array('', $name));
$label = '';
}
for ($i = 0; $i < $this->numNewFields; $i++) {
$form->addElement('text', 'new_fields[' . $i . ']', 'New field ' . ($i + 1) . ':', array('size' => 50, 'maxlength' => 250));
}
$form->addElement('hidden', 'numNewFields', $this->numNewFields);
$form->addGroup(array(HTML_QuickForm::createElement('reset', 'reset', 'Reset'), HTML_QuickForm::createElement('button', 'add_field', 'Add Related Field', array('onClick' => 'dataKeep(' . ($this->numNewFields + 1) . ');')), HTML_QuickForm::createElement('submit', 'submit', 'Submit New Category')), 'submit_group', null, ' ');
if ($form->validate()) {
$values = $form->exportValues();
$category->category = $values['catname'];
if (isset($values['new_fields'])) {
$values['info'] = array_merge($values['info'], $values['new_fields']);
}
foreach ($values['info'] as $infoname) {
if ($infoname == '') {
continue;
}
$obj = new stdClass();
$obj->name = $infoname;
$category->info[] = $obj;
}
$category->dbSave($this->db);
echo 'Category "', $category->category, '" succesfully added to the database.', '<p/>', '<a href="' . $_SERVER['PHP_SELF'] . '">', 'Add another new category</a>';
} else {
foreach (array_keys(get_class_vars(get_class($this))) as $member) {
$defaults[$member] = $this->{$member};
}
$defaults['catname'] = $category->category;
if (isset($category->info) && count($category->info) > 0) {
foreach ($category->info as $info_id => $name) {
$defaults['info[' . $info_id . ']'] = $name;
}
}
$form->setDefaults($defaults);
$renderer =& $form->defaultRenderer();
$form->accept($renderer);
$this->form =& $form;
$this->renderer =& $renderer;
$this->javascript();
}
}
示例9:
?>
// -->
</style>
<script type="text/javascript">
<!--
<?php
echo $monitor->getScript();
?>
//-->
</script>
</head>
<body>
<?php
$renderer =& HTML_QuickForm::defaultRenderer();
$renderer->setFormTemplate('
<form{attributes}>
<table width="450" border="0" cellpadding="3" cellspacing="2" bgcolor="#CCCC99">
{content}
</table>
</form>
');
$renderer->setHeaderTemplate('
<tr>
<td style="white-space:nowrap;background:#996;color:#ffc;" align="left" colspan="2"><b>{header}</b></td>
</tr>
');
$monitor->accept($renderer);
echo $renderer->toHtml();
$monitor->run();
示例10: editUser
public function editUser()
{
$this->db_authors = pdAuthorList::create($this->db, null, null, true);
$user =& $_SESSION['user'];
$user->collaboratorsDbLoad($this->db);
$form = new HTML_QuickForm('userForm', 'post', '', '', array('onsubmit' => 'return check_authors("userForm");'));
$form->addElement('static', 'login_label', 'Login:', $user->login);
$form->addElement('hidden', 'status', 'edit');
$form->addElement('hidden', 'login', $user->login);
$form->addElement('text', 'name', 'Name:', array('size' => 50, 'maxlength' => 100));
$form->addElement('text', 'email', 'E-mail:', array('size' => 50, 'maxlength' => 100));
$form->addElement('textarea', 'authors', 'Authors:', array('cols' => 60, 'rows' => 5, 'class' => 'wickEnabled:MYCUSTOMFLOATER', 'wrap' => 'virtual'));
$form->addElement('static', null, null, '<span class="small">' . 'There are ' . count($this->db_authors) . ' authors in the database. Type a partial name to ' . 'see a list of matching authors. Separate names ' . 'using commas.</span>');
$form->addElement('advcheckbox', 'option_internal_info', 'Options:', 'show internal info', null, array('No', 'Yes'));
$form->addElement('advcheckbox', 'option_user_info', 'Options:', 'show user info', null, array('No', 'Yes'));
$auth_list = pdAuthorList::create($this->db);
$form->addElement('submit', 'Submit', 'Save');
if ($form->validate()) {
$values = $form->exportValues();
assert('$values["login"] == $user->login');
$user->name = $values['name'];
$user->email = $values['email'];
$user->options = 0;
if ($values['option_internal_info'] == 'Yes') {
$user->options |= pdUser::OPTION_SHOW_INTERNAL_INFO;
}
if ($values['option_user_info'] == 'Yes') {
$user->options |= pdUser::OPTION_SHOW_USER_INFO;
}
unset($user->collaborators);
// need to retrieve author_ids for the selected authors
$selAuthors = explode(', ', preg_replace('/\\s\\s+/', ' ', $values['authors']));
$author_ids = array();
foreach ($selAuthors as $author) {
if (empty($author)) {
continue;
}
$result = array_search($author, $this->db_authors);
if ($result !== false) {
$user->collaborators[$result] = $this->db_authors[$result];
}
}
$user->dbSave($this->db);
echo 'Change to user information submitted.<p/>';
echo 'Click <a href="edit_user.php?status=edit">here</a> to edit your preferences again.';
} else {
echo '<h2>Login Information</h2>';
$defaults = array('name' => $user->name, 'email' => $user->email);
$defaults['option_internal_info'] = $user->showInternalInfo() ? 'Yes' : 'No';
$defaults['option_user_info'] = $user->showUserInfo() ? 'Yes' : 'No';
if (count($user->collaborators) > 0) {
$author_names = pdAuthorList::createFromAuthorIds($this->db, array_keys($user->collaborators), true);
$defaults['authors'] = implode(', ', array_values($author_names));
}
$form->setDefaults($defaults);
$renderer =& $form->defaultRenderer();
$form->accept($renderer);
$this->form =& $form;
$this->renderer =& $renderer;
$this->javascript();
}
}
示例11: elseif
$res .= '{{#if ' . $nom_champ . '}}' . "\n" . '<div class="BAZ_rubrique" data-id="' . $nom_champ . '">' . "\n" . '<span class="BAZ_label">' . $tableau[$i][2] . ' :</span>' . "\n" . '<span class="BAZ_texte">{{{' . $nom_champ . '}}}</span>' . "\n" . '</div> <!-- /.BAZ_rubrique -->' . "\n" . '{{/if}}' . "\n\n";
} elseif (function_exists($tableau[$i][0])) {
$texte = trim($tableau[$i][0]($formtemplate, $tableau[$i], 'html', array($nom_champ => '{{' . $nom_champ . '}}')));
if ($tableau[$i][0] == 'checkbox') {
$texte = preg_replace('|<span class="BAZ_texte">.*</span>|Uis', '<span class="BAZ_texte">{{{' . $nom_champ . '}}}</span>', $texte);
}
$res .= '{{#if ' . $nom_champ . '}}' . "\n" . $texte . "\n" . '{{/if}}' . "\n\n";
}
}
echo $res;
} elseif ($type == 'form') {
// template d'un formulaire bazar
$url = $this->href('json', $this->GetPageTag(), 'demand=save_entry');
//contruction du squelette du formulaire
$formtemplate = new HTML_QuickForm('formulaire', 'post', preg_replace('/&/', '&', $url));
$squelette =& $formtemplate->defaultRenderer();
$squelette->setFormTemplate('<form {attributes} class="form-horizontal content-padded list-spacer" ' . 'novalidate="novalidate">' . "\n" . '{content}' . "\n" . '</form>');
$squelette->setElementTemplate('<div class="control-group form-group">' . "\n" . '<div class="control-label col-xs-3">' . "\n" . '<!-- BEGIN required --><span class="symbole_obligatoire">*</span> <!-- END required -->' . "\n" . '{label} :</div>' . "\n" . '<div class="controls col-xs-8"> ' . "\n" . '{element}' . "\n" . '<!-- BEGIN error -->' . '<span class="alert alert-error alert-danger">{error}</span>' . '<!-- END error -->' . "\n" . '</div>' . "\n" . '</div>' . "\n");
$squelette->setElementTemplate('<div class="control-group form-group">' . "\n" . '<div class="liste_a_cocher"><strong>{label} {element}</strong>' . "\n" . '<!-- BEGIN required -->' . '<span class="symbole_obligatoire"> *</span>' . '<!-- END required -->' . "\n" . '</div>' . "\n" . '</div>' . "\n", 'accept_condition');
$squelette->setElementTemplate('<div class="form-actions">{label}{element}</div>' . "\n", 'groupe_boutons');
$squelette->setElementTemplate('<div class="control-group form-group">' . "\n" . '<div class="control-label col-xs-3">' . "\n" . '{label} :</div>' . "\n" . '<div class="controls col-xs-8"> ' . "\n" . '{element}' . "\n" . '</div>' . "\n" . '</div>', 'select');
$squelette->setRequiredNoteTemplate("<div class=\"symbole_obligatoire\">* {requiredNote}</div>\n");
//Traduction de champs requis
$formtemplate->setRequiredNote(_t('BAZ_CHAMPS_REQUIS'));
$formtemplate->setJsWarnings(_t('BAZ_ERREUR_SAISIE'), _t('BAZ_VEUILLEZ_CORRIGER'));
//antispam
$formtemplate->addElement('hidden', 'antispam', 1);
// generation du formulaire
$form = baz_afficher_formulaire_fiche('saisie', $formtemplate, $url, '', true);
$form = preg_replace('~<div class="form-actions">.*</div>~Ui', "\n" . '<a href="#" class="btn btn-block btn-positive btn-save">' . _t('BAZ_SAVE') . '</a>', $form);
$form = preg_replace('~<div id="map".*>~Ui', "\n" . '<div id="map">', $form);
示例12: mobile_rb_edit
//.........这里部分代码省略.........
$n = array();
foreach ($col_id as $cid) $n[] = $c[$cid];
$n = implode(' ',$n);
}
}
$comp[$k] = $n;
}
}
if (!empty($multi_adv_params['order'])) natcasesort($comp);
foreach ($records as $k=>$v) {
if (!empty($multi_adv_params['format_callback'])) $n = call_user_func($multi_adv_params['format_callback'], $v);
else {
// $n = $v[$col_id];
if ($single_column) $n = $v[$col_id[0]];
else {
$n = array();
foreach ($col_id as $cid) $n[] = $v[$cid];
$n = implode(' ',$n);
}
}
$comp[$k] = $n;
unset($ext_rec[$v['id']]);
}
if (empty($multi_adv_params['order'])) natcasesort($comp);
}
if ($args['type']==='select') $comp = array(''=>'---')+$comp;
$qf->addElement($args['type'], $args['id'], $label, $comp, array('id'=>$args['id']));
if($id!==false)
$qf->setDefaults(array($args['id']=>$rec[$args['id']]));
break;
case 'date': $qf->addElement('date',$args['id'],$label,array('format'=>'d M Y', 'minYear'=>date('Y')-95,'maxYear'=>date('Y')+5, 'addEmptyOption'=>true, 'emptyOptionText'=>'--'));
if ($val)
$qf->setDefaults(array($args['id'] => $val));
break;
case 'timestamp': $qf->addElement('date',$args['id'],$label,array('format'=>'d M Y H:i', 'minYear'=>date('Y')-95,'maxYear'=>date('Y')+5, 'addEmptyOption'=>true, 'emptyOptionText'=>'--'));
if($val) {
$default = Base_RegionalSettingsCommon::time2reg($val, true, true, true, false);
$qf->setDefaults(array($args['id'] => $default));
}
break;
case 'time': $qf->addElement('date',$args['id'],$label,array('format'=>'H:i', 'addEmptyOption'=>true, 'emptyOptionText'=>'--'));
if($val) {
$default = Base_RegionalSettingsCommon::time2reg($val, true, true, true, false);
$qf->setDefaults(array($args['id'] => $default));
}
break;
case 'multiselect': //ignore
if($id===false) continue;
$val = Utils_RecordBrowserCommon::get_val($tab,$field,$rec,true,$args);
if($val==='') continue;
$qf->addElement('static',$args['id'],$label);
$qf->setDefaults(array($args['id']=>$val));
unset($defaults[$args['id']]);
break;
}
if($args['required'])
$qf->addRule($args['id'],__('Field required'),'required');
}
$qf->addElement('submit', 'submit_button', __('Save'),IPHONE?'class="button white"':'');
if($qf->validate()) {
$values = $qf->exportValues();
foreach ($cols as $v) {
if ($v['type']=='checkbox' && !isset($values[$v['id']])) $values[$v['id']]=0;
elseif($v['type']=='date') {
if(is_array($values[$v['id']]) && $values[$v['id']]['Y']!=='' && $values[$v['id']]['M']!=='' && $values[$v['id']]['d']!=='')
$values[$v['id']] = sprintf("%d-%02d-%02d", $values[$v['id']]['Y'], $values[$v['id']]['M'], $values[$v['id']]['d']);
else
$values[$v['id']] = '';
} elseif($v['type']=='timestamp') {
if($values[$v['id']]['Y']!=='' && $values[$v['id']]['M']!=='' && $values[$v['id']]['d']!=='' && $values[$v['id']]['H']!=='' && $values[$v['id']]['i']!=='') {
$timestamp = $values[$v['id']]['Y'] . '-' . $values[$v['id']]['M'] . '-' . $values[$v['id']]['d'] . ' ' . $values[$v['id']]['H'] . ':' . $values[$v['id']]['i'];
$values[$v['id']] = Base_RegionalSettingsCommon::reg2time($timestamp, true);
} else
$values[$v['id']] = '';
} elseif($v['type']=='time') {
if($values[$v['id']]['H']!=='' && $values[$v['id']]['i']!=='') {
$time = recalculate_time(date('Y-m-d'), $values[$v['id']]);
$timestamp = Base_RegionalSettingsCommon::reg2time(date('1970-01-01 H:i:s', $time), true);
$values[$v['id']] = date('1970-01-01 H:i:s', $timestamp);
} else
$values[$v['id']] = '';
}
}
foreach ($defaults as $k=>$v)
if (!isset($values[$k])) $values[$k] = $v;
if($id!==false) {
$values['id'] = $id;
Utils_RecordBrowserCommon::update_record($tab, $id, $values);
} else {
$id = Utils_RecordBrowserCommon::new_record($tab, $values);
}
return false;
}
$renderer =& $qf->defaultRenderer();
$qf->accept($renderer);
print($renderer->toHtml());
}
示例13: array
}
}
//display table
if (IPHONE) {
print '</ul>';
} else {
Utils_GenericBrowserCommon::mobile_table($cols_out, $data_out, false);
}
//display paging
$cur_num_rows = Utils_RecordBrowserCommon::get_records_count($table, $crits);
if ($offset > 0) {
print '<a ' . (IPHONE ? 'class="button red" ' : '') . 'href="mobile.php?' . http_build_query(array_merge($_GET, array('rb_offset' => $offset - 1))) . '">' . __('Prev') . '</a>';
}
if ($offset < $cur_num_rows / $num_rows - 1) {
print ' <a ' . (IPHONE ? 'class="button green" ' : '') . 'href="mobile.php?' . http_build_query(array_merge($_GET, array('rb_offset' => $offset + 1))) . '">' . __('Next') . '</a>';
}
if ($cur_num_rows > $num_rows) {
$qf = new HTML_QuickForm('rb_page', 'get', 'mobile.php?' . http_build_query($_GET));
$qf->addElement('text', 'rb_offset', __('Page(0-%d)', array($cur_num_rows / $num_rows)));
$qf->addElement('submit', 'submit_button', __('OK'), IPHONE ? 'class="button white"' : '');
$qf->addRule('rb_offset', __('Field required'), 'required');
$qf->addRule('rb_offset', __('Invalid page number'), 'numeric');
$renderer =& $qf->defaultRenderer();
/* if(IPHONE) {
$renderer->setFormTemplate("<form{attributes}>{hidden}<ul>{content}</ul></form>");
$renderer->setElementTemplate('<li class="error"><!-- BEGIN required --><span style="color: #ff0000">*</span><!-- END required -->{label}<!-- BEGIN error --><span style=\"color: #ff0000\">{error}</span><!-- END error -->{element}</li>');
$renderer->setRequiredNoteTemplate("<li>{requiredNote}</li>");
} */
$qf->accept($renderer);
print $renderer->toHtml();
}
示例14: __construct
public function __construct()
{
parent::__construct('list_venues');
if ($this->loginError) {
return;
}
$this->loadHttpVars(true, false);
if (!isset($this->tab)) {
$this->tab = 'A';
} else {
if (strlen($this->tab) != 1 || ord($this->tab) < ord('A') || ord($this->tab) > ord('Z')) {
$this->pageError = true;
return;
}
}
$venue_list = pdVenueList::create($this->db, array('starting_with' => $this->tab, 'cat_id' => $this->cat_id));
$this->category = new pdCategory();
$this->category->dbLoad($this->db, $this->cat_id);
$form = new HTML_QuickForm('cat_selection', 'get', 'list_venues.php');
$form->addElement('hidden', 'tab', $this->tab);
$form->addElement('select', 'cat_id', 'Category:', array('' => '-- All Categories --') + pdCatList::create($this->db), array('onchange' => 'update();'));
$renderer =& $form->defaultRenderer();
$form->accept($renderer);
$form->setDefaults(array('cat_id' => ''));
$alpha_menu = $this->alphaSelMenu($this->tab, get_class($this) . '.php');
// put category id in the alpha menu
if (!empty($this->cat_id)) {
$alpha_menu = preg_replace('/tab=(\\w)/', "tab=\\1&cat_id={$this->cat_id}", $alpha_menu);
}
$this->javascript();
echo $alpha_menu;
echo '<h2>Publication Venues</h2>';
echo $renderer->toHtml();
if (empty($venue_list) || count($venue_list) == 0) {
echo 'No venues with name starting with ', $this->tab, '<br/>';
return;
}
foreach ($venue_list as $venue) {
// only show global venues
if ($venue->v_usage == 'single') {
continue;
}
$venue->dbLoad($this->db, $venue->venue_id);
$table = new HTML_Table(array('class' => 'publist'));
$cells = array();
$text = '';
if ($venue->title != '') {
$text .= '<b>' . $venue->title . '</b><br/>';
}
$v_cat = $venue->categoryGet();
if (!empty($v_cat)) {
$text .= '<b>' . ucfirst($v_cat) . '</b>: ';
}
$url = $venue->urlGet();
if ($url != null) {
$text .= '<a href="' . $url . '" target="_blank">';
}
$text .= $venue->nameGet();
if ($url != null) {
$text .= '</a>';
}
if (!empty($venue->options)) {
$vopt_names = $venue->voptsGet();
foreach ($venue->options as $vopt_id => $value) {
if (!empty($value)) {
$text .= '<br/><b>' . $vopt_names[$vopt_id] . '</b>: ' . $value;
}
}
}
if ($venue->editor != '') {
$text .= "<br/><b>Editor: </b>" . $venue->editor;
}
if (isset($venue->ranking)) {
$text .= '<br/><b>Ranking</b>: ' . $venue->ranking;
}
// display occurrences
if (count($venue->occurrences) > 0) {
foreach ($venue->occurrences as $occ) {
$text .= '<br/>';
$date = explode('-', $occ->date);
if ($occ->url != '') {
$text .= '<a href="' . $occ->url . '" target="_blank">';
}
$text .= $date[0];
if ($occ->url != '') {
$text .= '</a>';
}
if ($occ->location != '') {
$text .= ', ' . $occ->location;
}
}
} else {
if ($venue->date != '' && $venue->date != '0000-00-00') {
$date = explode('-', $venue->date);
$text .= "<br/><b>Date: </b>" . $date[0] . '-' . $date[1];
}
}
$pub_count = pdPubList::create($this->db, array('venue_id_count' => $venue->venue_id));
$text .= '<a href="list_publication.php?venue_id=' . $venue->venue_id . '&menu=0"><span class="small" style="color:#000;font-weight:normal;">' . '<br/>Publication entries: ' . $pub_count . '</span></a>';
$cells[] = $text;
//.........这里部分代码省略.........
示例15: __construct
public function __construct()
{
parent::__construct('batch_add_authors');
if ($this->loginError) {
return;
}
$this->use_mootools = true;
$form = new HTML_QuickForm('batch_add', 'post', null, '_self', 'multipart/form-data');
$tooltip = <<<TOOLTIP_END
New Authors::A semi-colon separated list of author names. Names can be in the following
formats:
<ul>
<li>fist last</li>
<li>fist initials last</li>
<li>last, first</li>
<li>last, first initials</li>
</ul>
TOOLTIP_END;
$form->addGroup(array(HTML_QuickForm::createElement('textarea', 'new_authors', null, array('cols' => 60, 'rows' => 10)), HTML_QuickForm::createElement('static', 'kwgroup_help', null, '<span class="small">Name format is: GIVEN_NAME1 [GIVEN_NAME2 .. etc.] LAST_NAME. Separate using semi-colons (;)</span>')), 'new_auth_group', "<span class=\"Tips1\" title=\"{$tooltip}\">New Authors:</span>", '<br/>', false);
$form->addGroup(array(HTML_QuickForm::createElement('submit', 'submit', 'Add New Authors'), HTML_QuickForm::createElement('button', 'cancel', 'Cancel', array('onclick' => 'history.back()'))), null, null, ' ', false);
if ($form->validate()) {
$values = $form->exportValues();
$values['new_authors'] = preg_replace("/;\\s*;/", ';', $values['new_authors']);
$new_authors = preg_split('/;\\s*/', $values['new_authors']);
$fl_auth_list = pdAuthorList::create($this->db, null, null, true);
$in_db_auths = array_intersect($fl_auth_list, $new_authors);
$new_auths = array_diff($new_authors, $fl_auth_list);
foreach ($new_auths as $auth_name) {
$auth = new pdAuthor();
$auth->nameSet($auth_name);
$auth->dbSave($this->db);
unset($auth);
}
if (count($in_db_auths) > 0) {
echo 'These authors were already in the database:<ul>';
foreach ($in_db_auths as $auth_name) {
echo '<li>', $auth_name, '</li>';
}
}
if (count($new_auths) > 0) {
if (count($in_db_auths) > 0) {
echo '</ul>', 'Only these authors were added to the database:', '<ul>';
} else {
echo 'These authors were added to the database:<ul>';
}
foreach ($new_auths as $auth_name) {
echo '<li>', $auth_name, '</li>';
}
echo '</ul>';
} else {
echo '</ul>No authors were added to the database.';
}
} else {
echo '<h2>Batch Add Authors</h2>';
$renderer =& $form->defaultRenderer();
$form->setRequiredNote('<font color="#FF0000">*</font> shows the required fields.');
$form->accept($renderer);
$this->form =& $form;
$this->renderer =& $renderer;
$this->js = <<<JS_END
window.addEvent('domready', function() {
var Tips1 = new Tips(\$\$('.Tips1'));
});
JS_END;
}
}