/* @type $articleNode eZContentObjectTreeNode */ $articleNode = $articleContentObject->mainNode(); $application = NodeTool::getApplicationFromNode($articleNode); $publisherFolderInfo = PublisherFolderTool::getPublisherFolderPathFromArticleNode($articleNode, true); $publisherFolderPath = $publisherFolderInfo['path']; $publisherFolderTranslation = PublisherFolderTool::getPublisherFolderTranslationFromPublisherFolder($publisherFolderInfo['pfid']); if( isset($publisherFolderTranslation['name']) ) { $publisherFolderTranslatioName = $publisherFolderTranslation['name']; } $articleObjecId = $articleContentObject->ID; } } //Insert into tracking table MMTrackingPdf::addTrack($clusterIdentifier, $userId, $application, $pdfId, $articleObjecId, $date, $publisherFolderPath, $publisherFolderTranslatioName); } } //No tracking else { $mime = $clFile->processFile( function($f){ return mime_content_type($f); } ); header("Content-disposition: attachment; filename=\"$filename\""); header("Content-Type: $mime"); header('Content-Transfer-Encoding: binary'); header("Content-Length: $filesize"); header('Pragma: no-cache'); header('Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0'); header('Expires: 0'); ob_clean();
$cli->output("[notification] Script begins"); $script->initialize(); // Check if we have needed folder if not create it. $path = "var/tracking/all-data"; if (!is_dir($path)) { mkdir($path); } $path .= '/' . $year . '-' . $month; if (!is_dir($path)) { mkdir($path); } $finalArray = MMTrackingPdf::fetchAllMonthlyTrackingByDate($month, $year); if ($finalArray && !empty($finalArray)) { $columns = array("APPLICATION", 'PUBLISHER', 'PUBLISHER NAME',"DATE", "FILE NAME", "USER ID", "COUNTRY CODE", "ARTICLE", "PDF ID", "UNIX TIME"); $count = 0; $emailBody = "\n"; $filename = 'all_data_' . $month . '_' . $year . '-generate_' . date('ymd') . '-tracking_pdf.csv'; $filePath = "{$path}/{$filename}"; if (false !== ( $file = fopen($filePath, "w") )) { fputcsv($file, $columns); } foreach ($finalArray as $data) { $count++;
require 'autoload.php'; $cli = eZCLI::instance(); $script = eZScript::instance(); $script->startup(); $cli->output( "[notification] Script begins" ); $script->initialize(); // Check if we have needed folder if not create it. $path = "var/tracking"; if (!is_dir($path)) { mkdir($path); } $finalArray = MMTrackingPdf::fetchMonthlyTracking(); // now the file $columns = array("DATE", "FILE NAME", "COUNTRY CODE", "ARTICLE", "APPLICATION", "PDF ID", "UNIX TIME"); $count = 0; $emailBody = "\n"; foreach ($finalArray as $publisher => $trackingDataArray) { $countPerPublisher = count($trackingDataArray); $publisherDir = "{$path}/" . MMTrackingPdf::$publishersMapping[$publisher] . '/' . $publisher; if (!is_dir($publisherDir)) { mkdir($publisherDir, 0777, true); } $filename = $publisher . "-" . date('ymd')."-tracking_pdf.csv";