本文整理汇总了PHP中eZContentObjectVersion::fetchForUser方法的典型用法代码示例。如果您正苦于以下问题:PHP eZContentObjectVersion::fetchForUser方法的具体用法?PHP eZContentObjectVersion::fetchForUser怎么用?PHP eZContentObjectVersion::fetchForUser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZContentObjectVersion
的用法示例。
在下文中一共展示了eZContentObjectVersion::fetchForUser方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: foreach
foreach ( $deleteIDArray as $deleteID )
{
$version = eZContentObjectVersion::fetch( $deleteID );
if ( $version instanceof eZContentObjectVersion )
{
eZDebug::writeNotice( $deleteID, "deleteID" );
$version->removeThis();
}
}
$db->commit();
}
}
if ( $http->hasPostVariable( 'EmptyButton' ) )
{
$versions = eZContentObjectVersion::fetchForUser( $userID );
$db = eZDB::instance();
$db->begin();
foreach ( $versions as $version )
{
$version->removeThis();
}
$db->commit();
}
$tpl = eZTemplate::factory();
$tpl->setVariable('view_parameters', $viewParameters );
$Result = array();
$Result['content'] = $tpl->fetch( 'design:content/draft.tpl' );
示例2: cleanupAllInternalDrafts
/**
* Removes all old internal drafts by the specified user for the past time span given by $timeDuration
*
* @param int|bool $userID The ID of the user to cleanup for, if false it will use the current user.
* @param int $timeDuration default time duration for internal drafts 60*60*24 seconds (1 day)
*/
static function cleanupAllInternalDrafts( $userID = false, $timeDuration = 86400 ) //
{
if ( !is_numeric( $timeDuration ) ||
$timeDuration < 0 )
{
eZDebug::writeError( "The time duration must be a positive numeric value (timeDuration = $timeDuration)", __METHOD__ );
return;
}
if ( $userID === false )
{
$userID = eZUser::currentUserID();
}
// Remove all internal drafts
$untouchedDrafts = eZContentObjectVersion::fetchForUser( $userID, eZContentObjectVersion::STATUS_INTERNAL_DRAFT );
$expiryTime = time() - $timeDuration; // only remove drafts older than time duration (default is 1 day)
foreach ( $untouchedDrafts as $untouchedDraft )
{
if ( $untouchedDraft->attribute( 'modified' ) < $expiryTime )
{
$untouchedDraft->removeThis();
}
}
}