当前位置: 首页>>代码示例>>PHP>>正文


PHP group_get_admin_ids函数代码示例

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


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

示例1: render_instance

 public static function render_instance(BlockInstance $instance, $editing = false)
 {
     require_once get_config('docroot') . 'artefact/lib.php';
     global $USER;
     $smarty = smarty_core();
     $groupdata = group_get_associated_groups($USER->get('id'), 'all', null, null);
     $data = new stdclass();
     $data->data = array();
     $data->count = $groupdata['count'];
     $data->displayname = display_name($user);
     if ($data->count) {
         foreach ($groupdata['groups'] as $g) {
             $record = array();
             $record['id'] = $g->id;
             $record['name'] = $g->name;
             $record['description'] = $g->description;
             $owner = group_get_admin_ids($g->id);
             $record['group_admin'] = display_name($owner[0]);
             $data->data[] = $record;
         }
     }
     $smarty->assign('eselma_groups', $data);
     return $smarty->fetch('blocktype:eselmagroup:content.tpl');
 }
开发者ID:vohung96,项目名称:mahara,代码行数:24,代码来源:lib.php

示例2: StdClass

    if ($objectionable !== false) {
        // Trigger activity.
        $data = new StdClass();
        $data->postid = $values['post'];
        $data->message = '';
        $data->reporter = $USER->get('id');
        $data->ctime = time();
        $data->event = DELETE_OBJECTIONABLE_POST;
        activity_occurred('reportpost', $data, 'interaction', 'forum');
    }
    update_record('interaction_forum_post', array('deleted' => 1), array('id' => $values['post']));
    $SESSION->add_ok_msg(get_string('deletepostsuccess', 'interaction.forum'));
    // Figure out which parent record to redirect us to. If the parent record is deleted,
    // keep moving up the chain until you find one that's not deleted.
    $postrec = new stdClass();
    $postrec->parent = $values['parent'];
    do {
        $postrec = get_record('interaction_forum_post', 'id', $postrec->parent, null, null, null, null, 'id, deleted, parent');
    } while ($postrec && $postrec->deleted && $postrec->parent);
    $redirecturl = get_config('wwwroot') . 'interaction/forum/topic.php?id=' . $values['topic'];
    if ($postrec && $postrec->parent) {
        $redirecturl .= '&post=' . $postrec->id;
    }
    redirect($redirecturl);
}
$smarty = smarty();
$smarty->assign('subheading', TITLE);
$smarty->assign('post', $post);
$smarty->assign('deleteform', $form);
$smarty->assign('groupadmins', group_get_admin_ids($post->group));
$smarty->display('interaction:forum:deletepost.tpl');
开发者ID:rboyatt,项目名称:mahara,代码行数:31,代码来源:deletepost.php

示例3: array

});
EOF;
$headers = array();
if ($publicgroup) {
    $headers[] = '<link rel="alternate" type="application/atom+xml" href="' . $feedlink . '" />';
}
$smarty = smarty(array(), $headers, array(), array());
$smarty->assign('heading', $forum->groupname);
$smarty->assign('subheading', $forum->title);
$smarty->assign('forum', $forum);
$smarty->assign('publicgroup', $publicgroup);
$smarty->assign('feedlink', $feedlink);
$smarty->assign('membership', $membership);
$smarty->assign('moderator', $moderator);
$smarty->assign('admin', $admin);
$smarty->assign('groupadmins', group_get_admin_ids($forum->groupid));
$smarty->assign('stickytopics', $stickytopics);
$smarty->assign('regulartopics', $regulartopics);
$smarty->assign('moderators', $moderators);
$smarty->assign('closedicon', $THEME->get_url('images/closed.gif', false, 'interaction/forum'));
$smarty->assign('subscribedicon', $THEME->get_url('images/subscribed.gif', false, 'interaction/forum'));
$smarty->assign('pagination', $pagination['html']);
$smarty->assign('INLINEJAVASCRIPT', $inlinejavascript);
$smarty->display('interaction:forum:view.tpl');
/**
 * format body
 * format lastposttime
 */
