当前位置: 首页>>代码示例>>PHP>>正文


PHP UserAttributeKey::getEditableInProfileList方法代码示例

本文整理汇总了PHP中UserAttributeKey::getEditableInProfileList方法的典型用法代码示例。如果您正苦于以下问题:PHP UserAttributeKey::getEditableInProfileList方法的具体用法?PHP UserAttributeKey::getEditableInProfileList怎么用?PHP UserAttributeKey::getEditableInProfileList使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UserAttributeKey的用法示例。


在下文中一共展示了UserAttributeKey::getEditableInProfileList方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: t

    }
}
?>
        
        
        <h1 class="profilin"><?php 
echo t('Edit Profile');
?>
</h1>
        <div class="ccm-form">
            <form method="post" action="<?php 
echo $this->action('save');
?>
" id="profile-edit-form" enctype="multipart/form-data">
            <?php 
$attribs = UserAttributeKey::getEditableInProfileList();
if (is_array($attribs) && count($attribs)) {
    ?>
                <fieldset>
                <div class="ccm-profile-attribute">
                    <?php 
    echo $form->label('uEmail', t('Email'));
    ?>
 <span class="ccm-required">*</span><br/>
                    <?php 
    echo $form->text('uEmail', $ui->getUserEmail());
    ?>
                </div>
                <?php 
    if (ENABLE_USER_TIMEZONES) {
        ?>
开发者ID:ricardomccerqueira,项目名称:rcerqueira.portfolio,代码行数:31,代码来源:edit.php

示例2: save

	public function save() { 
		$ui = $this->get('ui');

		$uh = Loader::helper('concrete/user');
		$th = Loader::helper('text');
		$vsh = Loader::helper('validation/strings');
		$cvh = Loader::helper('concrete/validation');
		$e = Loader::helper('validation/error');
	
		$data = $this->post();
		
		/* 
		 * Validation
		*/
		
		// validate the user's email
		$email = $this->post('uEmail');
		if (!$vsh->email($email)) {
			$e->add(t('Invalid email address provided.'));
		} else if (!$cvh->isUniqueEmail($email) && $ui->getUserEmail() != $email) {
			$e->add(t("The email address '%s' is already in use. Please choose another.",$email));
		}

		// password
		if(strlen($data['uPasswordNew'])) {
			$passwordNew = $data['uPasswordNew'];
			$passwordNewConfirm = $data['uPasswordNewConfirm'];
			
			if ((strlen($passwordNew) < USER_PASSWORD_MINIMUM) || (strlen($passwordNew) > USER_PASSWORD_MAXIMUM)) {
				$e->add(t('A password must be between %s and %s characters', USER_PASSWORD_MINIMUM, USER_PASSWORD_MAXIMUM));
			}		
			
			if (strlen($passwordNew) >= USER_PASSWORD_MINIMUM && !$cvh->password($passwordNew)) {
				$e->add(t('A password may not contain ", \', >, <, or any spaces.'));
			}
			
			if ($passwordNew) {
				if ($passwordNew != $passwordNewConfirm) {
					$e->add(t('The two passwords provided do not match.'));
				}
			}
			$data['uPasswordConfirm'] = $passwordNew;
			$data['uPassword'] = $passwordNew;
		}		
		
		$aks = UserAttributeKey::getEditableInProfileList();

		foreach($aks as $uak) {
			if ($uak->isAttributeKeyRequiredOnProfile()) {
				$e1 = $uak->validateAttributeForm();
				if ($e1 == false) {
					$e->add(t('The field "%s" is required', $uak->getAttributeKeyName()));
				} else if ($e1 instanceof ValidationErrorHelper) {
					$e->add($e1);
				}
			}
		}

		if (!$e->has()) {		
			$data['uEmail'] = $email;		
			if(ENABLE_USER_TIMEZONES) {
				$data['uTimezone'] = $this->post('uTimezone');
			}
			
			$ui->update($data);
			
			foreach($aks as $uak) {
				$uak->saveAttributeForm($ui);				
			}
			$this->redirect("/profile/edit", "save_complete");
		} else {
			$this->set('error', $e);
		}
	}
开发者ID:nveid,项目名称:concrete5,代码行数:74,代码来源:edit.php


注:本文中的UserAttributeKey::getEditableInProfileList方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。