/**
  * @see LinkedToMappingRuleDataAnalyzerInterface::runAndMakeMessages()
  */
 public function runAndMakeMessages(AnalyzerSupportedDataProvider $dataProvider, $columnName, $mappingRuleType, $mappingRuleData)
 {
     assert('is_string($columnName)');
     assert('is_string($mappingRuleType)');
     assert('is_array($mappingRuleData)');
     assert('is_int($mappingRuleData["type"])');
     assert('$mappingRuleData["type"] == UserValueTypeModelAttributeMappingRuleForm::ZURMO_USER_ID ||
                 $mappingRuleData["type"] == UserValueTypeModelAttributeMappingRuleForm::EXTERNAL_SYSTEM_USER_ID ||
                 $mappingRuleData["type"] == UserValueTypeModelAttributeMappingRuleForm::ZURMO_USERNAME');
     $this->type = $mappingRuleData["type"];
     if ($mappingRuleData['type'] == UserValueTypeModelAttributeMappingRuleForm::ZURMO_USER_ID) {
         $this->acceptableValues = UserValueTypeSanitizerUtil::getUserIds();
     } elseif ($mappingRuleData['type'] == UserValueTypeModelAttributeMappingRuleForm::EXTERNAL_SYSTEM_USER_ID) {
         $this->acceptableValues = UserValueTypeSanitizerUtil::getUserExternalSystemIds();
     } else {
         $acceptableValues = UserValueTypeSanitizerUtil::getUsernames();
         $this->acceptableValues = ArrayUtil::resolveArrayToLowerCase($acceptableValues);
     }
     $this->processAndMakeMessage($dataProvider, $columnName);
 }
 /**
  * Check whether the value specified is a valid zurmo user model id.
  * @param object $dataProvider
  * @param string $columnName
  */
 protected function resolveForTypeZurmoUserId(AnalyzerSupportedDataProvider $dataProvider, $columnName)
 {
     assert('is_string($columnName)');
     $userIds = UserValueTypeSanitizerUtil::getUserIds();
     $data = $dataProvider->getCountDataByGroupByColumnName($columnName);
     $count = 0;
     $rowCount = 0;
     foreach ($data as $valueCountData) {
         if ($valueCountData[$columnName] == null) {
             continue;
         }
         if (!in_array($valueCountData[$columnName], $userIds)) {
             $count++;
             $rowCount = $rowCount + $valueCountData['count'];
         }
     }
     if ($count > 0) {
         $label = '{count} zurmo user id(s) across {rowCount} row(s) were not found. ';
         $label .= 'These values will not be used during the import.';
         $this->addMessage(Zurmo::t('ImportModule', $label, array('{count}' => $count, '{rowCount}' => $rowCount)));
     }
 }
 protected function getAcceptableValues()
 {
     if ($this->mappingRuleData['type'] == UserValueTypeModelAttributeMappingRuleForm::ZURMO_USER_ID) {
         return UserValueTypeSanitizerUtil::getUserIds();
     } elseif ($this->mappingRuleData['type'] == UserValueTypeModelAttributeMappingRuleForm::EXTERNAL_SYSTEM_USER_ID) {
         return UserValueTypeSanitizerUtil::getUserExternalSystemIds();
     } else {
         $acceptableValues = UserValueTypeSanitizerUtil::getUsernames();
         return ArrayUtil::resolveArrayToLowerCase($acceptableValues);
     }
 }