• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

PHP get_user_language函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中get_user_language函数的典型用法代码示例。如果您正苦于以下问题:PHP get_user_language函数的具体用法?PHP get_user_language怎么用?PHP get_user_language使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: requestfriendship_submit

function requestfriendship_submit(Pieform $form, $values)
{
    global $USER, $SESSION, $id, $goto;
    $loggedinid = $USER->get('id');
    $user = get_record('usr', 'id', $id);
    // friend db record
    $f = new StdClass();
    $f->ctime = db_format_timestamp(time());
    // notification info
    $n = new StdClass();
    $n->url = profile_url($USER, false);
    $n->users = array($user->id);
    $n->fromuser = $loggedinid;
    $lang = get_user_language($user->id);
    $displayname = display_name($USER, $user);
    $n->strings = new stdClass();
    $n->strings->urltext = (object) array('key' => 'Requests');
    $f->owner = $id;
    $f->requester = $loggedinid;
    $f->message = $values['message'];
    insert_record('usr_friend_request', $f);
    $n->subject = get_string_from_language($lang, 'requestedfriendlistsubject', 'group');
    if (isset($values['message']) && !empty($values['message'])) {
        $n->message = get_string_from_language($lang, 'requestedfriendlistmessageexplanation', 'group', $displayname) . $values['message'];
    } else {
        $n->message = get_string_from_language($lang, 'requestedfriendlistinboxmessage', 'group', $displayname);
    }
    require_once 'activity.php';
    activity_occurred('maharamessage', $n);
    handle_event('addfriendrequest', array('requester' => $loggedinid, 'owner' => $id));
    $SESSION->add_ok_msg(get_string('friendformrequestsuccess', 'group', display_name($id)));
    redirect($goto);
}
开发者ID:rboyatt,项目名称:mahara,代码行数:33,代码来源:requestfriendship.php


示例2: invitetogroup_submit

function invitetogroup_submit(Pieform $form, $values)
{
    global $SESSION, $USER, $group, $user;
    $data = new StdClass();
    $data->group = $group->id;
    $data->member = $user->id;
    $data->ctime = db_format_timestamp(time());
    $data->role = $values['role'];
    insert_record('group_member_invite', $data);
    $lang = get_user_language($user->id);
    require_once 'activity.php';
    activity_occurred('maharamessage', array('users' => array($user->id), 'subject' => get_string_from_language($lang, 'invitetogroupsubject', 'group'), 'message' => get_string_from_language($lang, 'invitetogroupmessage', 'group', display_name($USER, $user), $group->name), 'url' => get_config('wwwroot') . 'group/view.php?id=' . $group->id));
    $SESSION->add_ok_msg(get_string('userinvited', 'group'));
    redirect('/user/view.php?id=' . $user->id);
}
开发者ID:Br3nda,项目名称:mahara,代码行数:15,代码来源:invite.php


示例3: get_pano_description

function get_pano_description()
{
    global $wpdb;
    $pano_table_name = get_pano_table_name();
    $text_table_name = get_pano_text_table_name();
    $language_code = get_user_language();
    $url = $_SERVER['HTTP_REFERER'];
    $parts = explode('?pano_id=', $url);
    $pano_id = $parts[1];
    if ($pano_id == NULL) {
        $pano_id = 1;
    }
    // DB query joining the pano table and the pano text table
    $panos = $wpdb->get_results("SELECT wppt.description FROM " . $pano_table_name . " wpp " . "INNER JOIN " . $text_table_name . " wppt ON " . "wppt.pano_id = " . "'" . $pano_id . "'" . "WHERE wppt.language_code = " . $language_code, ARRAY_A);
    return $panos;
}
开发者ID:Trying-On-The-Trades,项目名称:panomanager,代码行数:16,代码来源:pano_info.php


示例4: denyrequest_submit

