本文整理汇总了PHP中UserHelper::isEditor方法的典型用法代码示例。如果您正苦于以下问题:PHP UserHelper::isEditor方法的具体用法?PHP UserHelper::isEditor怎么用?PHP UserHelper::isEditor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserHelper
的用法示例。
在下文中一共展示了UserHelper::isEditor方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: show
public function show()
{
$this->editable = UserHelper::isEditor();
$cons = array();
$field = trim(fRequest::get('field'));
$start_year = trim(fRequest::get('start_year'));
$major = trim(fRequest::get('major'));
$location = trim(fRequest::get('location'));
$words = trim(fRequest::get('words'));
$cons['login_name|display_name~'] = $words;
if (!empty($field)) {
$cons['field='] = $field;
}
if (!empty($start_year)) {
$cons['start_year='] = $start_year;
}
if (!empty($major)) {
$cons['major='] = $major;
}
if (!empty($location)) {
$cons['location~'] = $location;
}
$this->users = fRecordSet::build('Profile', $cons, array('id' => 'asc'));
$this->field = $field;
$this->start_year = $start_year;
$this->major = $major;
$this->location = $location;
$this->words = $words;
$this->render('search/index');
}
示例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: delete
public function delete($id)
{
try {
$users = new Name($id);
if (!UserHelper::isEditor()) {
throw new fValidationException('not allowed');
}
$users->delete();
$this->ajaxReturn(array('result' => 'success'));
} catch (fException $e) {
$this->ajaxReturn(array('result' => 'failure', 'message' => $e->getMessage()));
}
}
示例4:
echo $tweet->getTimestamp()->getFuzzyDifference();
?>
</span>
<a class="reply" href="javascript:void(0)">
回复<?php
if ($cc = $tweet->getComments()->count()) {
?>
(<?php
echo $cc;
?>
)<?php
}
?>
</a>
<?php
if (UserHelper::isEditor()) {
?>
<a class="delete-tweet" href="javascript:void(0)" data-tweet-id="<?php
echo $tweet->getId();
?>
" >
删除</a>
<?php
}
?>
</div>
</div>
<div class="comments">
<?php
include __DIR__ . '/_comments.php';
?>
示例5: sendmail1
public function sendmail1()
{
try {
if (!UserHelper::isEditor()) {
throw fValidationException('not allowed');
}
$emails = json_decode(trim(fRequest::get('emails')));
$title = trim(fRequest::get('title'));
$content = trim(fRequest::get('content'));
foreach ($emails as $email) {
self::send($email, $title, $content);
}
$this->ajaxReturn(array('result' => 'success'));
} catch (Exception $e) {
$this->ajaxReturn(array('result' => 'failure', 'message' => $e->getMessage()));
}
}
示例6: 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()));
}
}