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


PHP group_current_group函数代码示例

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


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

示例1: get_data

 protected static function get_data($groupid)
 {
     global $USER;
     if (!defined('GROUP')) {
         define('GROUP', $groupid);
     }
     // get the currently requested group
     $group = group_current_group();
     $group->ctime = strftime(get_string('strftimedate'), $group->ctime);
     // if the user isn't logged in an the group isn't public don't show anything
     if (!is_logged_in() && !$group->public) {
         throw new AccessDeniedException();
     }
     // find the group administrators
     $group->admins = get_column_sql("SELECT \"member\"\n            FROM {group_member}\n            WHERE \"group\" = ?\n            AND \"role\" = 'admin'", array($group->id));
     $role = group_user_access($group->id);
     $group->role = $role;
     // logged in user can do stuff
     if (is_logged_in()) {
         $afterjoin = param_variable('next', 'view');
         if ($role) {
             if ($role == 'admin') {
                 $group->membershiptype = 'admin';
                 $group->requests = count_records('group_member_request', 'group', $group->id);
             } else {
                 $group->membershiptype = 'member';
             }
             $group->canleave = group_user_can_leave($group->id);
         } else {
             if ($group->jointype == 'invite' and $invite = get_record('group_member_invite', 'group', $group->id, 'member', $USER->get('id'))) {
                 $group->membershiptype = 'invite';
                 $group->invite = group_get_accept_form('invite', $group->id, $afterjoin);
             } else {
                 if ($group->jointype == 'request' and $request = get_record('group_member_request', 'group', $group->id, 'member', $USER->get('id'))) {
                     $group->membershiptype = 'request';
                 } else {
                     if ($group->jointype == 'open') {
                         $group->groupjoin = group_get_join_form('joingroup', $group->id, $afterjoin);
                     }
                 }
             }
         }
     }
     $group->settingsdescription = group_display_settings($group);
     if (get_config('allowgroupcategories')) {
         $group->categorytitle = $group->category ? get_field('group_category', 'title', 'id', $group->category) : '';
     }
     $filecounts = ArtefactTypeFileBase::count_user_files(null, $group->id, null);
     return array('group' => $group, 'filecounts' => $filecounts);
 }
开发者ID:richardmansfield,项目名称:richardms-mahara,代码行数:50,代码来源:lib.php

示例2: get_data

 protected static function get_data($groupid)
 {
     global $USER;
     if (!defined('GROUP')) {
         define('GROUP', $groupid);
     }
     // get the currently requested group
     $group = group_current_group();
     $group->ctime = format_date($group->ctime, 'strftimedate');
     // if the user isn't logged in an the group isn't public don't show anything
     if (!is_logged_in() && !$group->public) {
         throw new AccessDeniedException();
     }
     return group_get_groupinfo_data($group);
 }
开发者ID:rboyatt,项目名称:mahara,代码行数:15,代码来源:lib.php

示例3: Dwoo_Plugin_loadgroupquota

/**
 *
 * @package    mahara
 * @subpackage dwoo
 * @author     Catalyst IT Ltd
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL version 3 or later
 * @copyright  For copyright information on Mahara, please see the README file distributed with this software.
 *
 */
function Dwoo_Plugin_loadgroupquota(Dwoo $dwoo)
{
    $group = group_current_group();
    $quota = $group->quota;
    $quotaused = $group->quotaused;
    if ($quota >= 1048576) {
        $quota_message = get_string('quotausagegroup', 'mahara', sprintf('%0.1fMB', $group->quotaused / 1048576), sprintf('%0.1fMB', $quota / 1048567));
    } else {
        if ($quota >= 1024) {
            $quota_message = get_string('quotausagegroup', 'mahara', sprintf('%0.1fKB', $group->quotaused / 1024), sprintf('%0.1fKB', $quota / 1024));
        } else {
            $quota_message = get_string('quotausagegroup', 'mahara', sprintf('%d bytes', $group->quotaused), sprintf('%d bytes', $quota));
        }
    }
    $dwoo->assignInScope($quota_message, 'GROUPQUOTA_MESSAGE');
    if ($quota == 0) {
        $dwoo->assignInScope(100, 'GROUPQUOTA_PERCENTAGE');
    } else {
        $dwoo->assignInScope(round($quotaused / $quota * 100), 'GROUPQUOTA_PERCENTAGE');
    }
}
开发者ID:janaece,项目名称:globalclassroom4_clean,代码行数:30,代码来源:function.loadgroupquota.php

