mstdmstd
Новичок
Всем привет,
Делаю форму регистрации нового юзера, причем у меня отдельный каталог с формами и в этой форме protected/forms/OperatorRegisterForm.php :
...
?>И выскакивает ошибка
На первом обращении к форме в темплейте:
Если раскоментарить 2 строки вывода выше то вывод :
Эта форма была рабочей и с какого-то момента перестала работать.
Если в форме в функции rules() сразу вернуть пустой массив - то форма работает, но ес-но без валидации...
Проверил : к модели с таблицей юзеров есть нормальное обращение по всей программе...
Делаю форму регистрации нового юзера, причем у меня отдельный каталог с формами и в этой форме protected/forms/OperatorRegisterForm.php :
PHP:
<?php
class OperatorRegisterForm extends CFormModel
{
public $username;
...
public function rules()
{
return array(
array('username', 'unique',
'allowEmpty' => false,
'message'=>'Sorry, this User Name has already been taken.'),
?>И выскакивает ошибка
PHP:
include(UserModule.php) [<a href='function.include'>function.include</a>]: failed to open stream: No such file or directory
Stack Trace
Z:\home\localhost\www\local-yii-tyb.com\YiiBase.php(427): YiiBase::autoload()
unknown(0): YiiBase::autoload("UserModule")
Z:\home\localhost\www\local-yii-tyb.com\tybapp\protected\forms\OperatorRegisterForm.php(36): spl_autoload_call("UserModule")
Z:\home\localhost\www\local-yii-tyb.com\base\CModel.php(284): OperatorRegisterForm->rules()
Z:\home\localhost\www\local-yii-tyb.com\base\CModel.php(260): CModel->createValidators()
Z:\home\localhost\www\local-yii-tyb.com\base\CModel.php(304): CModel->getValidators("username")
Z:\home\localhost\www\local-yii-tyb.com\web\helpers\CHtml.php(1414): CModel->isAttributeRequired("username")
Z:\home\localhost\www\local-yii-tyb.com\web\widgets\CActiveForm.php(597): CHtml::activeLabelEx(OperatorRegisterForm, "username", array())
Z:\home\localhost\www\local-yii-tyb.com\tybapp\protected\views\_operator_register.php(68): CActiveForm->labelEx(OperatorRegisterForm, "username")
PHP:
<?php
$qForm = new OperatorRegisterForm;
$form = $this->beginWidget('CActiveForm', array(
'id' => 'quick-form',
'enableAjaxValidation'=> true ,
'enableClientValidation'=> true ,
'focus'=>array($qForm,'username'),
'clientOptions' => array(
'validateOnSubmit'=> true ,
'validateOnChange'=> true
),
'action' => array('main/operator_register'),
));
?>
<table cellpadding=2 style="border:2px dotted gray;display:none;" id="table_operator_register" >
<tr>
<td style="text-align: right">
<?php //echo '<pre>$form::'.print_r($form,true).'<pre>';
//echo '<pre>$qForm::'.print_r($qForm,true).'<pre>';
echo $form->labelEx($qForm, 'username'); ?> : // Тут ошибка
Код:
<pre>$form::CActiveForm Object
(
[action] => Array
(
[0] => main/operator_register
)
[method] => post
[stateful] =>
[errorMessageCssClass] => errorMessage
[htmlOptions] => Array
(
[id] => quick-form
)
[clientOptions] => Array
(
[validateOnSubmit] => 1
[validateOnChange] => 1
)
[enableAjaxValidation] => 1
[enableClientValidation] => 1
[focus] => Array
(
[0] => OperatorRegisterForm Object
(
[username] =>
[email] =>
[password] =>
[verifyPassword] =>
[firstname] =>
[lastname] =>
[verifyCode] =>
[country_id] =>
[birthday] =>
[location] =>
[sex] =>
[percent_discount] =>
[_errors:CModel:private] => Array
(
)
[_validators:CModel:private] =>
[_scenario:CModel:private] =>
[_e:CComponent:private] =>
[_m:CComponent:private] =>
)
[1] => username
)
[attributes:protected] => Array
(
)
[summaryID:protected] =>
[_summaryAttributes:CActiveForm:private] => Array
(
)
[actionPrefix] =>
[skin] => default
[_id:CWidget:private] => quick-form
[_owner:CWidget:private] => MainController Object
(
[layout] => //layouts/frontend_main
[defaultAction] => index
[app_config] => Array
(
[basePath] => Z:\home\localhost\www\local-yii-tyb.com\
[document_root] => Z:\home\localhost\www\local-yii-tyb.com\tybapp\
[app_name] => tybapp
[backend_root_url] => http://localhost/local-yii-tyb.com/tybapp/backend/
[frontend_root_url] => http://localhost/local-yii-tyb.com/tybapp/
[tablePrefix] => tyb_
[support_signature] => Best Regards,
The yiitest_test.com Team
support@yiitest_test.com
www.yiitest_test.com
Please consider our environment before printing this email.
[NoAnswer_Email] => NoReply@yii_test.com
[forms_enableAjaxValidation] => 1
[forms_enableClientValidation] => 1
[forms_validateOnSubmit] => 1
[forms_validateOnChange] => 1
[site_name] => First Yii Application
[DateFormat] => dd MMM yyyy
[MonthAsTextYearDateFormat] => %B %Y
[DateTimeFormat] => dd MMM yyyy h:m
[DateTimeAsTextFormat] => %B %d, %Y %H:%M%p
[DateAsTextFormat] => %B %d, %Y
[EmptyDateTimeValue] =>
[DateTimeMySqlFormat] => %Y-%m-%d %H:%M:%S
[work_js_dir] => work_js
[admin_pageSize] => 10
[enablePagination] => 1
[is_debug] => 1
[images_dir] => assets\mine\images\
[css_dir] => assets\mine\css\
[jquery_dir] => assets\mine\jquery\
[tiny_mce_dir] => assets\mine\tiny_mce\
[empty_tour_image] => emptyImg.png
[image_upload_valid_extentions] => Array
(
[0] => png
[1] => jpeg
[2] => jpg
[3] => gif
[4] => bmp
)
[uploads_images_max_size] => 149999
[uploads_images_max_width] => 1204
[uploads_images_max_height] => 1204
[purifier_config] => Array
(
[URI.AllowedSchemes] => Array
(
[http] => 1
[https] => 1
[mailto] => 1
[ftp] => 1
[nntp] => 1
[news] => 1
)
)
[captcha_properties] => Array
(
[class] => CCaptchaAction
[backColor] => 16777215
[transparent] =>
[testLimit] => 3
[foreColor] => 3440663
[height] => 50
[width] => 150
[maxLength] => 8
[minLength] => 7
[offset] => 2
)
[items_per_page] => 5
[max_images_in_tour] => 4
[tours_rows_on_page] => 3
[created_dir_permissions] => 0
[uploads_dir] => uploads
[dump_database] => uploads\dump_database\
[uploads_generated_pdfs_dir] => uploads\pdf\
[uploads_tours_dir] => uploads\tours\
[uploads_cms_items_dir] => uploads\cms_items\
[multi_upload_tmp_directory] => uploads\tmp\multi_upload\
[multi_upload_tmp_url_directory] => uploads\tmp\multi_upload\
[small_watermark] => assets\mine\images\watermarks\small_horse_watermark.png
[0] => horse_watermark.png
[watermark_x_margin] => 10
[watermark_y_margin] => 10
[watermark_opaque_koef] => 40
[use_thumbnails] => 1
[thumbnails_dir_name] => thumbnails
[thumbnail_small_width] => 32
[thumbnail_small_height] => 32
[thumbnail_big_width] => 64
[thumbnail_big_height] => 64
[thumbnail_quality] => 80
[avatar_width] => 64
[avatar_height] => 64
[avatar_quality] => 80
[image_preview_width] => 120
[image_preview_height] => 100
[attach_site_info_file] => Z:\home\localhost\www\local-yii-tyb.com\tybapp\uploads\attach_company_info\2560077.jpg
[sql_queries_to_file] => Z:\usr\local\apache\logs\sql_queries_to_file_
[sql_queries_skip_commands_array] => Array
(
[0] => SHOW FULL COLUMNS
[1] => SHOW CREATE TABLE
)
[ConcatStrMaxLength] => 50
[ConcatStrAddChars] => ...
[MinValidYear] => 2000
[MaxValidYear] => 2050
[DatePickerSelectionFormat] => mm/dd/yy
[contact_us_email] => [email protected]
[facebook_account] => http://facebook.com/yitest.com
[twitter_account] => http://twitter.com/yitest
)
[is_backend] =>
[menu] => Array
(
)
[breadcrumbs] => Array
(
)
[_id:CController:private] => main
[_action:CController:private] => CInlineAction Object
(
[_id:CAction:private] => index
[_controller:CAction:private] => MainController Object
*RECURSION*
[_e:CComponent:private] =>
[_m:CComponent:private] =>
)
[_pageTitle:CController:private] => My Web Application - Main
[_cachingStack:CController:private] =>
[_clips:CController:private] =>
[_dynamicOutput:CController:private] =>
[_pageStates:CController:private] =>
[_module:CController:private] =>
[_widgetStack:CBaseController:private] => Array
(
[0] => CJuiDialog Object
(
[tagName] => div
[scriptUrl] => /local-yii-tyb.com/tybapp/assets/c0740966/jui/js
[themeUrl] => /local-yii-tyb.com/tybapp/assets/c0740966/jui/css
[theme] => base
[scriptFile] => jquery-ui.min.js
[cssFile] => jquery-ui.css
[options] => Array
(
[title] => Operator Register
[autoOpen] =>
[modal] => 1
[width] => auto
[height] => auto
[draggable] =>
[resizable] =>
)
[htmlOptions] => Array
(
[id] => operator_register_dialog
)
[actionPrefix] =>
[skin] => default
[_id:CWidget:private] => operator_register_dialog
[_owner:CWidget:private] => MainController Object
*RECURSION*
[_widgetStack:CBaseController:private] => Array
(
)
[_e:CComponent:private] =>
[_m:CComponent:private] =>
)
[1] => CActiveForm Object
*RECURSION*
)
[_e:CComponent:private] =>
[_m:CComponent:private] =>
)
[_widgetStack:CBaseController:private] => Array
(
)
[_e:CComponent:private] =>
[_m:CComponent:private] =>
)
<pre><pre>$qForm::OperatorRegisterForm Object
(
[username] =>
[email] =>
[password] =>
[verifyPassword] =>
[firstname] =>
[lastname] =>
[verifyCode] =>
[country_id] =>
[birthday] =>
[location] =>
[sex] =>
[percent_discount] =>
[_errors:CModel:private] => Array
(
)
[_validators:CModel:private] =>
[_scenario:CModel:private] =>
[_e:CComponent:private] =>
[_m:CComponent:private] =>
)
Если в форме в функции rules() сразу вернуть пустой массив - то форма работает, но ес-но без валидации...
Проверил : к модели с таблицей юзеров есть нормальное обращение по всей программе...