Exemplo n.º 1
0
 function __construct($controller, $name = null, $sourceClass = null, $fieldList = null, $detailFormFields = null, $sourceFilter = "", $sourceSort = "Created DESC", $sourceJoin = "")
 {
     if (!class_exists("ComplexTableField_ItemRequest")) {
         die("<strong>" . _t('DataObjectManager.ERROR', 'Error') . "</strong>: " . _t('DataObjectManager.SILVERSTRIPEVERSION', 'DataObjectManager requires Silverstripe version 2.3 or higher.'));
     }
     // If no name is given, search the has_many for the first relation.
     if ($name === null && $sourceClass === null) {
         if ($has_manys = $controller->stat('has_many')) {
             foreach ($has_manys as $relation => $value) {
                 $name = $relation;
                 $sourceClass = $value;
                 break;
             }
         }
     }
     $SNG = singleton($sourceClass);
     if ($fieldList === null) {
         if ($fields = $SNG->stat('summary_fields')) {
             $fieldList = $fields;
         } else {
             if ($db = $SNG->db()) {
                 $fieldList = array();
                 foreach ($db as $field => $type) {
                     if ($field != "SortOrder") {
                         $fieldList[$field] = DOMUtil::readable_class($field);
                     }
                 }
             }
         }
     }
     parent::__construct($controller, $name, $sourceClass, $fieldList, $detailFormFields, $sourceFilter, $sourceSort, $sourceJoin);
     Requirements::css('dataobject_manager/css/dataobject_manager.css');
     Requirements::css('dataobject_manager/css/facebox.css');
     if (self::$allow_css_override) {
         Requirements::css('dataobject_manager/css/dataobjectmanager_override.css');
     }
     Requirements::javascript($this->BaseHref() . 'dataobject_manager/javascript/facebox.js');
     Requirements::javascript($this->BaseHref() . 'dataobject_manager/javascript/jquery-ui-1.6.js');
     Requirements::javascript($this->BaseHref() . 'dataobject_manager/javascript/dataobject_manager.js');
     Requirements::javascript($this->BaseHref() . 'dataobject_manager/javascript/tooltip.js');
     $this->filter_empty_string = '-- ' . _t('DataObjectManager.NOFILTER', 'No filter') . ' --';
     if (isset($_REQUEST['ctf'][$this->Name()])) {
         $this->start = $_REQUEST['ctf'][$this->Name()]['start'];
         $this->per_page = $_REQUEST['ctf'][$this->Name()]['per_page'];
         $this->showAll = $_REQUEST['ctf'][$this->Name()]['showall'];
         $this->search = $_REQUEST['ctf'][$this->Name()]['search'];
         $this->filter = $_REQUEST['ctf'][$this->Name()]['filter'];
         $this->sort = $_REQUEST['ctf'][$this->Name()]['sort'];
         $this->sort_dir = $_REQUEST['ctf'][$this->Name()]['sort_dir'];
     }
     $this->setPageSize($this->per_page);
     $this->loadSort();
     $this->loadSourceFilter();
     $fields = $this->getRawDetailFields(singleton($this->sourceClass()));
     foreach ($fields as $field) {
         if ($field instanceof DataObjectManager && !$field->controller instanceof SiteTree) {
             $this->hasNested = true;
         }
     }
 }
	function __construct($controller, $name, $sourceClass, $fieldList, $detailFormFields, $sourceFilter = "", $sourceSort = "", $sourceJoin = "") {
		parent::__construct($controller, $name, $sourceClass, $fieldList, $detailFormFields, $sourceFilter, $sourceSort, $sourceJoin);
		
		$SNG_file = singleton('File');
		
		// If search was request, filter the results here
		$SQL_search = (!empty($_REQUEST['FileSearch'])) ? Convert::raw2sql($_REQUEST['FileSearch']) : null;
		if($SQL_search) {
			$searchFilters = array();
			foreach($SNG_file->searchableFields() as $fieldName => $fieldSpec) {
				if(strpos($fieldName, '.') === false) $searchFilters[] = "\"$fieldName\" LIKE '%{$SQL_search}%'";
			}
			$this->sourceFilter = '(' . implode(' OR ', $searchFilters) . ')';
			$this->searchingFor = $_REQUEST['FileSearch'];
			
			// @todo Integrate search form more closely and don't rely on deprecated
			//  $extraLinkParams.
			$this->extraLinkParams = array(
				'FileSearch' => $SQL_search
			);
		}
		
		$this->sourceSort = 'Title';
		$this->Markable = true;
	}
 /**
  * Constructor method for MemberTableField.
  * 
  * @param Controller $controller Controller class which created this field
  * @param string $name Name of the field (e.g. "Members")
  * @param mixed $group Can be the ID of a Group instance, or a Group instance itself
  * @param DataObjectSet $members Optional set of Members to set as the source items for this field
  * @param boolean $hidePassword Hide the password field or not in the summary?
  */
 function __construct($controller, $name, $group = null, $members = null, $hidePassword = true)
 {
     $sourceClass = self::$data_class;
     $SNG_member = singleton($sourceClass);
     $fieldList = $SNG_member->summaryFields();
     $memberDbFields = DataObject::database_fields('Member');
     $csvFieldList = array();
     foreach ($memberDbFields as $field => $dbFieldType) {
         $csvFieldList[$field] = $field;
     }
     if ($group) {
         if (is_object($group)) {
             $this->group = $group;
         } elseif (is_numeric($group)) {
             $this->group = DataObject::get_by_id('Group', $group);
         }
     } else {
         if (isset($_REQUEST['ctf'][$this->Name()]["ID"]) && is_numeric($_REQUEST['ctf'][$this->Name()]["ID"])) {
             $this->group = DataObject::get_by_id('Group', $_REQUEST['ctf'][$this->Name()]["ID"]);
         }
     }
     if (!$hidePassword) {
         $fieldList["SetPassword"] = "******";
     }
     $this->hidePassword = $hidePassword;
     // @todo shouldn't this use $this->group? It's unclear exactly
     // what group it should be customising the custom Member set with.
     if ($members && $group) {
         $this->setCustomSourceItems($this->memberListWithGroupID($members, $group));
     }
     parent::__construct($controller, $name, $sourceClass, $fieldList);
     $SQL_search = isset($_REQUEST['MemberSearch']) ? Convert::raw2sql($_REQUEST['MemberSearch']) : null;
     if (!empty($_REQUEST['MemberSearch'])) {
         $searchFilters = array();
         foreach ($SNG_member->searchableFields() as $fieldName => $fieldSpec) {
             if (strpos($fieldName, '.') === false) {
                 $searchFilters[] = "\"{$fieldName}\" LIKE '%{$SQL_search}%'";
             }
         }
         $this->sourceFilter[] = '(' . implode(' OR ', $searchFilters) . ')';
     }
     if ($this->group) {
         $groupIDs = array($this->group->ID);
         if ($this->group->AllChildren()) {
             $groupIDs = array_merge($groupIDs, $this->group->AllChildren()->column('ID'));
         }
         $this->sourceFilter[] = sprintf('"Group_Members"."GroupID" IN (%s)', implode(',', $groupIDs));
     }
     $this->sourceJoin = " INNER JOIN \"Group_Members\" ON \"MemberID\"=\"Member\".\"ID\"";
     $this->setFieldListCsv($csvFieldList);
     $this->setPageSize($this->stat('page_size'));
 }