示例4: render_instance

 public static function render_instance(BlockInstance $instance, $editing = false)
 {
     global $USER;
     if ($instance->get_view()->get('owner') == "0") {
         return '';
     }
     $configdata = $instance->get('configdata');
     $rows = isset($configdata['rows']) ? $configdata['rows'] : 1;
     $columns = isset($configdata['columns']) ? $configdata['columns'] : 6;
     $order = isset($configdata['order']) ? $configdata['order'] : 'latest';
     $numtoshow = isset($configdata['numtoshow']) ? $configdata['numtoshow'] : $rows * $columns;
     $groupid = $instance->get_view()->get('group');
     // If the group has hidden membership, display nothing
     $usergroups = $USER->get('grouproles');
     $group = defined('GROUP') && $groupid == GROUP ? group_current_group() : get_record('group', 'id', $groupid);
     if ($group->hidemembersfrommembers && (!isset($usergroups[$groupid]) || $usergroups[$groupid] != 'admin')) {
         return '';
     }
     if ($group->hidemembers && !isset($usergroups[$groupid])) {
         return '';
     }
     require_once 'searchlib.php';
     $groupmembers = get_group_user_search_results($groupid, '', 0, $numtoshow, '', $order);
     if ($groupmembers['count']) {
         $smarty = smarty_core();
         $smarty->assign_by_ref('groupmembers', $groupmembers['data']);
         $groupmembers['tablerows'] = $smarty->fetch('blocktype:groupmembers:row.tpl');
     } else {
         $groupmembers = false;
     }
     $show_all = array('url' => get_config('wwwroot') . 'group/members.php?id=' . $groupid, 'message' => get_string('show_all', 'blocktype.groupmembers'));
     $smarty = smarty_core();
     $smarty->assign('groupmembers', $groupmembers);
     $smarty->assign('show_all', $show_all);
     return $smarty->fetch('blocktype:groupmembers:groupmembers.tpl');
 }
开发者ID:janaece,项目名称:globalclassroom4_clean,代码行数:36,代码来源:lib.php

示例5: smarty


//.........这里部分代码省略.........
    }
    if (defined('ADMIN')) {
        $smarty->assign('ADMIN', true);
    }
    if (defined('INSTITUTIONALADMIN')) {
        $smarty->assign('INSTITUTIONALADMIN', true);
    }
    $smarty->assign('LOGGEDIN', $USER->is_logged_in());
    if ($USER->is_logged_in()) {
        global $SELECTEDSUBNAV;
        // It's evil, but rightnav & mainnav stuff are now in different templates.
        $smarty->assign('MAINNAV', main_nav());
        $smarty->assign('RIGHTNAV', right_nav());
        $smarty->assign('SELECTEDSUBNAV', $SELECTEDSUBNAV);
    } else {
        $smarty->assign('sitedefaultlang', get_string('sitedefault', 'admin') . ' (' . get_string_from_language(get_config('lang'), 'thislanguage') . ')');
        $smarty->assign('LANGUAGES', get_languages());
    }
    $smarty->assign('FOOTERMENU', footer_menu());
    $smarty->assign_by_ref('USER', $USER);
    $smarty->assign('SESSKEY', $USER->get('sesskey'));
    $smarty->assign_by_ref('JAVASCRIPT', $javascript_array);
    $smarty->assign_by_ref('HEADERS', $headers);
    $siteclosedforupgrade = get_config('siteclosed');
    if ($siteclosedforupgrade && get_config('disablelogin')) {
        $smarty->assign('SITECLOSED', 'logindisabled');
    } else {
        if ($siteclosedforupgrade || get_config('siteclosedbyadmin')) {
            $smarty->assign('SITECLOSED', 'loginallowed');
        }
    }
    if (!isset($extraconfig['pagehelp']) || $extraconfig['pagehelp'] !== false and $help = has_page_help()) {
        $smarty->assign('PAGEHELPNAME', $help[0]);
        $smarty->assign('PAGEHELPICON', $help[1]);
    }
    if (defined('GROUP')) {
        require_once 'group.php';
        $group = group_current_group();
        $smarty->assign('GROUP', $group);
        $smarty->assign('SUBPAGENAV', group_get_menu_tabs());
        $smarty->assign('PAGEHEADING', $group->name);
    }
    // ---------- sideblock stuff ----------
    $sidebars = !isset($extraconfig['sidebars']) || $extraconfig['sidebars'] !== false;
    if ($sidebars && !defined('INSTALLER') && (!defined('MENUITEM') || substr(MENUITEM, 0, 5) != 'admin')) {
        if (get_config('installed') && !defined('ADMIN') && !defined('INSTITUTIONALADMIN')) {
            $data = site_menu();
            if (!empty($data)) {
                $smarty->assign('SITEMENU', site_menu());
                $SIDEBLOCKS[] = array('name' => 'linksandresources', 'weight' => 10, 'data' => $data);
            }
        }
        if ($USER->is_logged_in() && defined('MENUITEM') && substr(MENUITEM, 0, 11) == 'myportfolio') {
            if (get_config('showselfsearchsideblock')) {
                $SIDEBLOCKS[] = array('name' => 'selfsearch', 'weight' => 0, 'data' => array());
            }
            if (get_config('showtagssideblock')) {
                $SIDEBLOCKS[] = array('name' => 'tags', 'id' => 'sb-tags', 'weight' => 0, 'data' => tags_sideblock());
            }
        }
        if ($USER->is_logged_in() && !defined('ADMIN') && !defined('INSTITUTIONALADMIN')) {
            $SIDEBLOCKS[] = array('name' => 'profile', 'id' => 'sb-profile', 'weight' => -20, 'data' => profile_sideblock());
            if (get_config('showonlineuserssideblock')) {
                $SIDEBLOCKS[] = array('name' => 'onlineusers', 'id' => 'sb-onlineusers', 'weight' => -10, 'data' => onlineusers_sideblock());
            }
        }
        if (defined('GROUP')) {
            $SIDEBLOCKS[] = array('name' => 'group', 'id' => 'sb-groupnav', 'weight' => -10, 'data' => group_sideblock());
        }
        if (!$USER->is_logged_in() && !(get_config('siteclosed') && get_config('disablelogin'))) {
            $SIDEBLOCKS[] = array('name' => 'login', 'weight' => -10, 'id' => 'sb-loginbox', 'data' => array('loginform' => auth_generate_login_form()));
        }
        if (get_config('enablenetworking')) {
            require_once get_config('docroot') . 'api/xmlrpc/lib.php';
            if ($USER->is_logged_in() && ($ssopeers = get_service_providers($USER->authinstance))) {
                $SIDEBLOCKS[] = array('name' => 'ssopeers', 'weight' => 1, 'data' => $ssopeers);
            }
        }
        if (isset($extraconfig['sideblocks']) && is_array($extraconfig['sideblocks'])) {
            foreach ($extraconfig['sideblocks'] as $sideblock) {
                $SIDEBLOCKS[] = $sideblock;
            }
        }
        usort($SIDEBLOCKS, create_function('$a,$b', 'if ($a["weight"] == $b["weight"]) return 0; return ($a["weight"] < $b["weight"]) ? -1 : 1;'));
        // Place all sideblocks on the right. If this structure is munged
        // appropriately, you can put blocks on the left. In future versions of
        // Mahara, we'll make it easy to do this.
        $SIDEBLOCKS = array('left' => array(), 'right' => $SIDEBLOCKS);
        $smarty->assign('userauthinstance', $SESSION->get('authinstance'));
        $smarty->assign('MNETUSER', $SESSION->get('mnetuser'));
        $smarty->assign('SIDEBLOCKS', $SIDEBLOCKS);
        $smarty->assign('SIDEBARS', $sidebars);
    }
    if ($USER->get('parentuser')) {
        $smarty->assign('USERMASQUERADING', true);
        $smarty->assign('masqueradedetails', get_string('youaremasqueradingas', 'mahara', display_name($USER)));
        $smarty->assign('becomeyouagain', ' <a href="' . hsc($wwwroot) . 'admin/users/changeuser.php?restore=1">' . get_string('becomeadminagain', 'admin', hsc($USER->get('parentuser')->name)) . '</a>');
    }
    return $smarty;
}
开发者ID:richardmansfield,项目名称:richardms-mahara,代码行数:101,代码来源:web.php

