Implement Filter and Search in Backend Module of own Extension - typo3

I have no idea how I have to improve my listview in the backend module with a search or a filter (for only the records in the folder). That's why I don't have any code to show.
I actually have a list of all records and now I have to optimize this view for the administrator. This means I'd like to search over some columns and a filter to show only the records with the selected categorie from the dropdown.
I hope that someone can give me a hint, link or example how to realize something like that. I think it is a general thing how I can manipulate or integrate own php scripts or whatever.
Thanks for your help guys
Cheers

You can implement an filter method to you repository. Submit the form of filters to your index action an instead of $this->myRepository->fetchAll() make an function with filter: $this->myRepository->fetchByFilter($categorie).
In your repository class it looks something like that:
function fetchByFilter($categorie) {
$query = $this->createQuery();
$matching = [
$query->containts('categories', $categorie)
];
return $query->matching($query->logicalAnd($matching))->execute();
}

There might be such feature soon in the TYPO3 core (version 8.x), however doing such thing is not really easy.
An easier approach would be to use a custom backend module and render the content of the list module there again including the filter. You can take a look how I do it with the TYPO3 extension newssince version 5.0.
The contoller: https://github.com/TYPO3-extensions/news/blob/master/Classes/Controller/AdministrationController.php
Adding the filter for the record list: https://github.com/TYPO3-extensions/news/blob/master/Classes/Hooks/Backend/RecordListQueryHook8.php#L76
Hope that helps!

Related

What is the new method for TYPO3 pi_getFFvalue

im refactoring a decent sized TYPO3 project and have to refactor the part with the methods
$eIds = $this->pi_getFFvalue($this->cObj->data['pi_flexform'], 'selected_contacts', 'sDEF');
what is the new approach for extbase to fetch values from a flexform? having a really hard time finding the correct solution.
help is much appreciated
Rename the XML-Tags to settings.name inside your flexforms and use:
$this->settings['name']
Check this for an example: enter link description here

TYPO3 7.6 Backend module table DataTable not working

I've been searching for quite a while but neither solution worked.
I have created a backend module which shall display orders in a table. I achieved creating a table containing the wanted information BUT I need some more functionality and I thought there would be an easy way.
The table should be sortable, filterable and searchable - functions that TYPO3 uses for displaying datasets in the backend already.
I have tried to make use of the DataTables which are already included by the core of TYPO3 and should be easily accessible according to the following links:
https://forum.typo3.org/index.php/t/210780/
https://typo3.com/blog/how-to-use-javascript-in-typo3s-backend/
TYPO3 backend modul DataTable is no function
I added a js-file according to the answer from Philipp Wrann in the first link:
/Resources/Public/JavaScript/OrderingTables.js:
define('TYPO3/CMS/GiPdShop', ['jquery', 'datatables'], function($) {
var OrderingTables = {};
// Initialize dataTables
OrderingTables.initializeDataTables = function() {
$('#orders-table').DataTable();
};
$(document).ready(function() {
// Initialize the view
OrderingTables.initializeDataTables();
});
});
As there are no errors and the file is included if I check in the dev-tools I believe this is not a bad approach. To use the file I added the following to the <f:be.container> in the template:
includeRequireJsModules="{0: 'TYPO3/CMS/GiPdShop/OrderingTables'}"
Yet it doesn't create a DataTable, no added classes to the rows or cells of the table and thus I assume that there is some kind of error, maybe a missing configuration, maybe another option I missed out somehow.
The only other solutions I found so far seem rather complicated and I would love to keep it as simple as possible (I am not a professional in TYPO3 (yet) and the module should already be functional).
Can someone see a mistake I haven't found? Is it even possible to add the wanted functionality in such an easy way?
Any help would be highly appreciated.
It's really a stupid little thing I was missing.
The path 'TYPO3/CMS/GiPdShop' in the definition was missing the module.
So the correct path would be 'TYPO3/CMS/GiPdShop/OrderingTables', the same I have added in the template.
Really stupid but maybe this helps someone someday who gets stuck as well...
#PaulBeck thanks again!

How to make a custom ListView page in SuiteCRM

