/**
  * Recursively create a set of {@link Product} pages
  * that belong to this ProductGroup as a child, related
  * Product, or through one of this ProductGroup's nested
  * ProductGroup pages.
  * 
  * @param string $extraFilter Additional SQL filters to apply to the Product retrieval
  * @param array $permissions 
  * @return DataObjectSet
  */
 function ProductsShowable($extraFilter = '', $permissions = array("Show All Products"))
 {
     $filter = "`ShowInMenus` = 1";
     if ($extraFilter) {
         $filter .= " AND {$extraFilter}";
     }
     $products = new DataObjectSet();
     $childProducts = DataObject::get('Product', "`ParentID` = {$this->ID} AND {$filter}");
     $relatedProducts = $this->getManyManyComponents('Products', $filter);
     if ($childProducts) {
         $products->merge($childProducts);
     }
     if ($relatedProducts) {
         $products->merge($relatedProducts);
     }
     if (in_array($this->ChildGroupsPermission, $permissions)) {
         if ($childGroups = $this->ChildGroups()) {
             foreach ($childGroups as $childGroup) {
                 $products->merge($childGroup->ProductsShowable($extraFilter, $permissions));
             }
         }
     }
     $products->removeDuplicates();
     return $products;
 }
 /**
  * Returns a DataObjectSet of all the members that can publish pages
  * on this site by default
  */
 public function PublisherMembers()
 {
     if ($this->owner->CanPublishType == 'OnlyTheseUsers') {
         $groups = $this->owner->PublisherGroups();
         $members = new DataObjectSet();
         if ($groups) {
             foreach ($groups as $group) {
                 $members->merge($group->Members());
             }
         }
         // Default to ADMINs, if something goes wrong
         if (!$members->Count()) {
             $group = Permission::get_groups_by_permission('ADMIN')->first();
             $members = $group->Members();
         }
         return $members;
     } else {
         if ($this->owner->CanPublishType == 'LoggedInUsers') {
             // We don't want to return every user in the CMS....
             return Permission::get_members_by_permission('CMS_ACCESS_CMSMain');
         } else {
             $group = Permission::get_groups_by_permission('ADMIN')->first();
             return $group->Members();
         }
     }
 }
 /**
  * Returns a DataObjectSet of all the members that can publish this page
  */
 public function PublisherMembers()
 {
     if ($this->owner->CanPublishType == 'OnlyTheseUsers') {
         $groups = $this->owner->PublisherGroups();
         $members = new DataObjectSet();
         if ($groups) {
             foreach ($groups as $group) {
                 $members->merge($group->Members());
             }
         }
         // Default to ADMINs, if something goes wrong
         if (!$members->Count()) {
             $group = Permission::get_groups_by_permission('ADMIN')->first();
             $members = $group->Members();
         }
         return $members;
     } elseif ($this->owner->CanPublishType == 'Inherit') {
         if ($this->owner->Parent()->Exists()) {
             return $this->owner->Parent()->PublisherMembers();
         } else {
             return SiteConfig::current_site_config()->PublisherMembers();
         }
     } elseif ($this->owner->CanPublishType == 'LoggedInUsers') {
         return Permission::get_members_by_permission('CMS_ACCESS_CMSMain');
     } else {
         $group = Permission::get_groups_by_permission('ADMIN')->first();
         return $group->Members();
     }
 }
 /**
  * Collate permissions for this and all parent folders.
  * 
  * @return DataObjectSet
  */
 function AllGroupPermissions()
 {
     $groupSet = new DataObjectSet();
     $groups = $this->owner->GroupPermissions();
     foreach ($groups as $group) {
         $groupSet->push($group);
     }
     if ($this->owner->ParentID) {
         $groupSet->merge($this->owner->InheritedGroupPermissions());
     }
     $groupSet->removeDuplicates();
     return $groupSet;
 }
 /**
  * Collate permissions for this and all parent folders.
  * 
  * @return DataObjectSet
  */
 function AllMemberPermissions()
 {
     $memberSet = new DataObjectSet();
     $members = $this->owner->MemberPermissions();
     foreach ($members as $member) {
         $memberSet->push($member);
     }
     if ($this->owner->ParentID) {
         $memberSet->merge($this->owner->InheritedMemberPermissions());
     }
     $memberSet->removeDuplicates();
     return $memberSet;
 }
