<?php
 namespace App\OfferProfileRules; class Criterion_OfferLocation extends CriterionAbstract { public function checkFields(\App\OfferProfileRules\Fields $fields) { return $this->checkField($fields->offerLocation); } public function checkAssignedValues(\App\MessagesCollector $msgs) { if (($this->operation=='equal' or $this->operation=='notEqual') and !$this->values) { $msgs->addWarning("No offer location set."); } else { $CFG = \Engine\Loader_Cfg::getInstance()->getGlobal(); foreach($this->values as $elem) { if (!in_array($elem, $CFG['countriesCriteria'])) { $msgs->addWarning("The offer location `{$elem}` is not valid."); } } } } protected function createDescription_getEntityName($code) { $_LANG = \App\Loader_Lang::getInstance()->getGlobal(); return $_LANG['locations']['countriesCriteria']['long'][$code]; } } 