Ajax Register - Export
- hakana
- Topic Author
- Offline
- New Member
Less
More
- Posts: 3
- Thank you received: 0
8 years 10 months ago #7584
by hakana
Hi Emir,
I would like to modify the admin model file for export. I need to export the users which are not blocked (block = 0).
Is it possible for you to tell me how to modify the code here? You can add this as a parameter to the newer version of Ajax register by the way, I really need this. I dont need to download the blocked users to send them an email via a mass mailer product.
Here is the code (I added the block field below):
I would like to modify the admin model file for export. I need to export the users which are not blocked (block = 0).
Is it possible for you to tell me how to modify the code here? You can add this as a parameter to the newer version of Ajax register by the way, I really need this. I dont need to download the blocked users to send them an email via a mass mailer product.
Here is the code (I added the block field below):
$query = $db->getQuery(true);
$query->select('id, name, username, email, block');
$query->from($db->quoteName('#__users'));
if ($limit) {
$db->setQuery( $query, $offset, $limit );
} else {
$db->setQuery( $query );
}
$rows = $db->loadObjectList();
Please Log in or Create an account to join the conversation.
- hakana
- Topic Author
- Offline
- New Member
Less
More
- Posts: 3
- Thank you received: 0
8 years 10 months ago #7585
by hakana
OK the issue seems to be solved by adding this line:
$query->where('block = 0');
Now I need to set the character encoding because the Turkish characters look awful. There can be another parameter where we can set the character encoding in the admin export page. I will work on this to add this manually to the code, but if you would like to improve the export facility, please add the encoding option as well.
$query->where('block = 0');
Now I need to set the character encoding because the Turkish characters look awful. There can be another parameter where we can set the character encoding in the admin export page. I will work on this to add this manually to the code, but if you would like to improve the export facility, please add the encoding option as well.
Please Log in or Create an account to join the conversation.
- hakana
- Topic Author
- Offline
- New Member
Less
More
- Posts: 3
- Thank you received: 0
8 years 10 months ago - 8 years 10 months ago #7586
by hakana
I could not manage to insert a line with the right encoding.
Another request if possible. Is it possible to modify the SQL so that it capitalizes the first letter of every word in the name field? I think this is the hardest part. This can be also added as an option. Is it possible to add such a line here so that I modify the modal code?
Kind regards.
Another request if possible. Is it possible to modify the SQL so that it capitalizes the first letter of every word in the name field? I think this is the hardest part. This can be also added as an option. Is it possible to add such a line here so that I modify the modal code?
Kind regards.
Last Edit: 8 years 10 months ago by hakana.
Please Log in or Create an account to join the conversation.
- Saka
- Offline
- Administrator
8 years 10 months ago #7587
by Saka
Emir Sakic
www.sakic.net
I think encoding is fine, it's MS Excel's fault if you use it to open the file. Try Google Spreadsheets, it will look fine.
Capitalising directly in SQL would be harder, much easier to do it in PHP:
Line 59:
Replace with:
p.s. I don't usually support code modifications, this is for exercise only and will void your warranty.
Capitalising directly in SQL would be harder, much easier to do it in PHP:
Line 59:
foreach($rows as $row) {
Replace with:
foreach($rows as &$row) {
$row->name = ucwords($row->name);
p.s. I don't usually support code modifications, this is for exercise only and will void your warranty.
Emir Sakic
www.sakic.net
Please Log in or Create an account to join the conversation.
- hakana
- Topic Author
- Offline
- New Member
Less
More
- Posts: 3
- Thank you received: 0
8 years 10 months ago - 8 years 10 months ago #7588
by hakana
Hi Emir,
Thank you very much. I also take this current support as co-development of export section if you want to improve it.
Thank you for the capitalization code. I will improve it with support for Turkish characters.
This part is important. I have another component which exports user data with some additional fields in csv format. I never had this Turkish character issue with that. I directly open it in Excel and the characters are OK. Maybe you need to modify the header of the document (view.csv.php). You know better ofcourse. I will try to modify the header and see the results and then inform you.
End of message (EOM) from co-development team
Thank you very much. I also take this current support as co-development of export section if you want to improve it.
Thank you for the capitalization code. I will improve it with support for Turkish characters.
This part is important. I have another component which exports user data with some additional fields in csv format. I never had this Turkish character issue with that. I directly open it in Excel and the characters are OK. Maybe you need to modify the header of the document (view.csv.php). You know better ofcourse. I will try to modify the header and see the results and then inform you.
End of message (EOM) from co-development team
Last Edit: 8 years 10 months ago by hakana.
Please Log in or Create an account to join the conversation.
- hakana
- Topic Author
- Offline
- New Member
Less
More
- Posts: 3
- Thank you received: 0
8 years 10 months ago #7590
by hakana
Hi Emir,
You are right about the charset. If you want to open the file in Excel as it is, you can follow these steps:
Excel -> data -> from text
If you follow these steps you import the data as it is without any error in the characters. Maybe you can put this info as a note on the export page.
Kind regards,
Hakan
You are right about the charset. If you want to open the file in Excel as it is, you can follow these steps:
Excel -> data -> from text
If you follow these steps you import the data as it is without any error in the characters. Maybe you can put this info as a note on the export page.
Kind regards,
Hakan
Please Log in or Create an account to join the conversation.