Example #6
0
 /**
  * Collect NewsHolders recursively.
  * 
  * @param int $parentID
  * 
  * @return DataObjectSet
  */
 protected function getNewsHolders($parentID)
 {
     $parentID = (int) $parentID;
     $collected = new DataObjectSet();
     $children = DataObject::get('NewsHolder', "\"ParentID\" = {$parentID}", "\"Sort\" DESC");
     if ($children) {
         foreach ($children as $child) {
             $collected->push($child);
             $grandChildren = $this->getNewsHolders($child->ID);
             $collected->merge($grandChildren);
         }
     }
     return $collected;
 }
 protected function processAll($filepath, $preview = false)
 {
     $this->extend('updateColumnMap', $this->columnMap);
     // we have to check for the existence of this in case the stockcontrol module hasn't been loaded
     // and the CSV still contains a Stock column
     self::$hasStockImpl = Object::has_extension('Product', 'ProductStockDecorator');
     $results = parent::processAll($filepath, $preview);
     //After results have been processed, publish all created & updated products
     $objects = new DataObjectSet();
     $objects->merge($results->Created());
     $objects->merge($results->Updated());
     foreach ($objects as $object) {
         if (!$object->ParentID) {
             //set parent page
             if (is_numeric(self::$parentpageid) && DataObject::get_by_id('ProductGroup', self::$parentpageid)) {
                 //cached option
                 $object->ParentID = self::$parentpageid;
             } elseif ($parentpage = DataObject::get_one('ProductGroup', "\"Title\" = 'Products'", '"Created" DESC')) {
                 //page called 'Products'
                 $object->ParentID = self::$parentpageid = $parentpage->ID;
             } elseif ($parentpage = DataObject::get_one('ProductGroup', "\"ParentID\" = 0", '"Created" DESC')) {
                 //root page
                 $object->ParentID = self::$parentpageid = $parentpage->ID;
             } elseif ($parentpage = DataObject::get_one('ProductGroup', "", '"Created" DESC')) {
                 //any product page
                 $object->ParentID = self::$parentpageid = $parentpage->ID;
             } else {
                 $object->ParentID = self::$parentpageid = 0;
             }
         }
         $object->extend('updateImport');
         //could be used for setting other attributes, such as stock level
         $object->writeToStage('Stage');
         $object->publish('Stage', 'Live');
     }
     return $results;
 }
Example #8
0
 /**
  * Get members who have BLOGMANAGEMENT and ADMIN permission
  */
 function blogOwners($sort = 'Name', $direction = "ASC")
 {
     $adminMembers = Permission::get_members_by_permission('ADMIN');
     $blogOwners = Permission::get_members_by_permission('BLOGMANAGEMENT');
     if (!$adminMembers) {
         $adminMembers = new DataObjectSet();
     }
     if (!$blogOwners) {
         $blogOwners = new DataObjectSet();
     }
     $blogOwners->merge($adminMembers);
     $blogOwners->sort($sort, $direction);
     $this->extend('extendBlogOwners', $blogOwners);
     return $blogOwners;
 }