Exemplo n.º 4
0
 function __construct($controller, $name, $sourceClass, $mode, $fieldList, $detailFormFields = null, $sourceFilter = "", $sourceSort = "Created", $sourceJoin = "")
 {
     $this->mode = $mode;
     Session::set('CommentsSection', $mode);
     parent::__construct($controller, $name, $sourceClass, $fieldList, $detailFormFields, $sourceFilter, $sourceSort, $sourceJoin);
     $this->Markable = true;
     $this->setPageSize(15);
     // search
     $search = isset($_REQUEST['CommentSearch']) ? Convert::raw2sql($_REQUEST['CommentSearch']) : null;
     if (!empty($_REQUEST['CommentSearch'])) {
         $this->sourceFilter[] = "( `Name` LIKE '%{$search}%' OR `Comment` LIKE '%{$search}%')";
     }
 }
Exemplo n.º 5
0
 function __construct($controller, $name, $sourceClass, $mode, $fieldList, $detailFormFields = null, $sourceFilter = "", $sourceSort = "Created DESC", $sourceJoin = "")
 {
     $this->mode = $mode;
     parent::__construct($controller, $name, $sourceClass, $fieldList, $detailFormFields, $sourceFilter, $sourceSort, $sourceJoin);
     $this->Markable = true;
     $this->setPageSize(15);
     // search
     $search = isset($_REQUEST['CommentSearch']) ? Convert::raw2sql($_REQUEST['CommentSearch']) : null;
     if (!empty($_REQUEST['CommentSearch'])) {
         $this->sourceFilter[] = "( `Name` LIKE '%{$search}%' OR `Comment` LIKE '%{$search}%')";
     }
     Requirements::javascript('cms/javascript/CommentTableField.js');
 }
 function __construct($controller, $name, $sourceClass, $fieldList, $detailFormFields = null, $sourceFilter = "", $sourceSort = "", $sourceJoin = "")
 {
     parent::__construct($controller, $name, $sourceClass, $fieldList, $detailFormFields, $sourceFilter, $sourceSort, $sourceJoin);
     $this->Markable = true;
     if ($controllerClass = $this->controllerClass()) {
         $this->joinField = $this->getParentIdName($controllerClass, $this->sourceClass);
         if (!$this->joinField) {
             user_error("Can't find a has_one relationship from '{$this->sourceClass}' to '{$controllerClass}'", E_USER_WARNING);
         }
     } else {
         user_error("Can't figure out the data class of {$controller}", E_USER_WARNING);
     }
 }
