本文整理汇总了PHP中UserHelper::getProfileId方法的典型用法代码示例。如果您正苦于以下问题:PHP UserHelper::getProfileId方法的具体用法?PHP UserHelper::getProfileId怎么用?PHP UserHelper::getProfileId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserHelper
的用法示例。
在下文中一共展示了UserHelper::getProfileId方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: upload
/**
* Upload an image file for avatar
*/
public function upload()
{
try {
if (self::isImage($_FILES['avatar-file']) && move_uploaded_file($_FILES['avatar-file']['tmp_name'], $this->uploadfile)) {
fURL::redirect(SITE_BASE . '/avatar/edit');
} else {
throw new fValidationException('上传图片失败');
}
} catch (Exception $e) {
fMessaging::create('failure', 'upload avatar', $e->getMessage());
fURL::redirect(SITE_BASE . '/profile/' . UserHelper::getProfileId());
}
}
示例2: delete
public function delete($id)
{
try {
$msg = new Msg($id);
if (UserHelper::getProfileId() != $msg->getReceiver() and !UserHelper::isEditor()) {
throw new fValidationException('not allowed');
}
$msg->delete();
$this->ajaxReturn(array('result' => 'success'));
} catch (fException $e) {
$this->ajaxReturn(array('result' => 'failure', 'message' => $e->getMessage()));
}
}
示例3: fire
/**
* This function never fails.
*/
protected static function fire($type)
{
try {
$activity = new Activity();
try {
$activity->setProfileId(UserHelper::getProfileId());
} catch (fException $e) {
$activity->setProfileId(NULL);
}
$activity->setRealname(UserHelper::getDisplayName());
$activity->setType($type);
$activity->store();
} catch (Exception $e) {
// do nothing
}
}
示例4: reply
public function reply($id)
{
try {
$tweet = new Tweet($id);
$comment = new TweetComment();
$comment->setTweetId($tweet->getId());
$comment->setProfileId(UserHelper::getProfileId());
$comment->setContent(trim(fRequest::get('tweet-comment')));
if (strlen($comment->getContent()) < 1) {
throw new fValidationException('回复长度不能少于1个字符');
}
if (strlen($comment->getContent()) > 140) {
throw new fValidationException('回复长度不能超过140个字符');
}
$comment->store();
} catch (fException $e) {
// TODO
}
fURL::redirect(SITE_BASE . '/profile/' . $tweet->getProfileId() . '#tweet/' . $tweet->getId());
}
示例5: htmlspecialchars
<a href="http://law.sjtu.edu.cn/Rss/" target="_blank" class="icon_rss"></a>
<a href="http://weibo.com/2415072065" target="_blank" class="icon_sina" title="新浪微博"></a>
</div>
</div>
<div class="body">
<div class="logo">
<div class="logo1" onclick="window.open('http://www.sjtu.edu.cn/');" title="上海交通大学"></div>
<div class="logo2" onclick="window.open('/');" title="凯源法学院"></div>
</div>
<div style="text-align:right;padding-right:20px;">
<?php
if (fAuthorization::checkLoggedIn()) {
?>
<?php
if (UserHelper::hasProfile()) {
$profile_link = SITE_BASE . '/profile/' . UserHelper::getProfileId();
} else {
$profile_link = SITE_BASE . '/profiles/new';
}
?>
Hi, <a href="<?php
echo $profile_link;
?>
"><?php
echo htmlspecialchars(UserHelper::getDisplayName());
?>
</a> |
<?php
if (UserHelper::isEditor()) {
?>
<a href="<?php
示例6: reply
public function reply($id)
{
try {
$article = new Article($id);
$comment = new ArticleComment();
$comment->setArticleId($article->getId());
$comment->setProfileId(UserHelper::getProfileId());
$comment->setContent(trim(fRequest::get('article-comment')));
if (strlen($comment->getContent()) < 1) {
throw new fValidationException('回复长度不能少于1个字符');
}
if (strlen($comment->getContent()) > 240) {
throw new fValidationException('回复长度不能超过240个字符');
}
$comment->store();
fMessaging::create('success', 'create article comment', '成功发表评论!');
fURL::redirect(SITE_BASE . '/article/' . $id . '#comment-' . $comment->getId());
} catch (fException $e) {
fMessaging::create('failure', 'create article comment', $e->getMessage());
fURL::redirect(SITE_BASE . '/article/' . $id . '#comment-form');
}
}
示例7: array
<img src="<?php
echo AVATAR_BASE;
?>
/<?php
echo $this->username;
?>
.jpg" id="jcrop_target"/>
</div>
<div style="width:160px;height:160px;overflow:hidden;margin-left:5px;">
<img src="<?php
echo AVATAR_BASE;
?>
/<?php
echo $this->username;
?>
.jpg" id="jcrop_preview"/>
</div>
<div class="action">
<button type="submit" class="classy primary" data-afterclick="正在提交⋯⋯">
<span>保存选取的位置</span>
</button>
</div>
<p class="clear"></p>
</form>
<script type="text/javascript">window.profileId = '<?php
echo UserHelper::getProfileId();
?>
';</script>
<?php
$javascripts = array('jquery-1.7.1.min', 'jquery.Jcrop.min', 'avatar/edit.min');
include __DIR__ . '/../layout/footer.php';
示例8:
</span>
<br/>
<small class="pull-right">发送于<?php
echo $mail->getTimestamp()->getFuzzyDifference();
?>
(<?php
echo $mail->getTimestamp();
?>
)</small>
<p class="clear"></p>
</h3>
<div class="details">
<div class="legend">
<?php
$hasUnRead = $mail->hasUnRead(UserHelper::getProfileId());
if ($hasUnRead) {
?>
<a class="newreply" data-mail-id=<?php
echo $mail->getId();
?>
href="javascript:void(0)" data-text ="回复<?php
if ($cc = $mail->getReplies()->count()) {
?>
(<?php
echo $cc;
?>
)<?php
}
?>
">收起回复
示例9: update
public function update($id)
{
try {
$this->db = fORMDatabase::retrieve();
$this->db->query('BEGIN');
$profile = new Profile($id);
if (UserHelper::getProfileId() != $profile->getId() and !UserHelper::isEditor()) {
throw new fValidationException('not allowed');
}
$profile->setStartYear(fRequest::get('start_year'));
$profile->setClassNumber(fRequest::get('class_number'));
$profile->setStudentNumber(trim(fRequest::get('student_number')));
$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->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->setSubscription(trim(fRequest::get('subscription')));
$profile->store();
foreach ($profile->getContacts() as $contact) {
$contact->delete();
}
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::fireUpdateProfile();
$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()));
}
}