本文整理汇总了PHP中FormValidator::__construct方法的典型用法代码示例。如果您正苦于以下问题:PHP FormValidator::__construct方法的具体用法?PHP FormValidator::__construct怎么用?PHP FormValidator::__construct使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FormValidator
的用法示例。
在下文中一共展示了FormValidator::__construct方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ValidatorDate
/**
* Constructor.
* @param $form Form the associated form
* @param $field string the name of the associated field
* @param $type string the type of check, either "required" or "optional"
* @param $message string the error message for validation failures (i18n key)
* @param $dateFormat int the ValidatorDate date format to allow
* @param $dateScope string the minimum resolution of a date to allow
* @param $dateScope string the maximum resolution of a date to allow
*/
function __construct(&$form, $field, $type, $message, $dateFormat = DATE_FORMAT_ISO, $dateScopeMin = VALIDATOR_DATE_SCOPE_YEAR, $dateScopeMax = VALIDATOR_DATE_SCOPE_DAY)
{
$validator = new ValidatorDate($dateFormat);
$this->_scopeMin = $dateScopeMin;
$this->_scopeMax = $dateScopeMax;
parent::__construct($form, $field, $type, $message, $validator);
}
示例2: array
/**
* Constructor.
* The user function is passed the form data as its first argument and $additionalArguments, if set, as the remaining arguments. This function must return a boolean value.
* @param $form Form the associated form
* @param $field string the name of the associated field
* @param $type string the type of check, either "required" or "optional"
* @param $message string the error message for validation failures (i18n key)
* @param $userFunction callable function the user function to use for validation
* @param $additionalArguments array optional, a list of additional arguments to pass to $userFunction
* @param $complementReturn boolean optional, complement the value returned by $userFunction
*/
function __construct(&$form, $field, $type, $message, $userFunction, $additionalArguments = array(), $complementReturn = false)
{
parent::__construct($form, $field, $type, $message);
$this->_userFunction = $userFunction;
$this->_additionalArguments = $additionalArguments;
$this->_complementReturn = $complementReturn;
}
示例3:
/**
* Constructor.
* @param $form Form the associated form
* @param $field string the name of the associated field
* @param $type string the type of check, either "required" or "optional"
* @param $message string the error message for validation failures (i18n key)
* @param $validator Validator the validator used to validate this form field (optional)
* @param $requiredLocale The name of the required locale, i.e. en_US
*/
function __construct(&$form, $field, $type, $message, $requiredLocale = null, $validator = null)
{
parent::__construct($form, $field, $type, $message, $validator);
if ($requiredLocale === null) {
$requiredLocale = AppLocale::getPrimaryLocale();
}
$this->_requiredLocale = $requiredLocale;
}
示例4: UserForm
/**
* Builds a form containing form items based on a given parameter
* @param int form_type 1 = user_info
* @param user array
* @param string form name
* @param method
* @param action
*/
public function UserForm($form_type, $user, $form_name, $method = 'post', $action = null)
{
parent::__construct($form_name, $method, $action);
$this->form_type = $form_type;
if (isset($user)) {
$this->user_info = $user;
}
if (isset($result_object)) {
$this->result_object = $result_object;
}
if ($this->form_type == self::TYPE_USER_INFO) {
$this->build_user_info_form();
} elseif ($this->form_type == self::TYPE_SIMPLE_SEARCH) {
$this->build_simple_search();
}
$this->setDefaults();
}
示例5: DataForm
/**
* Builds a form containing form items based on a given parameter
* @param int form_type 1=import, 2=export
* @param obj cat_obj the category object
* @param obj res_obj the result object
* @param string form name
* @param method
* @param action
*/
public function DataForm($form_type, $form_name, $method = 'post', $action = null, $target = '', $locked_status)
{
parent::__construct($form_name, $method, $action, $target);
$this->form_type = $form_type;
if ($this->form_type == self::TYPE_IMPORT) {
$this->build_import_form();
} elseif ($this->form_type == self::TYPE_EXPORT) {
if ($locked_status == 0) {
$this->build_export_form_option(false);
} else {
$this->build_export_form();
}
} elseif ($this->form_type == self::TYPE_EXPORT_PDF) {
$this->build_pdf_export_form();
}
$this->setDefaults();
}
示例6: CatForm
/**
* Builds a form containing form items based on a given parameter
* @param int form_type 1=add, 2=edit,3=move,4=browse
* @param obj cat_obj the category object
* @param string form name
* @param method method
*/
public function CatForm($form_type, $category_object, $form_name, $method = 'post', $action = null)
{
parent::__construct($form_name, $method, $action);
$this->form_type = $form_type;
if (isset($category_object)) {
$this->category_object = $category_object;
}
if ($this->form_type == self::TYPE_EDIT) {
$this->build_editing_form();
} elseif ($this->form_type == self::TYPE_ADD) {
$this->build_add_form();
} elseif ($this->form_type == self::TYPE_MOVE) {
$this->build_move_form();
} elseif ($this->form_type == self::TYPE_SELECT_COURSE) {
$this->build_select_course_form();
}
$this->setDefaults();
}
示例7: LinkForm
/**
* Builds a form containing form items based on a given parameter
* @param int form_type 1=choose link
* @param obj cat_obj the category object
* @param string form name
* @param method
* @param action
*/
public function LinkForm($form_type, $category_object, $link_object, $form_name, $method = 'post', $action = null, $extra = null)
{
parent::__construct($form_name, $method, $action);
if (isset($category_object)) {
$this->category_object = $category_object;
} else {
if (isset($link_object)) {
$this->link_object = $link_object;
}
}
if (isset($extra)) {
$this->extra = $extra;
}
if ($form_type == self::TYPE_CREATE) {
$this->build_create();
} elseif ($form_type == self::TYPE_MOVE) {
$this->build_move();
}
}
示例8: __construct
/**
* Builds a form containing form items based on a given parameter
* @param int form_type 1=add, 2=edit,3=move,4=result_add
* @param obj cat_obj the category object
* @param obj res_obj the result object
* @param string form name
* @param method
* @param action
*/
public function __construct($form_type, $evaluation_object, $result_object, $form_name, $method = 'post', $action = null, $extra1 = null, $extra2 = null)
{
parent::__construct($form_name, $method, $action);
if (isset($evaluation_object)) {
$this->evaluation_object = $evaluation_object;
}
if (isset($result_object)) {
$this->result_object = $result_object;
}
if (isset($extra1)) {
$this->extra = $extra1;
}
switch ($form_type) {
case self::TYPE_EDIT:
$this->build_editing_form();
break;
case self::TYPE_ADD:
$this->build_add_form();
break;
case self::TYPE_MOVE:
$this->build_editing_form();
break;
case self::TYPE_RESULT_ADD:
$this->build_result_add_form();
break;
case self::TYPE_RESULT_EDIT:
$this->build_result_edit_form();
break;
case self::TYPE_ALL_RESULTS_EDIT:
$this->build_all_results_edit_form();
break;
case self::TYPE_ADD_USERS_TO_EVAL:
$this->build_add_user_to_eval();
break;
}
$this->setDefaults();
}
示例9:
function __construct($form_name = 'category', $method = 'post', $action = '', $target = '', $attributes = null, $track_submit = true)
{
parent::__construct($form_name, $method, $action, $target, $attributes, $track_submit);
}
示例10: __construct
public function __construct()
{
parent::__construct();
$this->db_handler = new Database();
}
示例11: import
/**
* Constructor.
* @param $form Form the associated form
* @param $field string the name of the associated field
* @param $type string the type of check, either "required" or "optional"
* @param $message string the error message for validation failures (i18n key)
* @param $regExp string the regular expression (PCRE form)
*/
function __construct(&$form, $field, $type, $message, $regExp)
{
import('lib.pkp.classes.validation.ValidatorRegExp');
$validator = new ValidatorRegExp($regExp);
parent::__construct($form, $field, $type, $message, $validator);
}
示例12:
/**
* Constructor.
* @param $form object
* @param $userIp string IP address of user request
* @param $message string Key of message to display on mismatch
*/
function __construct(&$form, $userIp, $message)
{
parent::__construct($form, RECAPTCHA_RESPONSE_FIELD, FORM_VALIDATOR_REQUIRED_VALUE, $message);
$this->_userIp = $userIp;
}
示例13: __construct
/**
* @param $form_name
* @param null $action
*/
public function __construct($form_name, $action = null)
{
parent::__construct($form_name, 'post', $action);
$displayscore = ScoreDisplay::instance();
$customdisplays = $displayscore->get_custom_score_display_settings();
$nr_items = count($customdisplays) != '0' ? count($customdisplays) : '1';
$this->setDefaults(array('scorecolpercent' => $displayscore->get_color_split_value()));
$this->addElement('hidden', 'maxvalue', '100');
$this->addElement('hidden', 'minvalue', '0');
$counter = 1;
//setting the default values
if (is_array($customdisplays)) {
foreach ($customdisplays as $customdisplay) {
$this->setDefaults(array('endscore[' . $counter . ']' => $customdisplay['score'], 'displaytext[' . $counter . ']' => $customdisplay['display']));
$counter++;
}
}
$scorecol = array();
//settings for the colored score
$this->addElement('header', get_lang('ScoreEdit'));
if ($displayscore->is_coloring_enabled()) {
$this->addElement('html', '<b>' . get_lang('ScoreColor') . '</b>');
$this->addElement('text', 'scorecolpercent', array(get_lang('Below'), get_lang('WillColorRed'), '%'), array('size' => 5, 'maxlength' => 5, 'input-size' => 2));
if (api_get_setting('gradebook.teachers_can_change_score_settings') != 'true') {
$this->freeze('scorecolpercent');
}
$this->addRule('scorecolpercent', get_lang('OnlyNumbers'), 'numeric');
$this->addRule(array('scorecolpercent', 'maxvalue'), get_lang('Over100'), 'compare', '<=');
$this->addRule(array('scorecolpercent', 'minvalue'), get_lang('UnderMin'), 'compare', '>');
}
//Settings for the scoring system
if ($displayscore->is_custom()) {
$this->addElement('html', '<br /><b>' . get_lang('ScoringSystem') . '</b>');
$this->addElement('static', null, null, get_lang('ScoreInfo'));
$this->setDefaults(array('beginscore' => '0'));
$this->addElement('text', 'beginscore', array(get_lang('Between'), null, '%'), array('size' => 5, 'maxlength' => 5, 'disabled' => 'disabled', 'input-size' => 2));
for ($counter = 1; $counter <= 20; $counter++) {
$renderer =& $this->defaultRenderer();
$elementTemplateTwoLabel = '<div id=' . $counter . ' style="display: ' . ($counter <= $nr_items ? 'inline' : 'none') . ';">
<!-- BEGIN required --><span class="form_required">*</span> <!-- END required -->
<label class="control-label">{label}</label>
<div class="form-group">
<label class="col-sm-2 control-label">
</label>
<div class="col-sm-1">
<!-- BEGIN error --><span class="form_error">{error}</span><br />
<!-- END error --> <b>' . get_lang('And') . '</b>
</div>
<div class="col-sm-2">
{element}
</div>
<div class="col-sm-1">
=
</div>
';
$elementTemplateTwoLabel2 = '
<div class="col-sm-2">
<!-- BEGIN error --><span class="form_error">{error}</span>
<!-- END error -->
{element}
</div>
<div class="col-sm-1">
<a href="javascript:plusItem(' . ($counter + 1) . ')">
<img style="display: ' . ($counter >= $nr_items ? 'inline' : 'none') . ';" id="plus-' . ($counter + 1) . '" src="' . Display::returnIconPath('add.png') . '" alt="' . get_lang('Add') . '" title="' . get_lang('Add') . '"></a>
<a href="javascript:minItem(' . $counter . ')">
<img style="display: ' . ($counter >= $nr_items && $counter != 1 ? 'inline' : 'none') . ';" id="min-' . $counter . '" src="' . Display::returnIconPath('delete.png') . '" alt="' . get_lang('Delete') . '" title="' . get_lang('Delete') . '"></a>
</div>
</div>
</div>';
$scorebetw = array();
$this->addElement('text', 'endscore[' . $counter . ']', null, array('size' => 5, 'maxlength' => 5, 'id' => 'txta-' . $counter, 'input-size' => 2));
$this->addElement('text', 'displaytext[' . $counter . ']', null, array('size' => 40, 'maxlength' => 40, 'id' => 'txtb-' . $counter));
$renderer->setElementTemplate($elementTemplateTwoLabel, 'endscore[' . $counter . ']');
$renderer->setElementTemplate($elementTemplateTwoLabel2, 'displaytext[' . $counter . ']');
$this->addRule('endscore[' . $counter . ']', get_lang('OnlyNumbers'), 'numeric');
$this->addRule(array('endscore[' . $counter . ']', 'maxvalue'), get_lang('Over100'), 'compare', '<=');
$this->addRule(array('endscore[' . $counter . ']', 'minvalue'), get_lang('UnderMin'), 'compare', '>');
}
}
if ($displayscore->is_custom()) {
$this->addButtonSave(get_lang('Ok'));
}
}
示例14: array
/**
* Constructor.
* @param $form Form the associated form
* @param $field string the name of the associated field
* @param $type string the type of check, either "required" or "optional"
* @param $message string the error message for validation failures (i18n key)
* @param $fields array all subfields for each item in the array, i.e. name[][foo]. If empty it is assumed that name[] is a data field
*/
function __construct(&$form, $field, $type, $message, $fields = array())
{
parent::__construct($form, $field, $type, $message);
$this->_fields = $fields;
$this->_errorFields = array();
}
示例15:
/**
* Constructor.
* @param $form Form
* @param $message string the locale key to use (optional)
*/
function __construct(&$form, $message = 'form.postRequired')
{
parent::__construct($form, 'dummy', FORM_VALIDATOR_REQUIRED_VALUE, $message);
}