Added Subsite::get_from_all_subsites

This commit is contained in:
Sam Minnee 2007-09-05 04:47:05 +00:00
parent 3ab4cb3780
commit edb82dd8a3
2 changed files with 12 additions and 1 deletions

View File

@ -8,7 +8,7 @@ class SiteTreeSubsites extends DataObjectDecorator {
'((Company Name))' => 'Title'
);
protected static $template_fields = array(
static $template_fields = array(
"URLSegment",
"Title",
"MenuTitle",
@ -44,6 +44,8 @@ class SiteTreeSubsites extends DataObjectDecorator {
* Update any requests to limit the results to the current site
*/
function augmentSQL(SQLQuery &$query) {
if(Subsite::$disable_subsite_filter) return;
// If you're querying by ID, ignore the sub-site - this is a bit ugly...
if(strpos($query->where[0], ".`ID` = ") === false && strpos($query->where[0], ".ID = ") === false) {

View File

@ -3,6 +3,8 @@
* A dynamically created subdomain. SiteTree objects can now belong to a subdomain
*/
class Subsite extends DataObject implements PermissionProvider {
static $disable_subsite_filter = false;
static $default_sort = 'Title';
@ -323,6 +325,13 @@ SQL;
'SUBSITE_EDIT' => 'Edit Sub-site Details',
);
}
static function get_from_all_subsites($className, $filter = "", $sort = "", $join = "", $limit = "") {
self::$disable_subsite_filter = true;
$result = DataObject::get($className, $filter, $sort, $join, $limit);
self::$disable_subsite_filter = false;
return $result;
}
}
/**