Example #9
0
 /**
  * Caution: Only call on instances, not through a singleton.
  *
  * @return FieldSet
  */
 public function getCMSFields()
 {
     $fields = new FieldSet(new TabSet("Root", new Tab(_t('SecurityAdmin.MEMBERS', 'Members'), new TextField("Title", $this->fieldLabel('Title')), $memberList = new MemberTableField($this, "Members", $this, null, false)), $permissionsTab = new Tab(_t('SecurityAdmin.PERMISSIONS', 'Permissions'), new PermissionCheckboxSetField('Permissions', false, 'Permission', 'GroupID', $this)), new Tab(_t('Security.IPADDRESSES', 'IP Addresses'), new LiteralField("", _t('SecurityAdmin.IPADDRESSESHELP', "<p>You can restrict this group to a particular \n\t\t\t\t\t\tIP address range (one range per line). <br />Ranges can be in any of the following forms: <br />\n\t\t\t\t\t\t203.96.152.12<br />\n\t\t\t\t\t\t203.96.152/24<br />\n\t\t\t\t\t\t203.96/16<br />\n\t\t\t\t\t\t203/8<br /><br />If you enter one or more IP address ranges in this box, then members will only get\n\t\t\t\t\t\tthe rights of being in this group if they log on from one of the valid IP addresses.  It won't prevent\n\t\t\t\t\t\tpeople from logging in.  This is because the same user might have to log in to access parts of the\n\t\t\t\t\t\tsystem without IP address restrictions.")), new TextareaField("IPRestrictions", "IP Ranges", 10))));
     // Only add a dropdown for HTML editor configurations if more than one is available.
     // Otherwise Member->getHtmlEditorConfigForCMS() will default to the 'cms' configuration.
     $editorConfigMap = HtmlEditorConfig::get_available_configs_map();
     if (count($editorConfigMap) > 1) {
         $fields->addFieldToTab('Root.Permissions', new DropdownField('HtmlEditorConfig', 'HTML Editor Configuration', $editorConfigMap), 'Permissions');
     }
     if (!Permission::check('EDIT_PERMISSIONS')) {
         $fields->removeFieldFromTab('Root', 'Permissions');
         $fields->removeFieldFromTab('Root', 'IP Addresses');
     }
     // Only show the "Roles" tab if permissions are granted to edit them,
     // and at least one role exists
     if (Permission::check('APPLY_ROLES') && DataObject::get('PermissionRole')) {
         $fields->findOrMakeTab('Root.Roles', _t('SecurityAdmin.ROLES', 'Roles'));
         $fields->addFieldToTab('Root.Roles', new LiteralField("", "<p>" . _t('SecurityAdmin.ROLESDESCRIPTION', "This section allows you to add roles to this group. Roles are logical groupings of permissions, which can be editied in the Roles tab") . "</p>"));
         // Add roles (and disable all checkboxes for inherited roles)
         $allRoles = Permission::check('ADMIN') ? DataObject::get('PermissionRole') : DataObject::get('PermissionRole', 'OnlyAdminCanApply = 0');
         $groupRoles = $this->Roles();
         $inheritedRoles = new DataObjectSet();
         $ancestors = $this->getAncestors();
         foreach ($ancestors as $ancestor) {
             $ancestorRoles = $ancestor->Roles();
             if ($ancestorRoles) {
                 $inheritedRoles->merge($ancestorRoles);
             }
         }
         $fields->findOrMakeTab('Root.Roles', 'Root.' . _t('SecurityAdmin.ROLES', 'Roles'));
         $fields->addFieldToTab('Root.Roles', $rolesField = new CheckboxSetField('Roles', 'Roles', $allRoles));
         $rolesField->setDefaultItems($inheritedRoles->column('ID'));
         $rolesField->setDisabledItems($inheritedRoles->column('ID'));
     }
     $memberList->setController($this);
     $memberList->setPermissions(array('edit', 'delete', 'export', 'add', 'inlineadd'));
     $memberList->setParentClass('Group');
     $memberList->setPopupCaption(_t('SecurityAdmin.VIEWUSER', 'View User'));
     $memberList->setRelationAutoSetting(false);
     $fields->push($idField = new HiddenField("ID"));
     $this->extend('updateCMSFields', $fields);
     return $fields;
 }
 /**
  * Refreshes the file list. If passed an array of IDs in the request, 
  * it augments the list with those files.
  *
  * @param SS_HTTPRequest
  * @return SSViewer
  */
 public function refresh(SS_HTTPRequest $r)
 {
     if ($r->requestVar('ids')) {
         $ids = array_unique($r->requestVar('ids'));
         $files = new DataObjectSet();
         $implodestring = implode(',', $ids);
         $implodestring = preg_replace("/^[,]/", "", $implodestring);
         if ($set = DataObject::get("File", "`ID` IN ({$implodestring})")) {
             foreach ($set as $file) {
                 $this->processFile($file);
                 $files->push($file);
             }
             $files->merge($this->Files());
             $files->removeDuplicates();
         } else {
             die("File {$id} doesn't exist");
         }
     } else {
         $files = $this->Files();
     }
     return $this->customise(array('Files' => $files))->renderWith($this->AttachedFilesTemplate);
 }