function denyrequest_submit(Pieform $form, $values)
{
    global $USER, $SESSION, $id;
    $loggedinid = $USER->get('id');
    $user = get_record('usr', 'id', $id);
    // friend db record
    $f = new StdClass();
    $f->ctime = db_format_timestamp(time());
    // notification info
    $n = new StdClass();
    $n->url = profile_url($USER, false);
    $n->users = array($user->id);
    $n->fromuser = $USER->get('id');
    $lang = get_user_language($user->id);
    $displayname = display_name($USER, $user);
    $n->urltext = $displayname;
    delete_records('usr_friend_request', 'owner', $loggedinid, 'requester', $id);
    $n->subject = get_string_from_language($lang, 'friendrequestrejectedsubject', 'group');
    if (isset($values['reason']) && !empty($values['reason'])) {
        $n->message = get_string_from_language($lang, 'friendrequestrejectedmessagereason', 'group', $displayname) . $values['reason'];
    } else {
        $n->message = get_string_from_language($lang, 'friendrequestrejectedmessage', 'group', $displayname);
    }
    require_once 'activity.php';
    activity_occurred('maharamessage', $n);
    handle_event('removefriendrequest', array('owner' => $loggedinid, 'requester' => $id));
    $SESSION->add_ok_msg(get_string('friendformrejectsuccess', 'group'));
    $offset = param_integer('offset', 0);
    switch (param_alpha('returnto', 'myfriends')) {
        case 'find':
            $goto = 'user/find.php';
            break;
        case 'view':
            $goto = profile_url($user, false);
            break;
        default:
            $goto = 'user/myfriends.php';
            break;
    }
    $goto .= strpos($goto, '?') ? '&offset=' . $offset : '?offset=' . $offset;
    $goto = get_config('wwwroot') . $goto;
    redirect($goto);
}
开发者ID:vohung96,项目名称:mahara,代码行数:43,代码来源:denyrequest.php


示例5: requestjoingroup_submit

function requestjoingroup_submit(Pieform $form, $values)
{
    global $SESSION, $USER, $group, $goto;
    insert_record('group_member_request', (object) array('group' => $group->id, 'member' => $USER->get('id'), 'ctime' => db_format_timestamp(time()), 'reason' => isset($values['reason']) ? $values['reason'] : null));
    // Send request to all group admins
    require_once 'activity.php';
    $groupadmins = get_column('group_member', 'member', 'group', $group->id, 'role', 'admin');
    foreach ($groupadmins as $groupadmin) {
        $adminlang = get_user_language($groupadmin);
        if (isset($values['reason']) && $values['reason'] != '') {
            $message = get_string_from_language($adminlang, 'grouprequestmessagereason', 'group', display_name($USER, get_record('usr', 'id', $groupadmin)), $group->name, $values['reason']);
        } else {
            $message = get_string_from_language($adminlang, 'grouprequestmessage', 'group', display_name($USER, get_record('usr', 'id', $groupadmin)), $group->name);
        }
        activity_occurred('maharamessage', array('users' => array($groupadmin), 'subject' => get_string_from_language($adminlang, 'grouprequestsubject', 'group'), 'message' => $message, 'url' => 'group/members.php?id=' . $group->id . '&membershiptype=request', 'strings' => (object) array('urltext' => (object) array('key' => 'pendingmembers', 'section' => 'group'))));
    }
    $SESSION->add_ok_msg(get_string('grouprequestsent', 'group'));
    redirect($goto);
}
开发者ID:patkira,项目名称:mahara,代码行数:19,代码来源:requestjoin.php


示例6: requestfriendship_submit

function requestfriendship_submit(Pieform $form, $values)
{
    global $USER, $SESSION, $id;
    $loggedinid = $USER->get('id');
    $user = get_record('usr', 'id', $id);
    // friend db record
    $f = new StdClass();
    $f->ctime = db_format_timestamp(time());
    // notification info
    $n = new StdClass();
    $n->url = get_config('wwwroot') . 'user/view.php?id=' . $loggedinid;
    $n->users = array($user->id);
    $lang = get_user_language($user->id);
    $displayname = display_name($USER, $user);
    $f->owner = $id;
    $f->requester = $loggedinid;
    $f->message = $values['message'];
    insert_record('usr_friend_request', $f);
    $n->subject = get_string_from_language($lang, 'requestedfriendlistsubject', 'group');
    if (isset($values['message']) && !empty($values['message'])) {
        $n->message = get_string_from_language($lang, 'requestedfriendlistmessagereason', 'group', $displayname) . $values['message'];
    } else {
        $n->message = get_string_from_language($lang, 'requestedfriendlistmessage', 'group', $displayname);
    }
    require_once 'activity.php';
    activity_occurred('maharamessage', $n);
    $SESSION->add_ok_msg(get_string('friendformrequestsuccess', 'group', display_name($id)));
    switch (param_alpha('returnto', 'myfriends')) {
        case 'find':
            redirect('/user/find.php');
            break;
        case 'view':
            redirect('/user/view.php?id=' . $id);
            break;
        default:
            redirect('/user/myfriends.php');
            break;
    }
}
开发者ID:Br3nda,项目名称:mahara,代码行数:39,代码来源:requestfriendship.php


