How can I do this ? (DB select)

Author Message

Selmah Maxim

Sunday 18 May 2003 2:51:05 am

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 ?

Paul Forsyth

Sunday 18 May 2003 3:06:03 am

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

Paul

Selmah Maxim

Sunday 18 May 2003 4:37:23 am

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

Selmah Maxim

Sunday 18 May 2003 5:57:10 am

I gived up :(

Paul ..

can give more info please ?!

Paul Forsyth

Sunday 18 May 2003 7:01:00 am

oops, sorry, posted to the wrong forum :(

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

Selmah Maxim

Sunday 18 May 2003 7:09:30 am

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.

Paul Forsyth

Sunday 18 May 2003 7:31:29 am

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?

Selmah Maxim

Sunday 18 May 2003 8:22:28 am

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 :(

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 :)

now any help please ?

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