Example #11
0
 /**
  * Returns the pages that depend on this page.
  * This includes virtual pages, pages that link to it, etc.
  * 
  * @param $includeVirtuals Set to false to exlcude virtual pages.
  */
 function DependentPages($includeVirtuals = true)
 {
     if (is_callable('Subsite::disable_subsite_filter')) {
         Subsite::disable_subsite_filter(true);
     }
     // Content links
     $items = $this->BackLinkTracking();
     if (!$items) {
         $items = new DataObjectSet();
     } else {
         foreach ($items as $item) {
             $item->DependentLinkType = 'Content link';
         }
     }
     // Virtual pages
     if ($includeVirtuals) {
         $virtuals = $this->VirtualPages();
         if ($virtuals) {
             foreach ($virtuals as $item) {
                 $item->DependentLinkType = 'Virtual page';
             }
             $items->merge($virtuals);
         }
     }
     // Redirector pages
     $redirectors = DataObject::get("RedirectorPage", "\"RedirectorPage\".\"RedirectionType\" = 'Internal' AND \"LinkToID\" = {$this->ID}");
     if ($redirectors) {
         foreach ($redirectors as $item) {
             $item->DependentLinkType = 'Redirector page';
         }
         $items->merge($redirectors);
     }
     if (is_callable('Subsite::disable_subsite_filter')) {
         Subsite::disable_subsite_filter(false);
     }
     return $items;
 }
 function getLatestYoutubeVideos($num)
 {
     $username = '******';
     $youtube = new YoutubeService();
     $videos1 = $youtube->getVideosUploadedByUser($username, $num, 1, 'published');
     $videos2 = $youtube->getFavoriteVideosByUser($username, $num, 1, 'published');
     $videos = new DataObjectSet();
     $videos->merge($videos1);
     $videos->merge($videos2);
     return $videos;
 }
 public static function get_by_publisher($class, $publisher, $status = null)
 {
     // To ensure 2.3 and 2.4 compatibility
     $bt = defined('DB::USE_ANSI_SQL') ? "\"" : "`";
     if ($status) {
         $statusStr = "'" . implode("','", $status) . "'";
     }
     $classes = (array) ClassInfo::subclassesFor($class);
     $classesSQL = implode("','", $classes);
     // build filter
     $filter = "{$bt}WorkflowRequest{$bt}.{$bt}ClassName{$bt} IN ('{$classesSQL}') ";
     if ($status) {
         $filter .= "AND {$bt}WorkflowRequest{$bt}.{$bt}Status{$bt} IN (" . $statusStr . ")";
     }
     $onDraft = Versioned::get_by_stage("SiteTree", "Stage", $filter, "{$bt}SiteTree{$bt}.{$bt}LastEdited{$bt} DESC", "LEFT JOIN {$bt}WorkflowRequest{$bt} ON {$bt}WorkflowRequest{$bt}.{$bt}PageID{$bt} = {$bt}SiteTree{$bt}.{$bt}ID{$bt} ");
     $onLive = Versioned::get_by_stage("SiteTree", "Live", $filter, "{$bt}SiteTree_Live{$bt}.{$bt}LastEdited{$bt} DESC", "LEFT JOIN {$bt}WorkflowRequest{$bt} ON {$bt}WorkflowRequest{$bt}.{$bt}PageID{$bt} = {$bt}SiteTree_Live{$bt}.{$bt}ID{$bt} ");
     $return = new DataObjectSet();
     $return->merge($onDraft);
     $return->merge($onLive);
     $return->removeDuplicates();
     $canPublish = SiteTree::batch_permission_check($return->column('ID'), $publisher->ID, 'CanPublishType', 'SiteTree_PublisherGroups', 'canPublish');
     foreach ($return as $page) {
         if (!isset($canPublish[$page->ID]) || !$canPublish[$page->ID]) {
             $return->remove($page);
         }
     }
     return $return;
 }
	public function Actions()
	{
	   $actions = new DataObjectSet();
	   foreach($this->parent->permissions as $perm) {
	     $action = false;
	     switch($perm) {
	       case "edit":
	       case "view":
	         $actions->push(new DataObjectManagerAction(
	           $this->ViewOrEdit_i18n(),
	           $this->EditLink(),
	           "popup",
	           "dataobject_manager/images/page_white_{$this->ViewOrEdit()}.png",
	           "editlink"	,
	           $this->parent->PopupWidth()           
	         ));
	       break;
	       	       	       
	       case "delete":
	         $actions->push(new DataObjectManagerAction(
	           _t('DataObjectManager.DELETE','Delete'),
	           $this->DeleteLink(),
	           "delete",
	           "dataobject_manager/images/trash.gif",
	           null,
	           $this->parent->getSetting('confirmDelete') ? "confirm" : null
	         ));
	       break;
	       
	       case "duplicate":
	         $actions->push(new DataObjectManagerAction(
	           _t('DataObjectManager.DUPLICATE','Duplicate'),
	           $this->DuplicateLink(),
	           "popup",
	           "dataobject_manager/images/page_copy.png",
	           null,
	           400
	         ));
	       break;
	     }
	   }
	   if($custom = $this->CustomActions()) {
	     if($custom instanceof DataObjectSet)
	       $actions->merge($custom);
	     else
	       $actions->push($custom);
	   }
	   return $actions;
	}
 /**
  * Gets all orphans from "Stage" and "Live" stages.
  * 
  * @param string $class
  * @param string $filter
  * @param string $sort
  * @param string $join
  * @param int|array $limit
  * @return DataObjectSet
  */
 function getOrphanedPages($class = 'SiteTree', $filter = '', $sort = null, $join = null, $limit = null)
 {
     $filter .= $filter ? ' AND ' : '';
     $filter .= sprintf("\"%s\".\"ParentID\" != 0 AND \"Parents\".\"ID\" IS NULL", $class);
     $orphans = new DataObjectSet();
     foreach (array('Stage', 'Live') as $stage) {
         $joinByStage = $join;
         $table = $class;
         $table .= $stage == 'Live' ? '_Live' : '';
         $joinByStage .= sprintf("LEFT JOIN \"%s\" AS \"Parents\" ON \"%s\".\"ParentID\" = \"Parents\".\"ID\"", $table, $table);
         $stageOrphans = Versioned::get_by_stage($class, $stage, $filter, $sort, $joinByStage, $limit);
         $orphans->merge($stageOrphans);
     }
     $orphans->removeDuplicates();
     return $orphans;
 }
 public function Results($searchCriteria)
 {
     switch ($searchCriteria['State']) {
         case 'approved':
             $moderationState = "approved";
             $title = "Approved";
             $commands = array('unapprove' => 'Unapprove', 'isspam' => 'Is Spam');
             break;
         case 'unapproved':
             $moderationState = "unapproved";
             $title = "Waiting Moderation";
             $commands = array('approve' => 'Approve', 'isspam' => 'Is Spam');
             break;
         default:
             $moderationState = "spam";
             $title = "Spam";
             $commands = array('approve' => 'Approve', 'isham' => 'Not Spam');
     }
     $commands['delete'] = 'Delete';
     if (($class = $this->getModelClass()) == 'All') {
         $ds = new DataObjectSet();
         foreach ($this->parentController->getManagedModels() as $class) {
             if ($class != 'All') {
                 $ds->merge(singleton($class)->getModeratedItems($moderationState, '', 'Created'));
             }
         }
     } else {
         ModeratableState::push_state($moderationState);
         $ds = DataObject::get($class, "{$this->getSearchQuery($searchCriteria)->getFilter()}", 'Created', null, $searchCriteria['Page'] * self::$page_length . ',' . self::$page_length);
         ModeratableState::pop_state();
     }
     if (!$ds) {
         return '<p>No Results</p>';
     }
     $blocks = array();
     $paging = array();
     $fields = new FieldSet();
     foreach ($searchCriteria as $k => $v) {
         if ($k != 'SecurityID') {
             $fields->push(new HiddenField($k, $k, $v));
         }
     }
     $form = new Form($this, 'SearchForm', $fields, new FieldSet());
     $form->setHTMLID('Form_CurrentSearchForm');
     $blocks[] = $form->forTemplate();
     if ($ds) {
         foreach ($ds as $do) {
             $links = array();
             foreach ($commands as $command => $text) {
                 $links[] = "<input class='action ajaxaction' type='button' value='{$text}' action='{$this->parentController->Link("{$do->ClassName}/{$do->ID}/{$moderationState}/{$command}")}' />";
             }
             $templates = array();
             foreach (array_reverse(ClassInfo::ancestry($do->ClassName)) as $class) {
                 if ($class == 'DataObject') {
                     break;
                 }
                 $templates[] = $class . 'Moderation';
             }
             $data = new ArrayData(array('ID' => $do->ID, 'ModerationLinks' => implode('', $links), 'Preview' => $do->renderWith($templates)));
             $blocks[] = $data->renderWith('ModerationPreview');
         }
     }
     if ($ds->MoreThanOnePage()) {
         // Build search info
         $paging[] = '<div>Viewing Page ' . $ds->CurrentPage() . ' of ' . $ds->TotalPages() . '</div>';
         if ($ds->NotFirstPage()) {
             $paging[] = "<input class='action pageaction' type='button' value='Prev' action='prev' />";
         }
         if ($ds->NotLastPage()) {
             $paging[] = "<input class='action pageaction' type='button' value='Next' action='next' />";
         }
     }
     $data = new ArrayData(array('State' => ucwords($searchCriteria['State']), 'Class' => $this->getModelClass(), 'Pagination' => implode("\n", $paging), 'Moderation' => implode("\n", $blocks)));
     return $data->renderWith('Moderation');
 }