示例7: release

 public function release($releaseuser = null)
 {
     $submitinfo = $this->submitted_to();
     if (is_null($submitinfo)) {
         throw new ParameterException("View with id " . $this->get('id') . " has not been submitted");
     }
     $releaseuser = optional_userobj($releaseuser);
     self::_db_release(array($this->id), $this->get('owner'), $this->get('submittedgroup'));
     $ownerlang = get_user_language($this->get('owner'));
     $url = $this->get_url(false);
     require_once 'activity.php';
     activity_occurred('maharamessage', array('users' => array($this->get('owner')), 'subject' => get_string_from_language($ownerlang, 'viewreleasedsubject', 'group', $this->get('title'), $submitinfo['name'], display_name($releaseuser, $this->get_owner_object())), 'message' => get_string_from_language($ownerlang, 'viewreleasedmessage', 'group', $this->get('title'), $submitinfo['name'], display_name($releaseuser, $this->get_owner_object())), 'url' => $url, 'urltext' => $this->get('title')));
 }
开发者ID:sarahjcotton,项目名称:mahara,代码行数:13,代码来源:view.php


示例8: add_feedback_form_submit

function add_feedback_form_submit(Pieform $form, $values)
{
    global $view, $artefact, $USER;
    $data = (object) array('title' => get_string('Comment', 'artefact.comment'), 'description' => $values['message']);
    if ($artefact) {
        $data->onartefact = $artefact->get('id');
        $data->owner = $artefact->get('owner');
        $data->group = $artefact->get('group');
        $data->institution = $artefact->get('institution');
    } else {
        $data->onview = $view->get('id');
        $data->owner = $view->get('owner');
        $data->group = $view->get('group');
        $data->institution = $view->get('institution');
    }
    if ($author = $USER->get('id')) {
        $anonymous = false;
        $data->author = $author;
    } else {
        $anonymous = true;
        $data->authorname = $values['authorname'];
    }
    if (isset($values['moderate']) && $values['ispublic'] && !$USER->can_edit_view($view)) {
        $data->private = 1;
        $data->requestpublic = 'author';
        $moderated = true;
    } else {
        $data->private = (int) (!$values['ispublic']);
        $moderated = false;
    }
    $private = $data->private;
    if (get_config('licensemetadata')) {
        $data->license = $values['license'];
        $data->licensor = $values['licensor'];
        $data->licensorurl = $values['licensorurl'];
    }
    if (isset($values['rating'])) {
        $data->rating = valid_rating($values['rating']);
    }
    $comment = new ArtefactTypeComment(0, $data);
    db_begin();
    $comment->commit();
    $url = $comment->get_view_url($view->get('id'), true, false);
    $goto = get_config('wwwroot') . $url;
    if (isset($data->requestpublic) && $data->requestpublic === 'author' && $data->owner) {
        $arg = $author ? display_name($USER, null, true) : $data->authorname;
        $moderatemsg = (object) array('subject' => false, 'message' => false, 'strings' => (object) array('subject' => (object) array('key' => 'makepublicrequestsubject', 'section' => 'artefact.comment', 'args' => array()), 'message' => (object) array('key' => 'makepublicrequestbyauthormessage', 'section' => 'artefact.comment', 'args' => array(hsc($arg))), 'urltext' => (object) array('key' => 'Comment', 'section' => 'artefact.comment')), 'users' => array($data->owner), 'url' => $url);
    }
    if (!empty($values['attachments']) && is_array($values['attachments']) && !empty($data->author)) {
        require_once get_config('libroot') . 'uploadmanager.php';
        safe_require('artefact', 'file');
        $ownerlang = empty($data->owner) ? get_config('lang') : get_user_language($data->owner);
        $folderid = ArtefactTypeFolder::get_folder_id(get_string_from_language($ownerlang, 'feedbackattachdirname', 'artefact.comment'), get_string_from_language($ownerlang, 'feedbackattachdirdesc', 'artefact.comment'), null, true, $data->owner, $data->group, $data->institution);
        $attachment = (object) array('owner' => $data->owner, 'group' => $data->group, 'institution' => $data->institution, 'author' => $data->author, 'allowcomments' => 0, 'parent' => $folderid, 'description' => get_string_from_language($ownerlang, 'feedbackonviewbyuser', 'artefact.comment', $view->get('title'), display_name($USER)));
        foreach ($values['attachments'] as $filesindex) {
            $originalname = $_FILES[$filesindex]['name'];
            $attachment->title = ArtefactTypeFileBase::get_new_file_title($originalname, $folderid, $data->owner, $data->group, $data->institution);
            try {
                $fileid = ArtefactTypeFile::save_uploaded_file($filesindex, $attachment);
            } catch (QuotaExceededException $e) {
                if ($data->owner == $USER->get('id')) {
                    $form->reply(PIEFORM_ERR, array('message' => $e->getMessage()));
                }
                redirect($goto);
            } catch (UploadException $e) {
                $form->reply(PIEFORM_ERR, array('message' => $e->getMessage()));
                redirect($goto);
            }
            $comment->attach($fileid);
        }
    }
    require_once 'activity.php';
    $data = (object) array('commentid' => $comment->get('id'), 'viewid' => $view->get('id'));
    activity_occurred('feedback', $data, 'artefact', 'comment');
    if (isset($moderatemsg)) {
        activity_occurred('maharamessage', $moderatemsg);
    }
    db_commit();
    $newlist = ArtefactTypeComment::get_comments(10, 0, 'last', $view, $artefact);
    // If you're anonymous and your message is moderated or private, then you won't
    // be able to tell what happened to it. So we'll provide some more explanation in
    // the feedback message.
    if ($anonymous && $moderated) {
        $message = get_string('feedbacksubmittedmoderatedanon', 'artefact.comment');
    } else {
        if ($anonymous && $private) {
            $message = get_string('feedbacksubmittedprivateanon', 'artefact.comment');
        } else {
            $message = get_string('feedbacksubmitted', 'artefact.comment');
        }
    }
    $form->reply(PIEFORM_OK, array('message' => $message, 'goto' => $goto, 'data' => $newlist));
}
开发者ID:janaece,项目名称:globalclassroom4_clean,代码行数:93,代码来源:lib.php


