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


PHP Group::load方法代码示例

本文整理汇总了PHP中Group::load方法的典型用法代码示例。如果您正苦于以下问题:PHP Group::load方法的具体用法?PHP Group::load怎么用?PHP Group::load使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Group的用法示例。


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

示例1: sync

 public static function sync($data)
 {
     $entity = (object) array('entity_service' => 'typedGroup', 'entity_type' => $data['type'], 'entity_id' => $data['group_id'], 'entity_name' => $data['name'], 'attributes' => $data);
     parent::sync($entity);
     // also update the group that this corresponds to
     $g = new Group();
     try {
         $g->load((int) $data['group_id']);
         $g->group_type = 'typedgroup';
         $g->save();
     } catch (PAException $e) {
         throw $e;
     }
 }
开发者ID:Cyberspace-Networks,项目名称:PeopleAggregator,代码行数:14,代码来源:TypedGroupEntity.php

示例2: getFriends

 public function getFriends($groupId = '', $friendLimit = '')
 {
     if ($groupId != '') {
         $this->groupId1 = $groupId;
     }
     $friends = $this->find();
     $result = array();
     foreach ($friends as $friend) {
         $group = new Group();
         $group->id = $friend->groupId2;
         $group->load();
         array_push($result, $group);
     }
     return $result;
 }
开发者ID:a4501150,项目名称:FDUGroup,代码行数:15,代码来源:FriendsGroup.php

示例3: setup_module

function setup_module($column, $module, $obj)
{
    $group_var = new Group();
    $group_var->load($_REQUEST['gid']);
    $obj->title = sprintf(__('%s Events'), PA::$group_noun);
    $obj->assoc_type = 'group';
    $obj->assoc_id = $_REQUEST['gid'];
    $obj->assoc_title = $group_var->title;
    $is_member = Group::get_user_type((int) $_SESSION['user']['id'], (int) $_REQUEST['gid']);
    if ($is_member == NOT_A_MEMBER) {
        $obj->may_edit = false;
    } else {
        $obj->may_edit = true;
    }
}
开发者ID:Cyberspace-Networks,项目名称:PeopleAggregator,代码行数:15,代码来源:group_poll.php

示例4: setup_module

function setup_module($column, $module, $obj)
{
    $group_var = new Group();
    $group_var->load($_REQUEST['gid']);
    switch ($module) {
        case 'EventCalendarModule':
            $obj->title = 'Group Events';
            $obj->assoc_type = 'group';
            $obj->assoc_id = $_REQUEST['gid'];
            $obj->assoc_title = $group_var->title;
            $is_member = Group::get_user_type((int) $_SESSION['user']['id'], (int) $_REQUEST['gid']);
            if ($is_member == NOT_A_MEMBER) {
                $obj->may_edit = false;
            } else {
                $obj->may_edit = true;
            }
            break;
    }
    $obj->mode = PUB;
}
开发者ID:CivicCommons,项目名称:oldBellCaPA,代码行数:20,代码来源:group_calendar.php

