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

PHP get_string_from_language函数代码示例

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

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



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

示例1: notify_user

 public static function notify_user($user, $data)
 {
     $lang = empty($user->lang) || $user->lang == 'default' ? get_config('lang') : $user->lang;
     $separator = str_repeat('-', 72);
     $sitename = get_config('sitename');
     $subject = get_string_from_language($lang, 'emailsubject', 'notification.email', $sitename);
     if (!empty($data->subject)) {
         $subject .= ': ' . $data->subject;
     }
     $messagebody = get_string_from_language($lang, 'emailheader', 'notification.email', $sitename) . "\n";
     $messagebody .= $separator . "\n\n";
     $messagebody .= get_string_from_language($lang, 'subject') . ': ' . $data->subject . "\n\n";
     if ($data->activityname == 'usermessage') {
         // Do not include the message body in user messages when they are sent by email
         // because it encourages people to reply to the email.
         $messagebody .= get_string_from_language($lang, 'newusermessageemailbody', 'group', display_name($data->userfrom), $data->url);
     } else {
         $messagebody .= $data->message;
         if (!empty($data->url)) {
             $messagebody .= "\n\n" . get_string_from_language($lang, 'referurl', 'notification.email', $data->url);
         }
     }
     if (isset($data->unsubscribeurl) && isset($data->unsubscribename)) {
         $messagebody .= "\n\n" . get_string_from_language($lang, 'unsubscribemessage', 'notification.email', $data->unsubscribename, $data->unsubscribeurl);
     }
     $messagebody .= "\n\n{$separator}";
     $prefurl = get_config('wwwroot') . 'account/activity/preferences/';
     $messagebody .= "\n\n" . get_string_from_language($lang, 'emailfooter', 'notification.email', $sitename, $prefurl);
     email_user($user, null, $subject, $messagebody, null, !empty($data->customheaders) ? $data->customheaders : null);
 }
开发者ID:Br3nda,项目名称:mahara,代码行数:30,代码来源:lib.php


示例2: notify_user

 public static function notify_user($user, $data)
 {
     $messagehtml = null;
     if (!empty($data->overridemessagecontents)) {
         $subject = $data->subject;
         if (!empty($data->emailmessage)) {
             $messagebody = $data->emailmessage;
         } else {
             if (!empty($user->emailmessage)) {
                 $messagebody = $user->emailmessage;
             } else {
                 $messagebody = $data->message;
             }
         }
         if (!empty($data->htmlmessage)) {
             $messagehtml = $data->htmlmessage;
         } else {
             if (!empty($user->htmlmessage)) {
                 $messagehtml = $user->htmlmessage;
             }
         }
     } else {
         $lang = empty($user->lang) || $user->lang == 'default' ? get_config('lang') : $user->lang;
         $separator = str_repeat('-', 72);
         $sitename = get_config('sitename');
         $subject = get_string_from_language($lang, 'emailsubject', 'notification.email', $sitename);
         if (!empty($data->subject)) {
             $subject .= ': ' . $data->subject;
         }
         $messagebody = get_string_from_language($lang, 'emailheader', 'notification.email', $sitename) . "\n";
         $messagebody .= $separator . "\n\n";
         $messagebody .= get_string_from_language($lang, 'subject') . ': ' . $data->subject . "\n\n";
         if ($data->url && stripos($data->url, 'http://') !== 0 && stripos($data->url, 'https://') !== 0) {
             $data->url = get_config('wwwroot') . $data->url;
         }
         if ($data->activityname == 'usermessage') {
             // Do not include the message body in user messages when they are sent by email
             // because it encourages people to reply to the email.
             $messagebody .= get_string_from_language($lang, 'newusermessageemailbody', 'group', display_name($data->userfrom), $data->url);
         } else {
             $messagebody .= $data->message;
             if (!empty($data->url)) {
                 $messagebody .= "\n\n" . get_string_from_language($lang, 'referurl', 'notification.email', $data->url);
             }
         }
         $messagebody .= "\n\n{$separator}";
         $prefurl = get_config('wwwroot') . 'account/activity/preferences/index.php';
         $messagebody .= "\n\n" . get_string_from_language($lang, 'emailfooter', 'notification.email', $sitename, $prefurl);
     }
     // Bug 738263: Put the user's email address in the Reply-to field; email_user() will put the site address in 'From:'
     $userfrom = null;
     if (!empty($data->fromuser) && !$data->hideemail) {
         $user_data = get_record('usr', 'id', $data->fromuser);
         if (empty($data->customheaders)) {
             $data->customheaders = array();
         }
         $data->customheaders[] = "Reply-to: {$user_data->email}";
     }
     email_user($user, $userfrom, $subject, $messagebody, $messagehtml, !empty($data->customheaders) ? $data->customheaders : null);
 }
