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


PHP get_records_select_assoc函数代码示例

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


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

示例1: pieform_element_userlist

/**
 * Provides a basic text field input.
 *
 * @todo this is just lies ...
 * @param array    $element The element to render
 * @param Pieform  $form    The form to render the element for
 * @return string           The HTML for the element
 */
function pieform_element_userlist(Pieform $form, $element)
{
    $smarty = smarty_core();
    $smarty->left_delimiter = '{{';
    $smarty->right_delimiter = '}}';
    $value = $form->get_value($element);
    if (!is_array($value) && isset($element['defaultvalue']) && is_array($element['defaultvalue'])) {
        $value = $element['defaultvalue'];
    }
    if (is_array($value) && count($value)) {
        $orderby = isset($element['searchparams']['orderby']) && $element['searchparams']['orderby'] == 'lastname' ? 'lastname,firstname,id' : 'firstname,lastname,id';
        $members = get_records_select_assoc('usr', 'id IN (' . join(',', array_map('intval', $value)) . ')', null, $orderby, 'id,username,firstname,lastname,preferredname,staff');
        foreach ($members as &$member) {
            $member = display_name($member);
        }
        $smarty->assign('options', $members);
        $smarty->assign('value', join(',', $value));
    }
    $smarty->assign('name', $element['name']);
    if (!empty($element['lefttitle'])) {
        $smarty->assign('lefttitle', $element['lefttitle']);
    }
    if (!empty($element['righttitle'])) {
        $smarty->assign('righttitle', $element['righttitle']);
    }
    if (!empty($element['leftarrowlabel'])) {
        $smarty->assign('leftarrowlabel', $element['leftarrowlabel']);
    }
    if (!empty($element['rightarrowlabel'])) {
        $smarty->assign('rightarrowlabel', $element['rightarrowlabel']);
    }
    if (!empty($element['group'])) {
        $smarty->assign('group', $element['group']);
        $smarty->assign('includeadmins', !isset($element['includeadmins']) || $element['includeadmins'] ? 1 : 0);
    }
    if (empty($element['searchscript'])) {
        $element['searchscript'] = 'json/usersearch.php';
    }
    $smarty->assign('searchscript', $element['searchscript']);
    if (empty($element['searchparams'])) {
        $element['searchparams'] = array('query' => '', 'limit' => 100);
    }
    $smarty->assign('searchparams', json_encode($element['searchparams']));
    $smarty->assign('onlyshowingfirst', json_encode(get_string('onlyshowingfirst', 'admin')));
    $smarty->assign('resultsof', json_encode(get_string('resultsof', 'admin')));
    return $smarty->fetch('form/userlist.tpl');
}
开发者ID:sarahjcotton,项目名称:mahara,代码行数:55,代码来源:userlist.php

示例2: removeMember

 public function removeMember($user)
 {
     if (is_numeric($user)) {
         $user = get_record('usr', 'id', $user);
     }
     db_begin();
     // If the user is being authed by the institution they are
     // being removed from, change them to internal auth, or if
     // we can't find that, some other no institution auth.
     $authinstances = get_records_select_assoc('auth_instance', "institution IN ('mahara', ?)", array($this->name), "institution = 'mahara' DESC, authname = 'internal' DESC");
     $oldauth = $user->authinstance;
     if (isset($authinstances[$oldauth]) && $authinstances[$oldauth]->institution == $this->name) {
         foreach ($authinstances as $ai) {
             if ($ai->authname == 'internal' && $ai->institution == 'mahara') {
                 $user->authinstance = $ai->id;
                 break;
             } else {
                 if ($ai->institution == 'mahara') {
                     $user->authinstance = $ai->id;
                     break;
                 }
             }
         }
         delete_records('auth_remote_user', 'authinstance', $oldauth, 'localusr', $user->id);
         // If the old authinstance was external, the user may need
         // to set a password
         if ($user->password == '') {
             log_debug('resetting pw for ' . $user->id);
             $this->removeMemberSetPassword($user);
         }
         update_record('usr', $user);
     }
     delete_records('usr_institution', 'usr', $user->id, 'institution', $this->name);
     handle_event('updateuser', $user->id);
     db_commit();
 }
