Content Review Report

Andy Parry wrote a script that looks at content which is due for review in the last 24 hours and sends an e-mail to the content owner requesting their attention, it is a dmCron template and is supposed to be executed daily.

This code has been created to replace the missing content review method in farcry core.

* Create objects which have review dates that need to be checked:
- dmHTML
* Create a query cotaining object ID's of review items
* Loop through query, identify content owner and inform them via e-mail that the
the review date has passed if it's within last 24 hours.
* End process.

<!--- @@displayname: Enpresiv Content Review Mailer --->

oHTML = createObject("component",application.types['dmHTML'].typePath);
today = DateFormat(Now(), 'yyyy-mm-dd');
// DateAdd uses N (set to -1) on the day part of the date to get yesterday's date.
yesterday = DateFormat(DateAdd("d", -5, Now()), 'yyyy-mm-dd');

<cfquery name="qHTML" datasource="#application.dsn#">
SELECT objectId, ownedBy, reviewDate
WHERE status = 'approved'
AND LENGTH(ownedBy) > 0
AND LENGTH(reviewDate) > 0
AND reviewDate < '#today#'
AND reviewDate > '#yesterday#'

<cfloop query="qHTML">

oUser = createObject("component",application.types['dmProfile'].typePath);
oNav = createObject("component",application.types['dmNavigation'].typePath);
stUser = oUser.getData(qHTML.ownedBy);
stHTML = oHTML.getData(qHTML.objectId);
stNav = oNav.getParent(qHTML.objectId);

<cfif len(stUser.emailAddress)>
<!--- If user has e-mail account, do something. --->