function doCreate($data, $form, $request)
 {
     if ($customclass = $this->retrieveCustomModelClass()) {
         $this->modelClass = $customclass;
     }
     $output = parent::doCreate($data, $form, $request);
     $this->clearCustomModelClass();
     return $output;
 }
Exemplo n.º 2
0
	function getSearchQuery($searchCriteria) {
		$query = parent::getSearchQuery($searchCriteria);
		if(!is_subclass_of($this->getModelClass(),"SiteTree")) {
			return $query;
		}
		$query->orderby("`SiteTree`.LastEdited DESC");
		if($page = $this->parentController->getParentPage()) {
			$query->where[] = "ParentID = $page->ID";					
		}
		return $query;
	}
 function AddForm()
 {
     $form = parent::AddForm();
     $templates = DataObject::get('Subsite_Template', '', 'Title');
     $templateArray = array('' => "(No template)");
     if ($templates) {
         $templateArray = $templateArray + $templates->map('ID', 'Title');
     }
     $form->Fields()->addFieldsToTab('Root.Configuration', array(new DropdownField('Type', 'Type', array('subsite' => 'New site', 'template' => 'New template')), new DropdownField('TemplateID', 'Copy structure from:', $templateArray)));
     return $form;
 }
 public function AddForm()
 {
     $form = parent::AddForm();
     if ($this->modelClass == 'PermissionRole') {
         $permissionField = $form->Fields()->dataFieldByName('Codes');
         if ($permissionField) {
             $permissionField->setHiddenPermissions(SecurityAdmin::$hidden_permissions);
         }
     }
     return $form;
 }
 function search($request, $form)
 {
     // Get the results form to be rendered
     $query = $this->getSearchQuery(array_merge($form->getData(), $request));
     $resultMap = new SQLMap($query, $keyField = "ID", $titleField = "Title");
     $items = $resultMap->getItems();
     $array = array();
     if ($items && $items->count()) {
         foreach ($items as $item) {
             $array[] = $item->ID;
         }
     }
     Session::set("StoreAdminLatestSearch", serialize($array));
     return parent::search($request, $form);
 }
 function ResultsForm($searchCriteria)
 {
     $form = parent::ResultsForm($searchCriteria);
     if ($tf = $form->Fields()->fieldByName($this->modelClass)) {
         /*$tf->actions['create'] = array(
         			'label' => 'delete',
         			'icon' => null,
         			'icon_disabled' => 'cms/images/test.gif',
         			'class' => 'testlink' 
         		);*/
         /*$tf->setPermissions(array(
         			'create'
         		));*/
     }
     return $form;
 }
 public function ImportForm()
 {
     $form = parent::ImportForm();
     $form->Fields()->replaceField('EmptyBeforeImport', new CheckboxField('EmptyBeforeImport', 'Clear Database before import', false));
     return $form;
 }