示例9: Incident

             $incident = new Incident();
             $incident->ajax($method);
             break;
         case 'calendars':
             $calendars = new Calendars();
             $calendars->ajax($method);
             break;
     }
     return;
     break;
 case 'login':
     if (!$user->checkLogin()) {
         $user->showLogin();
     } else {
         if ($user->isLogged()) {
             $user_language = get_user_language($system->getConfig('id_user'));
             if (file_exists('../include/languages/' . $user_language . '.mo')) {
                 $l10n = new gettext_reader(new CachedFileReader('../include/languages/' . $user_language . '.mo'));
                 $l10n->load_tables();
             }
             $home = new Home();
             $home->show();
         } else {
             $user->showLoginFail();
         }
     }
     break;
 case 'logout':
     $user->logout();
     $user->showLogin();
     break;
开发者ID:dsyman2,项目名称:integriaims,代码行数:31,代码来源:index.php


示例10: group_invite_user

/**
 * Invite a user to a group.
 *
 * @param object $group group
 * @param object $userid  User to invite
 * @param object $userfrom  User sending the invitation
 */
function group_invite_user($group, $userid, $userfrom, $role = 'member', $delay = null)
{
    $user = optional_userobj($userid);
    $data = new StdClass();
    $data->group = $group->id;
    $data->member = $user->id;
    $data->ctime = db_format_timestamp(time());
    $data->role = $role;
    ensure_record_exists('group_member_invite', $data, $data);
    $lang = get_user_language($user->id);
    require_once 'activity.php';
    $activitydata = array('users' => array($user->id), 'subject' => get_string_from_language($lang, 'invitetogroupsubject', 'group'), 'message' => get_string_from_language($lang, 'invitetogroupmessage', 'group', display_name($userfrom, $user), $group->name), 'url' => group_homepage_url($group, false), 'urltext' => $group->name);
    activity_occurred('maharamessage', $activitydata, null, null, $delay);
}
开发者ID:vohung96,项目名称:mahara,代码行数:21,代码来源:group.php


