本文整理汇总了PHP中form::set_field方法的典型用法代码示例。如果您正苦于以下问题:PHP form::set_field方法的具体用法?PHP form::set_field怎么用?PHP form::set_field使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类form
的用法示例。
在下文中一共展示了form::set_field方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: drawEventForm
function drawEventForm()
{
global $page;
$f = new form('cal_events', @$_GET['id'], $page['title']);
if (url_id()) {
$f->set_title_prefix(drawHeader(false, ' '));
}
if ($page['is_admin']) {
$f->set_field(array('name' => 'created_user', 'class' => 'admin', 'type' => 'select', 'sql' => 'SELECT id, CONCAT_WS(", ", lastname, firstname) FROM users WHERE is_active = 1 ORDER BY lastname, firstname', 'default' => $_SESSION['user_id'], 'required' => true, 'label' => getString('posted_by')));
}
$f->set_field(array('name' => 'title' . langExt(), 'label' => getString('title'), 'type' => 'text'));
$f->set_field(array('name' => 'start_date', 'label' => getString('start_date'), 'type' => 'datetime', 'required' => true));
$f->set_field(array('name' => 'end_date', 'label' => getString('end_date'), 'type' => 'datetime', 'required' => true));
$f->set_field(array('name' => 'type_id', 'type' => 'select', 'sql' => 'SELECT id, description' . langExt() . ' FROM cal_events_types ORDER BY description', 'label' => getString('category'), 'required' => 'true'));
$f->set_field(array('name' => 'description' . langExt(), 'label' => getString('description'), 'type' => 'textarea', 'class' => 'tinymce'));
langUnsetFields($f, 'title,description');
formAddChannels($f, 'cal_events', 'event_id');
$f->set_order('created_user,title, start_date, end_date, type_id, description, channels');
langTranslateCheckbox($f, url_id());
return $f->draw(false, false);
}
示例2: drawTop
db_delete('organizations', $_GET['delete_id']);
url_drop('delete_id,action');
}
echo drawTop();
if (url_id()) {
//form
$f = new form('organizations', @$_GET['id']);
$f->set_field(array('type' => 'text', 'name' => 'title' . langExt(), 'label' => getString('title')));
langUnsetFields($f, 'title');
langTranslateCheckbox($f);
echo $f->draw();
} else {
//modules list
$t = new table('organizations', drawHeader());
$t->set_column('draggy', 'd', ' ');
$t->set_column('title', 'l', getString('title'));
$t->set_column('delete', 'd', ' ');
$result = db_table('SELECT id, title' . langExt() . ' title FROM organizations WHERE is_active = 1 ORDER BY precedence');
foreach ($result as &$r) {
$r['draggy'] = draw_img('/images/icons/move.png');
$r['title'] = draw_link('organizations.php?id=' . $r['id'], $r['title']);
$r['delete'] = drawColumnDelete($r['id']);
}
echo $t->draw($result, 'No organizations');
//add new
$f = new form('organizations');
$f->set_field(array('type' => 'text', 'name' => 'title' . langExt(), 'label' => getString('title')));
langUnsetFields($f, 'title');
echo $f->draw(false, false);
}
echo drawBottom();
示例3: elseif
//$r["title"] = str_replace("The Associated Press: ", "", $r["title"]);
} elseif ($url["domainname"] == "google" && $url["subfolder"] == "afp") {
$r["publication"] = "AFP";
$r["title"] = str_replace("Afp: ", "", $r["title"]);
} elseif ($url["domainname"] == "google" && $url["subfolder"] == "ap") {
$r["publication"] = "AP";
$r["title"] = str_replace("The Associated Press: ", "", $r["title"]);
}
}
}
//to control return_to redirects. i'm not sure how i should handle this generally. it's a problem mainly when the page is included
if ($referrer && $referrer["host"] == $request["host"]) {
$_josh["referrer"] = false;
}
$f = new form('press_clips', @$_GET['id'], $action);
if (!$included) {
$f->set_title_prefix($page['breadcrumbs']);
}
$f->set_field(array('name' => 'title' . langExt(), 'type' => 'text', 'label' => getString('title')));
$f->set_field(array('name' => 'url', 'type' => 'text', 'label' => getString('url')));
$f->set_field(array('name' => 'publication' . langExtT(), 'type' => 'text', 'label' => getString('publication')));
$f->set_field(array('name' => 'pub_date', 'type' => 'date', 'label' => getString('published'), 'required' => true));
$f->set_field(array('name' => 'description' . langExt(), 'type' => 'textarea', 'label' => getString('description'), 'class' => 'tinymce'));
$f->set_field(array('name' => 'type_id', 'label' => getString('category'), 'type' => 'select', 'sql' => 'SELECT id, title' . langExt() . ' title FROM press_clips_types ORDER BY precedence', 'required' => true));
formAddChannels($f, 'press_clips', 'clip_id');
langUnsetFields($f, 'title,description,publication');
langTranslateCheckbox($f, url_id());
echo $f->draw(@$r, !$included);
if (!$included) {
echo drawBottom();
}
示例4: drawTop
<?php
include '../../include.php';
if ($posting) {
format_post_bits('is_selected');
langTranslatePost('name,description');
$id = db_save('soc_members');
url_change_post('../');
}
echo drawTop();
$f = new form('soc_members', @$_GET['id'], $page['title']);
$f->set_field(array('name' => 'name' . langExt(), 'type' => 'text', 'label' => getString('title')));
$f->set_field(array('name' => 'country_id', 'type' => 'select', 'sql' => 'SELECT id, en FROM jr_countries ORDER BY en'));
$f->set_field(array('name' => 'description' . langExt(), 'type' => 'textarea', 'class' => 'tinymce', 'label' => getString('description')));
langUnsetFields($f, 'name,description');
langTranslateCheckbox($f);
$f->set_title_prefix($page['breadcrumbs']);
echo $f->draw();
echo drawBottom();
示例5: drawTop
<?php
include '../../include.php';
echo drawTop();
$f = new form('translate', false, $page['title']);
$f->set_field(array('type' => 'textarea', 'name' => 'text_to_translate', 'class' => 'tinymce', 'label' => 'English text', 'value' => @$_POST['text_to_translate']));
$f->set_title_prefix($page['breadcrumbs']);
echo $f->draw();
if ($posting) {
echo draw_div_class('message', language_translate(@$_POST['text_to_translate'], 'en', 'es'));
echo draw_div_class('message', language_translate(@$_POST['text_to_translate'], 'en', 'fr'));
echo draw_div_class('message', language_translate(@$_POST['text_to_translate'], 'en', 'ru'));
}
echo drawBottom();
示例6: drawTop
<?php
include '../../include.php';
if ($posting) {
langTranslatePost('title,description');
db_save('pages');
url_change_post('./');
}
echo drawTop();
$f = new form('pages', @$_GET['id']);
$f->set_field(array('type' => 'text', 'name' => 'title' . langExt(), 'label' => getString('title')));
$f->set_field(array('type' => 'textarea', 'class' => 'tinymce', 'name' => 'description' . langExt(), 'label' => getString('description')));
$f->unset_fields('url,isSecure');
if (url_id('module_id')) {
$f->set_field(array('type' => 'hidden', 'name' => 'module_id', 'value' => $_GET['module_id']));
} else {
$f->unset_fields('module_id');
}
if (url_id('modulette_id')) {
$f->set_field(array('type' => 'hidden', 'name' => 'modulette_id', 'value' => $_GET['modulette_id']));
} else {
$f->unset_fields('modulette_id');
}
if (isset($_GET['url'])) {
$f->set_field(array('type' => 'hidden', 'name' => 'url', 'value' => $_GET['url']));
}
langUnsetFields($f, 'title,description');
langTranslateCheckbox($f);
echo $f->draw();
echo drawBottom();
示例7: drawTop
}
$id = db_save('dl_docs', @$_GET['doc_id']);
db_checkboxes('categories', 'dl_docs_to_categories', 'doc_id', 'category_id', $id);
url_drop('id');
} elseif (url_action('delete')) {
db_delete('dl_docs');
url_drop('id,action');
}
echo drawTop();
if (!empty($_GET['doc_id'])) {
if ($_GET['doc_id'] == 'new') {
$_GET['doc_id'] = false;
}
$f = new form('dl_docs', @$_GET['doc_id'], ($_GET['doc_id'] ? 'Edit' : 'Add') . ' Document');
$f->set_title_prefix($page['breadcrumbs']);
$f->set_field(array('name' => 'title', 'label' => getString('title'), 'type' => 'text'));
$f->unset_fields('extension');
$f->set_field(array('name' => 'content', 'label' => getString('file'), 'type' => 'file', 'additional' => getString('upload_max') . file_get_max()));
$f->set_field(array('name' => 'categories', 'label' => getString('categories'), 'type' => 'checkboxes', 'options_table' => 'dl_categories', 'option_title' => 'title', 'linking_table' => 'dl_docs_to_categories', 'object_id' => 'doc_id', 'option_id' => 'category_id'));
echo $f->draw();
} else {
$result = db_table('SELECT
d.id,
d.title,
' . db_updated('d') . ',
d.extension,
c.title "group"
FROM dl_docs d
JOIN dl_docs_to_categories d2c ON d.id = d2c.doc_id
JOIN dl_categories c ON d2c.category_id = c.id
ORDER BY c.precedence, d.title;');
示例8: drawSimpleTop
<?php
//this one is not public
include '../include.php';
if ($posting) {
db_query('UPDATE users SET password = PWDENCRYPT("' . $_POST['password1'] . '") WHERE id = ' . $_SESSION['user_id']);
$_SESSION['password'] = false;
url_change($_SESSION['homepage']);
}
echo drawSimpleTop(getString('password_update'));
$f = new form('password_update', false, getString('password_reset'));
$f->set_field(array('type' => 'password', 'name' => 'password1', 'label' => getString('password')));
$f->set_field(array('type' => 'password', 'name' => 'password2', 'label' => getString('confirm')));
echo $f->draw();
echo drawSimpleBottom();
示例9: implode
) {
alert('Only these filetypes are supported by this system:\n\n <?php
echo implode('\\n', $doctypes);
?>
\n\nPlease change your selection, or make sure that the \nappropriate extension is at the end of the filename.');
return false;
}
}
return true;
}
//-->
</script>
<?php
$f = new form('docs', @$_GET['id'], $page['title']);
$f->set_title_prefix($page['breadcrumbs']);
$f->set_field(array('name' => 'title' . langExt(), 'label' => getString('title'), 'type' => 'text'));
$f->set_field(array('name' => 'description' . langExt(), 'label' => getString('description'), 'type' => 'textarea', 'class' => 'tinymce'));
$f->set_field(array('name' => 'content', 'label' => getString('file'), 'type' => 'file', 'additional' => getString('upload_max') . file_get_max()));
$f->unset_fields('type_id,is_deleted');
if (getOption('languages')) {
$f->set_field(array('name' => 'language_id', 'type' => 'select', 'sql' => 'SELECT id, title FROM languages ORDER BY title', 'label' => getString('language'), 'required' => true));
} else {
$f->unset_fields('language_id');
}
$f->unset_fields('type_id');
formAddChannels($f, 'docs', 'doc_id');
$f->set_field(array('name' => 'categories', 'label' => getString('categories'), 'type' => 'checkboxes', 'options_table' => 'docs_categories', 'option_title' => 'title' . langExt(), 'linking_table' => 'docs_to_categories', 'object_id' => 'documentID', 'option_id' => 'categoryID'));
langUnsetFields($f, 'title,description');
langTranslateCheckbox($f, url_id());
echo $f->draw();
echo drawBottom();
示例10: getString
$title = getString('add_new');
$_josh['referrer'] = false;
$_josh['request']['path_query'] = 'edit.php';
//shoddy way of setting the form target
$r['url'] = 'http://';
} else {
url_query_require();
echo drawTop();
$title = $page['title'];
$r = db_grab('SELECT id, title, url, description from external_orgs WHERE id = ' . $_GET['id']);
}
if ($included) {
$_GET['id'] = false;
}
//type id was auto-setting checkbox
echo '<a name="bottom"></a>';
$f = new form('external_orgs', @$_GET['id'], $title);
if (!$included) {
$f->set_title_prefix(drawHeader(false, ' '));
}
$f->set_field(array('name' => 'title' . langExt(), 'type' => 'text', 'label' => getString('title')));
$f->set_field(array('name' => 'description' . langExt(), 'type' => 'textarea', 'label' => getString('description'), 'class' => 'tinymce'));
$f->set_field(array('name' => 'url' . langExt(), 'type' => 'text', 'label' => getString('url')));
$f->set_field(array('name' => 'types', 'label' => getString('type'), 'option_title' => 'title' . langExt(), 'type' => 'checkboxes', 'options_table' => 'external_orgs_types', 'linking_table' => 'external_orgs_to_types', 'object_id' => 'org_id', 'option_id' => 'type_id'));
formAddChannels($f, 'external_orgs', 'org_id');
langUnsetFields($f, 'title,description');
langTranslateCheckbox($f, url_id());
echo $f->draw($r, !$included);
if (!$included) {
echo drawBottom();
}
示例11: drawTop
db_delete('users_requests', $_GET['requestID']);
error_debug('deleted user request', __FILE__, __LINE__);
}
url_change('view.php?id=' . $id);
} elseif (url_id('requestID')) {
$values = db_grab('SELECT * FROM users_requests WHERE id = ' . $_GET['requestID']);
} else {
$values = false;
}
echo drawTop();
$f = new form('users', @$_GET['id'], $page['title']);
$f->set_title_prefix($page['breadcrumbs']);
//public info
$f->set_group(getString('public_info'), increment());
$f->unset_fields(array('image_medium', 'image_small', 'password', 'lastLogin', 'imageID', 'layoutID', 'homepage', 'notify_topics'));
$f->set_field(array('name' => 'firstname', 'type' => 'text', 'label' => getString('name_first'), 'position' => increment()));
$f->set_field(array('name' => 'nickname', 'type' => 'text', 'label' => getString('nickname'), 'position' => increment()));
$f->set_field(array('name' => 'lastname', 'type' => 'text', 'label' => getString('name_last'), 'position' => increment()));
$f->set_field(array('type' => 'select', 'name' => 'organization_id', 'label' => getString('organization'), 'sql' => 'SELECT id, title' . langExt() . ' title FROM organizations WHERE is_active = 1 ORDER BY precedence', 'required' => true, 'position' => increment()));
$f->set_field(array('name' => 'email', 'type' => 'text', 'label' => getString('email'), 'position' => increment()));
$f->set_field(array('name' => 'title' . langExt(), 'type' => 'text', 'label' => getString('staff_title'), 'position' => increment()));
$f->set_field(array('name' => 'image_large', 'type' => 'file', 'label' => getString('image'), 'position' => increment()));
if (getOption('languages')) {
$f->set_field(array('type' => 'select', 'name' => 'language_id', 'label' => getString('language'), 'sql' => 'SELECT id, title FROM languages ORDER BY title', 'required' => true, 'position' => increment()));
} else {
$f->set_hidden('language_id', 1);
}
if (getOption('staff_showdept')) {
$f->set_field(array('type' => 'select', 'name' => 'departmentID', 'label' => getString('department'), 'sql' => 'SELECT departmentID, departmentName FROM departments WHERE is_active = 1 ORDER BY precedence', 'position' => increment()));
} else {
$f->unset_fields('departmentID');
示例12: draw_img
return true;
}
//-->
</script>
</head>
<body>
<div id="container">
<div id="white">
<?php
$corners = array('top-left', 'top-right', 'bottom-left', 'bottom-right');
foreach ($corners as $c) {
echo draw_div_class($c, draw_img('/images/corners-white/' . $c . '.png'));
}
echo draw_img(DIRECTORY_WRITE . "/login.png");
$f = new form('login', false, getString('submit'));
$f->set_field(array('name' => 'email', 'type' => 'text', 'label' => getString('email'), 'value' => @$_COOKIE["last_email"]));
$f->set_field(array('name' => 'password', 'type' => 'password', 'label' => getString('password')));
$f->set_field(array('name' => 'goto', 'type' => 'hidden', 'value' => @$_GET["goto"]));
$f->set_focus(@$_COOKIE["last_email"] ? 'password' : 'email');
echo $f->draw();
?>
</div>
<div id="grey">
<?php
foreach ($corners as $c) {
echo draw_div_class($c, draw_img('/images/corners-grey/' . $c . '.png'));
}
echo getString("app_welcome");
echo draw_nav(array('/login/password_reset.php' => getString("login_forgot_password"), '/login/account_request.php' => getString("login_need_account"), 'mailto:' . $_josh['email_default'] => getString("login_ask_question")));
?>
</div>
示例13: drawSimpleTop
$value = db_grab('SELECT title from organizations WHERE id = ' . $value);
} elseif ($key == 'Additional Info') {
$value = nl2br($value);
}
$message .= '<tr><td class="left">' . $key . '</td><td>' . $value . '</td></tr>';
}
$message .= '<tr><td colspan="2" class="bottom">' . draw_link($link, 'click here') . '</td></tr>';
$message = '<table border="1">' . $message . '</table>';
emailAdmins($message, $subject);
}
url_change('account_confirm.php');
}
echo drawSimpleTop(getString('login_account_request'));
echo drawMessage(getString('login_account_request_msg'));
$f = new form('users_requests', false, getString('login_account_request'));
$f->set_field(array('type' => 'select', 'sql' => 'SELECT id, title' . langExt() . ' title FROM organizations WHERE is_active = 1 ORDER BY precedence', 'name' => 'organization_id', 'label' => getString('organization'), 'required' => true, 'null_value' => getString('please_select')));
$f->set_field(array('type' => 'text', 'name' => 'firstname', 'label' => getString('name_first')));
$f->set_field(array('type' => 'text', 'name' => 'nickname', 'label' => getString('nickname')));
$f->set_field(array('type' => 'text', 'name' => 'lastname', 'label' => getString('name_last')));
$f->set_field(array('type' => 'text', 'name' => 'title', 'label' => getString('staff_title')));
$f->set_field(array('type' => 'text', 'name' => 'phone', 'label' => getString('telephone')));
$f->set_field(array('type' => 'text', 'name' => 'email', 'label' => getString('email')));
if (getOption('staff_showoffice')) {
$f->set_field(array('type' => 'select', 'name' => 'officeID', 'label' => getString('location'), 'sql' => 'SELECT id, name FROM offices ORDER BY precedence', 'required' => true));
} else {
$f->unset_fields('officeID');
}
if (getOption('staff_showdept')) {
$f->set_field(array('type' => 'select', 'name' => 'departmentID', 'label' => getString('department'), 'sql' => 'SELECT departmentID, departmentName FROM departments WHERE is_active = 1 ORDER BY precedence'));
} else {
$f->unset_fields('departmentID');
示例14: drawSimpleTop
if ($posting) {
if ($r = db_grab('SELECT id FROM users WHERE email = "' . $_POST['email'] . '" AND is_active = 1')) {
emailPassword($r);
url_change('password_confirm.php');
} else {
url_query_add(array('msg' => 'email-not-found', 'email' => $_POST['email']));
//bad email
}
} elseif (url_id()) {
$_SESSION['user_id'] = false;
db_query('UPDATE users SET password = NULL WHERE id = ' . $_GET['id'] . ' AND is_active = 1');
if ($email = db_grab('SELECT email FROM users WHERE id = ' . $_GET['id'] . ' AND is_active = 1')) {
login($email, '', true);
url_change($_SESSION['homepage']);
} else {
url_change(false);
}
} else {
cookie('last_login');
$_SESSION['user_id'] = false;
}
echo drawSimpleTop(getString('password_reset'));
if (@$_GET['msg'] == 'email-not-found') {
echo drawMessage(getString('login_password_reset_msg_email_not_found'));
} else {
echo drawMessage(getString('login_password_reset_msg'));
}
$form = new form('login', false, getString('password_reset'));
$form->set_field(array('name' => 'email', 'label' => getString('email'), 'type' => 'text', 'value' => @$_GET['email']));
echo $form->draw();
echo drawSimpleBottom();
示例15: drawTopicForm
function drawTopicForm()
{
global $page;
$f = new form('bb_topics', @$_GET['id'], getString('topic_new'));
if ($page['is_admin']) {
$f->set_field(array('name' => 'created_user', 'class' => 'admin', 'type' => 'select', 'sql' => 'SELECT id, CONCAT_WS(", ", lastname, firstname) FROM users WHERE is_active = 1 ORDER BY lastname, firstname', 'default' => user(), 'required' => true, 'label' => getString('posted_by')));
}
if ($page['is_admin'] && !getOption('bb_notifypost')) {
$f->set_field(array('name' => 'is_admin', 'class' => 'admin', 'type' => 'checkbox', 'label' => getString('is_admin')));
} else {
$f->unset_fields('is_admin');
}
$f->set_field(array('name' => 'title' . langExt(), 'type' => 'text', 'label' => getString('title')));
if (getOption('bb_types')) {
$f->set_field(array('name' => 'type_id', 'type' => 'select', 'sql' => 'SELECT id, title' . langExt() . ' title FROM bb_topics_types', 'label' => getString('category')));
}
formAddChannels($f, 'bb_topics', 'topic_id');
$f->set_field(array('name' => 'description' . langExt(), 'type' => 'textarea', 'label' => getString('description'), 'class' => 'tinymce'));
$f->set_order('created_user,is_admin,title' . langExt() . ',type_id,channels,description' . langExt());
$f->unset_fields('thread_date,type_id,replies');
langUnsetFields($f, 'title,description');
langTranslateCheckbox($f, url_id());
return $f->draw(false, false);
}