本文整理汇总了PHP中Form::Form方法的典型用法代码示例。如果您正苦于以下问题:PHP Form::Form方法的具体用法?PHP Form::Form怎么用?PHP Form::Form使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Form
的用法示例。
在下文中一共展示了Form::Form方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: InstallForm
/**
* Constructor.
*/
function InstallForm()
{
parent::Form('install/install.tpl');
// FIXME Move the below options to an external configuration file?
$this->supportedLocales = AppLocale::getAllLocales();
$this->localesComplete = array();
foreach ($this->supportedLocales as $key => $name) {
$this->localesComplete[$key] = AppLocale::isLocaleComplete($key);
}
$this->supportedClientCharsets = array('utf-8' => 'Unicode (UTF-8)', 'iso-8859-1' => 'Western (ISO-8859-1)');
$this->supportedConnectionCharsets = array('' => __('common.notApplicable'), 'utf8' => 'Unicode (UTF-8)');
$this->supportedDatabaseCharsets = array('' => __('common.notApplicable'), 'utf8' => 'Unicode (UTF-8)');
$this->supportedEncryptionAlgorithms = array('md5' => 'MD5');
if (function_exists('sha1')) {
$this->supportedEncryptionAlgorithms['sha1'] = 'SHA1';
}
$this->supportedDatabaseDrivers = array('mysql' => array('mysql', 'MySQL'), 'postgres' => array('pgsql', 'PostgreSQL'), 'oracle' => array('oci8', 'Oracle'), 'mssql' => array('mssql', 'MS SQL Server'), 'fbsql' => array('fbsql', 'FrontBase'), 'ibase' => array('ibase', 'Interbase'), 'firebird' => array('ibase', 'Firebird'), 'informix' => array('ifx', 'Informix'), 'sybase' => array('sybase', 'Sybase'), 'odbc' => array('odbc', 'ODBC'));
// Validation checks for this form
$this->addCheck(new FormValidatorInSet($this, 'locale', 'required', 'installer.form.localeRequired', array_keys($this->supportedLocales)));
$this->addCheck(new FormValidatorCustom($this, 'locale', 'required', 'installer.form.localeRequired', array('AppLocale', 'isLocaleValid')));
$this->addCheck(new FormValidatorInSet($this, 'clientCharset', 'required', 'installer.form.clientCharsetRequired', array_keys($this->supportedClientCharsets)));
$this->addCheck(new FormValidator($this, 'filesDir', 'required', 'installer.form.filesDirRequired'));
$this->addCheck(new FormValidatorInSet($this, 'encryption', 'required', 'installer.form.encryptionRequired', array_keys($this->supportedEncryptionAlgorithms)));
$this->addCheck(new FormValidator($this, 'adminUsername', 'required', 'installer.form.usernameRequired'));
$this->addCheck(new FormValidatorAlphaNum($this, 'adminUsername', 'required', 'installer.form.usernameAlphaNumeric'));
$this->addCheck(new FormValidatorLength($this, 'adminPassword', 'required', 'user.register.form.passwordLengthTooShort', '>=', INSTALLER_DEFAULT_MIN_PASSWORD_LENGTH));
$this->addCheck(new FormValidator($this, 'adminPassword', 'required', 'installer.form.passwordRequired'));
$this->addCheck(new FormValidatorCustom($this, 'adminPassword', 'required', 'installer.form.passwordsDoNotMatch', create_function('$password,$form', 'return $password == $form->getData(\'adminPassword2\');'), array(&$this)));
$this->addCheck(new FormValidatorEmail($this, 'adminEmail', 'required', 'installer.form.emailRequired'));
$this->addCheck(new FormValidatorInSet($this, 'databaseDriver', 'required', 'installer.form.databaseDriverRequired', array_keys($this->supportedDatabaseDrivers)));
$this->addCheck(new FormValidator($this, 'databaseName', 'required', 'installer.form.databaseNameRequired'));
$this->addCheck(new FormValidatorPost($this));
}
示例2: AddEmailForm
function AddEmailForm()
{
Form::Form('AddEmailForm');
CGlobal::$website_title = "Thêm Email list";
$this->link_css('style/manage_item.css');
$this->email_list = array('email_list' => '');
}
示例3: ListModuleAdminForm
function ListModuleAdminForm()
{
Form::Form('ListModuleAdminForm');
CGlobal::$website_title = "Quản trị Modules";
$this->link_css('style/manage_content.css');
CGlobal::$website_title = "Quản trị Modules";
}
示例4: SubscriptionPolicyForm
/**
* Constructor
*/
function SubscriptionPolicyForm()
{
for ($i = SUBSCRIPTION_OPEN_ACCESS_DELAY_MIN; $i <= SUBSCRIPTION_OPEN_ACCESS_DELAY_MAX; $i++) {
$this->validDuration[$i] = $i;
}
for ($i = SUBSCRIPTION_EXPIRY_REMINDER_BEFORE_MONTHS_MIN; $i <= SUBSCRIPTION_EXPIRY_REMINDER_BEFORE_MONTHS_MAX; $i++) {
$this->validNumMonthsBeforeExpiry[$i] = $i;
}
for ($i = SUBSCRIPTION_EXPIRY_REMINDER_BEFORE_WEEKS_MIN; $i <= SUBSCRIPTION_EXPIRY_REMINDER_BEFORE_WEEKS_MAX; $i++) {
$this->validNumWeeksBeforeExpiry[$i] = $i;
}
for ($i = SUBSCRIPTION_EXPIRY_REMINDER_AFTER_MONTHS_MIN; $i <= SUBSCRIPTION_EXPIRY_REMINDER_AFTER_MONTHS_MAX; $i++) {
$this->validNumMonthsAfterExpiry[$i] = $i;
}
for ($i = SUBSCRIPTION_EXPIRY_REMINDER_AFTER_WEEKS_MIN; $i <= SUBSCRIPTION_EXPIRY_REMINDER_AFTER_WEEKS_MAX; $i++) {
$this->validNumWeeksAfterExpiry[$i] = $i;
}
parent::Form('subscription/subscriptionPolicyForm.tpl');
// If provided, subscription contact email is valid
$this->addCheck(new FormValidatorEmail($this, 'subscriptionEmail', 'optional', 'manager.subscriptionPolicies.subscriptionContactEmailValid'));
// If provided delayed open access duration is valid value
$this->addCheck(new FormValidatorInSet($this, 'delayedOpenAccessDuration', 'optional', 'manager.subscriptionPolicies.delayedOpenAccessDurationValid', array_keys($this->validDuration)));
// If provided expiry reminder months before value is valid value
$this->addCheck(new FormValidatorInSet($this, 'numMonthsBeforeSubscriptionExpiryReminder', 'optional', 'manager.subscriptionPolicies.numMonthsBeforeSubscriptionExpiryReminderValid', array_keys($this->validNumMonthsBeforeExpiry)));
// If provided expiry reminder weeks before value is valid value
$this->addCheck(new FormValidatorInSet($this, 'numWeeksBeforeSubscriptionExpiryReminder', 'optional', 'manager.subscriptionPolicies.numWeeksBeforeSubscriptionExpiryReminderValid', array_keys($this->validNumWeeksBeforeExpiry)));
// If provided expiry reminder months after value is valid value
$this->addCheck(new FormValidatorInSet($this, 'numMonthsAfterSubscriptionExpiryReminder', 'optional', 'manager.subscriptionPolicies.numMonthsAfterSubscriptionExpiryReminderValid', array_keys($this->validNumMonthsAfterExpiry)));
// If provided expiry reminder weeks after value is valid value
$this->addCheck(new FormValidatorInSet($this, 'numWeeksAfterSubscriptionExpiryReminder', 'optional', 'manager.subscriptionPolicies.numWeeksAfterSubscriptionExpiryReminderValid', array_keys($this->validNumWeeksAfterExpiry)));
$this->addCheck(new FormValidatorPost($this));
}
示例5: FormSiteUrls
function FormSiteUrls(&$template, $siteAdmin)
{
parent::Form($template);
$this->siteAdmin = $siteAdmin;
$o_site = new Site($siteAdmin);
$this->a_urls = $o_site->getUrls();
}
示例6: SubmissionMetadataForm
/**
* Constructor.
*/
function SubmissionMetadataForm($monographId)
{
parent::Form('controllers/modals/submissionMetadata/form/submissionMetadata.tpl');
$this->_monographId = (int) $monographId;
// Validation checks for this form
$this->addCheck(new FormValidatorPost($this));
}
示例7: FilterForm
/**
* Constructor.
* @param $filter Filter
* @param $filterGroupSymbolic string
* @param $title string
* @param $description string
*/
function FilterForm(&$filter, $title, $description, $filterGroupSymbolic)
{
parent::Form('controllers/grid/filter/form/filterForm.tpl');
// Initialize internal state.
$this->_filter =& $filter;
$this->_title = $title;
$this->_description = $description;
$this->_filterGroupSymbolic = $filterGroupSymbolic;
// Transport filter/template id.
$this->readUserVars(array('filterId', 'filterTemplateId'));
// Validation check common to all requests.
$this->addCheck(new FormValidatorPost($this));
// Validation check for template selection.
if (!is_null($filter) && !is_numeric($filter->getId())) {
$this->addCheck(new FormValidator($this, 'filterTemplateId', 'required', 'manager.setup.filter.grid.filterTemplateRequired'));
}
// Add filter specific meta-data and checks.
if (is_a($filter, 'Filter')) {
$this->setData('filterSettings', $filter->getSettings());
foreach ($filter->getSettings() as $filterSetting) {
// Add check corresponding to filter setting.
$settingCheck =& $filterSetting->getCheck($this);
if (!is_null($settingCheck)) {
$this->addCheck($settingCheck);
}
}
}
}
示例8: RegisterForm
function RegisterForm()
{
$this->link_css('style/register.css');
// $this->link_js('style/platform/js/register.js');
Form::Form('Register');
CGlobal::$website_title = " Sign up";
}
示例9: SubscriptionTypeForm
/**
* Constructor
* @param typeId int leave as default for new subscription type
*/
function SubscriptionTypeForm($typeId = null)
{
$this->validFormats = array(SUBSCRIPTION_TYPE_FORMAT_ONLINE => __('subscriptionTypes.format.online'), SUBSCRIPTION_TYPE_FORMAT_PRINT => __('subscriptionTypes.format.print'), SUBSCRIPTION_TYPE_FORMAT_PRINT_ONLINE => __('subscriptionTypes.format.printOnline'));
$currencyDao = DAORegistry::getDAO('CurrencyDAO');
$currencies = $currencyDao->getCurrencies();
$this->validCurrencies = array();
while (list(, $currency) = each($currencies)) {
$this->validCurrencies[$currency->getCodeAlpha()] = $currency->getName() . ' (' . $currency->getCodeAlpha() . ')';
}
$this->typeId = isset($typeId) ? (int) $typeId : null;
parent::Form('subscription/subscriptionTypeForm.tpl');
// Type name is provided
$this->addCheck(new FormValidatorLocale($this, 'name', 'required', 'manager.subscriptionTypes.form.typeNameRequired'));
// Cost is provided and is numeric and positive
$this->addCheck(new FormValidator($this, 'cost', 'required', 'manager.subscriptionTypes.form.costRequired'));
$this->addCheck(new FormValidatorCustom($this, 'cost', 'required', 'manager.subscriptionTypes.form.costNumeric', create_function('$cost', 'return (is_numeric($cost) && $cost >= 0);')));
// Currency is provided and is valid value
$this->addCheck(new FormValidator($this, 'currency', 'required', 'manager.subscriptionTypes.form.currencyRequired'));
$this->addCheck(new FormValidatorInSet($this, 'currency', 'required', 'manager.subscriptionTypes.form.currencyValid', array_keys($this->validCurrencies)));
// Non-expiring flag is valid value
$this->addCheck(new FormValidatorInSet($this, 'nonExpiring', 'optional', 'manager.subscriptionTypes.form.nonExpiringValid', array('0', '1')));
// Format is provided and is valid value
$this->addCheck(new FormValidator($this, 'format', 'required', 'manager.subscriptionTypes.form.formatRequired'));
$this->addCheck(new FormValidatorInSet($this, 'format', 'required', 'manager.subscriptionTypes.form.formatValid', array_keys($this->validFormats)));
// Institutional flag is valid value
$this->addCheck(new FormValidatorInSet($this, 'institutional', 'optional', 'manager.subscriptionTypes.form.institutionalValid', array('0', '1')));
// Membership flag is valid value
$this->addCheck(new FormValidatorInSet($this, 'membership', 'optional', 'manager.subscriptionTypes.form.membershipValid', array('1')));
// Public flag is valid value
$this->addCheck(new FormValidatorInSet($this, 'disable_public_display', 'optional', 'manager.subscriptionTypes.form.publicValid', array('1')));
$this->addCheck(new FormValidatorPost($this));
}
示例10: ScheduleForm
/**
* Constructor
*/
function ScheduleForm()
{
parent::Form('manager/scheduler/scheduleForm.tpl');
$this->addCheck(new FormValidatorPost($this));
$this->schedConf =& Request::getSchedConf();
$this->publishedPaperDao =& DAORegistry::getDAO('PublishedPaperDAO');
}
示例11: InstallForm
/**
* Constructor.
*/
function InstallForm()
{
parent::Form('install/install.tpl');
// FIXME Move the below options to an external configuration file?
$this->supportedLocales = Locale::getAllLocales();
$this->supportedClientCharsets = array('utf-8' => 'Unicode (UTF-8)', 'iso-8859-1' => 'Western (ISO-8859-1)');
$this->supportedConnectionCharsets = array('' => Locale::translate('common.notApplicable'), 'utf8' => 'Unicode (UTF-8)');
$this->supportedDatabaseCharsets = array('' => Locale::translate('common.notApplicable'), 'utf8' => 'Unicode (UTF-8)');
$this->supportedEncryptionAlgorithms = array('md5' => 'MD5');
if (function_exists('sha1')) {
$this->supportedEncryptionAlgorithms['sha1'] = 'SHA1';
}
$this->supportedDatabaseDrivers = array('mysql' => array('mysql', 'MySQL'), 'postgres' => array('pgsql', 'PostgreSQL'), 'oracle' => array('oci8', 'Oracle'), 'mssql' => array('mssql', 'MS SQL Server'), 'fbsql' => array('fbsql', 'FrontBase'), 'ibase' => array('ibase', 'Interbase'), 'firebird' => array('ibase', 'Firebird'), 'informix' => array('ifx', 'Informix'), 'sybase' => array('sybase', 'Sybase'), 'odbc' => array('odbc', 'ODBC'));
// Validation checks for this form
$this->addCheck(new FormValidatorInSet($this, 'locale', 'required', 'installer.form.localeRequired', array_keys($this->supportedLocales)));
$this->addCheck(new FormValidatorCustom($this, 'locale', 'required', 'installer.form.localeRequired', array('Locale', 'isLocaleValid')));
$this->addCheck(new FormValidatorInSet($this, 'clientCharset', 'required', 'installer.form.clientCharsetRequired', array_keys($this->supportedClientCharsets)));
$this->addCheck(new FormValidator($this, 'filesDir', 'required', 'installer.form.filesDirRequired'));
$this->addCheck(new FormValidatorInSet($this, 'encryption', 'required', 'installer.form.encryptionRequired', array_keys($this->supportedEncryptionAlgorithms)));
$this->addCheck(new FormValidator($this, 'adminUsername', 'required', 'installer.form.usernameRequired'));
// Opatan Inc. : FormValidatorAlphaNum for username is removed
// Opatan Inc. : Email Validator for admin username is added && email validator is removed
$this->addCheck(new FormValidatorEmail($this, 'adminUsername', 'required', 'installer.form.adminEmailRequired'));
$this->addCheck(new FormValidator($this, 'adminPassword', 'required', 'installer.form.passwordRequired'));
$this->addCheck(new FormValidatorCustom($this, 'adminPassword', 'required', 'installer.form.passwordsDoNotMatch', create_function('$password,$form', 'return $password == $form->getData(\'adminPassword2\');'), array(&$this)));
$this->addCheck(new FormValidatorInSet($this, 'databaseDriver', 'required', 'installer.form.databaseDriverRequired', array_keys($this->supportedDatabaseDrivers)));
$this->addCheck(new FormValidator($this, 'databaseName', 'required', 'installer.form.databaseNameRequired'));
$this->addCheck(new FormValidatorPost($this));
}
示例12: ArchiveForm
/**
* Constructor.
* @param $archiveId omit for a new archive
*/
function ArchiveForm($archiveId = null, $allowManagement = false)
{
parent::Form('admin/archiveForm.tpl');
$this->archiveId = isset($archiveId) ? (int) $archiveId : null;
$this->allowManagement = $allowManagement;
// Validation checks for this form
$this->addCheck(new FormValidator($this, 'title', 'required', 'admin.archives.form.titleRequired'));
$this->addCheck(new FormValidator($this, 'url', 'required', 'admin.archives.form.urlRequired'));
$this->addCheck(new FormValidatorPost($this));
import('lib.pkp.classes.captcha.CaptchaManager');
$captchaManager = new CaptchaManager();
$this->captchaEnabled = $captchaManager->isEnabled();
if ($this->captchaEnabled && !Validation::isSiteAdmin()) {
$this->addCheck(new FormValidatorCaptcha($this, 'captcha', 'captchaId', 'common.captchaField.badCaptcha'));
}
$this->harvesterPluginName = Request::getUserVar('harvesterPluginName');
if ($archiveId) {
$archiveDao =& DAORegistry::getDAO('ArchiveDAO');
$this->archive =& $archiveDao->getArchive($this->archiveId, false);
if (empty($this->harvesterPluginName) && $this->archive) {
$this->harvesterPluginName = $this->archive->getHarvesterPluginName();
}
}
if (empty($this->harvesterPluginName)) {
$site =& Request::getSite();
$this->harvesterPluginName = $site->getSetting('defaultHarvesterPlugin');
}
$this->harvesters =& PluginRegistry::loadCategory('harvesters');
HookRegistry::call('ArchiveForm::ArchiveForm', array(&$this, $this->harvesterPluginName));
}
示例13: RegistrationForm
/**
* Constructor.
*/
function RegistrationForm($site)
{
parent::Form('frontend/pages/userRegister.tpl');
// Validation checks for this form
$this->addCheck(new FormValidatorCustom($this, 'username', 'required', 'user.register.form.usernameExists', array(DAORegistry::getDAO('UserDAO'), 'userExistsByUsername'), array(), true));
$this->addCheck(new FormValidator($this, 'username', 'required', 'user.profile.form.usernameRequired'));
$this->addCheck(new FormValidator($this, 'password', 'required', 'user.profile.form.passwordRequired'));
$this->addCheck(new FormValidatorUsername($this, 'username', 'required', 'user.register.form.usernameAlphaNumeric'));
$this->addCheck(new FormValidatorLength($this, 'password', 'required', 'user.register.form.passwordLengthRestriction', '>=', $site->getMinPasswordLength()));
$this->addCheck(new FormValidatorCustom($this, 'password', 'required', 'user.register.form.passwordsDoNotMatch', create_function('$password,$form', 'return $password == $form->getData(\'password2\');'), array(&$this)));
$this->addCheck(new FormValidator($this, 'firstName', 'required', 'user.profile.form.firstNameRequired'));
$this->addCheck(new FormValidator($this, 'lastName', 'required', 'user.profile.form.lastNameRequired'));
$this->addCheck(new FormValidator($this, 'country', 'required', 'user.profile.form.countryRequired'));
// Email checks
$this->addCheck(new FormValidatorEmail($this, 'email', 'required', 'user.profile.form.emailRequired'));
$this->addCheck(new FormValidatorCustom($this, 'email', 'required', 'user.register.form.emailExists', array(DAORegistry::getDAO('UserDAO'), 'userExistsByEmail'), array(), true));
$this->captchaEnabled = Config::getVar('captcha', 'captcha_on_register') && Config::getVar('captcha', 'recaptcha');
if ($this->captchaEnabled) {
$this->addCheck(new FormValidatorReCaptcha($this, Request::getRemoteAddr(), 'common.captcha.error.invalid-input-response'));
}
$authDao = DAORegistry::getDAO('AuthSourceDAO');
$this->defaultAuth = $authDao->getDefaultPlugin();
if (isset($this->defaultAuth)) {
$this->addCheck(new FormValidatorCustom($this, 'username', 'required', 'user.register.form.usernameExists', create_function('$username,$form,$auth', 'return (!$auth->userExists($username) || $auth->authenticate($username, $form->getData(\'password\')));'), array(&$this, $this->defaultAuth)));
}
$this->addCheck(new FormValidatorPost($this));
$this->addCheck(new FormValidatorCSRF($this));
}
示例14: StageParticipantForm
/**
* Constructor.
* @param $monograph Monograph
* @param $stageId integer
*/
function StageParticipantForm(&$monograph, $stageId)
{
parent::Form('controllers/grid/users/stageParticipant/form/stageParticipantForm.tpl');
assert(is_a($monograph, 'Monograph'));
$this->_monograph =& $monograph;
$this->_stageId = (int) $stageId;
}
示例15: UserManagementForm
/**
* Constructor.
*/
function UserManagementForm($userId = null)
{
parent::Form('manager/people/userProfileForm.tpl');
if (!Validation::isJournalManager()) {
$userId = null;
}
$this->userId = isset($userId) ? (int) $userId : null;
$site =& Request::getSite();
// Validation checks for this form
if ($userId == null) {
$this->addCheck(new FormValidator($this, 'username', 'required', 'user.profile.form.usernameRequired'));
$this->addCheck(new FormValidatorCustom($this, 'username', 'required', 'user.register.form.usernameExists', array(DAORegistry::getDAO('UserDAO'), 'userExistsByUsername'), array($this->userId, true), true));
$this->addCheck(new FormValidatorAlphaNum($this, 'username', 'required', 'user.register.form.usernameAlphaNumeric'));
if (!Config::getVar('security', 'implicit_auth')) {
$this->addCheck(new FormValidator($this, 'password', 'required', 'user.profile.form.passwordRequired'));
$this->addCheck(new FormValidatorLength($this, 'password', 'required', 'user.register.form.passwordLengthTooShort', '>=', $site->getMinPasswordLength()));
$this->addCheck(new FormValidatorCustom($this, 'password', 'required', 'user.register.form.passwordsDoNotMatch', create_function('$password,$form', 'return $password == $form->getData(\'password2\');'), array(&$this)));
}
} else {
$this->addCheck(new FormValidatorLength($this, 'password', 'optional', 'user.register.form.passwordLengthTooShort', '>=', $site->getMinPasswordLength()));
$this->addCheck(new FormValidatorCustom($this, 'password', 'optional', 'user.register.form.passwordsDoNotMatch', create_function('$password,$form', 'return $password == $form->getData(\'password2\');'), array(&$this)));
}
$this->addCheck(new FormValidator($this, 'firstName', 'required', 'user.profile.form.firstNameRequired'));
$this->addCheck(new FormValidator($this, 'lastName', 'required', 'user.profile.form.lastNameRequired'));
$this->addCheck(new FormValidatorUrl($this, 'userUrl', 'optional', 'user.profile.form.urlInvalid'));
$this->addCheck(new FormValidatorEmail($this, 'email', 'required', 'user.profile.form.emailRequired'));
$this->addCheck(new FormValidatorCustom($this, 'email', 'required', 'user.register.form.emailExists', array(DAORegistry::getDAO('UserDAO'), 'userExistsByEmail'), array($this->userId, true), true));
$this->addCheck(new FormValidatorPost($this));
}