示例11: addfriend_submit

function addfriend_submit(Pieform $form, $values)
{
    global $USER, $SESSION;
    $user = get_record('usr', 'id', $values['id']);
    $loggedinid = $USER->get('id');
    if (is_friend($loggedinid, $user->id)) {
        $SESSION->add_info_msg(get_string('alreadyfriends', 'group', display_name($user)));
        delete_records('usr_friend_request', 'owner', $loggedinid, 'requester', $user->id);
        redirect(profile_url($user));
    }
    // friend db record
    $f = new StdClass();
    $f->ctime = db_format_timestamp(time());
    // notification info
    $n = new StdClass();
    $n->url = profile_url($USER, false);
    $n->users = array($user->id);
    $lang = get_user_language($user->id);
    $displayname = display_name($USER, $user);
    $n->urltext = $displayname;
    $f->usr1 = $values['id'];
    $f->usr2 = $loggedinid;
    db_begin();
    delete_records('usr_friend_request', 'owner', $loggedinid, 'requester', $user->id);
    insert_record('usr_friend', $f);
    db_commit();
    $n->subject = get_string_from_language($lang, 'addedtofriendslistsubject', 'group', $displayname);
    $n->message = get_string_from_language($lang, 'addedtofriendslistmessage', 'group', $displayname, $displayname);
    require_once 'activity.php';
    activity_occurred('maharamessage', $n);
    handle_event('addfriend', array('user' => $f->usr2, 'friend' => $f->usr1));
    $SESSION->add_ok_msg(get_string('friendformaddsuccess', 'group', display_name($user)));
    redirect(profile_url($user));
}
开发者ID:patkira,项目名称:mahara,代码行数:34,代码来源:user.php


示例12: create_mission

function create_mission($mission_name, $mission_description, $mission_xml, $pano_id, $domain_id, $quest_id, $mission_points)
{
    global $wpdb;
    $mission_table_name = get_mission_table_name();
    $mission_text_table_name = get_mission_text_table_name();
    $language_code = get_user_language();
    $language_code = str_replace("'", "", $language_code);
    // Insert the pano
    $wpdb->insert($mission_table_name, array('quest_id' => $quest_id, 'points' => $mission_points, 'mission_xml' => $mission_xml, 'pano_id' => $pano_id, 'domain_id' => $domain_id));
    // Get the id of the last row
    $lastid = $wpdb->insert_id;
    // Insert the pano_text
    $wpdb->insert($mission_text_table_name, array('mission_id' => $lastid, 'language_code' => $language_code, 'name' => $mission_name, 'description' => $mission_description));
    return $wpdb->insert_id;
}
开发者ID:Trying-On-The-Trades,项目名称:panomanager,代码行数:15,代码来源:db_functions.php


示例13: get_pano_description

function get_pano_description()
{
    global $wpdb;
    $pano_table_name = get_pano_table_name();
    $text_table_name = get_pano_text_table_name();
    $language_code = get_user_language();
    // DB query joining the pano table and the pano text table
    $panos = $wpdb->get_results("SELECT wpp.id, wppt.description FROM " . $pano_table_name . " wpp " . "INNER JOIN " . $text_table_name . " wppt ON " . "wppt.pano_id = wpp.id " . "WHERE wppt.language_code = " . $language_code, ARRAY_A);
    return $panos;
}
开发者ID:Trying-On-The-Trades,项目名称:vocabulary-plugin,代码行数:10,代码来源:db_functions.php