Exemplo n.º 7
0
 function __construct($controller, $name, $group, $members = null, $hidePassword = true, $pageLimit = 10)
 {
     if ($group) {
         if (is_object($group)) {
             $this->group = $group;
         } elseif (is_numeric($group)) {
             $this->group = DataObject::get_by_id('Group', $group);
         }
     } else {
         if (isset($_REQUEST['ctf']) && is_numeric($_REQUEST['ctf'][$this->Name()]["ID"])) {
             $this->group = DataObject::get_by_id('Group', $_REQUEST['ctf'][$this->Name()]["ID"]);
         }
     }
     $sourceClass = $this->stat('data_class');
     $SNG_member = singleton($this->stat('data_class'));
     foreach (self::$addedPermissions as $permission) {
         array_push($this->permissions, $permission);
     }
     $fieldList = array("FirstName" => _t('MemberTableField.FIRSTNAME', 'Firstname'), "Surname" => _t('MemberTableField.SURNAME', 'Surname'), "Email" => _t('MemberTableField.EMAIL', 'Email'));
     $memberDbFields = $SNG_member->db();
     $csvFieldList = array('Created' => 'Created', 'LastEdited' => 'LastEdited');
     foreach ($memberDbFields as $field => $dbFieldType) {
         $csvFieldList[$field] = $field;
     }
     foreach (self::$addedFields as $key => $value) {
         $fieldList[$key] = $value;
     }
     if (!$hidePassword) {
         $fieldList["SetPassword"] = "******";
     }
     // Legacy: Use setCustomSourceItems() instead.
     if ($members) {
         $this->customSourceItems = $this->memberListWithGroupID($members, $group);
     }
     $this->hidePassword = $hidePassword;
     parent::__construct($controller, $name, $sourceClass, $fieldList);
     // search
     $SQL_search = isset($_REQUEST['MemberSearch']) ? Convert::raw2sql($_REQUEST['MemberSearch']) : null;
     if (!empty($_REQUEST['MemberSearch'])) {
         $searchFilters = array();
         foreach ($SNG_member->searchableFields() as $fieldName => $fieldSpec) {
             if (strpos($fieldName, '.') === false) {
                 $searchFilters[] = "`{$fieldName}` LIKE '%{$SQL_search}%'";
             }
         }
         $this->sourceFilter[] = '(' . implode(' OR ', $searchFilters) . ')';
     }
     $this->sourceJoin = " INNER JOIN `Group_Members` ON `MemberID` = `Member`.`ID`";
     $this->setFieldListCsv($csvFieldList);
     $this->setPageSize($this->stat('page_size'));
 }
 function __construct($controller, $name, $sourceClass, $mode, $fieldList, $detailFormFields = null, $sourceFilter = "", $sourceSort = "Created", $sourceJoin = "")
 {
     $this->mode = $mode;
     Session::set('CommentsSection', $mode);
     parent::__construct($controller, $name, $sourceClass, $fieldList, $detailFormFields, $sourceFilter, $sourceSort, $sourceJoin);
     $this->Markable = true;
     // Note: These keys have special behaviour associated through TableListField.js
     $this->selectOptions = array('all' => _t('CommentTableField.SELECTALL', 'All'), 'none' => _t('CommentTableField.SELECTNONE', 'None'));
     // search
     $search = isset($_REQUEST['CommentSearch']) ? Convert::raw2sql($_REQUEST['CommentSearch']) : null;
     if (!empty($_REQUEST['CommentSearch'])) {
         $this->sourceFilter[] = "( \"Name\" LIKE '%{$search}%' OR \"Comment\" LIKE '%{$search}%')";
     }
 }
