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