/** * 获取“是否默认地址”所有选项 * @return array */ public static function getIsDefaultEnum() { static $enum = null; if ($enum === null) { $enum = array(self::IS_DEFAULT_Y => Lang::_('SRV_ENUM_GLOBAL_YES'), self::IS_DEFAULT_N => Lang::_('SRV_ENUM_GLOBAL_NO')); } return $enum; }
/** * 通过主键,编辑“登录密码” * @param integer $memberId * @param string $password * @param string $repassword * @return integer */ public function modifyPasswordByPk($memberId, $password, $repassword) { $formProcessor = $this->getFormProcessor(); if (($password = trim($password)) === '') { $formProcessor->addError('password', Lang::_('SRV_FILTER_REPWD_NEW_PASSWORD_NOTEMPTY')); return false; } if (!$formProcessor->run(FormProcessor::OP_UPDATE, array('password' => $password, 'repassword' => $repassword), $memberId)) { return false; } $attributes = $formProcessor->getValues(); $rowCount = $this->getDb()->modifyByPk($formProcessor->id, $attributes); return $rowCount; }
/** * 获取“详细地址”验证规则 * @param mixed $value * @return array */ public function getAddrStreetRule($value) { return array('MinLength' => new validator\MinLengthValidator($value, 5, Lang::_('SRV_FILTER_MEMBER_ADDRESSES_ADDR_STREET_MINLENGTH')), 'MaxLength' => new validator\MaxLengthValidator($value, 120, Lang::_('SRV_FILTER_MEMBER_ADDRESSES_ADDR_STREET_MAXLENGTH'))); }
/** * 获取“备用邮箱”验证规则 * @param mixed $value * @return array */ public function getEmailRule($value) { if ($value === '') { return array(); } return array('Mail' => new validator\MailValidator($value, true, Lang::_('SRV_FILTER_MEMBER_SOCIAL_EMAIL_MAIL'))); }
/** * 获取“是否删除”所有选项 * @return array */ public static function getTrashEnum() { static $enum = null; if ($enum === null) { $enum = array(self::TRASH_Y => Lang::_('SRV_ENUM_GLOBAL_YES'), self::TRASH_N => Lang::_('SRV_ENUM_GLOBAL_NO')); } return $enum; }
/** * 通过“错误码”获取“错误信息” * @param integer $errNo * @return string */ public static function getErrMsgByErrNo($errNo) { $errNo = (int) $errNo; $enum = self::getErrMsgEnum(); return isset($enum[$errNo]) ? $enum[$errNo] : Lang::_('SRV_FILTER_ACCOUNT_UNKNOWN_WRONG'); }
/** * 获取“是否删除”验证规则 * @param mixed $value * @return array */ public function getTrashRule($value) { $enum = DataPortal::getTrashEnum(); return array('InArray' => new validator\InArrayValidator($value, array_keys($enum), sprintf(Lang::_('SRV_FILTER_MEMBER_PORTAL_TRASH_INARRAY'), implode(', ', $enum)))); }
/** * 获取“确认密码”验证规则 * @param mixed $value * @return array */ public function getPRepasswordRule($value) { return array('Equal' => new validator\EqualValidator($value, $this->p_password, Lang::_('SRV_FILTER_MEMBERS_P_REPASSWORD_EQUAL'))); }
/** * 获取“排序”验证规则 * @param mixed $value * @return array */ public function getSortRule($value) { return array('Integer' => new validator\IntegerValidator($value, true, Lang::_('SRV_FILTER_MEMBER_TYPES_SORT_INTEGER'))); }
/** * 获取“兴趣爱好”所有选项 * @return array */ public static function getInterestsEnum() { static $enum = null; if ($enum === null) { $enum = array(self::INTERESTS_BOOKS => Lang::_('SRV_ENUM_MEMBER_SOCIAL_INTERESTS_BOOKS'), self::INTERESTS_IT => Lang::_('SRV_ENUM_MEMBER_SOCIAL_INTERESTS_IT'), self::INTERESTS_CAR => Lang::_('SRV_ENUM_MEMBER_SOCIAL_INTERESTS_CAR'), self::INTERESTS_COSMETIC => Lang::_('SRV_ENUM_MEMBER_SOCIAL_INTERESTS_COSMETIC'), self::INTERESTS_EXERCISE => Lang::_('SRV_ENUM_MEMBER_SOCIAL_INTERESTS_EXERCISE')); } return $enum; }