Exemplo n.º 9
0
 public function __construct($controller, $name, $sourceClass, $fieldList = null, $detailFormFields = null, $sourceFilter = "", $sourceSort = "", $sourceJoin = "")
 {
     parent::__construct($controller, $name, $sourceClass, $fieldList, $detailFormFields, $sourceFilter, $sourceSort, $sourceJoin);
     Deprecation::notice('3.0', 'Use GridField with GridFieldConfig_RelationEditor', Deprecation::SCOPE_CLASS);
     $this->Markable = true;
     if ($controllerClass = $this->controllerClass()) {
         $this->joinField = $this->getParentIdName($controllerClass, $this->sourceClass);
         if (!$this->joinField) {
             user_error("Can't find a has_one relationship from '{$this->sourceClass}' to '{$controllerClass}'", E_USER_WARNING);
         }
     } else {
         user_error("Can't figure out the data class of {$controller}", E_USER_WARNING);
     }
 }
	function __construct($controller, $name, $sourceClass, $fieldList, $detailFormFields = null, $sourceFilter = "", $sourceSort = "", $sourceJoin = "") {
		parent::__construct($controller, $name, $sourceClass, $fieldList, $detailFormFields, $sourceFilter, $sourceSort, $sourceJoin);

		Requirements::javascript(SAPPHIRE_DIR . "/javascript/i18n.js");
		Requirements::javascript(SAPPHIRE_DIR . "/javascript/HasManyFileField.js");
		Requirements::javascript(SAPPHIRE_DIR . '/javascript/RelationComplexTableField.js');
		Requirements::css(SAPPHIRE_DIR . '/css/HasManyFileField.css');
		
		$this->Markable = true;

		if($controllerClass = $this->controllerClass()) {
			$this->joinField = $this->getParentIdName($controllerClass, $this->sourceClass);
			if(!$this->joinField) user_error("Can't find a has_one relationship from '$this->sourceClass' to '$controllerClass'", E_USER_WARNING);
		} else {
			user_error("Can't figure out the data class of $controller", E_USER_WARNING);
		}
		
	}
