public function areImagesValid(ExecutionContext $context) { $captured_ids = array_map(function ($image) { return $image->getId(); }, $this->images->toArray()); $property_path = $context->getPropertyPath() . '.images'; if (!count($captured_ids)) { $context->addViolationAt($property_path, 'Please select at least one image!', array(), null); return; } $count = $this->query_builder->andWhere($this->query_builder->expr()->in('i.id', $captured_ids))->select('COUNT(i.id)')->getQuery()->getSingleScalarResult(); if (!$count) { $context->addViolation('Please select images from the list!', array(), null); } }
/** * * @param type $params */ public static function saveSettings($params) { $oPlugin = JchPlatformPlugin::getPlugin(); $oPlugin->params = $params->toArray(); $oData = new JRegistry($oPlugin); $aData = $oData->toArray(); $oController = new JControllerLegacy(); $oController->addModelPath(JPATH_ADMINISTRATOR . '/components/com_plugins/models', 'PluginsModel'); $oPluginModel = $oController->getModel('Plugin', 'PluginsModel'); if ($oPluginModel->save($aData) === FALSE) { JchOptimizeLogger::log(JText::sprintf('JLIB_APPLICATION_ERROR_SAVE_FAILED', $oPluginModel->getError()), $params); } }
/** * Stream WMS tiles for $feature in high resolution * or in low resolution if $lowResolution is set to true * * @param type $feature * @param type $lowResolution */ public function streamWMS($feature, $lowResolution = false) { /* * Easy case - no feature or no WMS */ if (!isset($feature)) { RestoLogUtil::httpError(404); } $featureArray = $feature->toArray(); if (!isset($featureArray['properties']['wmsInfos'])) { RestoLogUtil::httpError(404); } $this->stream($this->getWMSUrl($featureArray['properties']['wmsInfos'], $lowResolution)); }
/** * Node mapper * * @param type $config * @return \Core\Plugins\Navigation\Node */ public function mapNode($config) { $node = new Node(); $allData = $config->toArray(); foreach ($allData as $key => $value) { if ($key == 'childs') { continue; } $node->{'set' . ucfirst($key)}($value); } if (isset($config->childs)) { $collection = $this->mapCollection($config->childs, $node); $node->setChilds($collection); } return $node; }
/** * @param $id * @return array * @codeCoverageIgnore */ public function retrieveDefinitionData($id) { $this->definitionBean->retrieve($id); return $this->definitionBean->toArray(); }