本文整理汇总了PHP中UserHelper::getName方法的典型用法代码示例。如果您正苦于以下问题:PHP UserHelper::getName方法的具体用法?PHP UserHelper::getName怎么用?PHP UserHelper::getName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserHelper
的用法示例。
在下文中一共展示了UserHelper::getName方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct()
{
$this->username = UserHelper::getName();
$this->uploaddir = AVATAR_DIR;
$this->uploadfile = $this->uploaddir . $this->username . '.jpg';
$this->avatarfile = $this->uploaddir . $this->username . '-avatar.jpg';
$this->minifile = $this->uploaddir . $this->username . '-mini.jpg';
$this->target_width = $this->target_height = 160;
$this->mini_width = $this->mini_height = 40;
$this->jpeg_quality = 100;
}
示例2: create
public function create()
{
try {
$this->db = fORMDatabase::retrieve();
$this->db->query('BEGIN');
$profile = new Profile();
$profile->setLoginName(UserHelper::getName());
$profile->setDisplayName(UserHelper::getDisplayName());
$profile->setStartYear(fRequest::get('start_year'));
$profile->setClassNumber(fRequest::get('class_number'));
$profile->setStudentNumber(trim(fRequest::get('student_number')));
if (strlen($profile->getStudentNumber()) && !preg_match('/^\\d{10}$/', $profile->getStudentNumber())) {
throw new fValidationException('学号必须为10位数字');
}
$profile->setBirthday(trim(fRequest::get('birthday')));
$profile->setGender(fRequest::get('gender'));
//$profile->setLocation(trim(fRequest::get('location')));
$province = trim(fRequest::get('province'));
$city = trim(fRequest::get('city'));
$profile->setLocation(self::formatLocation($province, $city));
$profile->setPostNumber(trim(fRequest::get('post_number')));
$profile->setSubscription(trim(fRequest::get('subscription')));
$profile->setAdvices(trim(fRequest::get('advices')));
$profile->setPrivacyControl(trim(fRequest::get('privacy', 'int', 0)));
$profile->setField(trim(fRequest::get('field')));
$profile->setInstitute(trim(fRequest::get('institute')));
$profile->setPosition(trim(fRequest::get('position')));
$profile->setMajor(trim(fRequest::get('major')));
$profile->setMentor(trim(fRequest::get('mentor')));
$profile->setCreatedAt(Util::currentTime());
$profile->store();
foreach ($this->contact_types as $type) {
if (strlen(trim(fRequest::get($type)))) {
$contact = new Contact();
$contact->setProfileId($profile->getId());
$contact->setType($type);
$contact->setContent(trim(fRequest::get($type)));
$contact->setCreatedAt(Util::currentTime());
$contact->store();
}
}
$this->db->query('COMMIT');
Activity::fireNewProfile();
$this->ajaxReturn(array('result' => 'success', 'profile_id' => $profile->getId()));
} catch (fException $e) {
if (isset($this->db)) {
$this->db->query('ROLLBACK');
}
$this->ajaxReturn(array('result' => 'failure', 'message' => $e->getMessage()));
}
}
示例3: isEditor
public static function isEditor()
{
return strstr(EDITOR_IDS, '|' . UserHelper::getName() . '|') !== false;
}