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 » Workflow .. befor read wan`t work...
expandshrink

Workflow .. befor read wan`t work normaly !?

Workflow .. befor read wan`t work normaly !?

Monday 19 May 2003 5:40:58 pm - 1 reply

what i need that the user befor read the data page workflow will check the published date, and the the end date of this data page.

coz of this i put the workflow content,read, befor, now when i click the dead data page the workflow work, and redirect me to another page, but when i make refresh i got the data page ?!
what the worng here ?

here is my workflow data :

______________________________________

<?php

include_once("kernel/classes/ezcontentobjecttreenode.php"blunk.gif Emoticon;

define( "EZ_WORKFLOW_TYPE_CHECK_EXP_ID", "checkexp" );

class CheckExpType extends eZWorkflowEventType
{

function CheckExpType()
{
$this->eZWorkflowEventType( EZ_WORKFLOW_TYPE_CHECK_EXP_ID, "Check Exp." );
}

function execute( &$process, &$event )
{

$parameters =& $process->attribute( 'parameter_list' );

$node =& eZContentObjectTreeNode::fetch( $parameters['node_id'] );
$data_map = $node->attribute("data_map"blunk.gif Emoticon;
$Object = $node->attribute("object"blunk.gif Emoticon;

 

// enum value
$enumAttribute = $data_map[ 'registeration_period' ];


if($enumAttribute != null )
{
$enumObj = $enumAttribute->attribute( 'content' );
$enumobjectList = $enumObj->attribute( 'enumobject_list' );
$selectedEnumValue = $enumobjectList[0]->attribute( 'enumvalue' );

//
foreach ($Object as $Name=>$Value)
{
if("$Name" == "ID"blunk.gif Emoticon $Data[$Name] = $Value;
if("$Name" == "ClassID"blunk.gif Emoticon $Data[$Name]= $Value;
if("$Name" == "Published"blunk.gif Emoticon $Data[$Name] = $Value;
if("$Name" == "CurrentVersion"blunk.gif Emoticon $Data[$Name] = $Value;
}

$ActiveTo = $Data[Published]+$selectedEnumValue;
$Now = strtotime("now"blunk.gif Emoticon;

// get the company_status value //
$CompanyStatus = $data_map[ 'company_status' ];
$CompanyStatusValue = $CompanyStatus->attribute( 'content' );
$CompanyStatusValueID = $CompanyStatus->attribute( 'id' );


$db =& eZDb::instance();

$query = "select * from ezcontentobject_attribute where id='$CompanyStatusValueID' ";
$status = $db->arrayQuery($query);

if($ActiveTo <= $Now)
{
$query = "update ezcontentobject_attribute set data_int ='0' where id='$CompanyStatusValueID' ";
$db->query($query);
$process->Template = array( 'templateName' => 'design:' . 'data_not_active' . '.tpl',
'templateVars' => array( 'return_uri' => $requestUri,
'user_name' => $userName ) );
return EZ_WORKFLOW_TYPE_STATUS_FETCH_TEMPLATE;
}

elseif($status[0][data_int] == 0)
{
$process->Template = array( 'templateName' => 'design:' . 'data_not_active' . '.tpl',
'templateVars' => array( 'return_uri' => $requestUri,
'user_name' => $userName ) );
return EZ_WORKFLOW_TYPE_STATUS_FETCH_TEMPLATE;
}
} // End : $enumAttribute != null //
}// End : execute


}

eZWorkflowEventType::registerType( EZ_WORKFLOW_TYPE_CHECK_EXP_ID, "checkexptype" );

?>
___________________

Any help please ?

Monday 19 May 2003 6:33:56 pm

ahhhhaa ... found it .. thx for help happy.gif Emoticon

_______

if($ActiveTo <= $Now)
{
$query = "update ezcontentobject_attribute set data_int ='0' where id='$CompanyStatusValueID' ";
$db->query($query);
$process->Template = array( 'templateName' => 'design:' . 'data_not_active' . '.tpl');
return EZ_WORKFLOW_TYPE_STATUS_FETCH_TEMPLATE_REPEAT;

}

elseif($status[0][data_int] == 0)
{
$process->Template = array( 'templateName' => 'design:' . 'data_not_active' . '.tpl');
return EZ_WORKFLOW_TYPE_STATUS_FETCH_TEMPLATE_REPEAT;
}
_______________

but what u think which is faster for browesing, to but in cron job or like this ?
do u have idea, or any way to view for the admin the not active data pages ?

expandshrink

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

36 542 Users on board!

Forums menu

Proudly Developed with from