Example #17
0
 /**
  * Return the Sticky Threads
  * @return DataObjectSet
  */
 function getStickyTopics($include_global = true)
 {
     $standard = DataObject::get("ForumThread", "\"ForumThread\".\"ForumID\" = {$this->ID} AND \"ForumThread\".\"IsSticky\" = 1", "MAX(\"PostList\".\"Created\") DESC", "INNER JOIN \"Post\" AS \"PostList\" ON \"PostList\".\"ThreadID\" = \"ForumThread\".\"ID\"");
     if (!$standard || !$standard->count()) {
         $standard = new DataObjectSet();
     }
     if ($include_global) {
         // We have to join posts through their forums to their holders, and then restrict the holders to just the parent of this forum.
         $global = DataObject::get("ForumThread", "\"ForumThread\".\"IsGlobalSticky\" = 1", "MAX(\"PostList\".\"Created\") DESC", "INNER JOIN \"Post\" AS \"PostList\" ON \"PostList\".\"ThreadID\" = \"ForumThread\".\"ID\"");
         if (!$global || !$global->count()) {
             $global = new DataObjectSet();
         }
         $standard->merge($global);
         $standard->removeDuplicates();
     }
     if ($standard->count()) {
         $standard->sort('PostList.Created');
     }
     return $standard;
 }
 function testRemoveDuplicates()
 {
     // Note that PageComment and DataObjectSetTest_TeamComment are both descendants of DataObject, and don't
     // share an inheritance relationship below that.
     $pageComments = DataObject::get('DataObjectSetTest_TeamComment');
     $teamComments = DataObject::get('DataObjectSetTest_TeamComment');
     /* Test default functionality (remove by ID). We'd expect to loose all our
      * team comments as they have the same IDs as the first three page comments */
     $allComments = new DataObjectSet();
     $allComments->merge($pageComments);
     $allComments->merge($teamComments);
     $this->assertEquals($allComments->Count(), 6);
     $allComments->removeDuplicates();
     $this->assertEquals($allComments->Count(), 3, 'Standard functionality is to remove duplicate base class/IDs');
     /* Now test removing duplicates based on a common field. In this case we shall
      * use 'Name', so we can get all the unique commentators */
     $comment = new DataObjectSetTest_TeamComment();
     $comment->Name = "Bob";
     $allComments->push($comment);
     $this->assertEquals($allComments->Count(), 4);
     $allComments->removeDuplicates('Name');
     $this->assertEquals($allComments->Count(), 3, 'There are 3 uniquely named commentators');
     // Ensure that duplicates are removed where the base data class is the same.
     $mixedSet = new DataObjectSet();
     $mixedSet->push(new SiteTree(array('ID' => 1)));
     $mixedSet->push(new Page(array('ID' => 1)));
     // dup: same base class and ID
     $mixedSet->push(new Page(array('ID' => 1)));
     // dup: more than one dup of the same object
     $mixedSet->push(new Page(array('ID' => 2)));
     // not dup: same type again, but different
     $mixedSet->push(new SiteTree(array('ID' => 1)));
     // dup: another dup, not consequetive.
     $mixedSet->removeDuplicates('ID');
     $this->assertEquals($mixedSet->Count(), 2, 'There are 3 unique data objects in a very mixed set');
 }