示例14: release

 public function release($releaseuser = null)
 {
     require_once get_config('docroot') . 'artefact/lib.php';
     $submitinfo = $this->submitted_to();
     if (is_null($submitinfo)) {
         throw new ParameterException("View with id " . $this->get('id') . " has not been submitted");
     }
     $releaseuser = optional_userobj($releaseuser);
     db_begin();
     if ($submitinfo['type'] == 'group') {
         $group = $this->get('submittedgroup');
         $this->set('submittedgroup', null);
         if ($group) {
             // Remove hidden tutor view access records
             delete_records('view_access', 'view', $this->id, 'group', $group, 'visible', 0);
         }
     } else {
         if ($submitinfo['type'] == 'host') {
             $this->set('submittedhost', null);
         }
     }
     $this->set('submittedtime', null);
     $this->commit();
     ArtefactType::update_locked($this->owner);
     db_commit();
     $ownerlang = get_user_language($this->get('owner'));
     $url = get_config('wwwroot') . 'view/view.php?id=' . $this->get('id');
     require_once 'activity.php';
     activity_occurred('maharamessage', array('users' => array($this->get('owner')), 'subject' => get_string_from_language($ownerlang, 'viewreleasedsubject', 'group', $this->get('title'), $submitinfo['name'], display_name($releaseuser, $this->get_owner_object())), 'message' => get_string_from_language($ownerlang, 'viewreleasedmessage', 'group', $this->get('title'), $submitinfo['name'], display_name($releaseuser, $this->get_owner_object())), 'url' => $url, 'urltext' => $this->get('title')));
 }
开发者ID:richardmansfield,项目名称:richardms-mahara,代码行数:30,代码来源:view.php


