本文整理匯總了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;
}