This site has been archived and you can no longer log in or post new messages. For up-to-date community resources please visit ezplatform.com

eZ Community » Forums » Developer » How can I do this ? (DB select)
expandshrink

How can I do this ? (DB select)

How can I do this ? (DB select)

Sunday 18 May 2003 11:51:05 am - 7 replies

Hi ..

I have create new class for users, user can add his site info, business info .. etc, and he must select the period (3,6,12 month) from enum selector, everthing work nice.

Now, i wanna write php file and run as cron job, this fill will run once in the day, and will search the expiry of the users data, by selecting the enum value and adding it to the last modified date, and if it found will set a value in this class called Sata to 0, as unpublished .

So, i had worte this lines to select all the data for this class number 7, but i don`t know the tables relation, i cann`t figure it out, coz i need to select the last verion, and when i select the last verion i got empty array.

___________ CODE ____________________
$query = "select Max(version) as Max_Ver from ezcontentobject_attribute";
$Max_Ver =& $db->arrayQuery( $query );

$query = "select * from ezcontentobject, ezcontentobject_attribute , ezenumobjectvalue
where
ezcontentobject.contentclass_id ='7'
and
ezcontentobject_attribute.version = '$Max_Ver[0][Max_Ver]
and
ezcontentobject_attribute.contentobject_id = ezcontentobject.id
and
ezenumobjectvalue.contentobject_attribute_id =ezcontentobject_attribute.id

";
$attributeArray =& $db->arrayQuery( $query );
echo "<pre>";
print_r( $attributeArray);

____________________________________

any1 can help me plz ?

Sunday 18 May 2003 12:06:03 pm

Have you looked at using workflows? You can specify when classes become unpublished.

Paul

Sunday 18 May 2003 1:37:23 pm

I know, but to make it as cron job is faster and easier than make new workflow, what u think ?!

Sunday 18 May 2003 2:57:10 pm

I gived up sad.gif Emoticon

Paul ..

can give more info please ?!

Sunday 18 May 2003 4:01:00 pm

oops, sorry, posted to the wrong forum sad.gif Emoticon

heres what i wrote:

Workflows uses a cronjob as the underlying mechanism to affect the database. So you can schedule your ez cronjob to run whenever.

have a search for workflow on the forums. lots of info like this:

http://ez.no/developer/ez_publish_3/forum/setup_design/workflow

hope it helps

Sunday 18 May 2003 4:09:30 pm

i had read it befor, i had read all what i found in the serach with this words 'workflow+approve' , but i didn`t get the point of unpublish, publish workflow !

now am trying to write check exp. workflow, coz i don`t think the publish or unpublish do the job.

Sunday 18 May 2003 4:31:29 pm

From what i understand of what you want to do workflow is the best way.

With it you can select the articles, choose to unpublish them at a given date, and the cronjob will run and perform the checks. When the date is reached the articles will be unpublished.

Have you attempted to use workflows yet?

Modified on Sunday 18 May 2003 4:31:43 pm by Paul Forsyth

Sunday 18 May 2003 5:22:28 pm

yes ... i had tried the publish and unpublish workflow, the publish have (Unpublish object, Publish object) , nice but what come after this ?

and Unpublish ?

were to set when to publish or unpublish ?

which workflow to choose ?

in my class there are enum, which have 3 value timestamp for 3,6,12 month, so if i add this value to the published timestamp i`ll get the exp. date, how make workflow check this ?

now am trying to write my own workflow, but is very complex for me the DB structure , i cann`t unserstanted it to make query from it, also i cann`t catch which class is used for fetching the data map in the template systems to use it in the custom workflow ...

really sad, also i found bug, for my is really big bug, that when you delete anything from the adminface will not be detele from all tables, so after while the site will come slow, and the search will be deadly slow, coz alot of unwanted trash in the db sad.gif Emoticon

i don`t what think about Ez, but for me it`s come clearly that they don`t get money from selling the code, or building sites, it`s coming from the support, and only the support, i was thinking to ask them for some custom workflow and for more addons for ez32, but it`s cost alot, much better to write my own script and developering it slowly ...
I had worte my script, but i stop it, coz i counted what time i need to finish it, and testing , so i thoght if i start from ez32 will be faster, but am up set now ....

but i`ll keep trying to figure it out, coz is tested as code, i`ll need to change alot to figure what i need from it .

I hope i`ll finish befor Ez4 happy.gif Emoticon

now any help please ?

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from