I need to make a page in SuiteCRM (v7.9 -- based loosely on Sugar 6.5 CE) that has a list of objects (of a custom module), with checkboxes in front of each one. So far, so good: that's a standard ListView.
The catch is that only some records should be in the list (filtering on whether there is an associated row in a related custom module/object).
This page needs to be distinct from the "regular" list for this module, which should indeed list all records.
It seems to me it makes sense to use a custom "action" to access this page view, and I can get my custom action code to fire with the right URL.
But I don't see how to hook in the filtering. At first, it looked like the process_record logic hook might be helpful here, but it just gives the bean for every record to be displayed. Unless there's a flag "display this record" that I'm not seeing, that's not so helpful.
Ideally, of course, I'd like to be able to inject a different WHERE clause in my custom controller action before calling
parent::action_listview();
to display the page, but I'm not seeing doc to indicate how that might work. I would include source code, but so far, the line above is everything (but boilerplate) that's in the controller.php file.
Create a copy of listview in custom folder and then override the listview's listViewProcess() method and insert your query there:
function listViewProcess() // generating listview
{
$this->processSearchForm();
if($this->where==''){
$this->where.="leads.status='Converted'";
}
$this->lv->searchColumns = $this->searchForm->searchColumns;
if(!$this->headers)
return;
$this->lv->setup($this->seed, 'custom/modules/Leads/ListView/ListViewGeneric.tpl', $this->where, $this->params);
echo $this->lv->display();
}
More info: http://wiki-crm-forum.com/forum/viewtopic.php?f=2&t=9420&p=32674&hilit=listViewProcess&sid=21907ecd28734a726f61f7017a7e9a24#p32674
Another tested working example can be found here:
How to hard code the where condition in list view ,basic search,advance search in sugar CE
P.S: I'm not so sure about "v7.9 -- based loosely on Sugar 6.5 CE" I'd say it's 95% identical apart from API stuff
for custom modules in SuiteCRM.
You may change in function create_new_list_query.

HTML5 Custom Data Attributes in TYPO3 Backend Content Elements

I am wondering if there is a way to add a HTML5 Custom Data Attribute to any Content Element like Text or Text w/ images.
Anyone tried / did this before or is there a good reason not to do this?
You can either add a new field (own extension) or use any of the existing (e.g. layout to define own values. Then you can change the TypoScript rendering based on the value of this field.
... or in addition to #pgampe's answer, which is fine for programmers you can use ie. DCE extension, which allows you to create any HTML structure with usage pure Fluid syntax
Thank's for the answers. I didn't know DCE, looks very interesting.
As I needed a quick solution for just a few elements on one page I did something really quick and dirty. But as it worked for me, I would like to post it in addition to the two other excellent answers.
I used the field Description field to add the content of my custom field. I know it's not intended for this, but as alreay mentioned: quick & dirty. :-)
tt_content.stdWrap.innerWrap.cObject {
50 =< tt_content.stdWrap.innerWrap.cObject.default
50.20.10.value = csc-default layout-{field:layout}" data-filter="{field:rowDescription}
50.20.10.insertData = 1
}

How do i add a custom made TinyMCE form element to my Zend Project?

I have been working with Zend for a few months now and am at a stage where i'd like to add some fields to my form using TinyMce. What i want to achieve is to be able to just create a form extending Zend_form and just be able to say
$element = new TinyMce_Form_Element_Editor('element');
But i just do not have a single clue on how to achieve this. I have of course been looking around before asking this question and most sources just point me towards this site.
Wich seems to be aimed at people with alot of experiance with Zend. 2 months in it's not a big surprise i am not at the level this might have been intended for as i have tried following the instrucutions given and creating the file setup as shown by in the svn repositiry create by the writer of this article.
Aside from heading from one error into another i also do not uderstand what the code is doing exactly, i just have a vague guess at best when i run trough it.
Is there any kind of easy to follow simple tutorial explaining how to enable tinymce in a Zend Form?
Any advice or tips on how to achieve my goal will be well appreciated
Not best solution but you may find it useful:
class My_Form_Element_Tinymce extends Zend_Form_Element_Textarea
{
/**
* Element CSS class name
* #var string
*/
protected $class = 'tinyMCE';
public function init()
{
$this->getView()->headScript()->appendFile('path/to/tinymce.js');
$this->getView()->headScript()->appendFile('path/to/tinymce_config.js');
}
}
and in your tinymce_config.js add selector for tinyMCE class name
tinymce_config.js is your tinyMCE configuration file if you never used tinyMCE goto http://tinymce.com and you will find many examples with what you need.