开发者ID:richardmansfield,项目名称:richardms-mahara,代码行数:36,代码来源:institution.php

示例3: locked_profile_fields

function locked_profile_fields()
{
    global $USER, $SESSION;
    // Profile fields are locked for a user if they are locked by any
    // institution the user is a member of, but not an admin for.
    $lockinginstitutions = array_keys($USER->get('institutions'));
    $lockinginstitutions[] = 'mahara';
    $lockinginstitutions = array_diff($lockinginstitutions, $USER->get('admininstitutions'));
    $locked = get_records_select_assoc('institution_locked_profile_field', 'name IN (' . join(',', array_map('db_quote', $lockinginstitutions)) . ')', null, '', 'profilefield,name');
    if ($remotelocked = $SESSION->get('lockedfields')) {
        foreach ($remotelocked as $f) {
            if (!isset($locked[$f])) {
                $locked[$f] = $f;
            }
        }
    }
    return $locked;
}
开发者ID:patkira,项目名称:mahara,代码行数:18,代码来源:index.php

示例4: progressbarform_submit

function progressbarform_submit(Pieform $form, $values)
{
    global $SESSION, $USER, $possibleitems;
    $institution = $values['institution'];
    // Pre-fetching the current settings to reduce SELECT queries
    $currentsettings = get_records_select_assoc('institution_config', 'institution=? and field like \'progressbaritem_%\'', array($institution), 'field', 'field, value');
    if (!$currentsettings) {
        $currentsettings = array();
    }
    foreach ($possibleitems as $plugin => $pluginitems) {
        foreach ($pluginitems as $artefact) {
            $itemname = "progressbaritem_{$plugin}_{$artefact->name}";
            // Format the value into an integer or 0/1
            $val = $values[$itemname];
            if ($artefact->iscountable) {
                $val = (int) $val;
            } else {
                $val = (int) (bool) $val;
            }
            // Update the record if it already exists, or create the record if it doesn't
            if (array_key_exists($itemname, $currentsettings)) {
                if ($val) {
                    set_field('institution_config', 'value', $val, 'institution', $institution, 'field', $itemname);
                } else {
                    delete_records('institution_config', 'institution', $institution, 'field', $itemname);
                }
            } else {
                if ($val) {
                    insert_record('institution_config', (object) array('institution' => $institution, 'field' => $itemname, 'value' => $val));
                }
            }
        }
    }
    $SESSION->add_ok_msg(get_string('progressbarsaved', 'admin'));
    redirect('/admin/users/progressbar.php?institution=' . $institution);
}
开发者ID:sarahjcotton,项目名称:mahara,代码行数:36,代码来源:progressbar.php

示例5: changeauth_submit

