本文整理汇总了PHP中ProfileField::getErrors方法的典型用法代码示例。如果您正苦于以下问题:PHP ProfileField::getErrors方法的具体用法?PHP ProfileField::getErrors怎么用?PHP ProfileField::getErrors使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ProfileField
的用法示例。
在下文中一共展示了ProfileField::getErrors方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setupInitialData
/**
* Setup some inital database settings.
*
* This will be done at the first step.
*/
private function setupInitialData()
{
// Seems database is already initialized
if (HSetting::Get('paginationSize') == 10) {
return;
}
// Rebuild Search
HSearch::getInstance()->rebuild();
HSetting::Set('baseUrl', Yii::app()->getBaseUrl(true));
HSetting::Set('paginationSize', 10);
HSetting::Set('displayNameFormat', '{profile.firstname} {profile.lastname}');
// Authentication
HSetting::Set('authInternal', '1', 'authentication');
HSetting::Set('authLdap', '0', 'authentication');
HSetting::Set('refreshUsers', '1', 'authentication_ldap');
HSetting::Set('needApproval', '0', 'authentication_internal');
HSetting::Set('anonymousRegistration', '1', 'authentication_internal');
HSetting::Set('internalUsersCanInvite', '1', 'authentication_internal');
// Mailing
HSetting::Set('transportType', 'php', 'mailing');
HSetting::Set('systemEmailAddress', 'social@example.com', 'mailing');
HSetting::Set('systemEmailName', 'My Social Network', 'mailing');
HSetting::Set('receive_email_activities', User::RECEIVE_EMAIL_DAILY_SUMMARY, 'mailing');
HSetting::Set('receive_email_notifications', User::RECEIVE_EMAIL_WHEN_OFFLINE, 'mailing');
// File
HSetting::Set('maxFileSize', '1048576', 'file');
HSetting::Set('maxPreviewImageWidth', '200', 'file');
HSetting::Set('maxPreviewImageHeight', '200', 'file');
HSetting::Set('hideImageFileInfo', '0', 'file');
// Caching
HSetting::Set('type', 'CFileCache', 'cache');
HSetting::Set('expireTime', '3600', 'cache');
HSetting::Set('installationId', md5(uniqid("", true)), 'admin');
// Design
HSetting::Set('theme', "HumHub");
HSetting::Set('spaceOrder', 0, 'space');
// Basic
HSetting::Set('enable', 1, 'tour');
HSetting::Set('defaultLanguage', Yii::app()->getLanguage());
// Notification
HSetting::Set('enable_html5_desktop_notifications', 0, 'notification');
// Add Categories
$cGeneral = new ProfileFieldCategory();
$cGeneral->title = "General";
$cGeneral->sort_order = 100;
$cGeneral->visibility = 1;
$cGeneral->is_system = 1;
$cGeneral->description = '';
$cGeneral->save();
$cCommunication = new ProfileFieldCategory();
$cCommunication->title = "Communication";
$cCommunication->sort_order = 200;
$cCommunication->visibility = 1;
$cCommunication->is_system = 1;
$cCommunication->description = '';
$cCommunication->save();
$cSocial = new ProfileFieldCategory();
$cSocial->title = "Social bookmarks";
$cSocial->sort_order = 300;
$cSocial->visibility = 1;
$cSocial->is_system = 1;
$cSocial->description = '';
$cSocial->save();
// Add Fields
$field = new ProfileField();
$field->internal_name = "firstname";
$field->title = 'Firstname';
$field->sort_order = 100;
$field->profile_field_category_id = $cGeneral->id;
$field->field_type_class = 'ProfileFieldTypeText';
$field->ldap_attribute = 'givenName';
$field->is_system = 1;
$field->required = 1;
$field->show_at_registration = 1;
if ($field->save()) {
$field->fieldType->maxLength = 20;
$field->fieldType->save();
} else {
throw new CHttpException(500, print_r($field->getErrors(), true));
}
$field = new ProfileField();
$field->internal_name = "lastname";
$field->title = 'Lastname';
$field->sort_order = 200;
$field->profile_field_category_id = $cGeneral->id;
$field->field_type_class = 'ProfileFieldTypeText';
$field->ldap_attribute = 'sn';
$field->show_at_registration = 1;
$field->required = 1;
$field->is_system = 1;
if ($field->save()) {
$field->fieldType->maxLength = 30;
$field->fieldType->save();
}
$field = new ProfileField();
//.........这里部分代码省略.........