Permalink
Browse files

API CHANGE Removed CMSMainMarkingFilter, replaced a while ago by CMSS…

…iteTreeFilter_Search
  • Loading branch information...
1 parent 5a0208d commit 2c3dd5dd5388d522900faf3ed7707f1a7cae8b1d @chillu chillu committed Apr 22, 2011
Showing with 0 additions and 67 deletions.
  1. +0 −67 code/controller/CMSMain.php
@@ -1490,70 +1490,3 @@ function providePermissions() {
}
}
-
-/**
- * @package cms
- * @subpackage content
- */
-class CMSMainMarkingFilter {
-
- function __construct() {
- $this->ids = array();
- $this->expanded = array();
-
- $where = array();
-
- // Match against URLSegment, Title, MenuTitle & Content
- if (isset($_REQUEST['Term'])) {
- $term = Convert::raw2sql($_REQUEST['Term']);
- $where[] = "\"URLSegment\" LIKE '%$term%' OR \"Title\" LIKE '%$term%' OR \"MenuTitle\" LIKE '%$term%' OR \"Content\" LIKE '%$term%'";
- }
-
- // Match against date
- if (isset($_REQUEST['LastEdited'])) {
- $date = $_REQUEST['LastEdited'];
- $date = ((int)substr($date,6,4)) . '-' . ((int)substr($date,3,2)) . '-' . ((int)substr($date,0,2));
- $where[] = "\"LastEdited\" > '$date'";
- }
-
- // Match against exact ClassName
- if (isset($_REQUEST['ClassName']) && $_REQUEST['ClassName'] != 'All') {
- $klass = Convert::raw2sql($_REQUEST['ClassName']);
- $where[] = "\"ClassName\" = '$klass'";
- }
-
- $where = empty($where) ? '' : 'WHERE (' . implode(') AND (',$where) . ')';
-
- $parents = array();
-
- /* Do the actual search */
- $res = DB::query('SELECT "ParentID", "ID" FROM "SiteTree" '.$where);
- if (!$res) return;
-
- /* And keep a record of parents we don't need to get parents of themselves, as well as IDs to mark */
- foreach($res as $row) {
- if ($row['ParentID']) $parents[$row['ParentID']] = true;
- $this->ids[$row['ID']] = true;
- }
-
- /* We need to recurse up the tree, finding ParentIDs for each ID until we run out of parents */
- while (!empty($parents)) {
- $res = DB::query('SELECT "ParentID", "ID" FROM "SiteTree" WHERE "ID" in ('.implode(',',array_keys($parents)).')');
- $parents = array();
-
- foreach($res as $row) {
- if ($row['ParentID']) $parents[$row['ParentID']] = true;
- $this->ids[$row['ID']] = true;
- $this->expanded[$row['ID']] = true;
- }
- }
- }
-
- function mark($node) {
- $id = $node->ID;
- if(array_key_exists((int) $id, $this->expanded)) $node->markOpened();
- return array_key_exists((int) $id, $this->ids) ? $this->ids[$id] : false;
- }
-}
-
-?>

0 comments on commit 2c3dd5d

Please sign in to comment.