示例5: catch

    } catch (PAException $e) {
        $msg = "Error occured in retreiving category information\n";
        $msg .= "<br><center><font color=\"red\">" . $e->message . "</font></center>";
        $error_code = $e->code;
        $load_error = TRUE;
    }
    if ($load_error) {
        $redirect_msg = "Category does not exist.";
        $back_to_page = $base_url . '/forums.php';
        header("Location: {$base_url}/generic_error.php?msg={$redirect_msg}&back_to_page={$back_to_page}");
        exit;
    }
} elseif ($group_id) {
    $obj_group = new Group();
    try {
        $obj_group->load($group_id);
        $parent_name = stripslashes($obj_group->title);
        //$parent_description = stripslashes($obj_group->description);
    } catch (PAException $e) {
        $msg = "Error occured in retreiving group information\n";
        $msg .= "<br><center><font color=\"red\">" . $e->message . "</font></center>";
        $error_code = $e->code;
        $load_error = TRUE;
    }
    if (!Group::member_exists((int) $obj_group->collection_id, (int) $_SESSION['user']['id'])) {
        $load_error = TRUE;
    }
    if ($load_error) {
        $redirect_msg = "Group does not exist.";
        $back_to_page = $base_url . '/forums.php';
        header("Location: {$base_url}/generic_error.php?msg={$redirect_msg}&back_to_page={$back_to_page}");
开发者ID:CivicCommons,项目名称:oldBellCaPA,代码行数:31,代码来源:create_thread.php

示例6: getGroup

 public static function getGroup($id)
 {
     $objGroup = new Group();
     $objGroup->load($id);
     return $objGroup;
 }
开发者ID:Niggu,项目名称:cloudrexx,代码行数:6,代码来源:Group.class.php

示例7: removeGroup

 /**
  * Remove group from this node
  *
  * @param string $groupid
  * @return Node object (this) (or Error object)
  */
 function removeGroup($groupid)
 {
     global $DB, $CFG, $USER, $HUB_SQL, $HUB_CACHE;
     //check user owns the node
     try {
         $this->canedit();
     } catch (Exception $e) {
         return access_denied_error();
     }
     if (isset($HUB_CACHE)) {
         $HUB_CACHE->deleteData($this->urlid . $this->style);
     }
     //check user member of group
     $group = new Group($groupid);
     $group->load();
     if (!$group->ismember($USER->userid)) {
         return access_denied_error();
     }
     // check group not already in node
     $params = array();
     $params[0] = $this->urlid;
     $params[1] = $groupid;
     $res = $DB->delete($HUB_SQL->DATAMODEL_URL_GROUP_DELETE, $params);
     if (!res) {
         return database_error();
     }
     return $this->load();
 }
开发者ID:uniteddiversity,项目名称:LiteMap,代码行数:34,代码来源:url.class.php

示例8: setup_module

require_once 'api/Message/Message.php';
require_once 'web/includes/functions/auto_email_notify.php';
require_once 'web/includes/functions/mailing.php';
default_exception();
$parameter = js_includes("all");
$header = 'header.tpl';
//default network header while creating groups. While group editing header_group.tpl will be used.
$edit = FALSE;
$title = __("Create Group");
if (!empty($_REQUEST['gid'])) {
    $title = __("Edit Group");
    $user_type = Group::get_user_type($_SESSION['user']['id'], $_REQUEST['gid']);
    $header = 'header_group.tpl';
    $edit = TRUE;
    $groups = new Group();
    $groups->load($_REQUEST['gid']);
    $group_type = $groups->group_type;
}
function setup_module($column, $module, $obj)
{
    global $login_uid, $paging, $page_uid, $super_groups_available, $user_type, $group_type;
    switch ($module) {
        case 'AddGroupModule':
            if (!empty($_REQUEST['gid'])) {
                $obj->id = $_REQUEST['gid'];
            }
            break;
    }
}
$setting_data = ModuleSetting::load_setting(PAGE_ADDGROUP, PA::$login_uid);
$page = new PageRenderer("setup_module", PAGE_ADDGROUP, "{$title} - " . PA::$network_info->name, 'container_three_column.tpl', $header, PRI, HOMEPAGE, PA::$network_info, NULL, $setting_data);
开发者ID:Cyberspace-Networks,项目名称:PeopleAggregator,代码行数:31,代码来源:addgroup.php

示例9: load_info

/**
This function is used for loading the information from the get variables
Usage:on forum page for message board
**/
function load_info()
{
    $request_info = array();
    if (!empty($_REQUEST['gid'])) {
        $request_info['parent_id'] = $_REQUEST['gid'];
        $request_info['parent_name_hidden'] = 'gid';
        $request_info['parent_type'] = PARENT_TYPE_COLLECTION;
        $obj = new Group();
        $obj->load($_REQUEST['gid']);
        $request_info['header_title'] = stripslashes($obj->title);
    } else {
        if (!empty($_REQUEST['mid'])) {
            $request_info['parent_id'] = $_REQUEST['mid'];
            $request_info['parent_name_hidden'] = 'mid';
            $request_info['parent_type'] = PARENT_TYPE_MESSAGE;
            $obj = new MessageBoard();
            $data = $obj->get_by_id($_REQUEST['mid']);
            $request_info['header_title'] = stripslashes($data['title']);
        } else {
            if (!empty($_REQUEST['cid'])) {
                $content = Content::load_content((int) $_REQUEST['cid'], (int) PA::$login_uid);
                $ccid = $content->parent_collection_id;
                if ($ccid != 0 && $ccid != -1) {
                    //here parent collection 0 is for deleted content and -1 is for home page routed thus checking that its not a group id
                    $content_collection = ContentCollection::load_collection((int) $ccid, PA::$login_uid);
                    if ($content_collection->type == GROUP_COLLECTION_TYPE) {
                        $request_info['parent_id'] = $ccid;
                        $request_info['parent_name_hidden'] = 'gid';
                        $request_info['parent_type'] = PARENT_TYPE_COLLECTION;
                    }
                }
            } else {
                return false;
            }
        }
    }
    return $request_info;
}
开发者ID:Cyberspace-Networks,项目名称:CoreSystem,代码行数:42,代码来源:cnuihelper.php

示例10: load

 /**
  * Loads the data for the connection from the database
  *
  * @param String $style (optional - default 'long') may be 'short' or 'long' of 'cif'
  * @return Connection object (this) or Error
  */
 function load($style = 'long')
 {
     global $DB, $CFG, $HUB_SQL;
     try {
         $this->canview();
     } catch (Exception $e) {
         return access_denied_error();
     }
     $this->style = $style;
     $params = array();
     $params[0] = $this->connid;
     $resArray = $DB->select($HUB_SQL->DATAMODEL_CONNECTION_SELECT, $params);
     $count = count($resArray);
     if ($count == 0) {
         $ERROR = new error();
         $ERROR->createConnectionNotFoundError($this->connid);
         return $ERROR;
     }
     $fromid = 0;
     $toid = 0;
     for ($i = 0; $i < $count; $i++) {
         $array = $resArray[$i];
         $fromid = trim($array['FromID']);
         $toid = trim($array['ToID']);
         $this->fromcontexttypeid = trim($array['FromContextTypeID']);
         $this->tocontexttypeid = trim($array['ToContextTypeID']);
         $this->creationdate = trim($array['CreationDate']);
         $this->modificationdate = trim($array['ModificationDate']);
         $this->userid = trim($array['UserID']);
         $this->users = array();
         $this->users[0] = getUser($this->userid, $style);
         $this->linktypeid = trim($array['LinkTypeID']);
         $this->private = $array['Private'];
         $this->description = $array['Description'];
     }
     //now add in from/to nodes. Try from the cache first?
     $from = new CNode($fromid);
     $this->from = $from->load($style);
     $to = new CNode($toid);
     $this->to = $to->load($style);
     $r = new Role($this->fromcontexttypeid);
     $this->fromrole = $r->load();
     $r = new Role($this->tocontexttypeid);
     $this->torole = $r->load();
     $l = new LinkType($this->linktypeid);
     $this->linktype = $l->load();
     if ($style == 'long') {
         // add in the groups
         $resArray2 = $DB->select($HUB_SQL->DATAMODEL_CONNECTION_SELECT_GROUP, $params);
         $count2 = count($resArray2);
         if ($count2 > 0) {
             $this->groups = array();
             for ($i = 0; $i < $count2; $i++) {
                 $array = $resArray2[$i];
                 $group = new Group(trim($array['GroupID']));
                 array_push($this->groups, $group->load());
             }
         }
         //now add in any tags
         $resArray3 = $DB->select($HUB_SQL->DATAMODEL_CONNECTION_SELECT_TAGS, $params);
         $count3 = count($resArray3);
         if ($count3 > 0) {
             $this->tags = array();
             for ($i = 0; $i < $count3; $i++) {
                 $array = $resArray3[$i];
                 $tag = new Tag(trim($array['TagID']));
                 array_push($this->tags, $tag->load());
             }
         }
     }
     if ($style != 'cif') {
         $this->loadVotes();
     }
     return $this;
 }
开发者ID:uniteddiversity,项目名称:DebateHub,代码行数:81,代码来源:connection.class.php

示例11: Test

<?php

$f3 = (require "lib/base.php");
$f3->set("AUTOLOAD", "../lib");
$test = new Test();
$group = new Group(new DB\SQL("sqlite:/tmp/test.sqlite"));
$group->name = "My Group";
$group->save();
$test->expect($group->_id > 0, "Group was saved");
$group->load(array("id = ?", $group->_id));
$test->expect($group->erase(), "Group was deleted");
foreach ($test->results() as $result) {
    echo $result['text'] . "\t";
    if ($result['status']) {
        echo 'Pass';
    } else {
        echo 'Fail (' . $result['source'] . ')';
    }
    echo "\n";
}
开发者ID:binarygeotech,项目名称:burgers,代码行数:20,代码来源:group.php

示例12: group_user_authentication

function group_user_authentication($group_id)
{
    global $login_uid, $base_url;
    $access_array = array();
    $access_array['style'] = "";
    if (!empty($login_uid)) {
        $user_type = Group::get_user_type($login_uid, $group_id);
        $group_var = new Group();
        $group_var->load($group_id);
        switch (trim($user_type)) {
            case NOT_A_MEMBER:
                if ($group_var->reg_type == REG_MODERATED) {
                    $access_array['hyper_link'] = "{$base_url}/group.php?action=join&amp;gid={$group_id}";
                    $access_array['caption'] = 'Request to join';
                    $access_array['style'] = "style=\"width:160px;\"";
                } else {
                    $access_array['hyper_link'] = "{$base_url}/group.php?action=join&amp;gid={$group_id}";
                    $access_array['caption'] = 'Join';
                }
                break;
            case MEMBER:
                $access_array['hyper_link'] = "{$base_url}/group.php?action=leave&amp;gid={$group_id}";
                $access_array['caption'] = 'Unjoin';
                break;
            case OWNER:
                $access_array['hyper_link'] = "{$base_url}/addgroup.php?gid={$group_id}";
                $access_array['caption'] = 'Edit';
                break;
        }
    } else {
        $access_array['hyper_link'] = "{$base_url}/group.php?action=join&amp;gid={$group_id}";
        $access_array['caption'] = 'Join';
    }
    return $access_array;
}
开发者ID:CivicCommons,项目名称:oldBellCaPA,代码行数:35,代码来源:functions.php

示例13: load

 /**
  * @param $name
  * @param bool $email
  * @param bool $id
  * @return User
  */
 public function load($name, $email = false, $id = false)
 {
     $sql = self::sql();
     if (!$sql instanceof SQLModule) {
         return;
     }
     //Should never happen
     $t = $sql->get_config("SQL", "sql_prefix") . "_users";
     $query = "SELECT id, user_password, user_email, user_group, user_permissions, user_avatar, user_ip, user_registered, logged_in, user_banned, user_online, user_activated, activation_key FROM `" . $t . "` WHERE user_name = ?";
     if ($email) {
         $query = "SELECT id, user_password, user_name, user_group, user_permissions, user_avatar, user_ip, user_registered, logged_in, user_banned, user_online, user_activated, activation_key FROM `" . $t . "` WHERE user_email = ?";
     }
     if ($id) {
         $query = "SELECT user_password, user_email, user_name, user_group, user_permissions, user_avatar, user_ip, user_registered, logged_in, user_banned, user_online, user_activated, activation_key FROM `" . $t . "` WHERE id = ?";
     }
     $user = new User();
     $stmt = $sql->get_pdo()->prepare($query);
     $stmt->execute(array($name));
     $result = $stmt->fetch(PDO::FETCH_ASSOC);
     $user->id = $id ? $name : $result['id'];
     $user->ip = $result['user_ip'];
     $user->avatar = $result['user_avatar'];
     $user->name = $email ? $result['user_name'] : $id ? $result['user_name'] : $name;
     $user->password = $result['user_password'];
     $user->group = Group::load($result['user_group']);
     $user->permissions = explode(",", $result['user_permissions']);
     $user->email = $email ? $name : $result['user_email'];
     $user->registered = $result['user_registered'];
     $user->logged_in = $result['logged_in'];
     $user->activation_key = $result['activation_key'];
     $user->activated = $result['user_activated'];
     $user->banned = $result['user_banned'];
     $user->online = $result['user_online'];
     return $user;
 }
开发者ID:creatorfromhell,项目名称:WebCorePlus,代码行数:41,代码来源:User.php

示例14: handlePOST_GroupInvitationSubmit

 public function handlePOST_GroupInvitationSubmit($request_data)
 {
     if (isset($request_data['submit'])) {
         filter_all_post($request_data);
         $gid = $request_data['groups'];
         $self_invite = FALSE;
         $error = FALSE;
         // check if groups are there
         if (empty($gid)) {
             $error = TRUE;
             $msg[] = __("Please select a group");
         }
         if (empty($error) && !empty($request_data['email_user_name'])) {
             // if login name are supplied
             $friend_user_name = trim($request_data['email_user_name']);
             $friend_user_name_array = explode(',', $friend_user_name);
             $cnt_usr_name = count($friend_user_name_array);
             for ($counter = 0; $counter < $cnt_usr_name; $counter++) {
                 try {
                     $user_obj = new User();
                     $user_obj->load(trim($friend_user_name_array[$counter]));
                     if ($user_obj->email == PA::$login_user->email) {
                         $self_invite = TRUE;
                         //you can not invite your self
                     } else {
                         $valid_user_login_names[] = $user_obj->login_name;
                         $valid_usr_name_email[] = $user_obj->email;
                     }
                 } catch (PAException $e) {
                     if (!empty($friend_user_name_array[$counter])) {
                         $invalid_login_msg .= $friend_user_name_array[$counter] . ', ';
                     }
                 }
             }
             // end for
             if (!empty($invalid_login_msg)) {
                 $invalid_login_msg = substr($invalid_login_msg, 0, -2);
                 $msg[] = sprintf(__('Invitation could not be sent to following login names- %s'), $invalid_login_msg);
             }
         }
         // end if : if user names are supplied.
         $invalid = null;
         if (empty($error) && !empty($request_data['email_id'])) {
             // if email ids are supplied
             $friend_email = trim($request_data['email_id']);
             $friend_email_array = explode(',', $friend_email);
             $cnt_email = count($friend_email_array);
             // Check for valid-invalid email addresses start
             for ($counter = 0; $counter < $cnt_email; $counter++) {
                 $email_validation = Validation::validate_email(trim($friend_email_array[$counter]));
                 if ($email_validation == '0') {
                     $invalid[] = trim($friend_email_array[$counter]);
                 } else {
                     if ($friend_email_array[$counter] == PA::$login_user->email) {
                         $self_invite = TRUE;
                     } else {
                         $valid_user_first_emails[] = $friend_email_array[$counter];
                         $valid_email[] = trim($friend_email_array[$counter]);
                     }
                 }
             }
         }
         // Check for valid-invalid email addresses end
         // Action for valid-invalid email addresses start
         if (empty($friend_email) && empty($friend_user_name)) {
             // if email field is left empty
             $msg[] = MessagesHandler::get_message(6001);
             $error = TRUE;
         } else {
             if (!empty($friend_email) && !empty($friend_user_name)) {
                 $msg = array();
                 $msg[] = MessagesHandler::get_message(7026);
                 $error = TRUE;
             } else {
                 if (!empty($self_invite) || sizeof($invalid) > 0) {
                     // if self invitation is made
                     if (!empty($self_invite)) {
                         $msg[] = MessagesHandler::get_message(6002);
                     }
                     if (!empty($invalid)) {
                         // if invalid email addresses are supplied
                         $invalid_cnt = count($invalid);
                         $invalid_msg = '';
                         for ($counter = 0; $counter < $invalid_cnt; $counter++) {
                             if (!empty($invalid[$counter])) {
                                 $invalid_msg .= $invalid[$counter] . ', ';
                             }
                         }
                         if (!empty($invalid_msg)) {
                             $invalid_msg = substr($invalid_msg, 0, -2);
                             $msg[] = sprintf(__('Invitation could not be sent to following email addresses- %s'), $invalid_msg);
                         }
                     }
                 }
             }
         }
         if (empty($error)) {
             // At this point invitation could be made
             if (!empty($valid_email) && !empty($valid_usr_name_email)) {
                 $valid_email = array_merge($valid_email, $valid_usr_name_email);
//.........这里部分代码省略.........
开发者ID:Cyberspace-Networks,项目名称:PeopleAggregator,代码行数:101,代码来源:GroupInvitationModule.php

示例15: loadFromUsers

 /**
  * load in the groups for the given SQL statement
  *
  * @param string $sql
  * @param array $params the parameters that go into the sql statement
  * @param int $start starting from record item
  * @param int $max for a record limit of this given count
  * @param string $orderby the name of the field to sort by
  * @param string $sort 'ASC' or 'DESC' (ascending or descending ordering)
  * @param string the style of each record in the collection (defaults to 'long' , can be 'short');
  * @return GroupSet (this)
  */
 function loadFromUsers($sql, $params, $start, $max, $orderby, $sort, $style = 'long')
 {
     global $DB, $HUB_SQL;
     if (!isset($params)) {
         $params = array();
     }
     // get the total count of the connection records.
     $csql = $HUB_SQL->DATAMODEL_GROUP_LOAD_PART1;
     $csql .= $sql;
     $csql .= $HUB_SQL->DATAMODEL_GROUP_LOAD_PART2;
     $carray = $DB->select($csql, $params);
     $totalconns = $carray[0]["totalusers"];
     // get the connection records for the given parameters, start, max etc.
     // ADD SORTING
     $sql = $DB->userOrderString($sql, $orderby, $sort);
     // ADD LIMITING
     $sql = $DB->addLimitingResults($sql, $start, $max);
     $resArray = $DB->select($sql, $params);
     $count = count($resArray);
     $this->totalno = $totalconns;
     $this->start = $start;
     $this->count = $count;
     for ($i = 0; $i < $count; $i++) {
         $array = $resArray[$i];
         $g = new Group($array["UserID"]);
         $this->add($g->load());
     }
     return $this;
 }
开发者ID:uniteddiversity,项目名称:DebateHub,代码行数:41,代码来源:groupset.class.php


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