function changeauth_submit(Pieform $form, $values)
{
    global $users, $SESSION, $authinstances, $USER;
    $newauth = AuthFactory::create($values['authinstance']);
    $needspassword = method_exists($newauth, 'change_password');
    $updated = 0;
    $needpassword = 0;
    db_begin();
    $newauthinst = get_records_select_assoc('auth_instance', 'id = ?', array($values['authinstance']));
    if ($USER->get('admin') || $USER->is_institutional_admin($newauthinst[$values['authinstance']]->institution)) {
        foreach ($users as $user) {
            if ($user->authinstance != $values['authinstance']) {
                // Authinstance can be changed by institutional admins if both the
                // old and new authinstances belong to the admin's institutions
                $authinst = get_field('auth_instance', 'institution', 'id', $user->authinstance);
                if ($USER->get('admin') || $USER->is_institutional_admin($authinst)) {
                    // determine the current remoteusername
                    $current_remotename = get_field('auth_remote_user', 'remoteusername', 'authinstance', $user->authinstance, 'localusr', $user->id);
                    if (!$current_remotename) {
                        $current_remotename = $user->username;
                    }
                    // remove row if new authinstance row already exists to avoid doubleups
                    delete_records('auth_remote_user', 'authinstance', $values['authinstance'], 'localusr', $user->id);
                    insert_record('auth_remote_user', (object) array('authinstance' => $values['authinstance'], 'remoteusername' => $current_remotename, 'localusr' => $user->id));
                }
                if ($user->haspassword && !$needspassword) {
                    $user->password = '';
                } else {
                    if ($needspassword && !$user->haspassword) {
                        $needpassword++;
                    }
                }
                $user->authinstance = $values['authinstance'];
                update_record('usr', $user, 'id');
                $updated++;
            }
        }
    }
    db_commit();
    if ($needpassword) {
        // Inform the user that they may need to reset passwords
        $SESSION->add_info_msg(get_string('bulkchangeauthmethodresetpassword', 'admin', $needpassword));
    }
    $message = get_string('bulkchangeauthmethodsuccess', 'admin', $updated);
    $form->reply(PIEFORM_OK, array('message' => $message));
}
开发者ID:janaece,项目名称:globalclassroom4_clean,代码行数:46,代码来源:bulk.php

示例6: edituser_site_submit

function edituser_site_submit(Pieform $form, $values)
{
    if (!($user = get_record('usr', 'id', $values['id']))) {
        return false;
    }
    if (isset($values['password']) && $values['password'] !== '') {
        $user->password = $values['password'];
        $user->salt = '';
    }
    $user->passwordchange = (int) ($values['passwordchange'] == 'on');
    $user->quota = $values['quota'];
    $user->expiry = db_format_timestamp($values['expiry']);
    global $USER;
    if ($USER->get('admin')) {
        // Not editable by institutional admins
        $user->staff = (int) ($values['staff'] == 'on');
        $user->admin = (int) ($values['admin'] == 'on');
        if ($user->admin) {
            activity_add_admin_defaults(array($user->id));
        }
    }
    if ($values['maildisabled'] == 0 && get_account_preference($user->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->email;
        $u->id = $user->id;
        update_bounce_count($u, true);
        update_send_count($u, true);
    }
    set_account_preference($user->id, 'maildisabled', $values['maildisabled']);
    // Authinstance can be changed by institutional admins if both the
    // old and new authinstances belong to the admin's institutions
    $remotename = get_field('auth_remote_user', 'remoteusername', 'authinstance', $user->authinstance, 'localusr', $user->id);
    if (!$remotename) {
        $remotename = $user->username;
    }
    if (isset($values['authinstance']) && ($values['authinstance'] != $user->authinstance || isset($values['remoteusername']) && $values['remoteusername'] != $remotename)) {
        $authinst = get_records_select_assoc('auth_instance', 'id = ? OR id = ?', array($values['authinstance'], $user->authinstance));
        if ($USER->get('admin') || $USER->is_institutional_admin($authinst[$values['authinstance']]->institution) && $USER->is_institutional_admin($authinst[$user->authinstance]->institution)) {
            delete_records('auth_remote_user', 'localusr', $user->id);
            if ($authinst[$values['authinstance']]->authname != 'internal') {
                if (isset($values['remoteusername']) && strlen($values['remoteusername']) > 0) {
                    $un = $values['remoteusername'];
                } else {
                    $un = $remotename;
                }
                insert_record('auth_remote_user', (object) array('authinstance' => $values['authinstance'], 'remoteusername' => $un, 'localusr' => $user->id));
            }
            $user->authinstance = $values['authinstance'];
        }
    }
    update_record('usr', $user);
    redirect('/admin/users/edit.php?id=' . $user->id);
}
开发者ID:richardmansfield,项目名称:richardms-mahara,代码行数:55,代码来源:edit.php

示例7: get_extra_collection_info

 /**
  * Get more info for the collections: owner, url, tags, views
  *
  * @param array a list of collections $collectiondata
  * @return array updated collection data
  */
 public static function get_extra_collection_info(&$collectiondata, $gettags = true)
 {
     if ($collectiondata) {
         // Get view owner details for display
         $owners = array();
         $groups = array();
         $institutions = array();
         foreach ($collectiondata as $c) {
             if (!empty($c->owner) && !isset($owners[$c->owner])) {
                 $owners[$c->owner] = (int) $c->owner;
             } else {
                 if (!empty($c->group) && !isset($groups[$c->group])) {
                     $groups[$c->group] = (int) $c->group;
                 } else {
                     if (!empty($c->institution) && !isset($institutions[$c->institution])) {
                         $institutions[$c->institution] = $c->institution;
                     }
                 }
             }
         }
         if ($gettags) {
             $collectionidlist = join(',', array_map('intval', array_keys($collectiondata)));
             $tags = get_records_select_array('collection_tag', 'collection IN (' . $collectionidlist . ')');
             if ($tags) {
                 foreach ($tags as &$tag) {
                     $collectiondata[$tag->collection]->tags[] = $tag->tag;
                 }
             }
         }
         if (!empty($owners)) {
             global $USER;
             $userid = $USER->get('id');
             $fields = array('id', 'username', 'firstname', 'lastname', 'preferredname', 'admin', 'staff', 'studentid', 'email', 'profileicon', 'urlid', 'suspendedctime');
             if (count($owners) == 1 && isset($owners[$userid])) {
                 $owners = array($userid => new StdClass());
                 foreach ($fields as $f) {
                     $owners[$userid]->{$f} = $USER->get($f);
                 }
             } else {
                 $owners = get_records_select_assoc('usr', 'id IN (' . join(',', array_fill(0, count($owners), '?')) . ')', $owners, '', join(',', $fields));
             }
         }
         if (!empty($groups)) {
             $groups = get_records_select_assoc('group', 'id IN (' . join(',', $groups) . ')', null, '', 'id,name,urlid');
         }
         if (!empty($institutions)) {
             $institutions = get_records_assoc('institution', '', '', '', 'name,displayname');
             $institutions['mahara']->displayname = get_config('sitename');
         }
         $wwwroot = get_config('wwwroot');
         $needsubdomain = get_config('cleanurlusersubdomains');
         foreach ($collectiondata as &$c) {
             if (!empty($c->owner)) {
                 $c->sharedby = display_name($owners[$c->owner]);
                 $c->user = $owners[$c->owner];
             } else {
                 if (!empty($c->group)) {
                     $c->sharedby = $groups[$c->group]->name;
                     $c->groupdata = $groups[$c->group];
                 } else {
                     if (!empty($c->institution)) {
                         $c->sharedby = $institutions[$c->institution]->displayname;
                     }
                 }
             }
             $c = (array) $c;
             // Now that we have the owner & group records, create a temporary Collection object
             // so that we can use get_url method.
             require_once get_config('libroot') . 'collection.php';
             $collection = new Collection(0, $c);
             $c['url'] = $collection->get_url(false);
             $c['fullurl'] = $needsubdomain ? $collection->get_url(true) : $wwwroot . $c['url'];
             // Get any views that are part of this collection
             $c['views'] = get_records_sql_assoc('SELECT v.id, v.title, v.mtime FROM {view} v, {collection_view} cv, {collection} c
                                                  WHERE cv.collection = c.id AND cv.view = v.id AND c.id = ?', array($c['id']));
             // Set the collection modified time as the highest view
             // modified time if higher than collection modified time
             foreach ($c['views'] as $view) {
                 $cmodified = new DateTime($c['mtime']);
                 $vmodified = new DateTime($view->mtime);
                 if ($vmodified > $cmodified) {
                     $c['mtime'] = $view->mtime;
                 }
             }
         }
     }
 }
开发者ID:sarahjcotton,项目名称:mahara,代码行数:93,代码来源:view.php

示例8: delete

 /**
  * Deletes a Collection
  *
  */
 public function delete()
 {
     $viewids = get_column('collection_view', 'view', 'collection', $this->id);
     db_begin();
     // Delete navigation blocks within the collection's views which point at this collection.
     if ($viewids) {
         $values = $viewids;
         $values[] = 'navigation';
         $navigationblocks = get_records_select_assoc('block_instance', 'view IN (' . join(',', array_fill(0, count($viewids), '?')) . ') AND blocktype = ?', $values);
         if ($navigationblocks) {
             safe_require('blocktype', 'navigation');
             foreach ($navigationblocks as $b) {
                 $bi = new BlockInstance($b->id, $b);
                 $configdata = $bi->get('configdata');
                 if (isset($configdata['collection']) && $configdata['collection'] == $this->id) {
                     $bi->delete();
                 }
             }
         }
     }
     delete_records('collection_view', 'collection', $this->id);
     delete_records('collection_tag', 'collection', $this->id);
     delete_records('collection', 'id', $this->id);
     // Secret url records belong to the collection, so remove them from the view.
     // @todo: add user message to whatever calls this.
     if ($viewids) {
         delete_records_select('view_access', 'view IN (' . join(',', $viewids) . ') AND token IS NOT NULL');
     }
     db_commit();
 }
开发者ID:agwells,项目名称:Mahara-1,代码行数:34,代码来源:collection.php

示例9: get_extra_view_info

 public static function get_extra_view_info(&$viewdata, $getartefacts = true)
 {
     if ($viewdata) {
         // Get view owner details for display
         $owners = array();
         $groups = array();
         $institutions = array();
         foreach ($viewdata as $v) {
             if ($v->owner && !isset($owners[$v->owner])) {
                 $owners[$v->owner] = (int) $v->owner;
             } else {
                 if ($v->group && !isset($groups[$v->group])) {
                     $groups[$v->group] = (int) $v->group;
                 } else {
                     if (strlen($v->institution) && !isset($institutions[$v->institution])) {
                         $institutions[$v->institution] = $v->institution;
                     }
                 }
             }
         }
         $viewidlist = join(',', array_map('intval', array_keys($viewdata)));
         if ($getartefacts) {
             $artefacts = get_records_sql_array('SELECT va.view, va.artefact, a.title, a.artefacttype, t.plugin
                 FROM {view_artefact} va
                 INNER JOIN {artefact} a ON va.artefact = a.id
                 INNER JOIN {artefact_installed_type} t ON a.artefacttype = t.name
                 WHERE va.view IN (' . $viewidlist . ')
                 GROUP BY va.view, va.artefact, a.title, a.artefacttype, t.plugin
                 ORDER BY a.title, va.artefact', '');
             if ($artefacts) {
                 foreach ($artefacts as $artefactrec) {
                     safe_require('artefact', $artefactrec->plugin);
                     $classname = generate_artefact_class_name($artefactrec->artefacttype);
                     $artefactobj = new $classname(0, array('title' => $artefactrec->title));
                     $artefactobj->set('dirty', false);
                     if (!$artefactobj->in_view_list()) {
                         continue;
                     }
                     $artname = $artefactobj->display_title(30);
                     if (strlen($artname)) {
                         $viewdata[$artefactrec->view]->artefacts[] = array('id' => $artefactrec->artefact, 'title' => $artname);
                     }
                 }
             }
         }
         $tags = get_records_select_array('view_tag', 'view IN (' . $viewidlist . ')');
         if ($tags) {
             foreach ($tags as &$tag) {
                 $viewdata[$tag->view]->tags[] = $tag->tag;
             }
         }
         if (!empty($owners)) {
             $owners = get_records_select_assoc('usr', 'id IN (' . join(',', $owners) . ')', null, '', 'id,username,firstname,lastname,preferredname,admin,staff,studentid,email,profileicon');
         }
         if (!empty($groups)) {
             $groups = get_records_select_assoc('group', 'id IN (' . join(',', $groups) . ')', null, '', 'id,name');
         }
         if (!empty($institutions)) {
             $institutions = get_records_assoc('institution', '', '', '', 'name,displayname');
             $institutions['mahara']->displayname = get_config('sitename');
         }
         foreach ($viewdata as &$v) {
             $v->shortdescription = str_shorten_html(str_replace('<br />', ' ', $v->description), 100, true);
             if ($v->owner) {
                 $v->sharedby = View::owner_name($v->ownerformat, $owners[$v->owner]);
                 $v->user = $owners[$v->owner];
             } else {
                 if ($v->group) {
                     $v->sharedby = $groups[$v->group]->name;
                 } else {
                     if ($v->institution) {
                         $v->sharedby = $institutions[$v->institution]->displayname;
                     }
                 }
             }
             $v = (array) $v;
         }
     }
 }
开发者ID:richardmansfield,项目名称:richardms-mahara,代码行数:79,代码来源:view.php

示例10: array

        $values = array($institution);
        $params['institution'] = $institution;
    } else {
        define('MENUITEM', 'content/notes');
        $pageheading = get_string('mynotes', 'artefact.internal');
        $where = 'owner = ?';
        $values = array($USER->get('id'));
    }
}
if ($params) {
    $baseurl .= '?' . http_build_query($params);
}
$where .= ' AND artefacttype = ?';
$values[] = 'html';
$count = count_records_select('artefact', $where, $values);
$data = get_records_select_assoc('artefact', $where, $values, 'title, id', '*', $offset, $limit);
// Get blocks
if ($data) {
    $blocks = get_records_sql_assoc('
        SELECT
            bi.id AS block, bi.title AS blocktitle,
            va.artefact,
            va.view, v.title AS viewtitle, v.owner, v.group, v.institution, v.ownerformat, v.urlid
        FROM
            {block_instance} bi
            JOIN {view_artefact} va ON bi.id = va.block
            JOIN {view} v ON va.view = v.id
        WHERE
            va.artefact IN (' . join(',', array_fill(0, count($data), '?')) . ')
        ORDER BY va.view, bi.title', array_keys($data));
    if ($blocks) {
开发者ID:sarahjcotton,项目名称:mahara,代码行数:31,代码来源:notes.php

示例11: define

 */
define('INTERNAL', 1);
define('JSON', 1);
require dirname(dirname(__FILE__)) . '/init.php';
require_once 'group.php';
$data['error'] = false;
$data['message'] = null;
$initialgroups = param_integer_list('initialgroups', array());
$resultgroups = param_integer_list('resultgroups', array());
$userid = param_integer('userid');
$addtype = param_variable('addtype');
// Prevent group membership changing done by ordinary members, Tutors can only
// add members to group and cannot remove anyone. Group admins can do anything.
// With regard to invitation, both admins and tutors can invite people.
$allgroups = array_unique(array_merge($initialgroups, $resultgroups));
$groupdata = get_records_select_assoc('group', 'id IN (' . join(',', array_fill(0, count($allgroups), '?')) . ')', $allgroups);
foreach (group_get_grouptypes() as $grouptype) {
    safe_require('grouptype', $grouptype);
}
foreach ($allgroups as $groupid) {
    if (!($loggedinrole = group_user_access($groupid))) {
        json_reply('local', get_string('accessdenied', 'error'));
    }
    if ($loggedinrole == 'admin') {
        continue;
    }
    if (!in_array($loggedinrole, call_static_method('GroupType' . $groupdata[$groupid]->grouptype, 'get_view_assessing_roles'))) {
        json_reply('local', get_string('accessdenied', 'error'));
    }
    if (group_user_access($groupid, $userid) && in_array($groupid, array_diff($initialgroups, $resultgroups))) {
        json_reply('local', get_string('cantremovememberfromgroup', 'group', hsc($groupdata[$groupid]->name)));
开发者ID:sarahjcotton,项目名称:mahara,代码行数:31,代码来源:changegroupsmembership.json.php

示例12: archive_mime_types

 public static function archive_mime_types()
 {
     static $mimetypes = null;
     if (is_null($mimetypes)) {
         $descriptions = self::archive_file_descriptions();
         $mimetypes = get_records_select_assoc('artefact_file_mime_types', 'description IN (' . join(',', array_map('db_quote', array_keys($descriptions))) . ')');
     }
     return $mimetypes;
 }
开发者ID:richardmansfield,项目名称:richardms-mahara,代码行数:9,代码来源:lib.php

示例13: switch

    }
    switch (group_user_access($groupid)) {
        case 'member':
            json_reply('local', get_string('accessdenied', 'error'));
            break;
        case 'tutor':
            if ($usertype = group_user_access($groupid, $userid)) {
                if ($usertype == 'member' && in_array($groupid, array_diff($initialgroups, $resultgroups))) {
                    json_reply('local', get_string('cantremovemember', 'group'));
                } elseif ($usertype != 'member' && in_array($groupid, array_diff($initialgroups, $resultgroups))) {
                    json_reply('local', get_string('cantremoveuserisadmin', 'group'));
                }
            }
    }
}
$groupdata = get_records_select_assoc('group', 'id IN (' . join(',', array_unique(array_merge($initialgroups, $resultgroups))) . ')');
if ($jointype == 'controlled') {
    db_begin();
    //remove group membership
    if ($groupstoremove = array_diff($initialgroups, $resultgroups)) {
        $groupstoremovemail = '';
        foreach ($groupstoremove as $groupid) {
            group_remove_user($groupid, $userid, $role = null);
            $groupstoremovemail .= $groupdata[$groupid]->name . "\n";
        }
    }
    //add group membership
    if ($groupstoadd = array_diff($resultgroups, $initialgroups)) {
        $groupstoaddmail = '';
        foreach ($groupstoadd as $groupid) {
            group_add_user($groupid, $userid, $role = null);
开发者ID:richardmansfield,项目名称:richardms-mahara,代码行数:31,代码来源:changegroupsmembership.json.php

示例14: locked_profile_fields

function locked_profile_fields()
{
    global $USER;
    // Profile fields are locked for a user if they are locked by any
    // institution the user is a member of, but not an admin for.
    $lockinginstitutions = array_keys($USER->get('institutions'));
    $lockinginstitutions[] = 'mahara';
    $lockinginstitutions = array_diff($lockinginstitutions, $USER->get('admininstitutions'));
    return get_records_select_assoc('institution_locked_profile_field', 'name IN (' . join(',', array_map('db_quote', $lockinginstitutions)) . ')', null, '', 'profilefield,name');
}
开发者ID:Br3nda,项目名称:mahara,代码行数:10,代码来源:index.php

示例15: get_folder_path_for_file

 /**
  * Given a file, returns the folder path for it in the Mahara files area
  *
  * The path is pre-sanitised so it can be used when generating the export
  *
  * @param  $file The file or folder to get the folder path for
  * @return string
  */
 private function get_folder_path_for_file($file)
 {
     if ($this->folderdata === null) {
         $this->folderdata = get_records_select_assoc('artefact', "artefacttype = 'folder' AND owner = ?", array($file->get('owner')));
         if ($this->folderdata) {
             foreach ($this->folderdata as &$folder) {
                 $folder->title = PluginExportHtml::sanitise_path($folder->title);
             }
         }
     }
     $folderpath = ArtefactTypeFileBase::get_full_path($file->get('parent'), $this->folderdata);
     return $folderpath;
 }
开发者ID:rboyatt,项目名称:mahara,代码行数:21,代码来源:lib.php


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