_includeNotes = $includeNotes; $cellProvider = new ColumnBasedGridCellProvider(); parent::__construct( 'date', 'common.date', null, null, $cellProvider, ['width' => 10, 'alignment' => GridColumn::COLUMN_ALIGNMENT_LEFT, 'anyhtml' => true] ); } // // Public methods // /** * Method expected by ColumnBasedGridCellProvider * to render a cell in this column. * * @copydoc ColumnBasedGridCellProvider::getTemplateVarsFromRowColumn() */ public function getTemplateVarsFromRow($row) { $submissionFileData = $row->getData(); $submissionFile = $submissionFileData['submissionFile']; assert($submissionFile instanceof \PKP\submissionFile\SubmissionFile); $mtimestamp = strtotime($submissionFile->getData('updatedAt')); $dateFormatLong = PKPString::convertStrftimeFormat(Application::get()->getRequest()->getContext()->getLocalizedDateFormatLong()); $date = date($dateFormatLong, $mtimestamp); // File age $age = (int)floor((date('U') - $mtimestamp) / 86400); switch (true) { case $age <= 7: $cls = ' pkp_helpers_text_warn'; break; case $age <= 28: $cls = ' pkp_helpers_text_primary'; break; default: $cls = ''; break; } return ['label' => sprintf( "%s", $cls, htmlspecialchars($date) )]; } // // Private methods // /** * Determine whether or not submission note status should be included. */ public function _getIncludeNotes() { return $this->_includeNotes; } /** * Get stage id, if any. * * @return mixed int or null */ public function _getStageId() { return $this->_stageId; } }