public static function cleanMembers(\DataContainer $objDc)
 {
     $intPid = \Input::get('id');
     $blnIntroPrinted = false;
     if ($intPid && ($objArchive = SubmissionArchiveModel::findByPk($intPid)) !== null && $objArchive->memberGroups) {
         $arrArchiveGroups = deserialize($objArchive->memberGroups, true);
         if (!empty($arrArchiveGroups)) {
             if (($objMembers = \MemberModel::findAll()) !== null) {
                 while ($objMembers->next()) {
                     $arrGroups = deserialize($objMembers->groups, true);
                     if (count(array_intersect($arrGroups, $arrArchiveGroups)) > 0) {
                         // check for existing submissions
                         if (SubmissionModel::findBy('mid', $objMembers->id) === null) {
                             if (!$blnIntroPrinted) {
                                 echo $GLOBALS['TL_LANG']['tl_competition_submission']['cleanMembersIntro'] . '<br>';
                                 $blnIntroPrinted = true;
                             }
                             echo $objMembers->id . '<br>';
                             $objMembers->groups = serialize(array_diff($arrGroups, $arrArchiveGroups));
                             $objMembers->save();
                         }
                     }
                 }
             }
         }
     }
     die;
 }
 public function listReviews($arrRow)
 {
     $strReview = '<div>';
     if (($objMember = \MemberModel::findByPk($arrRow['jid'])) !== null) {
         $strReview .= $objMember->firstname . ' ' . $objMember->lastname;
     }
     if (($objSubmission = \HeimrichHannot\Competition\SubmissionModel::findByPk($arrRow['sid'])) !== null) {
         if ($objSubmission->companyTeamName) {
             $strReview .= ' <span style="color:#b3b3b3; padding-left:3px">[' . $objSubmission->companyTeamName . ']</span>';
         }
     }
     $strReview .= '</div>';
     return $strReview;
 }
 public static function getAllowedSubmissionsAsOptions($intReviewPid, $intMemberId, $strSubmissionFieldname = 'id', $blnIncludeEmptyFieldnames = false)
 {
     $arrOptions = array();
     $arrAllowedSubmissions = \HeimrichHannot\Competition\SubmissionModel::getAllowedSubmissions($intMemberId);
     if (($objReviewArchive = \HeimrichHannot\Competition\ReviewArchiveModel::findByPk($intReviewPid)) !== null) {
         $arrAllowedArchives = deserialize($objReviewArchive->submissionArchives, true);
         if (!empty($arrAllowedSubmissions)) {
             foreach ($arrAllowedSubmissions as $objSubmission) {
                 if ((empty($arrAllowedArchives) || in_array($objSubmission->pid, $arrAllowedArchives)) && ($blnIncludeEmptyFieldnames || $objSubmission->{$strSubmissionFieldname})) {
                     $arrOptions[$objSubmission->id] = $objSubmission->{$strSubmissionFieldname};
                 }
             }
             $arrOptions = Arrays::array_unique_keys($arrOptions);
             asort($arrOptions);
         }
     }
     return $arrOptions;
 }
<?php

define('COMPETITION_FILENAME_SUFFIX', '_judges');
/**
 * Back end modules
 */
array_insert($GLOBALS['BE_MOD'], 1, array('competition' => array('competition_submission' => array('tables' => array('tl_competition_submission_archive', 'tl_competition_submission'), 'icon' => 'system/modules/competition/assets/img/icon_submission.png', 'export' => \HeimrichHannot\Exporter\ModuleExporter::getBackendModule(), 'export_xls' => \HeimrichHannot\Exporter\ModuleExporter::getBackendModule(), 'clean_members' => array('HeimrichHannot\\Competition\\Competition', 'cleanMembers')), 'competition_review' => array('tables' => array('tl_competition_review_archive', 'tl_competition_review'), 'icon' => 'system/modules/competition/assets/img/icon_review.png', 'export' => \HeimrichHannot\Exporter\ModuleExporter::getBackendModule(), 'export_xls' => \HeimrichHannot\Exporter\ModuleExporter::getBackendModule()))));
/**
 * Hooks
 */
$GLOBALS['TL_HOOKS']['addCustomRegexp']['checkForDoubleReviewsBe'] = array('HeimrichHannot\\Competition\\Competition', 'checkForDoubleReviewsBe');
$GLOBALS['TL_HOOKS']['formHybridValidateFormField']['checkForDoubleReviewsFe'] = array('HeimrichHannot\\Competition\\Competition', 'checkForDoubleReviewsFe');
/**
 * Models
 */
$GLOBALS['TL_MODELS'][\HeimrichHannot\Competition\SubmissionModel::getTable()] = 'HeimrichHannot\\Competition\\SubmissionModel';
$GLOBALS['TL_MODELS'][\HeimrichHannot\Competition\SubmissionArchiveModel::getTable()] = 'HeimrichHannot\\Competition\\SubmissionArchiveModel';
$GLOBALS['TL_MODELS'][\HeimrichHannot\Competition\ReviewModel::getTable()] = 'HeimrichHannot\\Competition\\ReviewModel';
$GLOBALS['TL_MODELS'][\HeimrichHannot\Competition\ReviewArchiveModel::getTable()] = 'HeimrichHannot\\Competition\\ReviewArchiveModel';