1
ouioui
is xoopsCriteriaHandler exist ?
  • 2004/11/8 11:10

  • ouioui

  • Just popping in

  • Posts: 32

  • Since: 2003/7/11


Hi,

I need to store criteria in a DB.
Is someone created a criteriaHandler (extends XoopsObjectHandler) with insert, getObjetc methods ?

I didn't find it in the XOOPS kernel...

Best regard

2
ackbarr
Re:is xoopsCriteriaHandler exist ?

I think you misunderstand the purpose of the Criteria and XoopsObjectHandler objects.

XoopsObjectHandler - Used to define methods to retrieve / store XoopsObjects (usually in the MySQL database)

Criteria (and CriteriaCompo) - Used to specify which objects a particular request wants. Usually supplied as a parameter to a getObjects or getCount function within a XoopsObjectHandler class.

3
ouioui
Re:is xoopsCriteriaHandler exist ?
  • 2004/11/8 13:10

  • ouioui

  • Just popping in

  • Posts: 32

  • Since: 2003/7/11


Thank for your response,

I know the differents purposes of "criteria class" and "XoopsObjectHandler".
I want to use criteria as XoopsObject. So i need to developpe his XoopsObjectHandler.
CriteriaElement has attibut as sort, order, limit, start, groupby this is the parent class
Criteria has attibuts as prefix, function, column, operator ,value
CriteriaCompo has attribut as criteriaElements, conditions.
So i need to store every this mini framework in a database with a XoopsObjectHandler with a
"myXoopsCriteriaHandler->insert($mycriteria);"

Best regard

4
Mithrandir
Re:is xoopsCriteriaHandler exist ?

If you can give some more details as to why you need to store these data, it is easier for us to help.

Usually, Criteria and CriteriaCompo objects are created at runtime, so if you can tell us what you want to accomplish by saving the criteria in the database and not just that you need to do this, we may be able to guide you better.

5
ouioui
Re:is xoopsCriteriaHandler exist ?
  • 2004/11/8 15:59

  • ouioui

  • Just popping in

  • Posts: 32

  • Since: 2003/7/11


I need to store the xoopscriteria class in a DB to store conditions in a meta data definition. Currently, i try to develop a prototype module whith is based on a XOOPS application meta data definition to generate PHP program.

This meta-data include states class whith are based on condition (like the UML stateschart).
For example with a class name "Client":
State 1 : nameClient != ""
State 2 : age > 0 && age < 20
State 3 : age > 20 && age < 75
State 4 : DeathDate !="0000-00-00:00:00";
Every state have its own behavior, its own form...

My question is : is xoopsCriteriaHandler already existe in a module ?

Thank for your response

6
ackbarr
Re:is xoopsCriteriaHandler exist ?

nope - you'll have to roll-your-own

7
chippyash
Re:is xoopsCriteriaHandler exist ?
  • 2006/9/29 8:28

  • chippyash

  • Friend of XOOPS

  • Posts: 501

  • Since: 2004/1/29


The simple way is to create a handler object that has two simple methods:

put(&$CriteriaObject,$CriteriaId) returns boolean success or failure
$critStr = serialize($CriteriaObject)
//write $critStr to database keyed on $CriteriaId

get($CriteriaId) returns CriteriaObject
//get $critStr from database using $CriteriaId key
$CriteriaObject = unserialize($critStr);
return $CriteriaObject

table to store data has two fields:

id int,
criteria text



Hope it helps
A

Login

Who's Online

320 user(s) are online (254 user(s) are browsing Support Forums)


Members: 0


Guests: 320


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits