Timestamp and username problem

Si vous avez une idée pour une future fonctionnalité

par heix75 » Dim 19 Juin 2011 12:59

Hi!

Thank you for perfect component! But some problems and ideas:

How can I add timestamp field to frontend? I checked the collector database table, and there are column "modified". But it wont be modified when I edit some information in fields.
I've tried to create new field with type date. This shows date in frontend, when I add %H:%M:%S to it, it shows time too. That's OK. But It shows todays date/time also every collection item and when refreshing page, time refreshes too. Date and time can only be saved in field, when I manually select date from calendar there and save item after that. But later when I modify some data, then I must also select new date and time manually.
Can this be done automatically?

And the other idea is to add author's and/or modifier name column to frontend list like in backend history.

I have tried to hack collectors code and list templates, but no results :(

This little addons could make this component more perfect.
heix75
 
Messages: 4
Inscription: Dim 19 Juin 2011 12:37

par steevo » Jeu 23 Juin 2011 12:09

Hi, sorry for my late answer but i'm a little busy currently.

heix75 a écrit:How can I add timestamp field to frontend?

Timestamp field does exists yet. In a future version, you can create tour own field easily but for the moment it's complicated. You should add manually in database a new type field and add some lines code in several files.
Why do you need timestamp field? Could you use a number field instead?

heix75 a écrit:I checked the collector database table, and there are column "modified". But it wont be modified when I edit some information in fields.

That's not normal. In which table have you seen that?

heix75 a écrit:I've tried to create new field with type date. This shows date in frontend, when I add %H:%M:%S to it, it shows time too. That's OK. But It shows todays date/time also every collection item and when refreshing page, time refreshes too. Date and time can only be saved in field, when I manually select date from calendar there and save item after that.

You're right, i haven't seen that before. I will check what can happen...

heix75 a écrit:But later when I modify some data, then I must also select new date and time manually.
Can this be done automatically?

Normally, you don't have to select a new date. The field is filled with the old one automatically. Could you create an exemple in the demo site (http://demo.steevo.fr) to show me the problem?

heix75 a écrit:And the other idea is to add author's and/or modifier name column to frontend list like in backend history.

I have tried to hack collectors code and list templates, but no results :(

This little addons could make this component more perfect.

You have to modified the file components/com_collector/views/collection/tmpl/default_default.php

add those two first lines before the </tr>
Code: Tout sélectionner
      <td class="sectiontableheader" align="left">created by</td>
      <td class="sectiontableheader" align="left">modified by</td>

   </tr>


<?php


//$linkBase = 'index.php?option=com_collector&view=item&id='.$this->collection->id.'&Itemid='.$this->itemid.'&item=';


$linkBase = 'index.php?option=com_collector&view=item&id='.$this->collection->slug.'&Itemid='.$this->itemid.'&item=';


and add those lines at the end before the last </tr>
Code: Tout sélectionner
<td>
   <?php echo $row->creator; ?>
   </td>
   <td>
   <?php echo $row->author; ?>
   </td>
Avatar de l’utilisateur
steevo
Administrateur du site
 
Messages: 330
Inscription: Jeu 17 Déc 2009 22:59

par heix75 » Jeu 23 Juin 2011 21:29

Hi again!

I need this component for creating some kind of logbook or register system, so timestamp is neccessary for checking on what time and who modified the data last.

I have checked accidentally wrong database table (__collector_fields), but in (__collector_items) it works correctly of course :)
But how can I query data to table from this column?

I have tried to add this kind of code in com_collector/views/collection/view.html.php in case 7 section(date) temporarily for testing:

$query = 'SELECT modified';
$query .= ' FROM #__collector_items';
$query .= ' WHERE id = "'.$fieldId.'"';

$date = strtotime($query);

echo date('d.m.Y H:i:s', $date);

But this code doesn't retrieve any data of modified field.

When I find correct code, I can add a custom field in database for timestamp.
Is this code correct or can this be done more easilly, like you advised me to do with author and modifier, btw - thanks for that, i wil test it tomorrow ;)
heix75
 
Messages: 4
Inscription: Dim 19 Juin 2011 12:37

par steevo » Ven 24 Juin 2011 15:53

Just like creator and author, you can display dates with
Code: Tout sélectionner
<td><? echo $row->created; ?></td>
<td><? echo $row->modified; ?></td>
Avatar de l’utilisateur
steevo
Administrateur du site
 
Messages: 330
Inscription: Jeu 17 Déc 2009 22:59

par heix75 » Sam 25 Juin 2011 08:18

Thank you! It's working well... but...

Is there little bug in collector code somewhere with timezones? When I add these lines of code, then it shows me date and time, but it is in UTC format.
Also I noticed, that when I'm adding new item, then created and modified date inserted to database in UTC format, if I add new item in frontend, then created and modified date inserted with timezone offset +3. But in frontend, the times are also in UTC format.
Also in two tables (collector_items and collector_items_history) the timezones are different.

Where I can change the timezone to using the same format everywhere? I'd like to use timezone, which is set up in server configuration.

My server timezone is set up correctly - everywhere else the times and dates are correct.
heix75
 
Messages: 4
Inscription: Dim 19 Juin 2011 12:37

par heix75 » Sam 25 Juin 2011 15:05

heix75 a écrit:Thank you! It's working well... but...

Is there little bug in collector code somewhere with timezones? When I add these lines of code, then it shows me date and time, but it is in UTC format.
Also I noticed, that when I'm adding new item, then created and modified date inserted to database in UTC format, if I add new item in frontend, then created and modified date inserted with timezone offset +3. But in frontend, the times are also in UTC format.
Also in two tables (collector_items and collector_items_history) the timezones are different.

Where I can change the timezone to using the same format everywhere? I'd like to use timezone, which is set up in server configuration.

My server timezone is set up correctly - everywhere else the times and dates are correct.


Solved it temporarily, for setting date format to LC2 like on the some other file in collector code:

<?php $date = JHTML::_( 'date' , $row->modified, JText::_('DATE_FORMAT_LC2') ); ?>
<?php echo ($date); ?>

This shows correct timezone also :) Can you fix this in future versions, so all dates and times look the same everywhere? :)

The same bug I found in the backend "Items management" tab, at right there are:

Item Id, Status, Created and Modified fields, but the dates are shown later 3 hours(I'm in timezone UTC+3, but It shows UTC+6 right now. Double checked that server is set for UTC+3.

Item history shows item creation date on left 16:07(UTC+3), this is correct to my timezone, but on right, it is 19:07 (UTC+6).

And I found where the problem comes. When adding new item at backend, the dates are written in base correctly, and also shown correctly everywhere(using my server timezone). When adding item at frontend with same user. Then there is time difference. Which file will be used when adding new item? I can correct it there, and i think it is OK for me ;)
Fichiers joints
difference.JPG
(28.46 Kio) Pas encore téléchargé
heix75
 
Messages: 4
Inscription: Dim 19 Juin 2011 12:37


Retourner vers Demande de fonctionnalité

cron

Qui est en ligne

Utilisateurs parcourant ce forum: Aucun utilisateur enregistré et 1 invité