for some lists I need to add contraints to check the current user id and the
current date. This complicates the template code:
{{ assign var='_now' value=$smarty.now|camp_date_format:'%Y-%m-%d' }}
{{ list_interviews constraints="user_id is `$campsite->user->number` status
is pending questions_begin smaller `$_now` questions_end greater `$_now`
language_id is `$campsite->language->number`"}}
I think an better way would be to introduce an special values like "current"
or "now" for ComparisionOperation::$m_right_operant. This value is just an
keyword, and the the ComparisionOperation class have to retrive the real
value by itself from the CampContext.
The above template code would be:
{{ list_interviews constraints="user_id is current status is pending
questions_begin smaller now questions_end greater now language_id is
current"}}
What you think?
Sebastian
P.S. May to make it clear that "current" and "now" are functions, they
should be "current()" and "now()".
Please file a ticket with this description for 3.1. There's no time to
implement this now.
Mugur
On Jan 23, 2008 5:51 PM, Sebastian Goebel wrote:
> Hi,
>
> for some lists I need to add contraints to check the current user id and
> the
> current date. This complicates the template code:
>
> {{ assign var='_now' value=$smarty.now|camp_date_format:'%Y-%m-%d' }}
> {{ list_interviews constraints="user_id is `$campsite->user->number`
> status
> is pending questions_begin smaller `$_now` questions_end greater `$_now`
> language_id is `$campsite->language->number`"}}
>
>
> I think an better way would be to introduce an special values like
> "current"
> or "now" for ComparisionOperation::$m_right_operant. This value is just an
> keyword, and the the ComparisionOperation class have to retrive the real
> value by itself from the CampContext.
>
> The above template code would be:
> {{ list_interviews constraints="user_id is current status is pending
> questions_begin smaller now questions_end greater now language_id is
> current"}}
>
> What you think?
>
> Sebastian
>
> P.S. May to make it clear that "current" and "now" are functions, they
> should be "current()" and "now()".
>
>
>
>
-----Original Message-----
From: Mugur Rus [mailto:mugur.rus@gmail.com]
Sent: Thursday, January 24, 2008 8:29 PM
To: campsite-dev@campware.org
Subject: Re: [campsite-dev] special values for ComparisionOperation class
Please file a ticket with this description for 3.1. There's no time to implement this now.
Mugur
On Jan 23, 2008 5:51 PM, Sebastian Goebel < devel@yellowsunshine.de> wrote:
Hi,
for some lists I need to add contraints to check the current user id and the
current date. This complicates the template code:
{{ assign var='_now' value=$smarty.now|camp_date_format:'%Y-%m-%d' }}
{{ list_interviews constraints="user_id is `$campsite->user->number` status
is pending questions_begin smaller `$_now` questions_end greater `$_now`
language_id is `$campsite->language->number`"}}
I think an better way would be to introduce an special values like "current"
or "now" for ComparisionOperation::$m_right_operant. This value is just an
keyword, and the the ComparisionOperation class have to retrive the real
value by itself from the CampContext.
The above template code would be:
{{ list_interviews constraints="user_id is current status is pending
questions_begin smaller now questions_end greater now language_id is
current"}}
What you think?
Sebastian
P.S. May to make it clear that "current" and "now" are functions, they
should be "current()" and "now()".
I implemented 4 kind of special values, which will be computed:
curdate() - like mysql
curtime() - like mysql
now() - like mysql
current():
If this value is given, the computed value will be taken from an context' metaobject indicated by left operand. e.g.
"language is current" will retrive the value from $campsite->language->number.
An ListObject::$s_parameter have to be defined, like:
public static $s_parameters = array('language' => array('field' => 'fk_language_id', 'type' => 'integer'), ...)
-----Original Message-----
From: Sebastian Goebel [mailto:devel@yellowsunshine.de]
Sent: Tuesday, January 29, 2008 9:48 PM
To: campsite-dev@campware.org
Subject: RE: [campsite-dev] special values for ComparisionOperation class
-----Original Message-----
From: Mugur Rus [mailto:mugur.rus@gmail.com]
Sent: Thursday, January 24, 2008 8:29 PM
To: campsite-dev@campware.org
Subject: Re: [campsite-dev] special values for ComparisionOperation class
Please file a ticket with this description for 3.1. There's no time to implement this now.
Mugur
On Jan 23, 2008 5:51 PM, Sebastian Goebel < devel@yellowsunshine.de> wrote:
Hi,
for some lists I need to add contraints to check the current user id and the
current date. This complicates the template code:
{{ assign var='_now' value=$smarty.now|camp_date_format:'%Y-%m-%d' }}
{{ list_interviews constraints="user_id is `$campsite->user->number` status
is pending questions_begin smaller `$_now` questions_end greater `$_now`
language_id is `$campsite->language->number`"}}
I think an better way would be to introduce an special values like "current"
or "now" for ComparisionOperation::$m_right_operant. This value is just an
keyword, and the the ComparisionOperation class have to retrive the real
value by itself from the CampContext.
The above template code would be:
{{ list_interviews constraints="user_id is current status is pending
questions_begin smaller now questions_end greater now language_id is
current"}}
What you think?
Sebastian
P.S. May to make it clear that "current" and "now" are functions, they
should be "current()" and "now()".