Exemplo n.º 11
0
 /**
  * Constructor method for MemberTableField.
  * 
  * @param Controller $controller Controller class which created this field
  * @param string $name Name of the field (e.g. "Members")
  * @param mixed $group Can be the ID of a Group instance, or a Group instance itself
  * @param DataObjectSet $members Optional set of Members to set as the source items for this field
  * @param boolean $hidePassword Hide the password field or not in the summary?
  */
 function __construct($controller, $name, $group = null, $members = null, $hidePassword = true)
 {
     if (!$members) {
         if ($group) {
             if (is_numeric($group)) {
                 $group = DataObject::get_by_id('Group', $group);
             }
             $this->group = $group;
             $members = $group->Members();
         } elseif (isset($_REQUEST['ctf'][$this->Name()]["ID"]) && is_numeric($_REQUEST['ctf'][$this->Name()]["ID"])) {
             throw new Exception("Is this still being used?  It's a hack and we should remove it.");
             $group = DataObject::get_by_id('Group', $_REQUEST['ctf'][$this->Name()]["ID"]);
             $this->group = $group;
             $members = $group->Members();
         } else {
             $members = DataObject::get("Member");
         }
     }
     $SNG_member = singleton('Member');
     $fieldList = $SNG_member->summaryFields();
     $memberDbFields = $SNG_member->db();
     $csvFieldList = array();
     foreach ($memberDbFields as $field => $dbFieldType) {
         $csvFieldList[$field] = $field;
     }
     if (!$hidePassword) {
         $fieldList["SetPassword"] = "******";
     }
     $this->hidePassword = $hidePassword;
     // Add a search filter
     $SQL_search = isset($_REQUEST['MemberSearch']) ? Convert::raw2sql($_REQUEST['MemberSearch']) : null;
     if (!empty($_REQUEST['MemberSearch'])) {
         $searchFilters = array();
         foreach ($SNG_member->searchableFields() as $fieldName => $fieldSpec) {
             if (strpos($fieldName, '.') === false) {
                 $searchFilters[] = "\"{$fieldName}\" LIKE '%{$SQL_search}%'";
             }
         }
         $members = $members->where('(' . implode(' OR ', $searchFilters) . ')');
     }
     parent::__construct($controller, $name, $members, $fieldList);
     $this->setFieldListCsv($csvFieldList);
     $this->setPageSize($this->stat('page_size'));
 }
Exemplo n.º 12
0
	function __construct($controller, $name, $sourceClass, $fieldList, $detailFormFields, $sourceFilter = "", $sourceSort = "", $sourceJoin = "") {
		parent::__construct($controller, $name, $sourceClass, $fieldList, $detailFormFields, $sourceFilter, $sourceSort, $sourceJoin);

		Requirements::javascript(CMS_DIR . '/javascript/AssetTableField.js');
		
		$SNG_file = singleton('File');
		
		// If search was request, filter the results here
		$SQL_search = (!empty($_REQUEST['FileSearch'])) ? Convert::raw2sql($_REQUEST['FileSearch']) : null;
		if($SQL_search) {
			$searchFilters = array();
			foreach($SNG_file->searchableFields() as $fieldName => $fieldSpec) {
				if(strpos($fieldName, '.') === false) $searchFilters[] = "`$fieldName` LIKE '%{$SQL_search}%'";
			}
			$this->sourceFilter = '(' . implode(' OR ', $searchFilters) . ')';
		}		
		
		$this->sourceSort = 'Title';
		$this->Markable = true;
	}
Exemplo n.º 13
0
 public function __construct($controller, $name, $sourceClass, $fieldList = null, $detailFormFields = null, $sourceFilter = "", $sourceSort = "", $sourceJoin = "")
 {
     parent::__construct($controller, $name, $sourceClass, $fieldList, $detailFormFields, $sourceFilter, $sourceSort, $sourceJoin);
     $this->SetMimeTypes();
     $this->LoadAdminCSS();
 }
Exemplo n.º 14
0
 function __construct($controller, $name, $sourceClass, $fieldList, $detailFormFields, $sourceFilter = "", $sourceSort = "", $sourceJoin = "")
 {
     parent::__construct($controller, $name, $sourceClass, $fieldList, $detailFormFields, $sourceFilter, $sourceSort, $sourceJoin);
     $this->sourceSort = "Title";
     $this->Markable = true;
 }
 function __construct($controller, $name, $sourceClass, $fieldList, $detailFormFields = null, $sourceFilter = "", $sourceSort = "", $sourceJoin = "")
 {
     parent::__construct($controller, $name, $sourceClass, $fieldList, $detailFormFields, $sourceFilter, $sourceSort, $sourceJoin);
     $this->Markable = true;
     $this->joinField = $this->getParentIdName($this->controller->ClassName, $this->sourceClass);
 }
	function __construct($controller, $name = null, $sourceClass = null, $fieldList = null, $detailFormFields = null, $sourceFilter = "", $sourceSort = null, $sourceJoin = "") 
	{
		if(!class_exists("ComplexTableField_ItemRequest"))
			die("<strong>"._t('DataObjectManager.ERROR','Error')."</strong>: "._t('DataObjectManager.SILVERSTRIPEVERSION','DataObjectManager requires Silverstripe version 2.3 or higher.'));
    
    // If no name is given, search the has_many for the first relation.
    if($name === null && $sourceClass === null) {
      if($has_manys = $controller->stat('has_many')) {
        foreach($has_manys as $relation => $value) {
          $name = $relation;
          $sourceClass = $value;
          break;
        }
      }
    }
    $SNG = singleton($sourceClass);
    

    if($fieldList === null) {
      $diff = array_diff($SNG->summaryFields(),singleton('DataObject')->summaryFields());
      if(!empty($diff)) {
        $fieldList = $SNG->summaryFields();
      }
      else if($db = $SNG->db()) {
        $fieldList = array();
        foreach($db as $field => $type) {
          if($field != "SortOrder")
            $fieldList[$field] = DOMUtil::readable_class($field);
        }
      }
    }
		parent::__construct($controller, $name, $sourceClass, $fieldList, $detailFormFields, $sourceFilter, $sourceSort, $sourceJoin);
		Requirements::css('dataobject_manager/css/dataobject_manager.css');
		Requirements::css('dataobject_manager/css/facebox.css');
		if(self::$allow_css_override)
  			Requirements::css('dataobject_manager/css/dataobjectmanager_override.css');
		Requirements::javascript(THIRDPARTY_DIR.'/jquery-livequery/jquery.livequery.js');
		Requirements::javascript('dataobject_manager/javascript/facebox.js');	
		Requirements::javascript('dataobject_manager/javascript/dom_jquery_ui.js');
		Requirements::javascript('dataobject_manager/javascript/tooltip.js');
		Requirements::javascript('dataobject_manager/javascript/dataobject_manager.js');
		
		$this->filter_empty_string = '-- '._t('DataObjectManager.NOFILTER','No filter').' --';

		if($this->sourceSort) {
  		$parts = explode(" " , $this->sourceSort);
		  if(is_array($parts) && sizeof($parts) == 2) {
  		  list($field,$dir) = $parts;
  		  $this->sort = trim($field);
  		  $this->sort_dir = trim($dir);
		  }
		  else {
		    $this->sort = $this->sourceSort;
		    $this->sort_dir = "ASC";
		  }
		}

		if(isset($_REQUEST['ctf'][$this->Name()])) {
			$this->start = $_REQUEST['ctf'][$this->Name()]['start'];
			$this->per_page = $_REQUEST['ctf'][$this->Name()]['per_page'];
			$this->showAll = $_REQUEST['ctf'][$this->Name()]['showall'];
			$this->search = $_REQUEST['ctf'][$this->Name()]['search'];
			$this->filter = $_REQUEST['ctf'][$this->Name()]['filter'];			
			$this->sort = $_REQUEST['ctf'][$this->Name()]['sort'];
			$this->sort_dir = $_REQUEST['ctf'][$this->Name()]['sort_dir'];
		}
		
		
		$this->setPageSize($this->per_page);
		$this->loadSort();
		$this->loadSourceFilter();

		$fields = $this->getRawDetailFields(singleton($this->sourceClass()));
		foreach($fields as $field) {
		  if($field instanceof DataObjectManager && !($field->controller instanceof SiteTree)) {
		    $this->hasNested = true;
		    $this->setPopupWidth(850);
		  }
		}

	}