Example #19
0
	function getContextNav() {
		if($this->ID > 0) {
			$pages = new DataObjectSet();
			$pages->push($this->Parent());
			$pages->merge($this->getPagesBySibling());
			$pages->merge($this->getPagesByKeyword());
			$pages->merge($this->getPagesByBlogTags());
			$pages->merge($this->getPagesByReferer());
			$pages->removeDuplicates();
			$currentPage = $pages->find('ID', $this->ID);
			if($currentPage) $pages->remove($currentPage);
			return $pages;
		} else {
			return false;
		}
	}
 /**
  * Get all the workflows that this user is responsible for
  * 
  * @param Member $user 
  *				The user to get workflows for
  * 
  * @return DataObjectSet
  *				The list of workflow instances this user owns
  */
 public function usersWorkflows(Member $user)
 {
     $all = new DataObjectSet();
     $groupIds = $user->Groups()->column('ID');
     $groupJoin = ' INNER JOIN "WorkflowInstance_Groups" "wig" ON "wig"."WorkflowInstanceID" = "WorkflowInstance"."ID"';
     if (is_array($groupIds)) {
         $filter = '("WorkflowStatus" = \'Active\' OR "WorkflowStatus"=\'Paused\') AND "wig"."GroupID" IN (' . implode(',', $groupIds) . ')';
         $groupAssigned = DataObject::get('WorkflowInstance', $filter, '"Created" DESC', $groupJoin);
         if ($groupAssigned) {
             $all->merge($groupAssigned);
         }
     }
     $userJoin = ' INNER JOIN "WorkflowInstance_Users" "wiu" ON "wiu"."WorkflowInstanceID" = "WorkflowInstance"."ID"';
     $filter = '("WorkflowStatus" = \'Active\' OR "WorkflowStatus"=\'Paused\') AND "wiu"."MemberID" = ' . $user->ID;
     $userAssigned = DataObject::get('WorkflowInstance', $filter, '"Created" DESC', $userJoin);
     if ($userAssigned) {
         $all->merge($userAssigned);
     }
     return $all;
 }