function _install() { global $tikilib; $this->fetchData(); $this->replaceReferences($this->name); $this->replaceReferences($this->description); $this->replaceReferences($this->parent); $this->replaceReferences($this->migrateparent); $this->replaceReferences($this->items); $categlib = TikiLib::lib('categ'); if ($id = $categlib->exist_child_category($this->parent, $this->name)) { $categlib->update_category($id, $this->name, $this->description, $this->parent); } else { $id = $categlib->add_category($this->parent, $this->name, $this->description); } if ($this->migrateparent && ($from = $categlib->exist_child_category($this->migrateparent, $this->name))) { $categlib->move_all_objects($from, $id); } foreach ($this->items as $item) { list($type, $object) = $item; $type = Tiki_Profile_Installer::convertType($type); $object = Tiki_Profile_Installer::convertObject($type, $object); $categlib->categorize_any($type, $object, $id); } return $id; }
function _install() { global $tikilib; $this->fetchData(); $this->replaceReferences($this->type); $this->replaceReferences($this->object); $this->replaceReferences($this->categories); $categlib = TikiLib::lib('categ'); $type = Tiki_Profile_Installer::convertType($this->type); $object = Tiki_Profile_Installer::convertObject($type, $this->object); foreach ($this->categories as $categId) { $categlib->categorize_any($type, $object, $categId); } return true; }
private function setupGroup($groupName, $info, $permissions, $objects, $groupMap) { $userlib = TikiLib::lib('user'); if (!$userlib->group_exists($groupName)) { $userlib->add_group($groupName, $info['description'], $info['home'], $info['user_tracker'], $info['group_tracker'], implode(':', $info['registration_fields']), $info['user_signup'], $info['default_category'], $info['theme'], $info['user_tracker_field'], $info['group_tracker_field']); } else { $userlib->change_group($groupName, $groupName, $info['description'], $info['home'], $info['user_tracker'], $info['group_tracker'], $info['user_tracker_field'], $info['group_tracker_field'], implode(':', $info['registration_fields']), $info['user_signup'], $info['default_category'], $info['theme']); } if (count($info['include'])) { $userlib->remove_all_inclusions($groupName); foreach ($info['include'] as $included) { $userlib->group_inclusion($groupName, $included); } } foreach ($permissions as $perm => $v) { if ($v == 'y') { $userlib->assign_permission_to_group($perm, $groupName); } else { $userlib->remove_permission_from_group($perm, $groupName); } $this->setFeedback(sprintf(tra('Modified permission %s for %s'), $perm, $groupName)); } foreach ($objects as $data) { foreach ($data['permissions'] as $perm => $v) { $data['id'] = trim($data['id']); $data['type'] = self::convertType($data['type']); $data['id'] = Tiki_Profile_Installer::convertObject($data['type'], $data['id'], array('groupMap' => $groupMap)); if ($v == 'y') { $userlib->assign_object_permission($groupName, $data['id'], $data['type'], $perm); } else { $userlib->remove_object_permission($groupName, $data['id'], $data['type'], $perm); } $this->setFeedback(sprintf(tra('Modified permission %s on %s/%s for %s'), $perm, $data['type'], $data['id'], $groupName)); } } global $user; if ($info['autojoin'] == 'y' && $user) { $userlib->assign_user_to_group($user, $groupName); $this->setFeedback(tr('User %0 was added to %1', $user, $groupName)); } }