Alphabetical Filter for two languages - Disable of Group By

gregkoron

New Member
Hi, I need to create two lists, one for each language (English and Greek) and I extremely need them to have the following atributes:

1) I have to disable the choice of "Group by" at the front end. I cannot find it straightforwardly.

2) Also, I need an Alphabetical Filter in each list based on the corresponding alphabet (one in Greek and one in English). I have already read http://www.fabrikar.com/forums/index.php?wiki/alphabetical-filter/ and http://fabrikar.com/forums/index.php?threads/alphabet-pagination-solved.43360/#post-221518 , however I cannot make it work. I created a new template in components\com_fabrik\views\list\tmpl\default_alphafilter and I managed to show the alphabet. But, I get the warning "COM_FABRIK_LIST_TABS_MERGE_ERROR" and when I press on letter, then I get no results. I 've tried with Greek and English letters and with content in Greek and English interchangeably. The collation in my db is utf8_general_ci.

Can you provide some assistance?

Thank you in advance!
 
1)
In list settings "Data"/Group by set Access to whatever accesslevel you want (first thing I do on new Joomla sites is to create an accesslevel "nobody" assigned to no group).

2)
You don't need a custom template since Fabrik3.1
Create a calculation element with

return substr('{your-long-element_raw}',0,1);

set it to "Calc on save only" = YES

In list settings "Details"/Layout select this calc element as "Tab field".

Keep in mind that the calc element is only storing the first character to the database if you are adding or editing a record.
If you have a table/list with existing records you must open and re-save each record (or fill the calc column once via phpMyAdmin).
 
Thank you for the prompt reply. I followed your instructions and I managed to make them work. I need however some further assist for the following:

1) When I select a tab (a specific letter from the alphabet), I need to hide the search field (see the red box in attached 1.png).

2) I have created a new element called "alphabetic" and I set it to return substr('{my_joomla_table___surname}',0,1); and I have set it to "Only Calc on Save" = YES. However, when I edit some of my existing records from DB so as to trigger the "alphabetic" column to be calculated, this is not happened. The letters "A" and "M" was manually inserted to some records. Do you have any clue what is going wrong and the "alphabetic"element is not stored in the db table? Alternatively, I could fill easily the "alphabetic" column for all the records with some script, I wonder though if in the future I will insert a new row in the table and I only fill the "surname" column, then the "alphabetic" column will be calculated without any further action by me or I have understood something wrong?

3) I need another functionality in the list. In particular, I need on the fly (not to store something) to make link the values of a specific column, i.e. I would like in the list to show the stored surnames as links to their K2 items. The surnames and the K2 items can be matched via two options, the 1st is the "username" of each is surname-user that is used in the alias field of the K2 item and the 2nd is the surname itself that is used as owner of the K2 item. However, I prefer not to use the 2nd option since many surnames-users are authors of many K2 items.


Thank you for the assistance!
 

Attachments

  • 1.png
    1.png
    17.9 KB · Views: 30
1) Filter box: in list settings "Filters" set Filters=no

2) Should do. Make sure to have no typo, no formatting, no blanks in {my_joomla_table___surname}, try with {my_joomla_table___surname_raw}
For testing you may try e.g. return 'B'; to see if it's storing anything.

3) For every element you can add a custom link ("List view settings" in element settings) which can contain placeholders. Is the "username" stored in one of your elements? Then you can add something like
index.php?option=com_k2&k2_param={your-username-element}
(I don't know if it's really com_k2...)
 
Thank you for the assistance!

1) I need to keep the basic search, I only have to disable the "type" of search which is showed when the user press on a Tab. So, I think that I have to ways to do that:
a) Work with ths css, for example to hide the class: "fabrik_row oddRow1"
b) Could you provide the path to the php file that I have to edit so as to do the necessary modifications?

2) I have tried what you propose with no luck. The prefix is right also before the column name "surname" I have used 3 times the underscore character. Also, I have checked both with English and Greek data using mb_substr('{qbg3d_phonebook___surname}',0,1, 'UTF-8'); for the Greek characters. Please see the attached screenshots.

I have also tried the return 'B', but nothing is stored to db table either when I edit and save an existing record or when I insert manually a new one.
Could you provide more details about the "raw" in {my_joomla_table___surname_raw}, do you mean to add an underscore after the column name and a value of this column? The element that I need to use is of type text not of radiobutton, checkbox or dropdown.

3) I have to link every user in the list with his k2 item. In particular, I have to insert to the "Custom link" of the desired element (surname) the link: /index.php/el/component/k2/item/$id .Where the $id is a variable with the id of the K2 item.The only clue that I have available so as to search for that id is the alias of the K2 item, because it already contains the username of each user. So I have to execute some php script like the following to obtain first the id of the K2 item and then build the url.

$db = JFactory::getDBO();
$select = "SELECT id FROM #__k2_items WHERE alias= ".$username;

However I have to two problems in the "Custom link" :
a) I cannot execute php code
b)I cannot use a fabrik placeholder, I have tried to use the Name, the Label and the Full Element Name of the db column that I store the username of each user but with no luck.

Do I have to create a New_element where I can execute these tasks and store the url? And afterwards to call the New_element via a placeholder in the Custom link of desired element that I would like to make it link?

4) In fact in (3), I firstly need to merge two columns from the db and then make them link. I have the name and the surname in two different columns, and I need to merge them in one element in the list. Then, I have to make this element link to the profile (K2 item) of each user. Do I have again to create a New_element where the merged "name.surname" will be stored and then to attach the desired K2 item link to this element and fetch it in the list?
 