示例6: smarty


//.........这里部分代码省略.........
            // In drop-down navigation, the submenu is only usable if its parent is one of the top-level menu
            // items.  But if the submenu comes from something in right_nav (settings), it's unreachable.
            // Turning the submenu into SUBPAGENAV group-style tabs makes it usable.
            $smarty->assign('SUBPAGENAV', $SELECTEDSUBNAV);
        } else {
            $smarty->assign('SELECTEDSUBNAV', $SELECTEDSUBNAV);
        }
    } else {
        $smarty->assign('languageform', $langselectform);
    }
    $smarty->assign('FOOTERMENU', footer_menu());
    $smarty->assign_by_ref('USER', $USER);
    $smarty->assign('SESSKEY', $USER->get('sesskey'));
    $smarty->assign('CC_ENABLED', get_config('cookieconsent_enabled'));
    $javascript_array = append_version_number($javascript_array);
    $smarty->assign_by_ref('JAVASCRIPT', $javascript_array);
    $smarty->assign('RELEASE', get_config('release'));
    $smarty->assign('SERIES', get_config('series'));
    $smarty->assign('CACHEVERSION', get_config('cacheversion'));
    $siteclosedforupgrade = get_config('siteclosed');
    if ($siteclosedforupgrade && get_config('disablelogin')) {
        $smarty->assign('SITECLOSED', 'logindisabled');
    } else {
        if ($siteclosedforupgrade || get_config('siteclosedbyadmin')) {
            $smarty->assign('SITECLOSED', 'loginallowed');
        }
    }
    if (!isset($extraconfig['pagehelp']) || $extraconfig['pagehelp'] !== false and $help = has_page_help()) {
        $smarty->assign('PAGEHELPNAME', $help[0]);
        $smarty->assign('PAGEHELPICON', $help[1]);
    }
    if (defined('GROUP')) {
        require_once 'group.php';
        if ($group = group_current_group()) {
            $smarty->assign('GROUP', $group);
            if (!defined('NOGROUPMENU')) {
                $smarty->assign('SUBPAGENAV', group_get_menu_tabs());
                $smarty->assign('PAGEHEADING', $group->name);
            }
        }
    }
    // ---------- sideblock stuff ----------
    $sidebars = !isset($extraconfig['sidebars']) || $extraconfig['sidebars'] !== false;
    if ($sidebars && !defined('INSTALLER') && (!defined('MENUITEM') || substr(MENUITEM, 0, 5) != 'admin')) {
        if (get_config('installed') && !$adminsection) {
            $data = site_menu();
            if (!empty($data)) {
                $smarty->assign('SITEMENU', site_menu());
                $sideblocks[] = array('name' => 'linksandresources', 'weight' => 10, 'data' => $data);
            }
        }
        if ($USER->is_logged_in() && defined('MENUITEM') && (substr(MENUITEM, 0, 11) == 'myportfolio' || substr(MENUITEM, 0, 7) == 'content')) {
            if (get_config('showselfsearchsideblock')) {
                $sideblocks[] = array('name' => 'selfsearch', 'weight' => 0, 'data' => array());
            }
            if (get_config('showtagssideblock')) {
                $sideblocks[] = array('name' => 'tags', 'id' => 'sb-tags', 'weight' => 0, 'data' => tags_sideblock());
            }
        }
        if ($USER->is_logged_in() && !$adminsection) {
            $sideblocks[] = array('name' => 'profile', 'id' => 'sb-profile', 'class' => 'user-panel', 'weight' => -20, 'data' => profile_sideblock());
            $showusers = 2;
            $institutions = $USER->institutions;
            if (!empty($institutions)) {
                $showusers = 0;
                foreach ($institutions as $i) {
开发者ID:sarahjcotton,项目名称:mahara,代码行数:67,代码来源:web.php

示例7: group_get_menu_tabs

/**
 * Returns a datastructure describing the tabs that appear on a group page
 *
 * @param object $group Database record of group to get tabs for
 * @return array
 */
function group_get_menu_tabs()
{
    static $menu;
    $group = group_current_group();
    if (!$group) {
        return null;
    }
    $role = group_user_access($group->id);
    $menu = array('info' => array('path' => 'groups/info', 'url' => group_homepage_url($group, false), 'title' => get_string('About', 'group'), 'weight' => 20));
    if (group_can_list_members($group, $role)) {
        $menu['members'] = array('path' => 'groups/members', 'url' => 'group/members.php?id=' . $group->id, 'title' => get_string('Members', 'group'), 'weight' => 30);
    }
    if ($interactionplugins = plugins_installed('interaction')) {
        foreach ($interactionplugins as $plugin) {
            safe_require('interaction', $plugin->name);
            $plugin_menu = call_static_method(generate_class_name('interaction', $plugin->name), 'group_menu_items', $group);
            $menu = array_merge($menu, $plugin_menu);
        }
    }
    $menu['views'] = array('path' => 'groups/views', 'url' => 'view/groupviews.php?group=' . $group->id, 'title' => get_string('Views', 'group'), 'weight' => 50);
    $menu['collections'] = array('path' => 'groups/collections', 'url' => 'collection/index.php?group=' . $group->id, 'title' => get_string('Collections', 'group'), 'weight' => 60);
    if (group_role_can_edit_views($group, $role)) {
        $menu['share'] = array('path' => 'groups/share', 'url' => 'group/shareviews.php?group=' . $group->id, 'title' => get_string('share', 'view'), 'weight' => 70);
    }
    if ($role) {
        safe_require('grouptype', $group->grouptype);
        $artefactplugins = call_static_method('GroupType' . $group->grouptype, 'get_group_artefact_plugins');
        if ($plugins = plugins_installed('artefact')) {
            foreach ($plugins as &$plugin) {
                if (!in_array($plugin->name, $artefactplugins)) {
                    continue;
                }
                safe_require('artefact', $plugin->name);
                $plugin_menu = call_static_method(generate_class_name('artefact', $plugin->name), 'group_tabs', $group->id);
                $menu = array_merge($menu, $plugin_menu);
            }
        }
    }
    if (group_role_can_access_report($group, $role)) {
        $menu['report'] = array('path' => 'groups/report', 'url' => 'group/report.php?group=' . $group->id, 'title' => get_string('report', 'group'), 'weight' => 70);
    }
    if (defined('MENUITEM')) {
        $key = substr(MENUITEM, strlen('groups/'));
        if ($key && isset($menu[$key])) {
            $menu[$key]['selected'] = true;
        }
    }
    return $menu;
}
开发者ID:vohung96,项目名称:mahara,代码行数:55,代码来源:group.php

示例8: bulk_delete

 public static function bulk_delete($artefactids)
 {
     global $USER;
     require_once 'group.php';
     if (empty($artefactids)) {
         return;
     }
     $idstr = join(',', array_map('intval', $artefactids));
     db_begin();
     // Get the size of all the files we're about to delete that belong to
     // the user.
     if ($group = group_current_group()) {
         $totalsize = get_field_sql('
             SELECT SUM(size)
             FROM {artefact_file_files} f JOIN {artefact} a ON f.artefact = a.id
             WHERE a.group = ? AND f.artefact IN (' . $idstr . ')', array($group->id));
     } else {
         $totalsize = get_field_sql('
             SELECT SUM(size)
             FROM {artefact_file_files} f JOIN {artefact} a ON f.artefact = a.id
             WHERE a.owner = ? AND f.artefact IN (' . $idstr . ')', array($USER->get('id')));
     }
     // Get all fileids so that we can delete the files on disk
     $filetodeleteids = get_column_sql('
         SELECT fileid
         FROM {artefact_file_files} aff1
         WHERE artefact IN (' . $idstr . ')
         GROUP BY fileid
         HAVING COUNT(aff1.artefact) IN
            (SELECT COUNT(aff2.artefact)
             FROM {artefact_file_files} aff2
             WHERE aff1.fileid = aff2.fileid)', null);
     // The current rule is that file deletion should be logged in the artefact_log table
     // only for group-owned files.  To save time we will be slightly naughty here and
     // log deletion for all these files if at least one is group-owned.
     $log = (bool) count_records_select('artefact', 'id IN (' . $idstr . ') AND "group" IS NOT NULL');
     delete_records_select('artefact_attachment', 'attachment IN (' . $idstr . ')');
     delete_records_select('artefact_file_files', 'artefact IN (' . $idstr . ')');
     parent::bulk_delete($artefactids, $log);
     foreach ($filetodeleteids as $filetodeleteid) {
         $file = get_config('dataroot') . self::get_file_directory($filetodeleteid) . '/' . $filetodeleteid;
         if (is_file($file)) {
             unlink($file);
         }
     }
     if ($totalsize) {
         if ($group) {
             group_quota_remove($group->id, $totalsize);
         } else {
             $USER->quota_remove($totalsize);
             $USER->commit();
         }
     }
     db_commit();
 }
开发者ID:vohung96,项目名称:mahara,代码行数:55,代码来源:lib.php

示例9: smarty


//.........这里部分代码省略.........
        $mainnavsubnav = $SELECTEDSUBNAV;
        $smarty->assign('RIGHTNAV', right_nav());
        if (!$mainnavsubnav && $dropdownmenu) {
            // In drop-down navigation, the submenu is only usable if its parent is one of the top-level menu
            // items.  But if the submenu comes from something in right_nav (settings), it's unreachable.
            // Turning the submenu into SUBPAGENAV group-style tabs makes it usable.
            $smarty->assign('SUBPAGENAV', $SELECTEDSUBNAV);
        } else {
            $smarty->assign('SELECTEDSUBNAV', $SELECTEDSUBNAV);
        }
    } else {
        $smarty->assign('languageform', $langselectform);
    }
    $smarty->assign('FOOTERMENU', footer_menu());
    $smarty->assign_by_ref('USER', $USER);
    $smarty->assign('SESSKEY', $USER->get('sesskey'));
    $javascript_array = append_version_number($javascript_array);
    $smarty->assign_by_ref('JAVASCRIPT', $javascript_array);
    $smarty->assign('RELEASE', get_config('release'));
    $siteclosedforupgrade = get_config('siteclosed');
    if ($siteclosedforupgrade && get_config('disablelogin')) {
        $smarty->assign('SITECLOSED', 'logindisabled');
    } else {
        if ($siteclosedforupgrade || get_config('siteclosedbyadmin')) {
            $smarty->assign('SITECLOSED', 'loginallowed');
        }
    }
    if (!isset($extraconfig['pagehelp']) || $extraconfig['pagehelp'] !== false and $help = has_page_help()) {
        $smarty->assign('PAGEHELPNAME', $help[0]);
        $smarty->assign('PAGEHELPICON', $help[1]);
    }
    if (defined('GROUP')) {
        require_once 'group.php';
        if ($group = group_current_group()) {
            $smarty->assign('GROUP', $group);
            if (!defined('NOGROUPMENU')) {
                $smarty->assign('SUBPAGENAV', group_get_menu_tabs());
                $smarty->assign('PAGEHEADING', $group->name);
            }
        }
    }
    // ---------- sideblock stuff ----------
    $sidebars = !isset($extraconfig['sidebars']) || $extraconfig['sidebars'] !== false;
    if ($sidebars && !defined('INSTALLER') && (!defined('MENUITEM') || substr(MENUITEM, 0, 5) != 'admin')) {
        if (get_config('installed') && !$adminsection) {
            $data = site_menu();
            if (!empty($data)) {
                $smarty->assign('SITEMENU', site_menu());
                $SIDEBLOCKS[] = array('name' => 'linksandresources', 'weight' => 10, 'data' => $data);
            }
        }
        if ($USER->is_logged_in() && defined('MENUITEM') && (substr(MENUITEM, 0, 11) == 'myportfolio' || substr(MENUITEM, 0, 7) == 'content')) {
            if (get_config('showselfsearchsideblock')) {
                $SIDEBLOCKS[] = array('name' => 'selfsearch', 'weight' => 0, 'data' => array());
            }
            if (get_config('showtagssideblock')) {
                $SIDEBLOCKS[] = array('name' => 'tags', 'id' => 'sb-tags', 'weight' => 0, 'data' => tags_sideblock());
            }
        }
        if ($USER->is_logged_in() && !$adminsection) {
            $SIDEBLOCKS[] = array('name' => 'profile', 'id' => 'sb-profile', 'weight' => -20, 'data' => profile_sideblock());
            $showusers = 2;
            $institutions = $USER->institutions;
            if (!empty($institutions)) {
                $showusers = 0;
                foreach ($institutions as $i) {
开发者ID:nanda555,项目名称:TestAppFromAWS,代码行数:67,代码来源:web.php

示例10: group_get_menu_tabs

/**
 * Returns a datastructure describing the tabs that appear on a group page
 *
 * @param object $group Database record of group to get tabs for
 * @return array
 */
function group_get_menu_tabs()
{
    static $menu;
    $group = group_current_group();
    if (!$group) {
        return null;
    }
    $role = group_user_access($group->id);
    $menu = array('info' => array('path' => 'groups/info', 'url' => group_homepage_url($group, false), 'title' => get_string('About', 'group'), 'weight' => 20));
    if (group_can_list_members($group, $role)) {
        $menu['members'] = array('path' => 'groups/members', 'url' => 'group/members.php?id=' . $group->id, 'title' => get_string('Members', 'group'), 'weight' => 30);
    }
    if ($interactionplugins = plugins_installed('interaction')) {
        foreach ($interactionplugins as $plugin) {
            safe_require('interaction', $plugin->name);
            $plugin_menu = call_static_method(generate_class_name('interaction', $plugin->name), 'group_menu_items', $group);
            $menu = array_merge($menu, $plugin_menu);
        }
    }
    $menu['subnav'] = array('class' => 'group');
    $menu['views'] = array('path' => 'groups/views', 'url' => 'view/groupviews.php?group=' . $group->id, 'title' => get_string('Views', 'group'), 'weight' => 50);
    $menu['collections'] = array('path' => 'groups/collections', 'url' => 'collection/index.php?group=' . $group->id, 'title' => get_string('Collections', 'group'), 'weight' => 60);
    if (group_role_can_edit_views($group, $role)) {
        $menu['share'] = array('path' => 'groups/share', 'url' => 'group/shareviews.php?group=' . $group->id, 'title' => get_string('share', 'view'), 'weight' => 70);
    }
    if ($role) {
        safe_require('grouptype', $group->grouptype);
        $artefactplugins = call_static_method('GroupType' . $group->grouptype, 'get_group_artefact_plugins');
        if ($plugins = plugins_installed('artefact')) {
            foreach ($plugins as &$plugin) {
                if (!in_array($plugin->name, $artefactplugins)) {
                    continue;
                }
                safe_require('artefact', $plugin->name);
                $plugin_menu = call_static_method(generate_class_name('artefact', $plugin->name), 'group_tabs', $group->id);
                $menu = array_merge($menu, $plugin_menu);
            }
        }
    }
    if (group_role_can_access_report($group, $role)) {
        $menu['report'] = array('path' => 'groups/report', 'url' => 'group/report.php?group=' . $group->id, 'title' => get_string('report', 'group'), 'weight' => 70);
    }
    if (defined('MENUITEM')) {
        $key = substr(MENUITEM, strlen('groups/'));
        if ($key && isset($menu[$key])) {
            $menu[$key]['selected'] = true;
        }
    }
    // Sort the menu items by weight
    uasort($menu, function ($a, $b) {
        // Only items with a "weight" component need to get sorted. Ones without weight can go first.
        if (!array_key_exists('weight', $a)) {
            return -1;
        }
        if (!array_key_exists('weight', $b)) {
            return 1;
        }
        $aweight = $a['weight'];
        $bweight = $b['weight'];
        if ($aweight == $bweight) {
            return 0;
        }
        return $aweight < $bweight ? -1 : 1;
    });
    return $menu;
}
开发者ID:sarahjcotton,项目名称:mahara,代码行数:72,代码来源:group.php

示例11: pieform_element_filebrowser_delete

function pieform_element_filebrowser_delete(Pieform $form, $element, $artefact)
{
    global $USER;
    $institution = $form->get_property('institution');
    $group = $form->get_property('group');
    try {
        $artefact = artefact_instance_from_id($artefact);
    } catch (ArtefactNotFoundException $e) {
        $parentfolder = $element['folder'] ? $element['folder'] : null;
        $result = array('error' => true, 'message' => get_string('deletingfailed', 'artefact.file'), 'newlist' => pieform_element_filebrowser_build_filelist($form, $element, $parentfolder));
        return $result;
    }
    if (!$USER->can_edit_artefact($artefact)) {
        return array('error' => true, 'message' => get_string('nodeletepermission', 'mahara'));
    }
    if (!$artefact->can_be_deleted()) {
        return array('error' => true, 'message' => get_string('cantbedeleted', 'mahara'));
    }
    $parentfolder = $artefact->get('parent');
    // Remove the skin background and update the skin thumbs
    require_once get_config('libroot') . 'skin.php';
    Skin::remove_background($artefact->get('id'));
    $artefact->delete();
    $result = array('error' => false, 'deleted' => true, 'artefacttype' => $artefact->get('artefacttype'), 'message' => get_string('filethingdeleted', 'artefact.file', get_string($artefact->get('artefacttype'), 'artefact.file') . ' ' . $artefact->get('title')), 'maxuploadsize' => display_size(get_max_upload_size(!$institution && !$group)), 'newlist' => pieform_element_filebrowser_build_filelist($form, $element, $parentfolder));
    if (defined('GROUP')) {
        $group = group_current_group();
        $result['quota'] = $group->quota;
        $result['quotaused'] = $group->quotaused;
    } else {
        $result['quota'] = $USER->get('quota');
        $result['quotaused'] = $USER->get('quotaused');
    }
    return $result;
}
开发者ID:rboyatt,项目名称:mahara,代码行数:34,代码来源:filebrowser.php

示例12: define

define('SECTION_PLUGINTYPE', 'artefact');
define('SECTION_PLUGINNAME', 'internal');
define('SECTION_PAGE', 'notes');
define('TITLE', get_string('Notes', 'artefact.internal'));
$offset = param_integer('offset', 0);
$limit = param_integer('limit', 10);
$baseurl = get_config('wwwroot') . 'artefact/internal/notes.php';
$params = array();
if ($group = param_integer('group', null)) {
    define('MENUITEM', 'groups');
    define('GROUP', $group);
    require_once 'group.php';
    if (!group_user_can_edit_views($group, $USER->get('id'))) {
        throw new AccessDeniedException(get_string('accessdenied', 'error'));
    }
    $groupobj = group_current_group();
    $pageheading = get_string('notesfor', 'artefact.internal', $groupobj->name);
    $where = '"group" = ?';
    $values = array($group);
    $params['group'] = $group;
} else {
    if ($institution = param_alpha('institution', null)) {
        if ($institution == 'mahara') {
            define('ADMIN', 1);
            define('MENUITEM', 'configsite');
            $pageheading = get_string('Notes', 'artefact.internal');
        } else {
            define('INSTITUTIONALADMIN', 1);
            define('MENUITEM', 'manageinstitutions');
            require_once 'institution.php';
            $institutionobj = new Institution($institution);
开发者ID:sarahjcotton,项目名称:mahara,代码行数:31,代码来源:notes.php

示例13: group_sideblock

/**
 * creates the group sideblock
 */
function group_sideblock()
{
    require_once 'group.php';
    $data['group'] = group_current_group();
    if (!$data['group']) {
        return null;
    }
    $data['menu'] = group_get_menu_tabs();
    // @todo either: remove this if interactions become group
    // artefacts, or: do this in interaction/lib.php if we leave them
    // as interactions
    $data['forums'] = get_records_select_array('interaction_instance', '"group" = ? AND deleted = ? AND plugin = ?', array(GROUP, 0, 'forum'), 'ctime', 'id, plugin, title');
    if (!$data['forums']) {
        $data['forums'] = array();
    } else {
        safe_require('interaction', 'forum');
        $data['forums'] = PluginInteractionForum::sideblock_sort($data['forums']);
    }
    return $data;
}
开发者ID:Br3nda,项目名称:mahara,代码行数:23,代码来源:group.php

示例14: render_exception

 public function render_exception()
 {
     global $USER, $SESSION;
     if (defined('GROUP') && $USER->is_logged_in()) {
         $roles = $USER->get('grouproles');
         if (!isset($roles[GROUP])) {
             $group = group_current_group();
             if ($group->jointype == 'open' || $group->jointype == 'invite' && get_record('group_member_invite', 'group', GROUP, 'member', $USER->get('id'))) {
                 $SESSION->add_error_msg(get_string('notmembermayjoin', 'group', $group->name));
                 $next = substr($_SERVER['REQUEST_URI'], strlen(get_mahara_install_subdirectory()) - 1);
                 redirect(get_config('wwwroot') . 'group/view.php?id=' . GROUP . '&next=' . urlencode($next));
             }
             if ($group->jointype == 'request' && !get_record('group_member_request', 'group', GROUP, 'member', $USER->get('id'))) {
                 $SESSION->add_error_msg(get_string('notamember', 'group'));
                 redirect(get_config('wwwroot') . 'group/requestjoin.php?id=' . GROUP . '&returnto=view');
             }
         }
     }
     header("HTTP/1.0 403 Forbidden", true);
     return parent::render_exception();
 }
开发者ID:richardmansfield,项目名称:richardms-mahara,代码行数:21,代码来源:errors.php

示例15: get_data

 protected static function get_data($groupid, $editing = false)
 {
     global $USER;
     if (!defined('GROUP')) {
         define('GROUP', $groupid);
     }
     // get the currently requested group
     $group = group_current_group();
     $role = group_user_access($group->id);
     $bi = group_get_homepage_view_groupview_block($group->id);
     $configdata = $bi->get('configdata');
     if (!isset($configdata['sortsubmittedby']) || $configdata['sortsubmittedby'] == PluginBlocktypeGroupViews::SORTBY_TITLE) {
         $sortsubmittedby = 'c.name, v.title';
     } else {
         $sortsubmittedby = 'c.submittedtime DESC, v.submittedtime DESC';
     }
     if ($role) {
         $limit = isset($configdata['count']) ? intval($configdata['count']) : 5;
         $limit = $limit > 0 ? $limit : 5;
         // Get all views created in the group
         // Sortorder: Group homepage should be first, then sort by sortorder
         $sort = array(array('column' => "type='grouphomepage'", 'desc' => true));
         // Find out what order to sort them by (default is titles)
         if (!isset($configdata['sortgroupviewsby']) || $configdata['sortgroupviewsby'] == PluginBlocktypeGroupViews::SORTBY_TITLE) {
             $sort[] = array('column' => 'title');
         } else {
             $sort[] = array('column' => 'mtime', 'desc' => true);
         }
         $data['groupviews'] = View::view_search(null, null, (object) array('group' => $group->id), null, $limit, 0, true, $sort);
         foreach ($data['groupviews']->data as &$view) {
             if (!$editing && isset($view['template']) && $view['template']) {
                 $view['form'] = pieform(create_view_form(null, null, $view['id']));
             }
         }
         // Find out what order to sort them by (default is titles)
         if (!isset($configdata['sortsharedviewsby']) || $configdata['sortsharedviewsby'] == PluginBlocktypeGroupViews::SORTBY_TITLE) {
             $sortsharedviewsby = 'v.title';
             $sortsharedcollectionsby = array(array('column' => 'c.name'));
         } else {
             $sortsharedviewsby = 'v.mtime DESC';
             $sortsharedcollectionsby = array(array('column' => 'GREATEST(c.mtime, (SELECT MAX(v.mtime) FROM {view} v INNER JOIN {collection_view} cv ON v.id=cv.view WHERE cv.collection=c.id))', 'desc' => true));
         }
         // For group members, display a list of views that others have
         // shared to the group
         if (empty($configdata['showsharedviews'])) {
             $data['sharedviews'] = (object) array('data' => array(), 'count' => 0, 'limit' => $limit, 'offset' => 0);
         } else {
             $data['sharedviews'] = View::get_sharedviews_data($limit, 0, $group->id, $configdata['showsharedviews'] == 2 ? false : true, $sortsharedviewsby);
             foreach ($data['sharedviews']->data as &$view) {
                 if (!$editing && isset($view['template']) && $view['template']) {
                     $view['form'] = pieform(create_view_form($group, null, $view->id));
                 }
             }
         }
         if (empty($configdata['showsharedcollections'])) {
             $data['sharedcollections'] = (object) array('data' => array(), 'count' => 0, 'limit' => $limit, 'offset' => 0);
         } else {
             $data['sharedcollections'] = View::get_sharedcollections_data($limit, 0, $group->id, $configdata['showsharedcollections'] == 2 ? false : true, $sortsharedcollectionsby);
         }
         if (group_user_can_assess_submitted_views($group->id, $USER->get('id'))) {
             // Display a list of views submitted to the group
             list($collections, $views) = View::get_views_and_collections(null, null, null, null, false, $group->id, $sortsubmittedby);
             $allsubmitted = array_merge(array_values($collections), array_values($views));
             $data['allsubmitted'] = array('data' => array_slice($allsubmitted, 0, $limit), 'count' => count($allsubmitted), 'limit' => $limit, 'offset' => 0);
         }
     }
     if ($group->submittableto) {
         require_once 'pieforms/pieform.php';
         // A user can submit more than one view to the same group, but no view can be
         // submitted to more than one group.
         // Display a list of views this user has submitted to this group, and a submission
         // form containing drop-down of their unsubmitted views.
         list($collections, $views) = View::get_views_and_collections($USER->get('id'), null, null, null, false, $group->id, $sortsubmittedby);
         $data['mysubmitted'] = array_merge(array_values($collections), array_values($views));
         // Only render the submission form in viewing mode
         if (!$editing) {
             $data['group_view_submission_form'] = group_view_submission_form($group->id);
         }
     }
     $data['group'] = $group;
     return $data;
 }
开发者ID:kienv,项目名称:mahara,代码行数:82,代码来源:lib.php


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