function processExternalLinks($source) { $eContentAttachmentLogEntry = new EContentAttachmentLogEntry(); $eContentAttachmentLogEntry->dateStarted = time(); $eContentAttachmentLogEntry->sourcePath = 'Attaching External links to ' . $source; $eContentAttachmentLogEntry->recordsProcessed = 0; $eContentAttachmentLogEntry->insert(); //Get a list of all records that do not have items for the source $econtentRecord = new EContentRecord(); $econtentRecord->source = $source; $econtentRecord->find(); while ($econtentRecord->fetch()) { if ($econtentRecord->getNumItems() == 0 && $econtentRecord->sourceUrl != null && strlen($econtentRecord->sourceUrl) > 0) { $sourceUrl = $econtentRecord->sourceUrl; $econtentItem = new EContentItem(); $econtentItem->recordId = $econtentRecord->id; $econtentItem->item_type = 'externalLink'; $econtentItem->addedBy = 1; $econtentItem->date_added = time(); $econtentItem->date_updated = time(); $econtentItem->link = $sourceUrl; $econtentItem->insert(); $eContentAttachmentLogEntry->recordsProcessed++; //Increase processing time since this can take awhile set_time_limit(30); } } $eContentAttachmentLogEntry->dateFinished = time(); $eContentAttachmentLogEntry->status = 'finished'; $eContentAttachmentLogEntry->update(); }
function getEContentAttachNotes() { $id = $_REQUEST['id']; require_once ROOT_DIR . '/sys/eContent/EContentAttachmentLogEntry.php'; $logEntry = new EContentAttachmentLogEntry(); $logEntry->id = $id; if ($logEntry->find(true)) { if (strlen($logEntry->notes) == 0) { return "No notes have been entered for this process"; } else { return $logEntry->notes; } } else { return "We could not find a process with that id. No notes available."; } }
function launch() { global $interface; global $interface; $interface->setPageTitle('eContent Attachment History'); $logEntries = array(); $eContentAttachmentLog = new EContentAttachmentLogEntry(); $eContentAttachmentLog->orderBy('dateStarted DESC'); $eContentAttachmentLog->find(); while ($eContentAttachmentLog->fetch()) { $logEntries[] = clone $eContentAttachmentLog; } $interface->assign('logEntries', $logEntries); $interface->setTemplate('eContentAttachLog.tpl'); $interface->display('layout.tpl'); }