Exemplo n.º 17
0
 function __construct($controller, $name, $group, $members = null, $hidePassword = true, $pageLimit = 10)
 {
     if ($group) {
         if (is_object($group)) {
             $this->group = $group;
         } else {
             if (is_numeric($group)) {
                 $this->group = DataObject::get_by_id('Group', $group);
             }
         }
     } else {
         if (is_numeric($_REQUEST['ctf'][$this->Name()]["ID"])) {
             $this->group = DataObject::get_by_id('Group', $_REQUEST['ctf'][$this->Name()]["ID"]);
         }
     }
     $sourceClass = $this->stat("data_class");
     foreach (self::$addedPermissions as $permission) {
         array_push($this->permissions, $permission);
     }
     $fieldList = array("FirstName" => _t('MemberTableField.FIRSTNAME', 'Firstname'), "Surname" => _t('MemberTableField.SURNAME', 'Surname'), "Email" => _t('MemberTableField.EMAIL', 'Email'));
     $csvFieldList = $fieldList;
     foreach (self::$addedCsvFields as $key => $value) {
         $csvFieldList[$key] = $value;
     }
     foreach (self::$addedFields as $key => $value) {
         $fieldList[$key] = $value;
     }
     if (!$hidePassword) {
         $fieldList["SetPassword"] = "******";
     }
     if (isset($_REQUEST['ctf']['childID']) && ($memberID = $_REQUEST['ctf']['childID'])) {
         $SNG_member = DataObject::get_by_id($this->stat("data_class"), $_REQUEST['ctf']['childID']);
     } else {
         $SNG_member = singleton(Object::getCustomClass($this->stat("data_class")));
     }
     $detailFormFields = $SNG_member->getCMSFields();
     $this->detailFormValidator = $SNG_member->getValidator();
     $this->pageSize = $pageLimit;
     // Legacy: Use setCustomSourceItems() instead.
     if ($members) {
         $this->customSourceItems = $this->memberListWithGroupID($members, $group);
     }
     $this->hidePassword = $hidePassword;
     parent::__construct($controller, $name, $sourceClass, $fieldList);
     Requirements::javascript('cms/javascript/MemberTableField.js');
     // construct the filter and sort
     if (isset($_REQUEST['MemberOrderByField'])) {
         $this->sourceSort = '`' . Convert::raw2sql($_REQUEST['MemberOrderByField']) . '`' . Convert::raw2sql($_REQUEST['MemberOrderByOrder']);
     }
     // search
     $SQL_search = isset($_REQUEST['MemberSearch']) ? Convert::raw2sql($_REQUEST['MemberSearch']) : null;
     if (!empty($_REQUEST['MemberSearch'])) {
         $searchFilters = array();
         foreach ($SNG_member->stat('searchable_fields') as $fieldName => $fieldSpec) {
             $searchFilters[] = "`{$fieldName}` LIKE '%{$SQL_search}%'";
         }
         $this->sourceFilter[] = '(' . implode(' OR ', $searchFilters) . ')';
     }
     // filter by groups
     // TODO Not implemented yet
     if (isset($_REQUEST['ctf'][$this->Name()]['GroupID']) && is_numeric($_REQUEST['ctf'][$this->Name()]['GroupID'])) {
         $this->sourceFilter[] = "`GroupID`='{$_REQUEST['ctf'][$this->Name()]['GroupID']}'";
     } elseif ($this->group) {
         //$this->sourceFilter[] = "`GroupID`='{$this->group->ID}'";
         // If the table is not clean (without duplication), the  total and navigation wil not work well, so uncheck the big line below
         $this->sourceFilter[] = "`Group_Members`.`ID` IN (SELECT `ID` FROM `Group_Members` WHERE `GroupID`='{$this->group->ID}' GROUP BY `MemberID` HAVING MIN(`ID`))";
     }
     $this->sourceJoin = " INNER JOIN `Group_Members` ON `MemberID`=`Member`.`ID`";
     $this->setFieldListCsv($csvFieldList);
 }