示例15: group_remove_user

            group_remove_user($groupid, $userid, $role = null);
            $groupstoremovemail .= $groupdata[$groupid]->name . "\n";
        }
    }
    //add group membership
    if ($groupstoadd = array_diff($resultgroups, $initialgroups)) {
        $groupstoaddmail = '';
        foreach ($groupstoadd as $groupid) {
            group_add_user($groupid, $userid, $role = null);
            $groupstoaddmail .= $groupdata[$groupid]->name . "\n";
        }
    }
    db_commit();
    // Users notification
    $userrecord = get_record('usr', 'id', $userid);
    $lang = get_user_language($userid);
    $n = new StdClass();
    $n->users = array($userid);
    $n->subject = get_string_from_language($lang, 'changedgroupmembershipsubject', 'group');
    $n->message = '';
    if (isset($groupstoaddmail)) {
        $n->message .= get_string_from_language($lang, 'addedtongroupsmessage', 'group', count($groupstoadd), display_name($USER, $userrecord), $groupstoaddmail);
    }
    if (isset($groupstoremovemail)) {
        $n->message .= get_string_from_language($lang, 'removedfromngroupsmessage', 'group', count($groupstoremove), display_name($USER, $userrecord), $groupstoremovemail);
    }
    require_once get_config('libroot') . 'activity.php';
    activity_occurred('maharamessage', $n);
    $data['message'] = get_string('changedgroupmembership', 'group');
} else {
    if ($addtype == 'invite') {
开发者ID:sarahjcotton,项目名称:mahara,代码行数:31,代码来源:changegroupsmembership.json.php


示例16: release

 public function release($releaseuser = null)
 {
     $submitinfo = $this->submitted_to();
     if (is_null($submitinfo)) {
         throw new ParameterException("View with id " . $this->get('id') . " has not been submitted");
     }
     $releaseuser = optional_userobj($releaseuser);
     if ($submitinfo['type'] == 'group') {
         $this->set('submittedgroup', null);
     } else {
         if ($submitinfo['type'] == 'host') {
             $this->set('submittedhost', null);
         }
     }
     $this->commit();
     $ownerlang = get_user_language($this->get('owner'));
     require_once 'activity.php';
     activity_occurred('maharamessage', array('users' => array($this->get('owner')), 'subject' => get_string_from_language($ownerlang, 'viewreleasedsubject', 'group'), 'message' => get_string_from_language($ownerlang, 'viewreleasedmessage', 'group', $submitinfo['name'], display_name($releaseuser, $this->get_owner_object()))));
 }
开发者ID:Br3nda,项目名称:mahara,代码行数:19,代码来源:view.php


示例17: addmember_submit

function addmember_submit(Pieform $form, $values)
{
    global $USER, $SESSION, $userid;
    $group = get_record('group', 'id', $values['group']);
    $ctitle = $group->name;
    $adduser = get_record('usr', 'id', $userid);
    try {
        group_add_user($values['group'], $userid, 'member');
        $lang = get_user_language($userid);
        require_once get_config('libroot') . 'activity.php';
        activity_occurred('maharamessage', array('users' => array($userid), 'subject' => get_string_from_language($lang, 'addedtogroupsubject', 'group'), 'message' => get_string_from_language($lang, 'addedtogroupmessage', 'group', display_name($USER, $adduser), $ctitle), 'url' => group_homepage_url($group, false), 'urltext' => $ctitle));
        $SESSION->add_ok_msg(get_string('useradded', 'group'));
    } catch (SQLException $e) {
        $SESSION->add_error_msg(get_string('adduserfailed', 'group'));
    }
    redirect(profile_url($adduser));
}
开发者ID:rboyatt,项目名称:mahara,代码行数:17,代码来源:view.php


示例18: addfriend_submit

function addfriend_submit(Pieform $form, $values)
{
    global $USER, $SESSION;
    $user = get_record('usr', 'id', $values['id']);
    $loggedinid = $USER->get('id');
    $userid = $user->id;
    // friend db record
    $f = new StdClass();
    $f->ctime = db_format_timestamp(time());
    // notification info
    $n = new StdClass();
    $n->url = get_config('wwwroot') . 'user/view.php?id=' . $loggedinid;
    $n->users = array($user->id);
    $lang = get_user_language($user->id);
    $displayname = display_name($USER, $user);
    $n->urltext = $displayname;
    $f->usr1 = $values['id'];
    $f->usr2 = $loggedinid;
    insert_record('usr_friend', $f);
    $n->subject = get_string_from_language($lang, 'addedtofriendslistsubject', 'group', $displayname);
    $n->message = get_string_from_language($lang, 'addedtofriendslistmessage', 'group', $displayname, $displayname);
    require_once 'activity.php';
    activity_occurred('maharamessage', $n);
    handle_event('addfriend', array('user' => $f->usr2, 'friend' => $f->usr1));
    $SESSION->add_ok_msg(get_string('friendformaddsuccess', 'group', display_name($user)));
    redirect('/user/view.php?id=' . $values['id']);
}
开发者ID:richardmansfield,项目名称:richardms-mahara,代码行数:27,代码来源:user.php


示例19: declineRequestFromUser

 public function declineRequestFromUser($userid)
 {
     $lang = get_user_language($userid);
     $message = (object) array('users' => array($userid), 'subject' => get_string_from_language($lang, 'institutionmemberrejectsubject'), 'message' => get_string_from_language($lang, 'institutionmemberrejectmessage', 'mahara', $this->displayname));
     db_begin();
     delete_records('usr_institution_request', 'usr', $userid, 'institution', $this->name, 'confirmedusr', 1);
     require_once 'activity.php';
     activity_occurred('maharamessage', $message);
     handle_event('updateuser', $userid);
     db_commit();
 }
开发者ID:richardmansfield,项目名称:richardms-mahara,代码行数:11,代码来源:institution.php


示例20: add_feedback_form_submit

function add_feedback_form_submit(Pieform $form, $values)
{
    global $view, $artefact, $USER;
    require_once 'embeddedimage.php';
    $data = (object) array('title' => get_string('Comment', 'artefact.comment'), 'description' => $values['message']);
    if ($artefact) {
        $data->onartefact = $artefact->get('id');
        $data->owner = $artefact->get('owner');
        $data->group = $artefact->get('group');
        $data->institution = $artefact->get('institution');
        $onvieworartefactstr = "onartefact = {$data->onartefact}";
    } else {
        $data->onview = $view->get('id');
        $data->owner = $view->get('owner');
        $data->group = $view->get('group');
        $data->institution = $view->get('institution');
        $onvieworartefactstr = "onview = {$data->onview}";
    }
    $owner = $data->owner;
    $author = null;
    if ($author = $USER->get('id')) {
        $anonymous = false;
        $data->author = $author;
    } else {
        $anonymous = true;
        $data->authorname = $values['authorname'];
    }
    if (isset($values['moderate']) && $values['ispublic'] && !$USER->can_edit_view($view)) {
        $data->private = 1;
        $data->requestpublic = 'author';
        $moderated = true;
    } else {
        $data->private = (int) (!$values['ispublic']);
        $moderated = false;
    }
    $private = $data->private;
    if (get_config('licensemetadata')) {
        $data->license = $values['license'];
        $data->licensor = $values['licensor'];
        $data->licensorurl = $values['licensorurl'];
    }
    if (isset($values['rating'])) {
        $data->rating = valid_rating($values['rating']);
    }
    if ($values['replyto'] && ($pcomment = artefact_instance_from_id($values['replyto']))) {
        $data->parent = $pcomment->get('id');
        $grandparentid = $pcomment->get('parent');
        // Find the position for the new comment
        // Find the last offspring of the parent
        $parentid = $data->parent;
        $data->threadedposition = $pcomment->get('threadedposition');
        while ($lastchild = get_records_sql_array('
                SELECT c.artefact, c.threadedposition
                FROM {artefact_comment_comment} c
                    INNER JOIN {artefact} a ON a.id = c.artefact
                WHERE
                    ' . $onvieworartefactstr . '
                    AND a.parent = ?
                ORDER BY c.threadedposition DESC
                LIMIT 1', array($parentid))) {
            $parentid = $lastchild[0]->artefact;
            $data->threadedposition = $lastchild[0]->threadedposition;
        }
        $data->threadedposition++;
        // Increase the threaded position of following comments by 1
        execute_sql('
            UPDATE {artefact_comment_comment}
            SET threadedposition = threadedposition + 1
            WHERE
                ' . $onvieworartefactstr . '
                AND threadedposition >= ?', array($data->threadedposition));
    }
    if (!isset($data->threadedposition)) {
        $lastcomment = get_record_sql('
            SELECT max(threadedposition) AS lastposition
            FROM {artefact_comment_comment} c
            WHERE
                ' . $onvieworartefactstr);
        $data->threadedposition = $lastcomment->lastposition ? $lastcomment->lastposition + 1 : 1;
    }
    $comment = new ArtefactTypeComment(0, $data);
    db_begin();
    $comment->commit();
    $newdescription = EmbeddedImage::prepare_embedded_images($values['message'], 'comment', $comment->get('id'), $data->group);
    if ($newdescription !== $values['message']) {
        $updatedcomment = new stdClass();
        $updatedcomment->id = $comment->get('id');
        $updatedcomment->description = $newdescription;
        update_record('artefact', $updatedcomment, 'id');
    }
    $url = $comment->get_view_url($view->get('id'), true, false);
    $goto = get_config('wwwroot') . $url;
    if (isset($data->requestpublic) && $data->requestpublic === 'author' && $data->owner) {
        $arg = $author ? display_name($USER, null, true) : $data->authorname;
        $moderatemsg = (object) array('subject' => false, 'message' => false, 'strings' => (object) array('subject' => (object) array('key' => 'makepublicrequestsubject', 'section' => 'artefact.comment', 'args' => array()), 'message' => (object) array('key' => 'makepublicrequestbyauthormessage', 'section' => 'artefact.comment', 'args' => array(hsc($arg))), 'urltext' => (object) array('key' => 'Comment', 'section' => 'artefact.comment')), 'users' => array($data->owner), 'url' => $url);
    }
    if (!empty($values['attachments']) && is_array($values['attachments']) && !empty($data->author)) {
        require_once get_config('libroot') . 'uploadmanager.php';
        safe_require('artefact', 'file');
        $ownerlang = empty($data->owner) ? get_config('lang') : get_user_language($data->owner);
//.........这里部分代码省略.........
开发者ID:sarahjcotton,项目名称:mahara,代码行数:101,代码来源:lib.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP get_user_level函数代码示例发布时间:2022-05-15
下一篇:
PHP get_user_lang函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap