Ejemplo n.º 1
0
/**
 * Adds a specified group to a specified grouping. 
 * @param int $groupid The id of the group
 * @param int $groupingid The id of the grouping
 * @return boolean True if the group was added successfully, false otherwise
 */
function groups_db_add_group_to_grouping($groupid, $groupingid)
{
    if (!$groupid or !$groupingid or !groups_db_group_exists($groupid) or !groups_db_grouping_exists($groupingid)) {
        $success = false;
    } else {
        $success = true;
        $record = new Object();
        $record->groupingid = $groupingid;
        $record->groupid = $groupid;
        $record->timeadded = time();
        $results = insert_record('groups_groupings_groups', $record);
        if (!$results) {
            $success = false;
        }
    }
    return $groupingid;
}
Ejemplo n.º 2
0
/**
 * Determines if a group with a given groupid exists. 
 * @param int $groupid The groupid to check for
 * @return boolean True if the group exists, false otherwise or if an error 
 * occurred. 
 */
function groups_group_exists($groupid)
{
    return groups_db_group_exists($groupid);
}
Ejemplo n.º 3
0
/**
 * Sets the information about a group
 * @param object $groupsettings An object containing some or all of the 
 * following properties:
 * name, description, lang, theme, picture, hidepicture
 * @return boolean True if info was added successfully, false otherwise. 
 */
function groups_db_set_group_settings($groupid, $groupsettings)
{
    $success = true;
    if (!$groupid or !$groupsettings or !groups_db_group_exists($groupid)) {
        $success = false;
    } else {
        $record = $groupsettings;
        $record->id = $groupid;
        $record->timemodified = time();
        $result = update_record('groups', $record);
        if (!$result) {
            $success = false;
        }
    }
    return $success;
}