本文整理汇总了PHP中form::addRule方法的典型用法代码示例。如果您正苦于以下问题:PHP form::addRule方法的具体用法?PHP form::addRule怎么用?PHP form::addRule使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类form
的用法示例。
在下文中一共展示了form::addRule方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: login
function login($username = null, $status = null, &$auth = null)
{
global $msg, $auth, $is_post;
$welcome = $auth->checkAuth() ? 'login_success' : 'login_welcome';
$welcome = $msg[$welcome];
if ($is_post && !$auth->checkAuth()) {
$welcome = $msg['login_failed'] . ' ' . $welcome;
}
$ret .= '<h1>' . $msg['login'] . '</h1>' . LF;
if (!$auth->checkAuth()) {
$ret .= sprintf('<p>%1$s</p>' . LF, $msg['login_beta']);
}
$ret .= sprintf('<p>%1$s</p>' . LF, $welcome);
if (!$auth->checkAuth()) {
$form = new form('login_form', null, './?mod=user&action=login');
$form->setup($msg);
$form->addElement('text', 'username', $msg['username']);
$form->addElement('password', 'password', $msg['password']);
$form->addElement('submit', null, $msg['login']);
$form->addRule('username', sprintf($msg['required_alert'], $msg['username']), 'required', null, 'client');
$form->addRule('password', sprintf($msg['required_alert'], $msg['password']), 'required', null, 'client');
$ret .= $form->toHtml();
}
return $ret;
}
示例2: form
/**
*
*/
function show_form()
{
$form = new form('entry_form', null, './?mod=comment');
$form->setup($this->msg);
$form->addElement('text', 'sender_name', $this->msg['comment_sender'], array('size' => 40, 'maxlength' => '255'));
$form->addElement('text', 'sender_email', $this->msg['comment_email'], array('size' => 40, 'maxlength' => '255'));
$form->addElement('textarea', 'comment_text', $this->msg['comment_text'], array('rows' => 10, 'style' => 'width: 100%'));
$form->addElement('submit', 'save', $this->msg['submit']);
$form->addRule('sender_name', sprintf($this->msg['required_alert'], $this->msg['comment_sender']), 'required', null, 'client');
$form->addRule('sender_email', sprintf($this->msg['required_alert'], $this->msg['comment_email']), 'required', null, 'client');
$form->addRule('sender_email', $this->msg['email_invalid'], 'email', null, 'client');
$form->addRule('comment_text', sprintf($this->msg['required_alert'], $this->msg['comment_text']), 'required', null, 'client');
$msg = $this->msg[$this->status == 0 ? 'comment_welcome' : 'comment_sent'];
$ret .= sprintf('<p>%1$s</p>' . LF, $msg);
if ($this->status == 0) {
$ret .= $form->toHtml();
}
return $ret;
}
示例3: process
private function process()
{
$this->commonProcess();
$config = services::getService('config');
$lang = services::getService('lang');
$params = services::getService('pageParams');
$pool = new pools();
$pool->get($params->getParam('pool_id'));
$this->pool = $pool;
if ($pool->isMember($this->user->id)) {
$thread = new forumThreads();
$thread->id = $params->getParam('thread');
$thread->find();
$thread->fetch();
// new/change entry
if ($params->getParam('action') == 'new_entry') {
// formular
$form = new form('forum_entry');
$form->addElement('textarea', 'entrytext', $lang->getMsg('home_news_text'), array('rows' => 15, 'cols' => 70));
$form->addElement('hidden', 'action', 'new_entry');
$form->addElement('hidden', 'pool_id', $pool->id);
$form->addElement('hidden', 'thread', $thread->id);
$form->addElement('submit', 'entrysubmit', $lang->getMsg('home_news_submit'));
$form->addRule('entrytext', $lang->getMsg('showpool_forum_text_required'), 'required');
// write entry
if ($form->validate()) {
$new_entry = new forumEntries();
$new_entry->thread_id = $thread->id;
$new_entry->text = $form->exportValue('entrytext');
$new_entry->user_id = $this->user->id;
$new_entry->date = time();
$threads = clone $thread;
$threads->act_date = $new_entry->date;
$thread->delete();
$threads->insert();
$new_entry->insert();
$this->switchPage('threadbrowser&pool_id=' . $pool->id . '&thread=' . $threads->id . '&msg=msg_forum_entry_made');
}
$this->form = $form;
}
// build forum-tabledata
$this->thread = $thread;
// fetch entries
$entries = new forumEntries();
$entries->thread_id = $thread->id;
$entries->find();
while ($entries->fetch()) {
$entries->fetchUser();
$this->entries[$entries->id] = clone $entries;
}
} else {
$this->switchPage('showpool&pool_id=' . $pool->id . '&msg=msg_nice_try');
}
}
示例4: button
$textinput->fldType = 'password';
$textinput->size = 15;
$textinput->extra = ' autocomplete="off"';
if ($howcreated == 'LDAP') {
$textinput->extra .= ' disabled="disabled"';
}
$table->addCell($label->show());
$table->addCell(' ');
$table->addCell($textinput->show());
$table->endRow();
$form->addToForm($table->show());
$button = new button('submitform', $this->objLanguage->languageText('mod_useradmin_updatedetails', 'useradmin', 'Update Details'));
$button->setToSubmit();
// $button->setOnClick('validateForm()');
$form->addToForm('<p>' . $button->show() . '</p>');
$form->addRule('useradmin_firstname', $this->objLanguage->languageText('mod_userdetails_enterfirstname', 'userdetails'), 'required');
$form->addRule('useradmin_surname', $this->objLanguage->languageText('mod_userdetails_entersurname', 'userdetails'), 'required');
$form->addRule('useradmin_email', $this->objLanguage->languageText('mod_userdetails_enteremailaddress', 'userdetails'), 'required');
$form->addRule('useradmin_email', $this->objLanguage->languageText('mod_userdetails_entervalidemailaddress', 'userdetails'), 'email');
echo $form->show();
echo '</div>';
echo '<div><div style="width:25%; float: left; padding: 5px;">';
echo '<h3>' . $this->objLanguage->languageText('phrase_userimage', 'userdetails') . ':</h3>';
$objModule = $this->getObject('modules', 'modulecatalogue');
$changeimageform = new form('changeimage', $this->uri(array('action' => 'changeimage')));
$changeimageform->addToForm($useridinput->show());
if ($objModule->checkIfRegistered('filemanager')) {
$objSelectFile = $this->getObject('selectimage', 'filemanager');
$objSelectFile->name = 'imageselect';
$objSelectFile->restrictFileList = array('jpg', 'gif', 'png', 'jpeg', 'bmp');
$changeimageform->addToForm($objSelectFile->show());
示例5: ucfirst
$header->str = $this->objLanguage->languageText('mod_filemanager_editquota', 'filemanager', 'Edit Quota') . ': ';
if (substr($quota['path'], 0, 7) == 'context') {
$header->str .= ucfirst($this->objLanguage->code2Txt('mod_filemanager_contextfilesof', 'filemanager', NULL, '[-context-] Files of')) . ' ' . $this->objContext->getTitle(substr($quota['path'], 8));
$defaultQuota = $this->objQuotas->getDefaultContextQuota();
} else {
$header->str .= $this->objLanguage->languageText('mod_filemanager_userfilesof', 'filemanager', 'User files of') . ' ' . $this->objUser->fullName(substr($quota['path'], 6));
$defaultQuota = $this->objQuotas->getDefaultUserQuota();
}
echo $header->show();
$form = new form('updatequota', $this->uri(array('action' => 'updatequota')));
$hiddeninput = new hiddeninput('id', $quota['id']);
$form->addToForm($hiddeninput->show());
$radio = new radio('quotatype');
$radio->addOption('Y', $this->objLanguage->languageText('mod_filemanager_usedefaultquotaof', 'filemanager', 'Use Default Quota of') . ' ' . $defaultQuota . ' MB');
$radio->addOption('N', $this->objLanguage->languageText('mod_filemanager_usecustomquota', 'filemanager', 'Use Custom Quota'));
$radio->setBreakSpace('<br />');
$radio->setSelected($quota['usedefault']);
$form->addToForm($radio->show());
$customQuota = new textinput('customquota');
$customQuota->size = 5;
if ($quota['usedefault'] == 'Y') {
$customQuota->value = $defaultQuota;
} else {
$customQuota->value = $quota['quota'];
}
$form->addToForm(': ' . $customQuota->show() . ' MB');
$button = new button('confirm', $this->objLanguage->languageText('mod_filemanager_updatequota', 'filemanager', 'Update Quota'));
$button->setToSubmit();
$form->addToForm('<br /><br />' . $button->show());
$form->addRule('customquota', $this->objLanguage->languageText('mod_filemanager_validatenumber', 'filemanager', 'Please enter a number for the custom quota'), 'numeric');
echo $form->show();
示例6: button
$table->addCell($usernameLabel->show(), 100);
$table->addCell($username->show());
$table->endRow();
$table->startRow();
$table->addCell($emailLabel->show());
$table->addCell($email->show());
$table->endRow();
$table->startRow();
$table->addCell(' ');
$table->addCell(' ');
$table->endRow();
$table->startRow();
$redrawButton = new button('redraw', 'Redraw', 'redraw();');
$table->addCell($captchaLabel->show());
$table->addCell(stripslashes($this->objLanguage->languageText('mod_security_explaincaptcha', 'security', 'To prevent abuse, please enter the code as shown below. If you are unable to view the code, click on "Redraw" for a new one.')) . '<br /><div id="captchaDiv">' . $objCaptcha->show() . '</div>' . $captcha->show() . ' <a href="javascript:redraw();">' . $this->objLanguage->languageText('word_redraw', 'security', 'Redraw') . '</a>');
$table->endRow();
$form->addToForm($table->show());
$button = new button('submitform', $this->objLanguage->languageText('mod_security_sendmenewpassword', 'security', 'Send me a new password'));
$button->setToSubmit();
$form->addToForm('<p><br />' . $button->show() . '</p>');
$form->addRule('request_username', 'Please enter your username', 'required');
//$form->addRule('request_email', 'Not a valid Email', 'email');
$form->addRule('request_email', 'Please enter your emailaddress', 'required');
$form->addRule('request_captcha', 'Please enter the code in the image', 'required');
echo $form->show();
//$this->setLayoutTemplate(NULL);
//$this->setVar('pageSuppressXML', TRUE);
//echo '<div id="captchaDiv">'.$objCaptcha->show().'</div>'.$redrawButton->show();
echo '<p>' . $this->objLanguage->languageText('word_note', 'security', 'Note') . ': ';
echo $this->objLanguage->languageText('mod_security_passworddoesntworkldap', 'security', 'This does not work for accounts that use Network Identification. For assistance in this regard, please contact your System Administrator');
echo ' (' . $this->objConfig->getsiteEmail() . ')</p>';
示例7: textinput
//Create an element for the hidden text input
$objElement = new textinput("id");
//Set the value to the primary keyid
if (isset($id)) {
$objElement->setValue($id);
}
//Set the field type to hidden for the primary key
$objElement->fldType = "hidden";
//Add the hidden PK field to the form
$objForm->addToForm($objElement->show());
//Create label for input of category
$catLabel = new label($this->objLanguage->languageText("word_category"), "input_category");
//Create an element for the input of category
$objCat = new textinput("category");
$catMiss = $this->objLanguage->languageText('mod_storycategory_catmiss', "storycategoryadmin");
$objForm->addRule('category', $catMiss, 'required');
//Set the value of the element to $category
if (isset($category)) {
$objCat->setValue($category);
}
//Create label for the input of title
$titLabel = new label($this->objLanguage->languageText("word_title"), "input_title");
//Create an element for the input of title
$objTit = new textinput("title");
$titMiss = $this->objLanguage->languageText('mod_storycategory_titmiss', "storycategoryadmin");
$objForm->addRule('title', $titMiss, 'required');
//Set the width
$objTit->size = 70;
//Set the value of the element to $title
if (isset($title)) {
$objTit->setValue($title);
示例8: process
private function process()
{
$this->commonProcess();
$config = services::getService('config');
$lang = services::getService('lang');
$params = services::getService('pageParams');
$mail = services::getService('mail');
$categories = services::getService('cats');
$pool = new pools();
if ($pool->get($params->getParam('pool_id'))) {
// become member
if ($params->getParam('action') == 'become_member') {
if ($params->getParam('become_member_submit') || $pool->is_public) {
$new_membership = new poolsUser();
$new_membership->user_id = $this->user->id;
$new_membership->pool_id = $pool->id;
if (!$pool->is_public) {
$new_membership->wait = 1;
} else {
$new_membership->res_to_free = 1;
$new_membership->wait = 0;
}
if ($params->getParam('become_member_comments')) {
$new_membership->comments = $params->getParam('become_member_comments');
}
$new_membership->insert();
// compose E-Mails
if (!$pool->is_public) {
$tos = $pool->getAdmins();
foreach ($tos as $to) {
$mail->send('new_member', $to, $pool, $this->user, $new_membership->comments);
}
} else {
$this->switchPage('mysite&new_pool=' . $pool->id);
}
} else {
$this->become_member_form = true;
}
}
// are you waiting?
if ($pool->isWaiting($this->user->id)) {
$this->user_is_waiting = true;
}
// loose membership
if ($params->getParam('action') == 'no_member') {
// the last admin can't leave the pool
if (!$pool->isLastAdmin($this->user->id)) {
$pool->removeMember($this->user->id);
$this->addMsg('msg_leave_pool');
} else {
$this->addMsg('msg_leave_pool_last_admin');
}
}
// build tabledata
if ($pool->isMember($this->user->id)) {
$showcats = $categories->getChildren(0);
foreach ($showcats as $cat_id => $cat_name) {
$show_res = new resFetcher();
$show_res->_cat = $cat_id;
$show_res->_pools = array($pool->id);
$rescounter = $show_res->count();
if ($rescounter > 0) {
$this->cats[$cat_id] = array("name" => $cat_name, "count" => $rescounter);
}
}
$allcount = 0;
foreach ($this->cats as $cat) {
$allcount += $cat['count'];
}
$this->cats[0] = array("name" => $lang->getMsg('cat_all'), "count" => $allcount);
} else {
if (!$pool->isMember($this->user->id, true)) {
$this->not_member = true;
}
$res_counter = new poolsResources();
$res_counter->pool_id = $pool->id;
$this->res_counter = 0;
$res_counter->find();
while ($res_counter->fetch()) {
++$this->res_counter;
}
}
// build forum-tabledata
if ($pool->isMember($this->user->id)) {
// new/change entry
if ($params->getParam('action') == 'new_entry') {
// formular
$form = new form('forum_entry');
$form->addElement('text', 'entryheader', $lang->getMsg('showpool_forum_headline'), array('size' => 30, 'maxlength' => 100));
$form->addElement('textarea', 'entrytext', $lang->getMsg('home_news_text'), array('rows' => 15, 'cols' => 70));
$form->addElement('hidden', 'action', 'new_entry');
$form->addElement('hidden', 'pool_id', $pool->id);
$form->addElement('hidden', 'thread', $thread->id);
$form->addElement('submit', 'entrysubmit', $lang->getMsg('home_news_submit'));
$form->addRule('entryheader', $lang->getMsg('showpool_forum_headline_required'), 'required');
$form->addRule('entrytext', $lang->getMsg('showpool_forum_text_required'), 'required');
// write entry
if ($form->validate()) {
$new_thread = new forumThreads();
$new_thread->pool_id = $pool->id;
//.........这里部分代码省略.........
示例9: sprintf
/**
* Return HTML code of change password form
*/
function change_password_form()
{
if ($this->auth->checkAuth()) {
// welcome message
$msg = $this->msg['pwd_welcome'];
if ($this->status == PROCESS_FAILED) {
$msg = $this->msg['pwd_chg_failed'] . ' ' . $msg;
}
if ($this->status == PROCESS_SUCCEED) {
$msg = $this->msg['pwd_chg_succeed'];
}
$ret .= sprintf('<h1>' . $this->msg['change_pwd'] . '</h1>') . LF;
$ret .= sprintf('<p>' . $msg . '</p>') . LF;
// form
if ($this->status != PROCESS_SUCCEED) {
$form = new form('change_password_form', null, './?mod=user&action=password');
$form->setup($this->msg);
$form->addElement('password', 'pwd_current', $this->msg['pwd_current']);
$form->addElement('password', 'pwd_new', $this->msg['pwd_new']);
$form->addElement('password', 'pwd_retype', $this->msg['pwd_retype']);
$form->addElement('submit', null, $this->msg['submit']);
$form->addRule('pwd_current', sprintf($this->msg['required_alert'], $this->msg['pwd_current']), 'required', null, 'client');
$form->addRule('pwd_new', sprintf($this->msg['required_alert'], $this->msg['pwd_new']), 'required', null, 'client');
$form->addRule('pwd_retype', sprintf($this->msg['required_alert'], $this->msg['pwd_retype']), 'required', null, 'client');
$form->addRule(array('pwd_new', 'pwd_retype'), $this->msg['pwd_nomatch'], 'compare', null, 'client');
$ret .= $form->toHtml();
}
return $ret;
}
return $ret;
}
示例10: checkbox
}
$emailAlert = new checkbox('emailalertopt', $this->objLanguage->languageText('mod_contextadmin_emailalertwhat', 'contextadmin', 'Send email alerts'), true);
// this will checked
if ($mode == 'add' && is_array($fixup)) {
$emailAlert->setChecked($fixup['alerts']);
} elseif ($mode == 'add') {
$emailAlert->setChecked('0');
} else {
if ($mode == 'edit') {
$emailAlert->setChecked($context['alerts']);
}
}
$table->startRow();
$table->addCell($this->objLanguage->languageText('mod_contextadmin_emailalert', 'contextadmin', 'Alerts'));
$table->addCell($emailAlert->show());
$table->endRow();
$button = new button('savecontext', $this->objLanguage->languageText('mod_contextadmin_gotonextstep', 'contextadmin', 'Go to Next Step'));
$button->cssId = 'savebutton';
$button->setToSubmit();
//$table_ = $table->show();
//if ($objSysConfig->getValue('context_access_private_only', 'context', 'false') == 'true') {
// $table_ .= $access->show();
//}
$form->addToForm($table->show() . '<p><br />' . $button->show() . '</p>');
$hiddenInput = new hiddeninput('mode', $mode);
$form->addToForm($hiddenInput->show());
if ($mode == 'add') {
$form->addRule('contextcode', $this->objLanguage->code2Txt('mod_contextadmin_pleaseentercontextcode', 'contextadmin', NULL, 'Please enter a [-context-] code'), 'required');
}
$form->addRule('title', $this->objLanguage->languageText('mod_contextadmin_pleaseentertitle', 'contextadmin', 'Please enter a title'), 'required');
echo $form->show();
示例11: dropdown
if ($action != 'translate') {
$parentId = "";
}
}
$objFmTable->endRow();
//Create a dropdown for the category selector
$objCat = new dropdown('category_selector');
$objCat->extra = " onchange=\"document.forms['storyinput'].category.value=document.forms['storyinput'].category_selector.value;\"";
$objCat->addOption("", "Clear input");
$objCat->addFromDB($car, 'title', 'category', $category);
//Add a row for the category
$objFmTable->startRow();
$objFmTable->addCell($objLanguage->languageText("word_category") . ": ", NULL, "top", "right");
$objTextInput = new textinput('category', $category);
$objTextInput->extra = 'readonly="READONLY"';
$objForm->addRule('category', $objLanguage->languageText("mod_stories_val_catnotnull", "stories"), 'required');
$objFmTable->addCell($objTextInput->show() . " " . $objCat->show(), NULL, "top", "left");
$objFmTable->endRow();
//Add a row for the language
$objFmTable->startRow();
$objFmTable->addCell($objLanguage->languageText("word_language") . ": ", NULL, "top", "right");
$objTextInput = new textinput('language', $language);
$objTextInput->extra = 'readonly="READONLY"';
$objForm->addRule(array('name' => 'language', 'length' => 2), $objLanguage->languageText("mod_stories_val_lang2chargt", "stories"), 'maxlength');
$objForm->addRule('language', $objLanguage->languageText("mod_stories_val_langnotnull", "stories"), 'required');
//Create a dropdown for the language selector
$objCat = new dropdown('language_selector');
$objCat->extra = " onchange=\"document.forms['storyinput'].language.value=document.forms['storyinput'].language_selector.value;\"";
$objCat->addOption("", "Clear input");
$objLangList = $this->newObject('languagecode', 'language');
$objCat->selected = $language;
示例12: renderLoginBox
/**
* Method to render a login box
* @returns string
*/
public function renderLoginBox($module = NULL)
{
try {
//set the action for the login form
if ($module != NULL) {
$formAction = $this->objEngine->uri(array('action' => 'login', 'mod' => $module), 'security');
} else {
$formAction = $this->objEngine->uri(array('action' => 'login'), 'security');
}
$useHTTPS = $this->objSysConfig->getValue('MOD_SECURITY_HTTPS', 'security');
if ($useHTTPS == '1') {
$formAction = str_replace("http:", "https:", $formAction);
}
//Load up the various HTML classes
$this->loadClass('button', 'htmlelements');
$this->loadClass('textinput', 'htmlelements');
$this->loadClass('checkbox', 'htmlelements');
$this->loadClass('link', 'htmlelements');
$this->loadClass('label', 'htmlelements');
$this->loadClass('fieldset', 'htmlelements');
$objBox = $this->newObject('alertbox', 'htmlelements');
$objIcon = $this->getObject('geticon', 'htmlelements');
// prepare the link for the oAuth providers
$box = $this->oauthDisp();
$fb = $this->fbButton();
//fbConnect();
// Create a Form object
$objForm = new form('loginform', $formAction);
$objFields = new fieldset();
$objFields->setLegend(' ');
//--Create an element for the username
$objInput = new textinput('username', '', 'text', '15');
$objInput->extra = 'maxlength="255" placeholder="' . $this->objLanguage->languageText('word_username', 'system') . '"';
$objLabel = new label($this->objLanguage->languageText('word_username') . ': ', 'input_username');
//Add validation for username
$objForm->addRule('username', $this->objLanguage->languageText("mod_login_unrequired", 'security', 'Please enter a username. A username is required in order to login.'), 'required');
//Add the username box to the form
$this->objIcon->setIcon('user');
$objFields->addContent($this->objIcon->show());
$objFields->addContent($objInput->show() . '<br />');
//$objForm->addToForm();
//--- Create an element for the password
$objInput = new textinput('password', '', 'password', '15');
$objInput->extra = 'maxlength="255" placeholder="' . $this->objLanguage->languageText('word_password', 'system') . '"';
$objLabel = new label($this->objLanguage->languageText('word_password') . ': ', 'input_password');
//Add the password box to the form
//$objForm->addToForm();
$this->objIcon->setIcon('key');
$objFields->addContent($this->objIcon->show());
// $objFields->addContent($objLabel->show() . '<br />');
$objFields->addContent($objInput->show());
//--- Create an element for the network login radio
$objElement = new checkbox("useLdap");
$objElement->setCSS("transparentbgnb");
$objElement->label = $this->objLanguage->languageText("phrase_networkid") . ' ';
$ldap = '';
$objSysConfig = $this->getObject('dbsysconfig', 'sysconfig');
$showLDAPCheckBox = $objSysConfig->getValue('show_ldap_checkbox', 'security');
if ($this->objConfig->getuseLDAP() && $showLDAPCheckBox == 'true') {
$ldap .= $objElement->label . ' ' . $objElement->show();
}
//--- Create an element for the remember me checkbox
$objRElement = new checkbox("remember");
$objRElement->setCSS("transparentbgnb noborder");
$objRElement->label = $this->objLanguage->languageText("phrase_rememberme", "security");
$rem = $objRElement->show() . "<br />";
//--- Create a submit button
$objButton = new button('submit', $this->objLanguage->languageText("word_login"));
// Add the login icon
$objButton->setIconClass("user");
// Set the button type to submit
$objButton->setToSubmit();
// Add the button to the form
// openid / google /yahoo login
// Open ID login code.
$showOpenIdLogin = $objSysConfig->getValue('show_openidconnect_auth', 'security');
$openidlink = "";
if ($showOpenIdLogin == 'true') {
// OpenId auth page is used for Google and Yahoo
$objAltConfig = $this->getObject('altconfig', 'config');
$siteRoot = $objAltConfig->getSiteRoot();
$OPENID_AUTH_PAGE = $this->uri(array("action" => "openidconnect"), "security");
// Google icon
$gIcon = $this->newObject('geticon', 'htmlelements');
$gIcon->setIcon('google');
$gIcon->alt = "Google ID";
$gIcon->extra = ' name="but_google" id="but_google2" onload="" ';
// Facebook icon
$fIcon = $this->newObject('geticon', 'htmlelements');
$fIcon->setIcon('facebook');
$fIcon->alt = "FB ID";
$fIcon->extra = ' name="but_fb" id="but_fb" onload="" ';
$FB_AUTH_PAGE = $this->uri(array("action" => "initfacebooklogin", 'auth_site' => 'facebook'), "security");
// Yahoo icon
$yIcon = $this->newObject('geticon', 'htmlelements');
$yIcon->setIcon('yahoo');
//.........这里部分代码省略.........
示例13: valFormShow
/**
* Short description for function
*
* Long description (if any) ...
*
* @return void
* @access public
*/
function valFormShow()
{
//I am not using multilingualized text for the examples
$objForm = new form('testform');
$objForm->setAction($this->uri(array('action' => 'valform'), 'htmlelements'));
$objForm->setDisplayType(2);
$name = new textinput('name');
$name->label = 'Name(must be filled out)';
$objForm->addRule('name', 'Please enter your name', 'required');
$surname = new textinput('surname');
$surname->label = 'Surname (must be less than 15 characters)';
$objForm->addRule(array('name' => 'surname', 'length' => 15), 'Your surname is too long', 'maxlength');
$email = new textinput('email');
$email->label = 'Email (must be a valid email address)';
$objForm->addRule('email', 'Not a valid Email', 'email');
$pwd = new textinput('pwd');
$pwd->label = 'Password ';
$pwd->fldType = 'password';
$pwd2 = new textinput('pwd2');
$pwd2->label = 'Retype password (must be the same as "Password" case sensitive)';
$pwd2->fldType = 'password';
$objForm->addRule(array('pwd', 'pwd2'), 'Password did not match', 'compare');
$age = new textinput('age');
$age->label = 'Age (must be older than 18)';
$objForm->addRule(array('name' => 'age', 'minnumber' => 18), 'You have to be older than 18', 'minnumber');
$colour = new textinput('colour');
$colour->label = 'Favourate Colour (must be between 3 and 15 characters inclusive)';
$objForm->addRule(array('name' => 'colour', 'lower' => 3, 'upper' => 10), 'must be between 3 and 10 characters inclusive', 'rangelength');
$sentence = new textinput('sentence');
$sentence->label = 'Sentence (must contain no punctuation) not working yet';
$car = new textinput('car');
$car->label = 'Favourate Car (must contain only alphabetic characters)';
$objForm->addRule('car', 'Must contain letters of the alphabet', 'letteronly');
$monitor = new textinput('monitor');
$monitor->label = 'Favourate Monitor (must contain only alphanumeric characters)';
$objForm->addRule('monitor', 'Must contain letters of the alphabet and valid numbers', 'alphanumeric');
$birthday = new textinput('birthday');
$birthday->label = 'Birthday (mm/dd/yyy) not working yet';
$sex = new radio('sex_radio');
$sex->addOption('m', 'Male');
$sex->addOption('f', 'Female');
$sex->addOption('n', 'Seaweed');
//$objForm->addRule('sex_radio','Please select your sex','select');
$save = new button('save');
$save->setToSubmit();
$save->setValue('Save');
$objForm->addToForm($name);
$objForm->addToForm($surname);
$objForm->addToForm($email);
$objForm->addToForm($pwd);
$objForm->addToForm($pwd2);
$objForm->addToForm($age);
$objForm->addToForm($sentence);
$objForm->addToForm($colour);
$objForm->addToForm($car);
$objForm->addToForm($monitor);
$objForm->addToForm($birthday);
//$objForm->addToForm($sex);
$objForm->addToForm($save);
$this->setVar('left', "");
$this->setVar('right', '');
$this->setVar('content', $objForm->show());
$this->setVar('bottom', '');
}
示例14: getEditContextForm
/**
* Get context edit form
* @return string
*
*/
public function getEditContextForm($contextCode = NULL)
{
if (empty($contextCode)) {
$contextCode = $this->_objDBContext->getContextCode();
}
$context = $this->_objDBContext->getRow('contextcode', $contextCode);
$objH = new htmlheading();
$objForm = new form();
$inpContextCode = new textinput();
$inpMenuText = new textinput();
$inpTitle = new textinput();
$inpButton = new button();
$objIcon = $this->newObject('geticon', 'htmlelements');
$dropAccess = new dropdown();
//$radioStatus = new radio();
$objStartDate = $this->newObject('datepicker', 'htmlelements');
$objFinishDate = $this->newObject('datepicker', 'htmlelements');
$objIcon->setIcon('help');
$objH->str = $this->_objLanguage->languageText("mod_context_step", 'context') . ' 1: ' . $this->_objLanguage->languageText("mod_context_addcontext", 'context');
$objH->type = 3;
//setup the form
$objForm->name = 'addfrm';
$objForm->action = $this->uri(array('action' => 'saveedit'));
$objForm->extra = 'class="f-wrap-1"';
$objForm->displayType = 3;
//contextcode
$inpContextCode->name = 'contextcode';
$inpContextCode->id = 'contextcode';
$inpContextCode->value = '';
$inpContextCode->cssClass = 'f-name';
//title
$inpTitle->name = 'title';
$inpTitle->id = 'title';
$inpTitle->value = $context['title'];
$inpTitle->cssClass = 'f-name';
//menu text
$inpMenuText->value = $context['menutext'];
$inpMenuText->name = 'menutext';
$inpMenuText->id = 'menutext';
$inpMenuText->cssClass = 'f-name';
//status
$dropAccess->name = 'status';
$dropAccess->addOption('Published', $this->_objLanguage->languageText("mod_context_published", 'context'));
$dropAccess->addOption('Unpublished', $this->_objLanguage->languageText("mod_context_unpublished", 'context'));
$dropAccess->setSelected(trim($context['status']));
//access
$checked = $context['access'] == 'Public' ? ' checked = "checked" ' : '';
$drop = '<fieldset class="f-radio-wrap">
<b>' . $this->_objLanguage->languageText("mod_context_access", 'context') . ':</b>
<fieldset>
<label for="Public">
<input id="Public" type="radio" name="access" ' . $checked . '
value="Public" class="f-radio" tabindex="8" />
' . $this->_objLanguage->languageText("mod_context_public", 'context') . ' <span class="caption"> - ' . $this->_objLanguage->code2Txt("mod_context_publichelp", 'context', array('context' => 'Course')) . '</span></label>';
$checked = $context['access'] == 'Open' ? ' checked = "checked" ' : '';
$drop .= '<label for="Open">
<input id="Open" type="radio" name="access" ' . $checked . ' value="Open" class="f-radio" tabindex="9" />
' . $this->_objLanguage->languageText("mod_context_open", 'context') . ' <span class="caption"> - ' . $this->_objLanguage->code2Txt("mod_context_openhelp", 'context', array('context' => 'Course')) . '</span></label>';
$checked = $context['access'] == 'Private' ? ' checked = "checked" ' : '';
$drop .= ' <label for="Private">
<input id="Private" type="radio" name="access" ' . $checked . ' value="Private" class="f-radio" tabindex="10" />
' . $this->_objLanguage->languageText("mod_context_private", 'context') . ' <span class="caption"> - ' . $this->_objLanguage->code2Txt("mod_context_privatehelp", 'context', array('context' => 'course')) . '</span></label>
</fieldset>
</fieldset>';
//start date
$objStartDate->name = 'startdate';
$objStartDate->value = $context['startdate'];
//finish date
$objFinishDate->name = 'finishdate';
$objFinishDate->value = $context['finishdate'];
//button
$inpButton->setToSubmit();
$inpButton->cssClass = 'f-submit';
$inpButton->value = ucwords($this->_objLanguage->languageText("word_save"));
//validation
$objForm->addRule('menutext', $this->_objLanguage->languageText("mod_contextadmin_err_requiremenutext", 'contextadmin'), 'required!');
$objForm->addRule('title', $this->_objLanguage->languageText("mod_contextadmin_err_requiretitle", 'contextadmin'), 'required!');
$objForm->addToForm('<div class="req"><b>*</b>' . $this->_objLanguage->languageText("mod_context_required", 'context') . '</div>');
$objForm->addToForm('<fieldset>');
$objForm->addToForm('<label for="contextcode"><b><span class="req">*</span>' . ucwords($this->_objLanguage->code2Txt("mod_context_contextcode", 'context', array('context' => 'Course'))) . ':</b> <span class="highlight">');
$objForm->addToForm($this->_objDBContext->getContextCode() . '</span><br /></label>');
$objForm->addToForm('<label for="title"><b><span class="req">*</span>' . $this->_objLanguage->languageText("word_title") . ':</b>');
$objForm->addToForm($inpTitle->show() . '<br /></label>');
$objForm->addToForm('<label for="menutext"><b><span class="req">*</span>' . $this->_objLanguage->languageText("mod_context_menutext", 'context') . ':</b>');
$objForm->addToForm($inpMenuText->show() . '<br /></label>');
$objForm->addToForm('<label for="access"><b><span class="req">*</span>' . $this->_objLanguage->languageText("mod_context_status", 'context') . ':</b>');
$objForm->addToForm($dropAccess->show() . '<br /></label>');
//.........这里部分代码省略.........
示例15: form
/**
*
*/
function show_form()
{
$query = 'SELECT a.* FROM glossary a
WHERE a.glo_uid = ' . $this->db->quote($_GET['uid']);
$this->entry = $this->db->get_row($query);
$is_new = is_array($this->entry) ? 0 : 1;
$form = new form('entry_form', null, './' . $this->get_url_param());
$form->setup($this->msg);
$form->addElement('text', 'original', $this->msg['en'], array('size' => 40, 'maxlength' => '255'));
$form->addElement('text', 'phrase', $this->msg['id'], array('size' => 40, 'maxlength' => '255'));
$form->addElement('select', 'discipline', $this->msg['discipline'], $this->db->get_row_assoc('SELECT * FROM discipline ORDER BY discipline_name', 'discipline', 'discipline_name'));
$form->addElement('select', 'ref_source', $this->msg['ref_source'], $this->db->get_row_assoc('SELECT * FROM ref_source WHERE glossary = 1', 'ref_source', 'ref_source_name'));
$form->addElement('text', 'wpen', $this->msg['wpen'], array('size' => 40, 'maxlength' => '255'));
$form->addElement('text', 'wpid', $this->msg['wpid'], array('size' => 40, 'maxlength' => '255'));
$form->addElement('hidden', 'glo_uid');
$form->addElement('hidden', 'is_new', $is_new);
$form->addElement('submit', 'save', $this->msg['save']);
$form->addRule('phrase', sprintf($this->msg['required_alert'], $this->msg['id']), 'required', null, 'client');
$form->addRule('original', sprintf($this->msg['required_alert'], $this->msg['en']), 'required', null, 'client');
$form->addRule('discipline', sprintf($this->msg['required_alert'], $this->msg['discipline']), 'required', null, 'client');
$form->addRule('ref_source', sprintf($this->msg['required_alert'], $this->msg['ref_source']), 'required', null, 'client');
$form->setDefaults($this->entry);
$ret .= sprintf('<h1>%1$s</h1>' . LF, ($is_new ? $this->msg['new'] : $this->msg['edit']) . ' - ' . $this->msg['glossary']);
$ret .= $form->toHtml();
return $ret;
}