예제 #1
0
 public static function _init()
 {
     static::$_properties['member_id'] = Util_Orm::get_relational_numeric_key_prop();
     static::$_properties['profile_id'] = Util_Orm::get_relational_numeric_key_prop();
     static::$_properties['profile_option_id'] = Util_Orm::get_relational_numeric_key_prop(false);
     static::$_properties['public_flag']['validation']['in_array'][] = Site_Util::get_public_flags();
 }
예제 #2
0
파일: member.php 프로젝트: uzura8/flockbird
 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);
 }
예제 #3
0
파일: note.php 프로젝트: uzura8/flockbird
 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')));
     }
 }
예제 #4
0
 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);
     }
 }
예제 #5
0
파일: form.php 프로젝트: uzura8/flockbird
 public static function get_public_flag_options($key = null, $type = 'default', $with_no_change_option = false)
 {
     $options = array();
     if ($with_no_change_option) {
         $options[99] = '変更しない';
     }
     $public_flags = Site_Util::get_public_flags($type);
     foreach ($public_flags as $public_flag) {
         $options[$public_flag] = term('public_flag.options.' . $public_flag);
     }
     if (isset($key)) {
         return $options[$key];
     }
     return $options;
 }
예제 #6
0
파일: album.php 프로젝트: uzura8/flockbird
 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'))));
         }
     }
 }
예제 #7
0
 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'));
     }
 }
예제 #8
0
 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'))));
         }
     }
 }
예제 #9
0
 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;
 }
예제 #10
0
파일: note.php 프로젝트: uzura8/flockbird
 private static function get_validation_object(Model_Note $note, $is_edit = false)
 {
     $val = \Validation::forge();
     $val->add_model($note);
     $val->add('published_at_time', '日時')->add_rule('datetime_except_second')->add_rule('datetime_is_past');
     if (empty($note->is_published)) {
         $val->add('is_draft', term('form.draft'))->add_rule('valid_string', 'numeric')->add_rule('in_array', array(0, 1));
     }
     if ($is_edit) {
         $val->add('original_public_flag')->add_rule('in_array', \Site_Util::get_public_flags());
     }
     return $val;
 }
예제 #11
0
 /**
  * Validate if there is alpha_numeric small character
  *
  * @param   string
  * @return  bool
  */
 public static function _validation_public_flag($val)
 {
     return is_numeric($val) && in_array($val, Site_Util::get_public_flags());
 }
예제 #12
0
파일: model.php 프로젝트: uzura8/flockbird
 /**
  * @dataProvider get_list_provider
  */
 public function test_get_list($self_member_id = null, $target_member_id = null, $is_mytimeline = null, $viewType = null, $max_id = null, $limit = null, $is_latest = null, $is_desc = null, $since_id = null)
 {
     $public_flags_all = \Site_Util::get_public_flags();
     list($test_list, $next_id) = Site_Model::get_list($self_member_id, $target_member_id, $is_mytimeline, $viewType, $max_id, $limit, $is_latest, $is_desc, $since_id);
     if (!$test_list) {
         return;
     }
     $is_limitted = count($test_list) <= self::$total_count;
     // test for limit
     if ($limit) {
         $this->assertTrue(count($test_list) <= $limit);
     } else {
         $this->assertTrue(count($test_list) <= \Config::get('timeline.articles.limit'));
     }
     $first_id = 0;
     $before_id = 0;
     foreach ($test_list as $timeline_cache) {
         if (!$first_id) {
             $first_id = $timeline_cache->id;
         }
         // member_id
         if ($target_member_id) {
             $this->assertEquals($target_member_id, $timeline_cache->member_id);
         }
         // test for public_flag
         if ($timeline_cache->public_flag == FBD_PUBLIC_FLAG_PRIVATE) {
             $this->assertEquals($self_member_id, $timeline_cache->member_id);
         }
         if (!$self_member_id) {
             $this->assertEquals($timeline_cache->public_flag, FBD_PUBLIC_FLAG_ALL);
         }
         if ($self_member_id && $timeline_cache->member_id != $self_member_id) {
             $this->assertTrue(in_array($timeline_cache->public_flag, array(FBD_PUBLIC_FLAG_ALL, FBD_PUBLIC_FLAG_MEMBER)));
         }
         if ($self_member_id && $self_member_id == $target_member_id) {
             $this->assertTrue(in_array($timeline_cache->public_flag, array(FBD_PUBLIC_FLAG_ALL, FBD_PUBLIC_FLAG_MEMBER, FBD_PUBLIC_FLAG_PRIVATE)));
         }
         if ($self_member_id && $target_member_id && $self_member_id != $target_member_id) {
             $this->assertTrue(in_array($timeline_cache->public_flag, array(FBD_PUBLIC_FLAG_ALL, FBD_PUBLIC_FLAG_MEMBER)));
         }
         if ($self_member_id && $is_mytimeline && $timeline_cache->member_id != $self_member_id) {
             $this->assertTrue(in_array($timeline_cache->public_flag, array(FBD_PUBLIC_FLAG_ALL, FBD_PUBLIC_FLAG_MEMBER)));
         }
         if ($self_member_id && $is_mytimeline && $timeline_cache->member_id == $self_member_id) {
             $this->assertTrue(in_array($timeline_cache->public_flag, array(FBD_PUBLIC_FLAG_ALL, FBD_PUBLIC_FLAG_MEMBER, FBD_PUBLIC_FLAG_PRIVATE)));
         }
         // test for viewType
         if ($is_mytimeline && $viewType == 1) {
             $member_ids = \Model_MemberRelation::get_member_ids($self_member_id, 'follow');
             $member_ids[] = $self_member_id;
             $this->assertTrue(in_array($timeline_cache->member_id, $member_ids));
         }
         if ($is_mytimeline && $viewType == 2) {
             $member_ids = \Model_MemberRelation::get_member_ids($self_member_id, 'firiend');
             $member_ids[] = $self_member_id;
             $this->assertTrue(in_array($timeline_cache->member_id, $member_ids));
         }
         // test for param max_id
         if ($max_id) {
             $this->assertTrue($timeline_cache->id <= $max_id);
         }
         // test for param since_id
         if ($since_id) {
             $this->assertTrue($timeline_cache->id > $since_id);
         }
         if ($before_id) {
             // test for param is_desc
             if ($is_desc) {
                 $this->assertTrue($timeline_cache->id < $before_id);
             } else {
                 $this->assertTrue($timeline_cache->id > $before_id);
             }
         }
         $before_id = $timeline_cache->id;
     }
     $last_id = $timeline_cache->id;
     // test for param is_latest
     if ($is_latest && !$is_limitted) {
         $this->assertTrue($first_id == self::$total_last_id);
     }
     // test for return next_id
     if ($next_id) {
         if ($is_desc) {
             $this->assertTrue($next_id < $last_id);
         } else {
             $this->assertTrue($next_id > $last_id);
         }
     }
 }
예제 #13
0
파일: image.php 프로젝트: uzura8/flockbird
 private static function get_validation_object(Model_AlbumImage $album_image)
 {
     $val = \Validation::forge();
     $val->add_model($album_image);
     $val->fieldset()->field('file_name')->delete_rule('required');
     if (Site_Util::check_album_disabled_to_update($album_image->album->foreign_table, true)) {
         $val->fieldset()->field('public_flag')->delete_rule('required');
         $val->fieldset()->delete('public_flag');
     } else {
         $val->add('original_public_flag')->add_rule('in_array', \Site_Util::get_public_flags());
     }
     $val->add('shot_at_time', '撮影日時')->add_rule('required')->add_rule('datetime_except_second')->add_rule('datetime_is_past');
     if (is_enabled_map('image/edit', 'album')) {
         $val->add('latitude', '緯度')->add_rule('numeric_between', -90, 90);
         $val->add('longitude', '経度')->add_rule('numeric_between', -180, 180);
     }
     return $val;
 }
예제 #14
0
        ?>
><?php 
    }
    ?>
	<button  <?php 
    echo Util_Array::conv_array2attr_string($btn_attr);
    ?>
>
		<?php 
    echo $icon . $name;
    ?>
 <span class="caret"></span>
	</button>
	<ul class="dropdown-menu" role="menu">
<?php 
    $public_flags = \Site_Util::get_public_flags($option_type);
    foreach ($public_flags as $public_flag_value) {
        $label = get_public_flag_label($public_flag_value, false, 'icon_term');
        if ($public_flag == $public_flag_value) {
            ?>
		<li><span class="disabled"><?php 
            echo $label;
            ?>
</span></li>
<?php 
        } else {
            $data_atters = array('public_flag' => $public_flag_value);
            if (!empty($id)) {
                $data_atters['id'] = $id;
            }
            if (!empty($view_icon_only)) {
예제 #15
0
파일: thread.php 프로젝트: uzura8/flockbird
 private static function get_validation_object(Model_Thread $thread, $is_edit = false)
 {
     $val = \Validation::forge();
     $val->add_model($thread);
     if ($is_edit) {
         $val->add('original_public_flag')->add_rule('in_array', \Site_Util::get_public_flags());
     }
     return $val;
 }
예제 #16
0
function get_public_flags() {
	var public_flags = new Object();
<?php 
$public_flag_values = Site_Util::get_public_flags();
foreach ($public_flag_values as $value) {
    list($name, $icon, $btn_color) = get_public_flag_label($value);
    ?>
	public_flags['<?php 
    echo $value;
    ?>
'] = new Object();
	public_flags['<?php 
    echo $value;
    ?>
']['name']      = '<?php 
    echo $name;
    ?>
';
	public_flags['<?php 
    echo $value;
    ?>
']['icon']      = '<?php 
    echo $icon;
    ?>
';
	public_flags['<?php 
    echo $value;
    ?>
']['btn_color'] = '<?php 
    echo $btn_color;
    ?>
예제 #17
0
 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();
 }
예제 #18
0
파일: album.php 프로젝트: uzura8/flockbird
 private static function get_validation(Model_Album $album, $is_edit = false)
 {
     $val = \Validation::forge();
     $val->add_model($album);
     $val->add('original_public_flag')->add_rule('in_array', \Site_Util::get_public_flags());
     if ($is_edit) {
         $val->add('is_update_children_public_flag')->add_rule('in_array', array(0, 1));
     }
     return $val;
 }
예제 #19
0
 private function set_member_public_flag($name)
 {
     $this->member_public_flags[$name] = $this->get_member_field_default_public_flag($name);
     $prop = $name . '_public_flag';
     if ($this->member_obj && !is_null($this->member_obj->{$prop})) {
         $this->member_public_flags[$name] = $this->member_obj->{$prop};
     }
     if (!$this->check_is_editable_member_field_public_flag($name)) {
         return;
     }
     $posted_public_flags = Input::post('member_public_flag');
     if (!isset($posted_public_flags[$name])) {
         return;
     }
     if (!in_array($posted_public_flags[$name], Site_Util::get_public_flags())) {
         return;
     }
     $this->member_public_flags[$name] = $posted_public_flags[$name];
 }