public function createGroup($grpName, $layerList) { $group = new GROUP($grpName); $i = 1; // Loop through LAYERS of current group foreach ($layerList as $layIdx) { // Get layer info from map file $mapLay = $this->map->getLayer($layIdx); $mapLayName = $mapLay->name; $mapLayType = $mapLay->type; $mapLayConnType = $mapLay->connectiontype; //error_log("$mapLayName - $mapLayConnType"); // Write layer properties to glayer object $glayer = new GLAYER($mapLayName); $glayer->setLayerIdx($layIdx); $glayer->setLayerType($mapLayType); // Add result field list if ($mapLayType <= 4 && $mapLayConnType != MS_WMS) { // result fields only for queryable layers point (0), line (1), polygon (2), annotation (4) $selFields0 = $this->_initResultFields($this->map, $mapLay, $mapLayType); // Trim spaces if (is_array($selFields0)) { if (count($selFields0) > 0) { //pm_logDebug(3, $selFields0, "P.MAPPER-DEBUG: initgroups.php/createGroup()->selFields0"); $selFields = array(); foreach ($selFields0 as $sf0) { // If field name starts with '&' then translate $sf = substr(trim($sf0), 0, 1) == '&' ? _p(trim($sf0)) : trim($sf0); $selFields[] = $sf; } $glayer->setResFields($selFields); } } } // add to categories array if defined in map file if ($category = $this->getLayerMetaTag($mapLay, "CATEGORY")) { $this->_initCategories($mapLayName, $category); } // Add hyperlink fields if ($this->_getHyperFieldList($mapLay)) { $glayer->setHyperFields($this->_getHyperFieldList($mapLay)); } // Add JOIN properties if defined if ($this->_getJoinProperties($mapLay)) { $glayer->setTableJoin($this->_getJoinProperties($mapLay)); } // Add classes $numclasses = $mapLay->numclasses; $classes = array(); for ($cl = 0; $cl < $numclasses; $cl++) { $class = $mapLay->getClass($cl); $className = $this->mapStringEncode($class->name); if (strlen($className) > 0) { $classname = _p(trim($className)); $classes[] = $classname; //str_replace("'", "\\'", $classname); } } $glayer->setClasses($classes); // Check/Set labelitems if defined if ($mapLay->labelitem) { $labelItem = $mapLay->labelitem[0] == "@" ? _p(substr($mapLay->labelitem, 1)) : $mapLay->labelitem; $glayer->setLabelItem($labelItem); } // Check/Set layer transparency (opacity) if (floatval($_SESSION['MS_VERSION']) >= 5) { $glayer->setOpacity($mapLay->opacity); } else { $glayer->setOpacity($mapLay->transparency); } // Check if layer is XY layer if ($XYLayerPropStr = $this->getLayerMetaTag($mapLay, "XYLAYER_PROPERTIES")) { $glayer->setXYLayerAttribute(); $XYLayerPropList = $this->_getXYLayerPropList($XYLayerPropStr); $glayer->setXYLayerProperties($XYLayerPropList); pm_logDebug(3, $XYLayerPropList, "P.MAPPER-DEBUG: initgroups.php/_createGroups() - XYLayerProperties for layer {$mapLayName}"); // Set in sessionid that XYLayer exists $this->existsXYLayer = 1; } //Check for skipLegend // 1: only for TOC_TREE, 2: always skip legend $skipLegend = $this->getLayerMetaTag($mapLay, "SKIP_LEGEND"); $glayer->setSkipLegend($skipLegend); // Layer Encoding $glayer->setLayerEncoding($this->getLayerMetaTag($mapLay, "LAYER_ENCODING")); // DB properties if ($mapLayConnType == 6) { $glayer->setLayerDbProperties($this->pgLayerParseData($mapLay)); } if ($mapLayConnType == 8) { $glayer->setLayerDbProperties($this->oraGetDbProperties($mapLay)); } // now add layer to group $group->addLayer($glayer); // set group description and result headers, process only for 1st layer of group if ($i == 1) { // Set group description $description = $this->_initDescription($mapLay); $group->setDescription($description); // Set result group headers if ($mapLayType <= 4) { $selHeadersList = $this->_initResultHeaders($this->map, $mapLay, $mapLayType, $this->gLanguage); $group->setResHeaders($selHeadersList[0]); $group->setResStdHeaders($selHeadersList[1]); } $i = 0; } } return $group; }
function pageLoadGroup($group) { $access = $group->access_type; $skip_group_modules = FALSE; $is_admin = FALSE; if ($group->access_type == $group->ACCESS_PRIVATE) { if (PA::$login_uid) { //if private group if (GROUP::member_exists($group->collection_id, PA::$login_uid)) { $skip_group_modules = FALSE; } else { // haha no way for non member of group $skip_group_modules = TRUE; } } else { //haha no way for anonymous user $skip_group_modules = TRUE; } $access_type = 'Private'; } else { $access_type = 'Public'; } if ($group->reg_type == $group->REG_OPEN) { $access_type .= ' Open'; } else { $access_type .= ' Moderated'; } if (Group::is_admin((int) $group->collection_id, (int) PA::$login_uid)) { $is_admin = TRUE; } $members = $group->get_members($cnt = FALSE, 5, 1, 'created', 'DESC', FALSE); $group_details = array(); $group_details['collection_id'] = $group->collection_id; $group_details['type'] = $group->type; $group_details['author_id'] = $group->author_id; $user = new User(); $user->load((int) $group->author_id); $login_name = $user->login_name; $first_name = $user->first_name; $last_name = $user->last_name; $group_details['author_name'] = $login_name; $group_details['author_picture'] = $user->picture; $group_details['title'] = $group->title; $group_details['description'] = $group->description; $group_details['is_active'] = $group->is_active; $group_details['picture'] = $group->picture; $group_details['desktop_picture'] = @$group->desktop_picture; $group_details['created'] = PA::datetime($group->created, 'long', 'short'); // date("F d, Y h:i A", $group->created); $group_details['changed'] = $group->changed; $group_details['category_id'] = $group->category_id; $cat_obj = new Category(); $cat_obj->set_category_id($group->category_id); $cat_obj->load(); $cat_name = stripslashes($cat_obj->name); $cat_description = stripslashes($cat_obj->description); $group_details['category_name'] = $cat_name; $group_details['category_description'] = $cat_description; $group_details['members'] = Group::get_member_count($group->collection_id); $group_details['access_type'] = $access_type; $group_details['is_admin'] = $is_admin; //////////////////get details of group EOF if (is_array($members)) { $count = count($members); foreach ($members as $member) { $count_relations = Relation::get_relations($member['user_id'], APPROVED, PA::$network_info->network_id); $user = new User(); $user->load((int) $member['user_id']); $login_name = $user->login_name; $user_picture = $user->picture; $users_data[] = array('user_id' => $member['user_id'], 'picture' => $user_picture, 'login_name' => $login_name, 'no_of_relations' => count($count_relations)); } $final_array = array('users_data' => $users_data, 'total_users' => $count); } $users = $final_array; $is_member = Group::member_exists((int) $group->collection_id, (int) PA::$login_uid) ? TRUE : FALSE; $group_details['is_member'] = $is_member; $group_details['skip_group_modules'] = $skip_group_modules; $group_details['users'] = $users; return $group_details; }
/** * Add the selected user to the group. * @param GROUP $obj * @access private */ public function commit($obj) { $obj->add_user($this->_user); }
/** * Remove the selected user from the given group. * @param GROUP $obj * @access private */ public function commit($obj) { $obj->remove_user($this->_user); }
/** * Description of reporter options. * @param $type integer The type of permission. * @param GROUP $group The group to use if {@link $type} is equal to {@link Project_user_group}. * @return string * @throws UNKNOWN_VALUE_EXCEPTION * @access private */ protected function _text_for_user_list_options($type, $group) { switch ($type) { case Project_user_all: return 'Allow all users'; case Project_user_registered_only: return 'Allow only registered users'; case Project_user_group: return 'Allow only users from ' . $group->title_as_plain_text(); default: throw new UNKNOWN_VALUE_EXCEPTION($type); } }
$skip_group_modules = FALSE; //$gid = (int)$_REQUEST['gid']; gid changed to ccid $gid = (int)$_REQUEST['gid']; if (strstr($_SERVER['PHP_SELF'], FILE_FORUM_MESSAGES)) { $gid = (int)$_REQUEST['ccid']; } $collection = $group = ContentCollection::load_collection((int)$gid, $_SESSION['user']['id']); if ($collection->type==GROUP_COLLECTION_TYPE) { $access = $group->access_type; if( $group->access_type == $group->ACCESS_PRIVATE ) { if ($_SESSION['user']['id']) {//if private group if (GROUP::member_exists($gid,$_SESSION['user']['id'])) { $skip_group_modules = FALSE; } else {// haha no way for non member of group $skip_group_modules = TRUE; } } else {//haha no way for anonymous user $skip_group_modules = TRUE; } $access_type = 'Private'; } else { $access_type = 'Public'; } if( $group->reg_type == $group->REG_OPEN ) { $access_type.= ' Open'; } else {