Attachments

  • a.png
    a.png
    42 KB · Views: 30
  • b.png
    b.png
    41 KB · Views: 33
Can you restrict each thread to just one issue? It gets really difficult to respond to threads with multiple issues, as they just grow so huge, and it's hard keeping track of them.

1) I need to keep the basic search, I only have to disable the "type" of search which is showed when the user press on a Tab. So, I think that I have to ways to do that:
a) Work with ths css, for example to hide the class: "fabrik_row oddRow1"
b) Could you provide the path to the php file that I have to edit so as to do the necessary modifications?

a) see the wiki for CSS overrides:

http://fabrikar.com/forums/index.php?wiki/custom-styling-a-list/

So basically copy custom_css_example.php to custom_css.php in your list template folder, and add whatever styling you need. Don't hide the 'fabrik_row" or "oddRow1" as that will affect your list. You could hide that specific row with an attribute selector like ...

Code:
[data-filter-row="yourtable___yourelement"] {
   display: none;
}

b) the filters are rendered with a layout, components/com_fabrik/layouts/list/fabrik-filters.php, which you could override on a sitewide or per-list or per-template basis, see wiki:

http://fabrikar.com/forums/index.php?wiki/jlayouts/#list-layouts

... but it'd be much simpler to use method a) and do it with CSS.

-- hugh
 
2) I have tried what you propose with no luck. The prefix is right also before the column name "surname" I have used 3 times the underscore character. Also, I have checked both with English and Greek data using mb_substr('{qbg3d_phonebook___surname}',0,1, 'UTF-8'); for the Greek characters. Please see the attached screenshots.

I have also tried the return 'B', but nothing is stored to db table either when I edit and save an existing record or when I insert manually a new one.
Could you provide more details about the "raw" in {my_joomla_table___surname_raw}, do you mean to add an underscore after the column name and a value of this column? The element that I need to use is of type text not of radiobutton, checkbox or dropdown.

It'll be quicker and easier if I just login and look at this one. Can you fill out http://fabrikar.com/you/my-sites with a backend login (create a super admin login specifically for us, set the language to English, and disable the account when we're not dealing with an issue for you).

-- hugh
 
3) I have to link every user in the list with his k2 item. In particular, I have to insert to the "Custom link" of the desired element (surname) the link: /index.php/el/component/k2/item/$id .Where the $id is a variable with the id of the K2 item.The only clue that I have available so as to search for that id is the alias of the K2 item, because it already contains the username of each user. So I have to execute some php script like the following to obtain first the id of the K2 item and then build the url.

$db = JFactory::getDBO();
$select = "SELECT id FROM #__k2_items WHERE alias= ".$username;

However I have to two problems in the "Custom link" :
a) I cannot execute php code
b)I cannot use a fabrik placeholder, I have tried to use the Name, the Label and the Full Element Name of the db column that I store the username of each user but with no luck.

Do I have to create a New_element where I can execute these tasks and store the url? And afterwards to call the New_element via a placeholder in the Custom link of desired element that I would like to make it link?

4) In fact in (3), I firstly need to merge two columns from the db and then make them link. I have the name and the surname in two different columns, and I need to merge them in one element in the list. Then, I have to make this element link to the profile (K2 item) of each user. Do I have again to create a New_element where the merged "name.surname" will be stored and then to attach the desired K2 item link to this element and fetch it in the list?

So where are you trying to run the code you mention in 3)?

Personally I would use a calc element to create the combined name and link.

Something like ...

Code:
$fullName = '{mytable___name} {mytable___surname}';
$myDb = JFactory::getDbo();
$myQuery = $myDb->getQuery(true);
$myQuery->select('id')->from('#__k2_items')->where('alias = ' . $myDb->quote($fullName));
$myDb->setQuery($myQuery);
$myK2Id = $myDb->loadResult();
if (!empty($myK2Id)) {
   return '<a href="index.php/el/component/k2/item' . $myK2Id . '">' . $fullName . '</a>';
}
return '';

... and show that in the list as the name column.

-- hugh
 
Service Unavailable
The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later.
 
2) I have tried what you propose with no luck. The prefix is right also before the column name "surname" I have used 3 times the underscore character. Also, I have checked both with English and Greek data using mb_substr('{qbg3d_phonebook___surname}',0,1, 'UTF-8'); for the Greek characters. Please see the attached screenshots.

I have also tried the return 'B', but nothing is stored to db table either when I edit and save an existing record or when I insert manually a new one.
Could you provide more details about the "raw" in {my_joomla_table___surname_raw}, do you mean to add an underscore after the column name and a value of this column? The element that I need to use is of type text not of radiobutton, checkbox or dropdown.

Seems to be working fine. I just test on User List EN, rowid 3262. Changed "Art" to "Bart", it correctly saved the B in the calc'ed field, and moved that record to the B tab in the list. Edited again, changed it back to Art, and it worked again, went back to the A tab.

Can you give me exact instructions as to how to get it to fail in the way you describe?

Note that I also enabled AJAX calc, so you can actually see it working on the page when you change the surname, you'll see the alpahebtic_en calc field change. I also set it to show in the list, to make it easier for me to test.

-- hugh
 
I would like to thank you once again for the assistance.

Keep in mind that the calc element is only storing the first character to the database if you are adding or editing a record.
If you have a table/list with existing records you must open and re-save each record (or fill the calc column once via phpMyAdmin).

It seems that I have misunderstood some things, although I founded weird, I was opening via phpMyAdmin the records and after some editing (not in the calc element) I just saved them. Clearly, there is not something there to trigger the calculation of the element!
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top