开发者ID:janaece,项目名称:globalclassroom4_clean,代码行数:60,代码来源:lib.php


示例3: 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


示例4: 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


示例5: 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


示例6: 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


示例7: 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


示例8: send_digest

 public static function send_digest()
 {
     $users = array();
     $sitename = get_config('sitename');
     $types = get_records_assoc('activity_type', 'admin', 0, 'plugintype,pluginname,name', 'id,name,plugintype,pluginname');
     foreach ($types as &$type) {
         if (!empty($type->plugintype)) {
             $type->section = "{$type->plugintype}.{$type->pluginname}";
         } else {
             $type->section = "activity";
         }
     }
     $sql = 'SELECT q.id, u.username, u.firstname, u.lastname, u.preferredname, u.email, u.admin, u.staff,
                 p.value AS lang, q.*,' . db_format_tsfield('ctime') . '
             FROM {usr} u 
                 JOIN {notification_emaildigest_queue} q
                     ON q.usr = u.id
                 LEFT OUTER JOIN {usr_account_preference} p ON (p.usr = u.id AND p.field = \'lang\')
             ORDER BY usr,type,q.ctime';
     if ($tosend = get_records_sql_array($sql, array())) {
         foreach ($tosend as $queue) {
             if (!isset($users[$queue->usr])) {
                 $users[$queue->usr] = new StdClass();
                 $users[$queue->usr]->user = new StdClass();
                 $users[$queue->usr]->user->username = $queue->username;
                 $users[$queue->usr]->user->firstname = $queue->firstname;
                 $users[$queue->usr]->user->lastname = $queue->lastname;
                 $users[$queue->usr]->user->preferredname = $queue->preferredname;
                 $users[$queue->usr]->user->email = $queue->email;
                 $users[$queue->usr]->user->admin = $queue->admin;
                 $users[$queue->usr]->user->staff = $queue->staff;
                 $users[$queue->usr]->user->id = $queue->usr;
                 $users[$queue->usr]->user->lang = empty($queue->lang) || $queue->lang == 'default' ? get_config('lang') : $queue->lang;
                 $users[$queue->usr]->entries = array();
             }
             $queue->nicetype = get_string_from_language($users[$queue->usr]->user->lang, 'type' . $types[$queue->type]->name, $types[$queue->type]->section);
             $users[$queue->usr]->entries[$queue->id] = $queue;
         }
     }
     foreach ($users as $user) {
         $lang = $user->user->lang;
         $subject = get_string_from_language($lang, 'emailsubject', 'notification.emaildigest', $sitename);
         $body = get_string_from_language($lang, 'emailbodynoreply', 'notification.emaildigest', $sitename);
         foreach ($user->entries as $entry) {
             $body .= get_string_from_language($lang, 'type', 'activity') . ': ' . $entry->nicetype . ' ' . get_string_from_language($lang, 'attime', 'activity') . ' ' . format_date($entry->ctime) . "\n";
             if (!empty($entry->subject)) {
                 $body .= get_string_from_language($lang, 'subject') . $entry->subject . "\n";
             }
             if (!empty($entry->message)) {
                 $body .= "\n" . $entry->message;
             }
             if (!empty($entry->url)) {
                 $body .= "\n" . $entry->url;
             }
             $body .= "\n\n";
         }
         $prefurl = get_config('wwwroot') . 'account/activity/preferences/';
         $body .= "\n\n" . get_string_from_language($lang, 'emailbodyending', 'notification.emaildigest', $prefurl);
         try {
             email_user($user->user, null, $subject, $body);
             //only delete them if the email succeeded!
             $in = db_array_to_ph($user->entries);
             delete_records_select('notification_emaildigest_queue', 'id IN (' . implode(', ', $in) . ')', array_keys($user->entries));
         } catch (Exception $e) {
             // @todo
         }
     }
 }
开发者ID:Br3nda,项目名称:mahara,代码行数:68,代码来源:lib.php


示例9: language_select_form

/**
 * Returns a language select form
 *
 * @return string      HTML of language select form
 */
function language_select_form()
{
    global $SESSION;
    $languageform = '';
    $languages = get_languages();
    if (count($languages) > 1) {
        $languages = array_merge(array('default' => get_string('sitedefault', 'admin') . ' (' . get_string_from_language(get_config('lang'), 'thislanguage') . ')'), $languages);
        require_once 'pieforms/pieform.php';
        $languageform = pieform(array('name' => 'languageselect', 'renderer' => 'div', 'class' => 'form-inline with-label-widthauto', 'validate' => false, 'presubmitcallback' => '', 'elements' => array('inputgroup' => array('type' => 'fieldset', 'class' => 'input-group', 'elements' => array('lang' => array('type' => 'select', 'title' => get_string('language') . ':', 'hiddenlabel' => true, 'options' => $languages, 'defaultvalue' => $SESSION->get('lang') ? $SESSION->get('lang') : 'default'), 'changelang' => array('type' => 'button', 'usebuttontag' => true, 'class' => 'btn-default input-group-btn', 'value' => get_string('change')))))));
    }
    return $languageform;
}
开发者ID:sarahjcotton,项目名称:mahara,代码行数:17,代码来源:web.php


示例10: __construct

 public function __construct($data)
 {
     parent::__construct($data);
     $this->overridemessagecontents = true;
     $post = get_record_sql('
         SELECT
             p.subject, p.body, p.poster, p.parent, ' . db_format_tsfield('p.ctime', 'ctime') . ',
             t.id AS topicid, fp.subject AS topicsubject, f.title AS forumtitle, g.name AS groupname, f.id AS forumid
         FROM {interaction_forum_post} p
         INNER JOIN {interaction_forum_topic} t ON (t.id = p.topic AND t.deleted = 0)
         INNER JOIN {interaction_forum_post} fp ON (fp.parent IS NULL AND fp.topic = t.id)
         INNER JOIN {interaction_instance} f ON (t.forum = f.id AND f.deleted = 0)
         INNER JOIN {group} g ON (f.group = g.id AND g.deleted = 0)
         WHERE p.id = ? AND p.deleted = 0', array($this->postid));
     // The post may have been deleted during the activity delay
     if (!$post) {
         $this->users = array();
         return;
     }
     $subscribers = get_records_sql_assoc('
         SELECT "user" AS subscriber, \'topic\' AS type, "key" FROM {interaction_forum_subscription_topic} WHERE topic = ?
         UNION
         SELECT "user" AS subscriber, \'forum\' AS type, "key" FROM {interaction_forum_subscription_forum} WHERE forum = ?
         ORDER BY type', array($post->topicid, $post->forumid));
     $this->users = $subscribers ? activity_get_users($this->get_id(), array_keys($subscribers)) : array();
     $this->fromuser = $post->poster;
     // When emailing forum posts, create Message-Id headers for threaded display by email clients
     $urlinfo = parse_url(get_config('wwwroot'));
     $hostname = $urlinfo['host'];
     $cleanforumname = str_replace('"', "'", strip_tags($post->forumtitle));
     $this->customheaders = array('List-Id: "' . $cleanforumname . '" <forum' . $post->forumid . '@' . $hostname . '>', 'List-Help: ' . get_config('wwwroot') . 'interaction/forum/view.php?id=' . $post->forumid, 'Message-ID: <forumpost' . $this->postid . '@' . $hostname . '>');
     if ($post->parent) {
         $this->customheaders[] = 'In-Reply-To: <forumpost' . $post->parent . '@' . $hostname . '>';
         $this->customheaders[] = 'References: <forumpost' . $post->parent . '@' . $hostname . '>';
     }
     $posttime = strftime(get_string('strftimedaydatetime'), $post->ctime);
     $htmlbody = $post->body;
     $this->message = strip_tags(str_shorten_html($htmlbody, 200, true));
     // For internal notifications.
     $textbody = trim(html2text($post->body));
     $postlink = get_config('wwwroot') . 'interaction/forum/topic.php?id=' . $post->topicid . '#post' . $this->postid;
     $this->url = $postlink;
     $this->add_urltext(array('key' => 'Topic', 'section' => 'interaction.forum'));
     foreach ($this->users as &$user) {
         $lang = empty($user->lang) || $user->lang == 'default' ? get_config('lang') : $user->lang;
         if ($post->parent) {
             $user->subject = get_string_from_language($lang, 'replyforumpostnotificationsubject', 'interaction.forum', $post->groupname, $post->forumtitle, $post->topicsubject);
         } else {
             $user->subject = get_string_from_language($lang, 'newforumpostnotificationsubject', 'interaction.forum', $post->groupname, $post->forumtitle, $post->subject);
         }
         $type = $subscribers[$user->id]->type;
         $unsubscribeid = $post->{$type . 'id'};
         $unsubscribelink = get_config('wwwroot') . 'interaction/forum/unsubscribe.php?' . $type . '=' . $unsubscribeid . '&key=' . $subscribers[$user->id]->key;
         $user->emailmessage = get_string_from_language($lang, 'forumposttemplate', 'interaction.forum', $post->subject ? $post->subject : get_string_from_language($lang, 're', 'interaction.forum', $post->topicsubject), display_name($post->poster, $user), $posttime, $textbody, $postlink, $type, $unsubscribelink);
         $user->htmlmessage = get_string_from_language($lang, 'forumposthtmltemplate', 'interaction.forum', $post->subject ? $post->subject : get_string_from_language($lang, 're', 'interaction.forum', $post->topicsubject), display_name($post->poster, $user), $posttime, $htmlbody, $postlink, $unsubscribelink, $type);
     }
 }
开发者ID:richardmansfield,项目名称:richardms-mahara,代码行数:57,代码来源:lib.php


示例11: 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


示例12: db_commit

            $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') {
        if ($groupstoadd = array_diff($resultgroups, $initialgroups)) {
            foreach ($groupstoadd as $groupid) {
                group_invite_user($groupdata[$groupid], $userid, $USER->get('id'));
            }
        }
        $data['message'] = get_string('userinvited', 'group');
    }
}
json_reply(false, $data);
开发者ID:sarahjcotton,项目名称:mahara,代码行数:31,代码来源:changegroupsmembership.json.php


示例13: 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


示例14: accountprefs_submit

function accountprefs_submit(Pieform $form, $values)
{
    global $USER, $SESSION;
    $authobj = AuthFactory::create($USER->authinstance);
    db_begin();
    $ispasswordchanged = false;
    if (isset($values['password1']) && $values['password1'] !== '') {
        global $authclass;
        $password = $authobj->change_password($USER, $values['password1']);
        $USER->password = $password;
        $USER->passwordchange = 0;
        $USER->commit();
        $ispasswordchanged = true;
    }
    // use this as looping through values is not safe.
    $expectedprefs = expected_account_preferences();
    if ($values['maildisabled'] == 0 && get_account_preference($USER->get('id'), 'maildisabled') == 1) {
        // Reset the sent and bounce counts otherwise mail will be disabled
        // on the next send attempt
        $u = new StdClass();
        $u->email = $USER->get('email');
        $u->id = $USER->get('id');
        update_bounce_count($u, true);
        update_send_count($u, true);
    }
    // Remember the user's language & theme prefs, so we can reload the page if they change them
    $oldlang = $USER->get_account_preference('lang');
    $oldtheme = $USER->get_account_preference('theme');
    $oldgroupsideblockmaxgroups = $USER->get_account_preference('groupsideblockmaxgroups');
    $oldgroupsideblocksortby = $USER->get_account_preference('groupsideblocksortby');
    if (get_config('allowmobileuploads')) {
        // Make sure the mobile token is formatted / saved correctly
        $values['mobileuploadtoken'] = array_filter($values['mobileuploadtoken']);
        $new_token_pref = empty($values['mobileuploadtoken']) ? null : '|' . join('|', $values['mobileuploadtoken']) . '|';
        $USER->set_account_preference('mobileuploadtoken', $new_token_pref);
        unset($values['mobileuploadtoken']);
    }
    // Set user account preferences
    foreach ($expectedprefs as $eprefkey => $epref) {
        if (isset($values[$eprefkey]) && $values[$eprefkey] !== get_account_preference($USER->get('id'), $eprefkey)) {
            $USER->set_account_preference($eprefkey, $values[$eprefkey]);
        }
    }
    $returndata = array();
    if (isset($values['username']) && $values['username'] != $USER->get('username')) {
        $USER->username = $values['username'];
        $USER->commit();
        $returndata['username'] = $values['username'];
    }
    $reload = false;
    if (get_config('cleanurls') && isset($values['urlid']) && $values['urlid'] != $USER->get('urlid')) {
        $USER->urlid = $values['urlid'];
        $USER->commit();
        $reload = true;
    }
    if ($ispasswordchanged) {
        // Destroy other sessions of the user
        require_once get_config('docroot') . 'auth/session.php';
        remove_user_sessions($USER->get('id'));
    }
    db_commit();
    $returndata['message'] = get_string('prefssaved', 'account');
    if (isset($values['theme']) && $values['theme'] != $oldtheme) {
        $USER->update_theme();
        $reload = true;
    }
    if (isset($values['lang']) && $values['lang'] != $oldlang) {
        // The session language pref is used when the user has no user pref,
        // and when logged out.
        $SESSION->set('lang', $values['lang']);
        $returndata['message'] = get_string_from_language($values['lang'], 'prefssaved', 'account');
        $reload = true;
    }
    if (isset($values['groupsideblockmaxgroups']) && $values['groupsideblockmaxgroups'] != $oldgroupsideblockmaxgroups) {
        $reload = true;
    }
    if ($values['groupsideblocksortby'] != $oldgroupsideblocksortby) {
        $reload = true;
    }
    $reload = plugin_account_prefs_submit($form, $values) || $reload;
    if (!empty($reload)) {
        // Use PIEFORM_CANCEL here to force a page reload and show the new language.
        $returndata['location'] = get_config('wwwroot') . 'account/index.php';
        $SESSION->add_ok_msg($returndata['message']);
        $form->json_reply(PIEFORM_CANCEL, $returndata);
    }
    $form->json_reply(PIEFORM_OK, $returndata);
}
开发者ID:patkira,项目名称:mahara,代码行数:88,代码来源:index.php


示例15: get_message

 public function get_message($user)
 {
     $newaccessmessagestr = $this->incollection ? 'newcollectionaccessmessage' : 'newviewaccessmessage';
     $newaccessmessagenoownerstr = $this->incollection ? 'newcollectionaccessmessagenoowner' : 'newviewaccessmessagenoowner';
     if ($this->ownername) {
         return get_string_from_language($user->lang, $newaccessmessagestr, 'activity', $this->title, $this->ownername);
     }
     return get_string_from_language($user->lang, $newaccessmessagenoownerstr, 'activity', $this->title);
 }
开发者ID:janaece,项目名称:globalclassroom4_clean,代码行数:9,代码来源:activity.php


示例16: get_message

 public function get_message($user)
 {
     $title = $this->title;
     $plural = '';
     if ($titles = $this->get_view_titles()) {
         $title = implode('", "', $titles);
         $plural = 'views';
     }
     $newaccessmessagestr = $this->incollection ? 'newcollectionaccessmessage' . $plural : 'newviewaccessmessage' . $plural;
     if ($this->ownername) {
         return get_string_from_language($user->lang, $newaccessmessagestr, 'activity', $title, $this->ownername, $this->title);
     }
     $newaccessmessagenoownerstr = $this->incollection ? 'newcollectionaccessmessagenoowner' : 'newviewaccessmessagenoowner' . $plural;
     return get_string_from_language($user->lang, $newaccessmessagenoownerstr, 'activity', $title, $this->title);
 }
开发者ID:rboyatt,项目名称:mahara,代码行数:15,代码来源:activity.php


示例17: change_language

 public static function change_language($userid, $oldlang, $newlang)
 {
     $oldname = get_string_from_language($oldlang, 'feedbackattachdirname', 'view');
     $artefact = ArtefactTypeFolder::get_folder_by_name($oldname, null, $userid);
     if (empty($artefact)) {
         return;
     }
     $name = get_string_from_language($newlang, 'feedbackattachdirname', 'view');
     $description = get_string_from_language($newlang, 'feedbackattachdirdesc', 'view');
     if (!empty($name)) {
         $artefact = artefact_instance_from_id($artefact->id);
         $artefact->set('title', $name);
         $artefact->set('description', $description);
         $artefact->commit();
     }
 }
开发者ID:Br3nda,项目名称:mahara,代码行数:16,代码来源:lib.php


示例18: get_htmlmessage

 public function get_htmlmessage($user)
 {
     $post = $this->temp->post;
     $reportername = hsc(display_default_name($this->reporter));
     $reporterurl = profile_url($this->reporter);
     $ctime = strftime(get_string_from_language($user->lang, 'strftimedaydatetime'), $this->ctime);
     return get_string_from_language($user->lang, 'objectionablecontentposthtml', 'interaction.forum', hsc($post->topicsubject), $reportername, $ctime, $this->message, $post->posttime, $post->htmlbody, get_config('wwwroot') . $this->url, hsc($post->topicsubject), $reporterurl, $reportername);
 }
开发者ID:vohung96,项目名称:mahara,代码行数:8,代码来源:lib.php


示例19: 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


示例20: __construct

 /**
  * @param array $data Parameters:
  *                    - viewid (int)
  *                    - commentid (int)
  */
 public function __construct($data, $cron = false)
 {
     parent::__construct($data, $cron);
     $comment = new ArtefactTypeComment($this->commentid);
     $this->overridemessagecontents = true;
     if ($onartefact = $comment->get('onartefact')) {
         // feedback on artefact
         $userid = null;
         require_once get_config('docroot') . 'artefact/lib.php';
         $artefactinstance = artefact_instance_from_id($onartefact);
         if ($artefactinstance->feedback_notify_owner()) {
             $userid = $artefactinstance->get('owner');
         }
         if (empty($this->url)) {
             $this->url = get_config('wwwroot') . 'view/artefact.php?artefact=' . $onartefact . '&view=' . $this->viewid;
         }
     } else {
         // feedback on view.
         $onview = $comment->get('onview');
         if (!($viewrecord = get_record('view', 'id', $onview))) {
             throw new ViewNotFoundException(get_string('viewnotfound', 'error', $onview));
         }
         $userid = $viewrecord->owner;
         if (empty($this->url)) {
             $this->url = get_config('wwwroot') . 'view/view.php?id=' . $onview;
         }
     }
     if (empty($userid)) {
         return;
     }
     $this->users = activity_get_users($this->get_id(), array($userid));
     $title = $onartefact ? $artefactinstance->get('title') : $viewrecord->title;
     $this->urltext = $title;
     $body = $comment->get('description');
     $posttime = strftime(get_string('strftimedaydatetime'), $comment->get('ctime'));
     $user = $this->users[0];
     $lang = empty($user->lang) || $user->lang == 'default' ? get_config('lang') : $user->lang;
     // Internal
     $this->message = strip_tags(str_shorten_html($body, 200, true));
     // Comment deleted notification
     if ($deletedby = $comment->get('deletedby')) {
         $this->strings = (object) array('subject' => (object) array('key' => 'commentdeletednotificationsubject', 'section' => 'artefact.comment', 'args' => array($title)));
         $deletedmessage = ArtefactTypeComment::deleted_messages();
         $removedbyline = get_string_from_language($lang, $deletedmessage[$deletedby], 'artefact.comment');
         $this->message = $removedbyline . ":\n" . $this->message;
         // Email
         $this->users[0]->htmlmessage = get_string_from_language($lang,  

鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP get_string_manager函数代码示例发布时间:2022-05-15
下一篇:
PHP get_string_between函数代码示例发布时间: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