/** * (non-PHPdoc) * @see \tfc\mvc\interfaces\Action::run() */ public function run() { Text::_('MOD_MEMBER__'); $mod = Model::getInstance('Social', 'member'); $row = $mod->findByPk(Identity::getUserId()); if (is_array($row) && isset($row['birth_ymd'])) { $row['birth_y'] = substr($row['birth_ymd'], 0, 4); $row['birth_m'] = substr($row['birth_ymd'], 5, 2); $row['birth_d'] = substr($row['birth_ymd'], 8, 2); } //\tfc\saf\debug_dump($row); $this->assign('sex_enum', DataSocial::getSexEnum()); $this->assign('interests_enum', DataSocial::getInterestsEnum()); $this->render($row); }
/** * 通过“性别”,获取“性别名” * @param string $sex * @return string */ public function getSexLangBySex($sex) { $enum = DataSocial::getSexEnum(); return isset($enum[$sex]) ? $enum[$sex] : ''; }
/** * (non-PHPdoc) * @see \library\BaseModel::getElementsRender() */ public function getElementsRender() { $urlManager = Mvc::getView()->getUrlManager(); $output = array('member_id' => array('__tid__' => 'main', 'type' => 'hidden', 'label' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_MEMBER_ID_LABEL'), 'hint' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_MEMBER_ID_HINT')), 'login_name' => array('__tid__' => 'main', 'type' => 'text', 'label' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_LOGIN_NAME_LABEL'), 'hint' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_LOGIN_NAME_HINT'), 'required' => true), 'realname' => array('__tid__' => 'main', 'type' => 'text', 'label' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_REALNAME_LABEL'), 'hint' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_REALNAME_HINT')), 'sex' => array('__tid__' => 'main', 'type' => 'radio', 'label' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_SEX_LABEL'), 'hint' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_SEX_HINT'), 'options' => DataSocial::getSexEnum(), 'value' => DataSocial::SEX_MALE), 'birth_ymd' => array('__tid__' => 'main', 'type' => 'datetimepicker', 'label' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_BIRTH_YMD_LABEL'), 'hint' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_BIRTH_YMD_HINT'), 'format' => 'date'), 'is_pub_birth' => array('__tid__' => 'main', 'type' => 'switch', 'label' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_IS_PUB_BIRTH_LABEL'), 'hint' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_IS_PUB_BIRTH_HINT'), 'options' => DataSocial::getIsPubBirthEnum(), 'value' => DataSocial::IS_PUB_BIRTH_Y), 'birth_md' => array('__tid__' => 'main', 'type' => 'text', 'label' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_BIRTH_MD_LABEL'), 'hint' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_BIRTH_MD_HINT')), 'anniversary' => array('__tid__' => 'main', 'type' => 'text', 'label' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_ANNIVERSARY_LABEL'), 'hint' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_ANNIVERSARY_HINT')), 'is_pub_anniversary' => array('__tid__' => 'main', 'type' => 'switch', 'label' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_IS_PUB_ANNIVERSARY_LABEL'), 'hint' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_IS_PUB_ANNIVERSARY_HINT'), 'options' => DataSocial::getIsPubAnniversaryEnum(), 'value' => DataSocial::IS_PUB_ANNIVERSARY_Y), 'head_portrait' => array('__tid__' => 'main', 'type' => 'text', 'label' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_HEAD_PORTRAIT_LABEL'), 'hint' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_HEAD_PORTRAIT_HINT')), 'head_portrait_file' => array('__tid__' => 'main', 'type' => 'string', 'label' => '', 'hint' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_HEAD_PORTRAIT_HINT'), 'value' => '<div id="head_portrait_file" url="' . $urlManager->getUrl('ajaxupload', '', '', array('from' => 'picture')) . '" name="upload">' . Text::_('CFG_SYSTEM_GLOBAL_UPLOAD') . '</div>'), 'introduce' => array('__tid__' => 'main', 'type' => 'textarea', 'label' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_INTRODUCE_LABEL'), 'hint' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_INTRODUCE_HINT')), 'interests' => array('__tid__' => 'main', 'type' => 'checkbox', 'label' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_INTERESTS_LABEL'), 'hint' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_INTERESTS_HINT'), 'options' => DataSocial::getInterestsEnum()), 'is_pub_interests' => array('__tid__' => 'main', 'type' => 'switch', 'label' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_IS_PUB_INTERESTS_LABEL'), 'hint' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_IS_PUB_INTERESTS_HINT'), 'options' => DataSocial::getIsPubInterestsEnum(), 'value' => DataSocial::IS_PUB_INTERESTS_Y), 'telephone' => array('__tid__' => 'main', 'type' => 'text', 'label' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_TELEPHONE_LABEL'), 'hint' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_TELEPHONE_HINT')), 'mobiphone' => array('__tid__' => 'main', 'type' => 'text', 'label' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_MOBIPHONE_LABEL'), 'hint' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_MOBIPHONE_HINT')), 'is_pub_mobiphone' => array('__tid__' => 'main', 'type' => 'switch', 'label' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_IS_PUB_MOBIPHONE_LABEL'), 'hint' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_IS_PUB_MOBIPHONE_HINT'), 'options' => DataSocial::getIsPubMobiphoneEnum(), 'value' => DataSocial::IS_PUB_MOBIPHONE_Y), 'email' => array('__tid__' => 'main', 'type' => 'text', 'label' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_EMAIL_LABEL'), 'hint' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_EMAIL_HINT')), 'is_pub_email' => array('__tid__' => 'main', 'type' => 'switch', 'label' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_IS_PUB_EMAIL_LABEL'), 'hint' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_IS_PUB_EMAIL_HINT'), 'options' => DataSocial::getIsPubEmailEnum(), 'value' => DataSocial::IS_PUB_EMAIL_Y), 'live_country_id' => array('__tid__' => 'main', 'type' => 'select', 'label' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_LIVE_COUNTRY_ID_LABEL'), 'hint' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_LIVE_COUNTRY_ID_HINT')), 'live_province_id' => array('__tid__' => 'main', 'type' => 'select', 'label' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_LIVE_PROVINCE_ID_LABEL'), 'hint' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_LIVE_PROVINCE_ID_HINT')), 'live_city_id' => array('__tid__' => 'main', 'type' => 'select', 'label' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_LIVE_CITY_ID_LABEL'), 'hint' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_LIVE_CITY_ID_HINT')), 'live_district_id' => array('__tid__' => 'main', 'type' => 'select', 'label' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_LIVE_DISTRICT_ID_LABEL'), 'hint' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_LIVE_DISTRICT_ID_HINT')), 'live_country' => array('__tid__' => 'main', 'type' => 'text', 'label' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_LIVE_COUNTRY_LABEL'), 'hint' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_LIVE_COUNTRY_HINT')), 'live_province' => array('__tid__' => 'main', 'type' => 'text', 'label' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_LIVE_PROVINCE_LABEL'), 'hint' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_LIVE_PROVINCE_HINT')), 'live_city' => array('__tid__' => 'main', 'type' => 'text', 'label' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_LIVE_CITY_LABEL'), 'hint' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_LIVE_CITY_HINT')), 'live_district' => array('__tid__' => 'main', 'type' => 'text', 'label' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_LIVE_DISTRICT_LABEL'), 'hint' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_LIVE_DISTRICT_HINT')), 'live_street' => array('__tid__' => 'main', 'type' => 'text', 'label' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_LIVE_STREET_LABEL'), 'hint' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_LIVE_STREET_HINT')), 'live_zipcode' => array('__tid__' => 'main', 'type' => 'text', 'label' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_LIVE_ZIPCODE_LABEL'), 'hint' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_LIVE_ZIPCODE_HINT')), 'address_country_id' => array('__tid__' => 'main', 'type' => 'select', 'label' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_ADDRESS_COUNTRY_ID_LABEL'), 'hint' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_ADDRESS_COUNTRY_ID_HINT')), 'address_province_id' => array('__tid__' => 'main', 'type' => 'select', 'label' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_ADDRESS_PROVINCE_ID_LABEL'), 'hint' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_ADDRESS_PROVINCE_ID_HINT')), 'address_city_id' => array('__tid__' => 'main', 'type' => 'select', 'label' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_ADDRESS_CITY_ID_LABEL'), 'hint' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_ADDRESS_CITY_ID_HINT')), 'address_district_id' => array('__tid__' => 'main', 'type' => 'select', 'label' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_ADDRESS_DISTRICT_ID_LABEL'), 'hint' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_ADDRESS_DISTRICT_ID_HINT')), 'address_country' => array('__tid__' => 'main', 'type' => 'text', 'label' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_ADDRESS_COUNTRY_LABEL'), 'hint' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_ADDRESS_COUNTRY_HINT')), 'address_province' => array('__tid__' => 'main', 'type' => 'text', 'label' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_ADDRESS_PROVINCE_LABEL'), 'hint' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_ADDRESS_PROVINCE_HINT')), 'address_city' => array('__tid__' => 'main', 'type' => 'text', 'label' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_ADDRESS_CITY_LABEL'), 'hint' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_ADDRESS_CITY_HINT')), 'address_district' => array('__tid__' => 'main', 'type' => 'text', 'label' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_ADDRESS_DISTRICT_LABEL'), 'hint' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_ADDRESS_DISTRICT_HINT')), 'address_street' => array('__tid__' => 'main', 'type' => 'text', 'label' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_ADDRESS_STREET_LABEL'), 'hint' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_ADDRESS_STREET_HINT')), 'address_zipcode' => array('__tid__' => 'main', 'type' => 'text', 'label' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_ADDRESS_ZIPCODE_LABEL'), 'hint' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_ADDRESS_ZIPCODE_HINT')), 'qq' => array('__tid__' => 'contact', 'type' => 'text', 'label' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_QQ_LABEL'), 'hint' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_QQ_HINT')), 'msn' => array('__tid__' => 'contact', 'type' => 'text', 'label' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_MSN_LABEL'), 'hint' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_MSN_HINT')), 'skypeid' => array('__tid__' => 'contact', 'type' => 'text', 'label' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_SKYPEID_LABEL'), 'hint' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_SKYPEID_HINT')), 'wangwang' => array('__tid__' => 'contact', 'type' => 'text', 'label' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_WANGWANG_LABEL'), 'hint' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_WANGWANG_HINT')), 'weibo' => array('__tid__' => 'contact', 'type' => 'text', 'label' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_WEIBO_LABEL'), 'hint' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_WEIBO_HINT')), 'blog' => array('__tid__' => 'contact', 'type' => 'text', 'label' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_BLOG_LABEL'), 'hint' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_BLOG_HINT')), 'website' => array('__tid__' => 'contact', 'type' => 'text', 'label' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_WEBSITE_LABEL'), 'hint' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_WEBSITE_HINT')), 'fax' => array('__tid__' => 'contact', 'type' => 'text', 'label' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_FAX_LABEL'), 'hint' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_FAX_HINT')), 'addresses' => array('__tid__' => 'main', 'type' => 'text', 'label' => Text::_('MOD_MEMBER_URLS_ADDRESSES_INDEX'), 'hint' => Text::_('MOD_MEMBER_URLS_ADDRESSES_CREATE'))); return $output; }
/** * (non-PHPdoc) * @see \libsrv\FormProcessor::_cleanPostProcess() */ protected function _cleanPostProcess() { if (isset($this->sex)) { $enum = DataSocial::getSexEnum(); if (!isset($enum[$this->sex])) { $this->sex = null; } } if (isset($this->interests)) { $enum = DataSocial::getInterestsEnum(); $newInterests = array(); $oldInterests = (array) $this->interests; foreach ($oldInterests as $value) { if (($value = trim($value)) === '') { continue; } if (isset($enum[$value])) { $newInterests[] = $value; } } $this->interests = implode(',', array_unique($newInterests)); } if (isset($this->birth_ymd)) { $birthYmd = date('Y-m-d', strtotime($this->birth_ymd)); if ($birthYmd !== $this->birth_ymd) { unset($this->birth_ymd); } else { $this->birth_md = date('md', strtotime($this->birth_ymd)); } } if (isset($this->is_pub_birth)) { $enum = DataSocial::getIsPubBirthEnum(); if (!isset($enum[$this->is_pub_birth])) { unset($enum[$this->is_pub_birth]); } } if (isset($this->is_pub_anniversary)) { $enum = DataSocial::getIsPubAnniversaryEnum(); if (!isset($enum[$this->is_pub_anniversary])) { unset($enum[$this->is_pub_anniversary]); } } if (isset($this->is_pub_interests)) { $enum = DataSocial::getIsPubInterestsEnum(); if (!isset($enum[$this->is_pub_interests])) { unset($enum[$this->is_pub_interests]); } } if (isset($this->is_pub_mobiphone)) { $enum = DataSocial::getIsPubMobiphoneEnum(); if (!isset($enum[$this->is_pub_mobiphone])) { unset($enum[$this->is_pub_mobiphone]); } } if (isset($this->is_pub_email)) { $enum = DataSocial::getIsPubEmailEnum(); if (!isset($enum[$this->is_pub_email])) { unset($enum[$this->is_pub_email]); } } return true; }