public static function _init() { static::$_properties['name']['label'] = term('member.name'); static::$_properties['name']['validation']['min_length'][] = conf('member.name.validation.length.min'); static::$_properties['name']['validation']['max_length'][] = conf('member.name.validation.length.max'); if (is_enabled('notice') && conf('mention.isEnabled', 'notice')) { static::$_properties['name']['validation']['match_pattern'][] = sprintf('/^(%s)$/u', conf('member.name.validation.match_patterns.register')); $method = conf('member.name.validation.blacklist.method'); if (is_callable($method)) { static::$_properties['name']['validation']['not_in_array'][] = call_user_func($method); } } static::$_properties['register_type']['validation']['in_array'][] = Site_Member::get_accept_member_register_types(); $sex_options = Site_Form::get_form_options4config('term.member.sex.options'); static::$_properties['sex']['label'] = term('member.sex.label'); static::$_properties['sex']['form']['options'] = $sex_options; static::$_properties['sex']['validation']['in_array'][] = array_keys($sex_options); $options_public_flag = Site_Util::get_public_flags(); static::$_properties['sex_public_flag']['label'] = sprintf('%sの%s', term('member.sex.label'), term('public_flag.label')); static::$_properties['sex_public_flag']['form'] = Site_Form::get_public_flag_configs(); static::$_properties['sex_public_flag']['validation']['in_array'][] = $options_public_flag; static::$_properties['birthyear']['label'] = term('member.birthyear'); $options = Form_Util::get_year_options(conf('member.profile.birthday.year_from'), conf('member.profile.birthday.year_to')); static::$_properties['birthyear']['form']['options'] = $options; static::$_properties['birthyear']['validation']['in_array'][] = array_keys($options); static::$_properties['birthyear_public_flag']['label'] = sprintf('%sの%s', term('member.birthyear'), term('public_flag.label')); static::$_properties['birthyear_public_flag']['form'] = Site_Form::get_public_flag_configs(); static::$_properties['birthyear_public_flag']['validation']['in_array'][] = $options_public_flag; static::$_properties['birthday']['label'] = term('member.birthday'); static::$_properties['birthday_public_flag']['label'] = sprintf('%sの%s', term('member.birthday'), term('public_flag.label')); static::$_properties['birthday_public_flag']['form'] = Site_Form::get_public_flag_configs(); static::$_properties['birthday_public_flag']['validation']['in_array'][] = $options_public_flag; static::$_properties['invite_member_id'] = Util_Orm::get_relational_numeric_key_prop(false); }
public static function _init() { static::$_properties['public_flag']['form'] = \Site_Form::get_public_flag_configs(); static::$_properties['public_flag']['validation']['in_array'][] = \Site_Util::get_public_flags(); if (is_enabled('notice')) { static::$_observers['MyOrm\\Observer_DeleteNotice'] = array('events' => array('before_delete'), 'conditions' => array('foreign_table' => array('note' => 'value'), 'foreign_id' => array('id' => 'property'))); } if (is_enabled('timeline')) { $type_note = \Config::get('timeline.types.note'); // 更新時に timeline の sort_datetime, comment_count を更新 static::$_observers['MyOrm\\Observer_UpdateRelationalTables'] = array('events' => array('after_update'), 'relations' => array('model_to' => '\\Timeline\\Model_Timeline', 'conditions' => array('foreign_table' => array('note' => 'value'), 'foreign_id' => array('id' => 'property'), 'type' => array($type_note => 'value')), 'check_changed' => array('check_properties' => array('title', 'body', 'public_flag', 'sort_datetime', 'comment_count', 'like_count')), 'update_properties' => array('public_flag', 'sort_datetime', 'comment_count', 'like_count', 'updated_at'))); } }
public static function _init() { static::$_properties['default_public_flag']['form'] = Site_Form::get_public_flag_configs(); static::$_properties['default_public_flag']['validation']['in_array'][] = Site_Util::get_public_flags(); $option_keys = array('form_type', 'display_type', 'value_type', 'is_edit_public_flag', 'is_unique', 'is_disp_regist' => 'get_is_disp_options', 'is_disp_config' => 'get_is_disp_options', 'is_disp_search' => 'get_is_disp_options'); foreach ($option_keys as $option_key => $method) { if (is_int($option_key)) { $option_key = $method; $method = sprintf('get_%s_options', $option_key); } self::set_properties_options($option_key, $method); } }
public static function _init() { static::$_properties['name']['label'] = term('album') . '名'; static::$_properties['public_flag']['form'] = \Site_Form::get_public_flag_configs(); static::$_properties['public_flag']['validation']['in_array'][] = \Site_Util::get_public_flags(); static::$_properties['foreign_table']['validation']['in_array'][] = Site_Util::get_album_foreign_tables(); if (is_enabled('notice')) { static::$_observers['MyOrm\\Observer_DeleteNotice'] = array('events' => array('before_delete'), 'conditions' => array('foreign_table' => array('album' => 'value'), 'foreign_id' => array('id' => 'property'))); } if (\Module::loaded('timeline')) { // 更新時に timeline の sort_datetime を更新 $observer_key = \Config::get('timeline.types.album'); static::$_observers['MyOrm\\Observer_UpdateRelationalTables'] = array('events' => array('after_update'), 'relations' => array('model_to' => '\\Timeline\\Model_Timeline', 'conditions' => array('foreign_table' => array('album' => 'value'), 'foreign_id' => array('id' => 'property'), 'type' => array($observer_key => 'value')), 'check_changed' => array('check_properties' => array('name', 'body', 'public_flag')), 'update_properties' => array('sort_datetime' => array('updated_at' => 'property')))); if (\Config::get('timeline.articles.cache.is_use')) { static::$_observers['MyOrm\\Observer_ExecuteToRelations'] = array('events' => array('after_update'), 'relations' => array('model_to' => '\\Timeline\\Model_Timeline', 'execute_func' => array('method' => '\\Timeline\\Site_Util::delete_cache', 'params' => array('id' => 'property')), 'conditions' => array('foreign_table' => array('album' => 'value'), 'foreign_id' => array('id' => 'property')))); } } }
public static function _init() { static::$_properties['type']['validation']['in_array'][] = \Config::get('timeline.types'); static::$_properties['foreign_table']['validation']['in_array'][] = Site_Util::get_accept_timeline_foreign_tables(); static::$_properties['public_flag']['form'] = \Site_Form::get_public_flag_configs(); static::$_properties['public_flag']['validation']['in_array'][] = \Site_Util::get_public_flags(); if (is_enabled('notice')) { static::$_observers['MyOrm\\Observer_InsertNotice'] = array('events' => array('after_insert'), 'update_properties' => array('foreign_table' => array('timeline' => 'value'), 'foreign_id' => array('id' => 'property'), 'type_key' => array('create' => 'value'), 'member_id_from' => array('member_id' => 'property'))); static::$_observers['MyOrm\\Observer_DeleteNotice'] = array('events' => array('before_delete'), 'conditions' => array('foreign_table' => array('timeline' => 'value'), 'foreign_id' => array('id' => 'property'))); } if (\Config::get('timeline.articles.cache.is_use')) { // 更新・削除時に timeline の cache を削除 static::$_observers['MyOrm\\Observer_UpdateTimeline'] = array('events' => array('after_update'), 'check_changed' => array('check_properties' => array('body', 'source', 'source_uri', 'public_flag', 'sort_datetime' => array('ignore_property' => 'comment_count')))); static::$_observers['MyOrm\\Observer_DeleteTimeline'] = array('events' => array('before_delete')); } if (\Config::get('timeline.importanceLevel.isEnabled')) { // 更新時に timeline の importance_level を更新 static::$_observers['MyOrm\\Observer_UpdateTimelineImportanceLevel'] = array('events' => array('before_update')); } }
public static function _init() { static::$_properties['name']['label'] = term('site.picture', 'site.title'); static::$_properties['public_flag']['form'] = \Site_Form::get_public_flag_configs(); static::$_properties['public_flag']['validation']['in_array'][] = \Site_Util::get_public_flags(); if (conf('albumImageLoction.saveFromExif', 'album')) { static::$_observers['MyOrm\\Observer_SaveAlbumImageLocation'] = array('events' => array('after_insert')); } if (is_enabled('notice')) { static::$_observers['MyOrm\\Observer_InsertNotice'] = array('events' => array('after_insert'), 'update_properties' => array('foreign_table' => array('album' => 'value'), 'foreign_id' => array('album_id' => 'property'), 'type_key' => array('child_data' => 'value'), 'member_id_from' => array('related' => array('album' => 'member_id')))); static::$_observers['MyOrm\\Observer_DeleteNotice'] = array('events' => array('before_delete'), 'conditions' => array('foreign_table' => array('album_image' => 'value'), 'foreign_id' => array('id' => 'property'))); } if (\Module::loaded('timeline')) { $type_album_image_profile = \Config::get('timeline.types.album_image_profile'); // 更新時に timeline の sort_datetime, comment_count を更新 static::$_observers['MyOrm\\Observer_UpdateRelationalTables'] = array('events' => array('after_update'), 'relations' => array('model_to' => '\\Timeline\\Model_Timeline', 'conditions' => array('foreign_table' => array('album_image' => 'value'), 'foreign_id' => array('id' => 'property'), 'type' => array($type_album_image_profile => 'value')), 'check_changed' => array('check_properties' => array('public_flag', 'sort_datetime', 'comment_count', 'like_count')), 'update_properties' => array('public_flag', 'sort_datetime', 'updated_at', 'comment_count', 'like_count'))); if (\Config::get('timeline.articles.cache.is_use')) { static::$_observers['MyOrm\\Observer_ExecuteToRelations'] = array('events' => array('after_update'), 'relations' => array('model_to' => '\\Timeline\\Model_TimelineChildData', 'conditions' => array('foreign_table' => array('album_image' => 'value'), 'foreign_id' => array('id' => 'property')), 'check_changed' => array('check_properties' => array('name', 'public_flag')), 'execute_func' => array('method' => '\\Timeline\\Site_Util::delete_cache', 'params' => array('timeline_id' => 'property')))); } } }
public static function get_validation_birthday() { $val = \Validation::forge('site_config_profile_birthday'); $name_prefix = 'birthday'; $name = self::get_name($name_prefix, 'isEnable'); $value = self::get_values($name, 0); $options_enable = array('0' => '無効', '1' => '有効'); $val->add($name, term('member.birthday') . '設定を有効にするか', array('type' => 'radio', 'options' => $options_enable, 'value' => $value))->add_rule('valid_string', 'numeric', 'required')->add_rule('in_array', array_keys($options_enable)); $name = self::get_name($name_prefix, 'isDispRegist'); $value = self::get_values($name, 1); $options_is_disp = array('1' => '表示する', '0' => '表示しない'); $val->add($name, '新規登録', array('type' => 'radio', 'options' => $options_is_disp, 'value' => $value))->add_rule('valid_string', 'numeric', 'required')->add_rule('in_array', array_keys($options_is_disp)); $name = self::get_name($name_prefix, 'isDispConfig'); $value = self::get_values($name, 1); $val->add($name, 'プロフィール変更', array('type' => 'radio', 'options' => $options_is_disp, 'value' => $value))->add_rule('valid_string', 'numeric', 'required')->add_rule('in_array', array_keys($options_is_disp)); $name = self::get_name($name_prefix, 'isDispSearch'); $value = self::get_values($name, 1); $val->add($name, 'メンバー検索', array('type' => 'radio', 'options' => $options_is_disp, 'value' => $value))->add_rule('valid_string', 'numeric', 'required')->add_rule('in_array', array_keys($options_is_disp)); $name_prefix = 'birthday_birthyear'; $name = self::get_name($name_prefix, 'viewType'); $value = self::get_values($name, 0); $options = array('0' => '生年表示', '1' => '年齢表示'); $val->add($name, '生年表示タイプ', array('type' => 'radio', 'options' => $options, 'value' => $value))->add_rule('valid_string', 'numeric')->add_rule('in_array', array_keys($options)); $name = self::get_name($name_prefix, 'displayType'); $value = self::get_values($name, 0); $options_display_type = \Site_Profile::get_display_type_options(); $val->add($name, '表示場所(生年)', array('type' => 'select', 'options' => $options_display_type, 'value' => $value))->add_rule('valid_string', 'numeric')->add_rule('in_array', array_keys($options_display_type)); $name = self::get_name($name_prefix, 'isRequired'); $value = self::get_values($name, 0); $options_is_required = array('1' => ''); $val->add($name, '必須(生年)', array('type' => 'checkbox', 'options' => $options_is_required, 'value' => $value))->add_rule('checkbox_val', $options_is_required); $name_prefix .= '_publicFlag'; $name = self::get_name($name_prefix, 'isEdit'); $value = self::get_values($name, 0); $options_is_edit_public_flag = array('0' => '固定', '1' => 'メンバー選択'); $val->add($name, '公開設定の選択(生年)', array('type' => 'radio', 'options' => $options_is_edit_public_flag, 'value' => $value))->add_rule('valid_string', 'numeric')->add_rule('in_array', array_keys($options_is_edit_public_flag)); $name = self::get_name($name_prefix, 'default'); $atters = \Site_Form::get_public_flag_configs(); $atters['value'] = self::get_values($name, conf('public_flag.default')); $val->add($name, '公開設定デフォルト値(生年)', $atters)->add_rule('valid_string', 'numeric')->add_rule('in_array', \Site_Util::get_public_flags()); $name_prefix = 'birthday_birthday'; $name = self::get_name($name_prefix, 'displayType'); $value = self::get_values($name, 0); $options_display_type = \Site_Profile::get_display_type_options(); $val->add($name, '表示場所(誕生日)', array('type' => 'select', 'options' => $options_display_type, 'value' => $value))->add_rule('valid_string', 'numeric')->add_rule('in_array', array_keys($options_display_type)); $name = self::get_name($name_prefix, 'isRequired'); $value = self::get_values($name, 0); $options_is_required = array('1' => ''); $val->add($name, '必須(誕生日)', array('type' => 'checkbox', 'options' => $options_is_required, 'value' => $value))->add_rule('checkbox_val', $options_is_required); $name_prefix .= '_publicFlag'; $name = self::get_name($name_prefix, 'isEdit'); $value = self::get_values($name, 0); $val->add($name, '公開設定の選択(誕生日)', array('type' => 'radio', 'options' => $options_is_edit_public_flag, 'value' => $value))->add_rule('valid_string', 'numeric')->add_rule('in_array', array_keys($options_is_edit_public_flag)); $name = self::get_name($name_prefix, 'default'); $atters = \Site_Form::get_public_flag_configs(); $atters['value'] = self::get_values($name, conf('public_flag.default')); $val->add($name, '公開設定デフォルト値(誕生日)', $atters)->add_rule('valid_string', 'numeric')->add_rule('in_array', \Site_Util::get_public_flags()); if (conf('member.profile.birthday.use_generation_view')) { $name_prefix = 'birthday_generationView'; $name = self::get_name($name_prefix, 'isEnable'); $value = self::get_values($name, 0); $val->add($name, '年代表示を有効にするか', array('type' => 'radio', 'options' => $options_enable, 'value' => $value))->add_rule('valid_string', 'numeric')->add_rule('in_array', array_keys($options_enable)); $name = self::get_name($name_prefix, 'unit'); $value = self::get_values($name, 0); $options = array('0' => '10年単位', '1' => '5年単位'); $val->add($name, '年代区切り', array('type' => 'radio', 'options' => $options, 'value' => $value))->add_rule('valid_string', 'numeric')->add_rule('in_array', array_keys($options)); $name_prefix .= '_publicFlag'; $name = self::get_name($name_prefix, 'isEdit'); $value = self::get_values($name, 0); $val->add($name, '公開設定の選択(年代)', array('type' => 'radio', 'options' => $options_is_edit_public_flag, 'value' => $value))->add_rule('valid_string', 'numeric')->add_rule('in_array', array_keys($options_is_edit_public_flag)); $name = self::get_name($name_prefix, 'default'); $atters = \Site_Form::get_public_flag_configs(); $atters['value'] = self::get_values($name, conf('public_flag.default')); $val->add($name, '公開設定デフォルト値(年代)', $atters)->add_rule('valid_string', 'numeric')->add_rule('in_array', \Site_Util::get_public_flags()); } return $val; }
public static function _init() { static::$_properties['type']['validation']['in_array'][] = \Config::get('timeline.types'); static::$_properties['public_flag']['form'] = \Site_Form::get_public_flag_configs(); static::$_properties['public_flag']['validation']['in_array'][] = \Site_Util::get_public_flags(); }