Create a custom default value for date field datatypes

Author Message

Barney Gumble

Tuesday 20 January 2004 7:03:58 am

When adding a new date field datatype to a class, the default value can either be 'Empty' or 'Current Date'. Is is possible to add to this list, adding for example 'One year ahead'?

Eirik Alfstad Johansen

Tuesday 20 January 2004 7:22:13 am

Hi Barney,

> Is is possible to add to this list, adding for example 'One year ahead'?

Probably not without modifying the datatype itself (and thereby, the kernel). I suggest creating your own datatype using the date datatype as a starting point. Extending the datatype to handle dates one year from now probably won't be to hard (and if you run into problems, you can always post a question here).

Sincerely,

Eirik Johansen

Sincerely,

Eirik Alfstad Johansen
http://www.netmaking.no/

Balazs Halasy

Tuesday 20 January 2004 7:32:06 am

Yeah, this would be easy to do. Simply copy the original date datatype, create an extension and implement your custom date datatype such that it also gives the possibility to do 1 day/month/year ahead/behind, etc. Couple lines of PHP should take care of this. Refer to http://ez.no/developer/ez_publish_3/documentation/development/extensions/datatypes/new_datatype_ for info about creating the datatype.

Balazs

Barney Gumble

Tuesday 20 January 2004 8:27:21 am

Thanks guys, that's enough info to give me a good start! Lightning speed support yet again ;o)

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 18 2025 18:39:43
Script start
Timing: Jan 18 2025 18:39:43
Module start 'layout'
Timing: Jan 18 2025 18:39:43
Module start 'content'
Timing: Jan 18 2025 18:39:44
Module end 'content'
Timing: Jan 18 2025 18:39:44
Script end

Main resources:

Total runtime0.8064 sec
Peak memory usage4,096.0000 KB
Database Queries62

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0085 588.1563152.6563
Module start 'layout' 0.00850.0035 740.812539.4922
Module start 'content' 0.01200.7928 780.3047579.6016
Module end 'content' 0.80490.0015 1,359.906312.1250
Script end 0.8064  1,372.0313 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00370.4533160.0002
Check MTime0.00160.2022160.0001
Mysql Total
Database connection0.00170.213410.0017
Mysqli_queries0.748492.7979620.0121
Looping result0.00070.0871600.0000
Template Total0.762894.620.3814
Template load0.00260.316220.0013
Template processing0.760394.273020.3801
Template load and register function0.00020.027410.0002
states
state_id_array0.00120.153910.0012
state_identifier_array0.00140.170220.0007
Override
Cache load0.00190.2327170.0001
Sytem overhead
Fetch class attribute can translate value0.00080.104230.0003
Fetch class attribute name0.00170.216660.0003
XML
Image XML parsing0.00100.122030.0003
class_abstraction
Instantiating content class attribute0.00000.001660.0000
General
dbfile0.00540.6699220.0002
String conversion0.00000.001140.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
4content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
4content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
2content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 12
 Number of unique templates used: 5

Time used to render debug report: 0.0001 secs