function setup_topics(&$topics)
{
    if ($topics) {
开发者ID:richardmansfield,项目名称:richardms-mahara,代码行数:31,代码来源:view.php

示例4: make_annotation_feedback_public_submit

function make_annotation_feedback_public_submit(Pieform $form, $values)
{
    global $USER;
    $annotationfeedback = new ArtefactTypeAnnotationFeedback((int) $values['annotationfeedbackid']);
    $annotationid = $annotationfeedback->get('onannotation');
    $annotation = new ArtefactTypeAnnotation((int) $annotationid);
    $viewid = $values['viewid'];
    $view = new View($viewid);
    $relativeurl = $annotation->get_view_url($viewid, true, false);
    $url = get_config('wwwroot') . $relativeurl;
    $author = $annotationfeedback->get('author');
    $owner = $annotationfeedback->get('owner');
    $groupid = $annotationfeedback->get('group');
    $group_admins = array();
    if ($groupid) {
        $group_admins = group_get_admin_ids($groupid);
    }
    $requester = $USER->get('id');
    if ($author == $owner && $requester == $owner || $requester == $owner && $annotationfeedback->get('requestpublic') == 'author' || array_search($requester, $group_admins) !== false && $annotationfeedback->get('requestpublic') == 'author' || $requester == $author && $annotationfeedback->get('requestpublic') == 'owner') {
        $annotationfeedback->set('private', 0);
        $annotationfeedback->set('requestpublic', null);
        $annotationfeedback->commit();
        $form->reply(PIEFORM_OK, array('message' => get_string('annotationfeedbackmadepublic', 'artefact.annotation'), 'goto' => $url));
    }
    $subject = 'makepublicrequestsubject';
    if ($requester == $owner) {
        $annotationfeedback->set('requestpublic', 'owner');
        $message = 'makepublicrequestbyownermessage';
        $arg = display_name($owner, $author);
        $userid = $author;
        $sessionmessage = get_string('makepublicrequestsent', 'artefact.annotation', display_name($author));
    } else {
        if ($requester == $author) {
            $annotationfeedback->set('requestpublic', 'author');
            $message = 'makepublicrequestbyauthormessage';
            $arg = display_name($author, $owner);
            $userid = $owner;
            $sessionmessage = get_string('makepublicrequestsent', 'artefact.annotation', display_name($owner));
        } else {
            if (array_search($requester, $group_admins) !== false) {
                $annotationfeedback->set('requestpublic', 'owner');
                $message = 'makepublicrequestbyownermessage';
                $arg = display_name($requester, $author);
                $userid = $author;
                $sessionmessage = get_string('makepublicrequestsent', 'artefact.annotation', display_name($author));
            } else {
                // Something is wrong. Go back to the view.
                redirect($url);
            }
        }
    }
    db_begin();
    $annotationfeedback->commit();
    $data = (object) array('subject' => false, 'message' => false, 'strings' => (object) array('subject' => (object) array('key' => $subject, 'section' => 'artefact.annotation', 'args' => array()), 'message' => (object) array('key' => $message, 'section' => 'artefact.annotation', 'args' => array(hsc($arg))), 'urltext' => (object) array('key' => 'Annotation', 'section' => 'artefact.annotation')), 'users' => array($userid), 'url' => $relativeurl);
    activity_occurred('maharamessage', $data);
    db_commit();
    $options = ArtefactTypeAnnotationfeedback::get_annotation_feedback_options();
    $options->showcomment = $annotationfeedback->get('id');
    $options->artefact = $values['artefactid'];
    $options->view = $viewid;
    $options->annotation = $annotationid;
    $options->block = $values['blockid'];
    $newlist = ArtefactTypeAnnotationfeedback::get_annotation_feedback($options);
    $form->reply(PIEFORM_OK, array('message' => $sessionmessage, 'goto' => $url, 'data' => $newlist));
}
开发者ID:rboyatt,项目名称:mahara,代码行数:65,代码来源:lib.php

示例5: make_public_submit

function make_public_submit(Pieform $form, $values)
{
    global $SESSION, $USER, $view;
    $comment = new ArtefactTypeComment((int) $values['comment']);
    $relativeurl = $comment->get_view_url($view->get('id'), true, false);
    $url = get_config('wwwroot') . $relativeurl;
    $author = $comment->get('author');
    $owner = $comment->get('owner');
    $groupid = $comment->get('group');
    $group_admins = array();
    if ($groupid) {
        $group_admins = group_get_admin_ids($groupid);
    }
    $requester = $USER->get('id');
    if ($author == $owner && $requester == $owner || $requester == $owner && $comment->get('requestpublic') == 'author' || array_search($requester, $group_admins) !== false && $comment->get('requestpublic') == 'author' || $requester == $author && $comment->get('requestpublic') == 'owner') {
        $comment->set('private', 0);
        $comment->set('requestpublic', null);
        $comment->commit();
        $SESSION->add_ok_msg(get_string('commentmadepublic', 'artefact.comment'));
        redirect($url);
    }
    $subject = 'makepublicrequestsubject';
    if ($requester == $owner) {
        $comment->set('requestpublic', 'owner');
        $message = 'makepublicrequestbyownermessage';
        $arg = display_name($owner, $author);
        $userid = $author;
        $sessionmessage = get_string('makepublicrequestsent', 'artefact.comment', display_name($author));
    } else {
        if ($requester == $author) {
            $comment->set('requestpublic', 'author');
            $message = 'makepublicrequestbyauthormessage';
            $arg = display_name($author, $owner);
            $userid = $owner;
            $sessionmessage = get_string('makepublicrequestsent', 'artefact.comment', display_name($owner));
        } else {
            if (array_search($requester, $group_admins) !== false) {
                $comment->set('requestpublic', 'owner');
                $message = 'makepublicrequestbyownermessage';
                $arg = display_name($requester, $author);
                $userid = $author;
                $sessionmessage = get_string('makepublicrequestsent', 'artefact.comment', display_name($author));
            } else {
                redirect($url);
                // Freak out?
            }
        }
    }
    db_begin();
    $comment->commit();
    $data = (object) array('subject' => false, 'message' => false, 'strings' => (object) array('subject' => (object) array('key' => $subject, 'section' => 'artefact.comment', 'args' => array()), 'message' => (object) array('key' => $message, 'section' => 'artefact.comment', 'args' => array(hsc($arg))), 'urltext' => (object) array('key' => 'Comment', 'section' => 'artefact.comment')), 'users' => array($userid), 'url' => $relativeurl);
    activity_occurred('maharamessage', $data);
    db_commit();
    $SESSION->add_ok_msg($sessionmessage);
    redirect($url);
}
开发者ID:janaece,项目名称:globalclassroom4_clean,代码行数:56,代码来源:lib.php

示例6: edit_annotation_feedback_submit

function edit_annotation_feedback_submit(Pieform $form, $values)
{
    global $viewid, $annotationfeedback, $annotation, $SESSION, $goto, $USER;
    db_begin();
    $annotationfeedback->set('description', $values['message']);
    require_once get_config('libroot') . 'view.php';
    $view = new View($viewid);
    $owner = $view->get('owner');
    $group = $annotationfeedback->get('group');
    $oldispublic = !$annotationfeedback->get('private');
    $approvecomments = $view->get('approvecomments');
    // We need to figure out what to set the 'requestpublic' field in the artefact_annotation_feedback table.
    // Then, set who is requesting to make it public - if the public flag has changed.
    if (!empty($group) && ($approvecomments || !$approvecomments && $view->user_comments_allowed($USER) == 'private') && $values['ispublic'] && !$USER->can_edit_view($view) && $values['ispublic'] != $oldispublic) {
        // This annotation belongs to a group - but this shouldn't really happen - keeping in case
        // we allow annotations in group views.
        // 1. If approvecomments on this view is switched on and
        //    the author of the feedback wants to make it public and
        //    the author of the feeback can't edit the group view and
        //    the auther of the feedback has changed the public setting,
        // the owner of the view needs to approve the feedback before it's made public.
        // 2. If approvecomments on this view is switched off and
        //    the access (for the author of the feedback) of the view forces private comments and
        //    the author of the feeback can't edit the view and
        //    the auther of the feedback has changed the public setting,
        // the owner of the view needs to approve the feedback before it's made public.
        // The author of the feedback wants to make the feedback public.
        $annotationfeedback->set('requestpublic', 'author');
    } else {
        if (($approvecomments || !$approvecomments && $view->user_comments_allowed($USER) == 'private') && $values['ispublic'] && !empty($owner) && $owner != $annotationfeedback->get('author') && $values['ispublic'] != $oldispublic) {
            // 1. If approvecomments on this view is switched on and
            //    the author of the feedback would like to make this public and
            //    the author of the feeback is not the owner of the view and
            //    the auther of the feedback has changed the public setting,
            // the owner of the view needs to approve the feedback before it's made public.
            // 2. If approvecomments on this view is switched off and
            //    the access (for the author of the feedback) of the view forces private feedback and
            //    the author of the feeback is not the owner of the view and
            //    the auther of the feedback has changed the public setting,
            // the owner of the view needs to approve the feedback before it's made public.
            // The author of the feedback wants to make the feedback public.
            $annotationfeedback->set('requestpublic', 'author');
        } else {
            // Otherwise, the owner of the feedback is editing the feedback.
            // Set the privacy setting of the feedback - based on the 'ispublic' flag set by the user.
            // And, clear the request to make the feedback public.
            $annotationfeedback->set('private', 1 - (int) $values['ispublic']);
            $annotationfeedback->set('requestpublic', null);
        }
    }
    $annotationfeedback->commit();
    require_once 'activity.php';
    $data = (object) array('annotationfeedbackid' => $annotationfeedback->get('id'), 'annotationid' => $annotation->get('id'), 'viewid' => $viewid, 'artefactid' => '');
    activity_occurred('annotationfeedback', $data, 'artefact', 'annotation');
    if ($annotationfeedback->get('requestpublic') == 'author') {
        if (!empty($owner)) {
            edit_annotation_feedback_notify($view, $annotationfeedback->get('author'), $owner);
        } else {
            if (!empty($group)) {
                $group_admins = group_get_admin_ids($group);
                // TODO: need to notify the group admins bug #1197197
            }
        }
    }
    db_commit();
    $SESSION->add_ok_msg(get_string('annotationfeedbackupdated', 'artefact.annotation'));
    redirect($goto);
}
开发者ID:vohung96,项目名称:mahara,代码行数:68,代码来源:edit.php

示例7: group_within_edit_window

$publicgroup = $group->public;
$ineditwindow = group_within_edit_window($group);
$feedlink = get_config('wwwroot') . 'interaction/forum/atom.php?type=t&id=' . $topic->id;
$membership = user_can_access_forum((int) $topic->forumid);
$moderator = $ineditwindow && (bool) ($membership & INTERACTION_FORUM_MOD);
$forumconfig = get_records_assoc('interaction_forum_instance_config', 'forum', $topic->forumid, '', 'field,value');
$indentmode = isset($forumconfig['indentmode']) ? $forumconfig['indentmode']->value : 'full_indent';
$maxindentdepth = isset($forumconfig['maxindent']) ? $forumconfig['maxindent']->value : 10;
if (!$membership && !get_field('group', 'public', 'id', $topic->groupid)) {
    $objection = param_integer('objection', 0);
    $errorstr = $objection ? get_string('accessdeniedobjection', 'error') : get_string('cantviewtopic', 'interaction.forum');
    throw new GroupAccessDeniedException($errorstr, $objection);
}
$topic->canedit = ($moderator || user_can_edit_post($topic->poster, $topic->ctime)) && $ineditwindow;
define('TITLE', $topic->forumtitle . ' - ' . $topic->subject);
$groupadmins = group_get_admin_ids($topic->groupid);
if ($membership && !$topic->forumsubscribed) {
    $topic->subscribe = pieform(array('name' => 'subscribe_topic', 'renderer' => 'div', 'plugintype' => 'interaction', 'pluginname' => 'forum', 'class' => 'btn-group btn-group-top', 'autofocus' => false, 'elements' => array('submit' => array('type' => 'button', 'usebuttontag' => true, 'class' => 'btn-default', 'value' => $topic->topicsubscribed ? '<span class="icon icon-times icon-lg text-danger left"></span>' . get_string('unsubscribefromtopic', 'interaction.forum') : '<span class="icon icon-star icon-lg left"></span>' . get_string('subscribetotopic', 'interaction.forum'), 'help' => false), 'topic' => array('type' => 'hidden', 'value' => $topicid), 'type' => array('type' => 'hidden', 'value' => $topic->topicsubscribed ? 'unsubscribe' : 'subscribe'))));
}
// posts pagination params
$offset = param_integer('offset', 0);
$limit = param_integer('limit', 10);
$postid = param_integer('post', 0);
if (!empty($postid)) {
    // validates the $postid
    $post = get_record('interaction_forum_post', 'id', $postid, 'deleted', '0', null, null, 'id, path');
    if (!$post) {
        throw new NotFoundException("The post with ID '{$postid}' is not found or deleted!");
    }
    // caculated offset value to jump to the page of the post
    $offset = count_records_select('interaction_forum_post', 'topic = ? AND path < ?', array($topicid, $post->path));
开发者ID:sarahjcotton,项目名称:mahara,代码行数:31,代码来源:topic.php

示例8: edit_comment_submit

function edit_comment_submit(Pieform $form, $values)
{
    global $viewid, $comment, $SESSION, $goto, $USER;
    db_begin();
    $comment->set('description', $values['message']);
    $comment->set('rating', valid_rating($values['rating']));
    require_once get_config('libroot') . 'view.php';
    $view = new View($viewid);
    $owner = $view->get('owner');
    $group = $comment->get('group');
    $approvecomments = $view->get('approvecomments');
    if (!empty($group) && ($approvecomments || !$approvecomments && $view->user_comments_allowed($USER) == 'private') && $values['ispublic'] && !$USER->can_edit_view($view)) {
        $comment->set('requestpublic', 'author');
    } else {
        if (($approvecomments || !$approvecomments && $view->user_comments_allowed($USER) == 'private') && $values['ispublic'] && (!empty($owner) && $owner != $comment->get('author'))) {
            $comment->set('requestpublic', 'author');
        } else {
            $comment->set('private', 1 - (int) $values['ispublic']);
            $comment->set('requestpublic', null);
        }
    }
    $comment->commit();
    require_once 'activity.php';
    $data = (object) array('commentid' => $comment->get('id'), 'viewid' => $viewid);
    activity_occurred('feedback', $data, 'artefact', 'comment');
    if ($comment->get('requestpublic') == 'author') {
        if (!empty($owner)) {
            edit_comment_notify($view, $comment->get('author'), $owner);
        } else {
            if (!empty($group)) {
                $group_admins = group_get_admin_ids($group);
                // TO DO: need to notify the group admins bug #1197197
            }
        }
    }
    db_commit();
    $SESSION->add_ok_msg(get_string('commentupdated', 'artefact.comment'));
    redirect($goto);
}
开发者ID:janaece,项目名称:globalclassroom4_clean,代码行数:39,代码来源:edit.php

示例9: notify_groups_threshold_exceeded

 /**
  * Notify group admins if the group quota is above the quota threshold.
  *
  * @param $groups        array of group objects - the $group object needs to include a quotausedpercent
  *                       that is set by: (quotaused / quota) * 100
  */
 function notify_groups_threshold_exceeded($groups)
 {
     // if we have just been given a $group object
     if (is_object($groups)) {
         $groups[] = $groups;
     }
     require_once get_config('docroot') . 'lib/activity.php';
     safe_require('notification', 'internal');
     foreach ($groups as $group) {
         // find the group admins and notify them - there should be at least 1 admin for a group
         if ($admins = group_get_admin_ids(array($group->id))) {
             $data = array('subject' => get_string('adm_group_notificationsubject', 'artefact.file'), 'message' => get_string('adm_group_notificationmessage', 'artefact.file', $group->name, ceil((int) $group->quotausedpercent), display_size($group->quota)), 'users' => $admins, 'url' => 'artefact/file/groupfiles.php?group=' . $group->id, 'urltext' => get_string('textlinktouser', 'artefact.file', $group->name), 'type' => 1);
             $activity = new ActivityTypeMaharamessage($data);
             $activity->notify_users();
         }
     }
 }
开发者ID:vohung96,项目名称:mahara,代码行数:23,代码来源:lib.php

示例10: __construct

 public function __construct($data, $cron = false)
 {
     parent::__construct($data, $cron);
     $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.id AS groupid, 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;
     }
     // Set notification to site admins.
     $siteadmins = activity_get_users($this->get_id(), null, null, true);
     // Get forum moderators and admins.
     $forumadminsandmoderators = activity_get_users($this->get_id(), array_merge(get_forum_moderators($post->forumid), group_get_admin_ids($post->groupid)));
     // Populate users to notify list and get rid of duplicates.
     foreach (array_merge($siteadmins, $forumadminsandmoderators) as $user) {
         if (!isset($this->users[$user->id])) {
             $this->users[$user->id] = $user;
         }
     }
     // Record who reported it.
     $this->fromuser = $this->reporter;
     $post->posttime = strftime(get_string('strftimedaydatetime'), $post->ctime);
     $post->textbody = trim(html2text($post->body));
     $post->htmlbody = clean_html($post->body);
     $this->url = 'interaction/forum/topic.php?id=' . $post->topicid . '&post=' . $this->postid . '&objection=1';
     $this->add_urltext(array('key' => 'Topic', 'section' => 'interaction.forum'));
     if ($this->event === REPORT_OBJECTIONABLE) {
         $this->overridemessagecontents = true;
         $this->strings->subject = (object) array('key' => 'objectionablecontentpost', 'section' => 'interaction.forum', 'args' => array($post->topicsubject, display_default_name($this->reporter)));
     } else {
         if ($this->event === MAKE_NOT_OBJECTIONABLE) {
             $this->strings = (object) array('subject' => (object) array('key' => 'postnotobjectionablesubject', 'section' => 'interaction.forum', 'args' => array($post->topicsubject, display_default_name($this->reporter))), 'message' => (object) array('key' => 'postnotobjectionablebody', 'section' => 'interaction.forum', 'args' => array(display_default_name($this->reporter), display_default_name($post->poster))));
         } else {
             if ($this->event === DELETE_OBJECTIONABLE_POST) {
                 $this->url = '';
                 $this->strings = (object) array('subject' => (object) array('key' => 'objectionablepostdeletedsubject', 'section' => 'interaction.forum', 'args' => array($post->topicsubject, display_default_name($this->reporter))), 'message' => (object) array('key' => 'objectionablepostdeletedbody', 'section' => 'interaction.forum', 'args' => array(display_default_name($this->reporter), display_default_name($post->poster), $post->textbody)));
             } else {
                 if ($this->event === DELETE_OBJECTIONABLE_TOPIC) {
                     $this->url = '';
                     $this->strings = (object) array('subject' => (object) array('key' => 'objectionabletopicdeletedsubject', 'section' => 'interaction.forum', 'args' => array($post->topicsubject, display_default_name($this->reporter))), 'message' => (object) array('key' => 'objectionabletopicdeletedbody', 'section' => 'interaction.forum', 'args' => array(display_default_name($this->reporter), display_default_name($post->poster), $post->textbody)));
                 } else {
                     throw new SystemException();
                 }
             }
         }
     }
     $this->temp = (object) array('post' => $post);
 }
开发者ID:vohung96,项目名称:mahara,代码行数:57,代码来源:lib.php

示例11: define

define('TITLE', $topic->title . ' - ' . get_string('deletetopicspecific', 'interaction.forum', $topic->subject));
$form = pieform(array('name' => 'deletetopic', 'renderer' => 'div', 'autofocus' => false, 'elements' => array('title' => array('value' => get_string('deletetopicsure', 'interaction.forum')), 'submit' => array('type' => 'submitcancel', 'value' => array(get_string('yes'), get_string('no')), 'goto' => get_config('wwwroot') . ($returnto == 'view' ? 'interaction/forum/view.php?id=' . $topic->forumid : 'interaction/forum/topic.php?id=' . $topicid)), 'forum' => array('type' => 'hidden', 'value' => $topic->forumid))));
function deletetopic_submit(Pieform $form, $values)
{
    global $SESSION, $USER, $topicid;
    $objectionable = get_record_sql("SELECT fp.id\n            FROM {interaction_forum_post} fp\n            JOIN {objectionable} o\n            ON (o.objecttype = 'forum' AND o.objectid = fp.id)\n            WHERE fp.topic = ?\n            AND fp.parent IS NULL\n            AND o.resolvedby IS NULL\n            AND o.resolvedtime IS NULL", array($topicid));
    if ($objectionable !== false) {
        // Trigger activity.
        $data = new StdClass();
        $data->postid = $objectionable->id;
        $data->message = '';
        $data->reporter = $USER->get('id');
        $data->ctime = time();
        $data->event = DELETE_OBJECTIONABLE_TOPIC;
        activity_occurred('reportpost', $data, 'interaction', 'forum');
    }
    // mark topic as deleted
    update_record('interaction_forum_topic', array('deleted' => 1), array('id' => $topicid));
    EmbeddedImage::delete_embedded_images('topic', $topicid);
    // mark relevant posts as deleted
    update_record('interaction_forum_post', array('deleted' => 1), array('topic' => $topicid));
    $SESSION->add_ok_msg(get_string('deletetopicsuccess', 'interaction.forum'));
    redirect('/interaction/forum/view.php?id=' . $values['forum']);
}
$smarty = smarty();
$smarty->assign('forum', $topic->title);
$smarty->assign('subheading', TITLE);
$smarty->assign('topic', $topic);
$smarty->assign('groupadmins', group_get_admin_ids($topic->group));
$smarty->assign('deleteform', $form);
$smarty->display('interaction:forum:deletetopic.tpl');
开发者ID:vohung96,项目名称:mahara,代码行数:31,代码来源:deletetopic.php


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