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

Author Message

Selmah Maxim

Monday 19 May 2003 8:40:58 am

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");

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");
$Object = $node->attribute("object");

 

// 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") $Data[$Name] = $Value;
if("$Name" == "ClassID") $Data[$Name]= $Value;
if("$Name" == "Published") $Data[$Name] = $Value;
if("$Name" == "CurrentVersion") $Data[$Name] = $Value;
}

$ActiveTo = $Data[Published]+$selectedEnumValue;
$Now = strtotime("now");

// 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 ?

Selmah Maxim

Monday 19 May 2003 9:33:56 am

ahhhhaa ... found it .. thx for help :)

_______

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 ?

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

eZ debug

Timing: Jan 30 2025 22:22:27
Script start
Timing: Jan 30 2025 22:22:27
Module start 'layout'
Timing: Jan 30 2025 22:22:27
Module start 'content'
Timing: Jan 30 2025 22:22:27
Module end 'content'
Timing: Jan 30 2025 22:22:27
Script end

Main resources:

Total runtime0.0241 sec
Peak memory usage4,096.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0053 588.2656151.2266
Module start 'layout' 0.00530.0035 739.4922220.7188
Module start 'content' 0.00890.0137 960.21091,001.7266
Module end 'content' 0.02260.0015 1,961.937533.9922
Script end 0.0240  1,995.9297 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002510.2043140.0002
Check MTime0.00104.2973140.0001
Mysql Total
Database connection0.00093.902010.0009
Mysqli_queries0.00229.132430.0007
Looping result0.00000.037610.0000
Template Total0.00104.410.0010
Template load0.00083.415610.0008
Template processing0.00020.922310.0002
Override
Cache load0.00062.368510.0006
General
dbfile0.002410.096380.0003
String conversion0.00000.025840.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs