Vygeneruje položky pro XML element Data.
160527
function getDataItems (items) {
  validate.requiredItems(items)

  const data = {}
  validate.vatIdNumber(items.dicPopl)
  data.dic_popl = items.dicPopl

  validate.businessPremisesId(items.idProvoz)
  data.id_provoz = items.idProvoz

  validate.cashRegisterId(items.idPokl)
  data.id_pokl = items.idPokl

  validate.receiptNumber(items.poradCis)
  data.porad_cis = items.poradCis

  validate.date(items.datTrzby)
  data.dat_trzby = formatDate(items.datTrzby)

  if (isDefinedAndNotNull(items.rezim)) {
    validate.regime(items.rezim)
    data.rezim = items.rezim
  } else {
    data.rezim = 0
  }

  if (isDefinedAndNotNull(items.dicPoverujiciho)) {
    validate.vatIdNumber(items.dicPoverujiciho)
    data.dic_poverujiciho = items.dicPoverujiciho
  }

  validate.financialNumber(items.celkTrzba)
  data.celk_trzba = formatNumber(items.celkTrzba)

  const map = {
    zaklNepodlDph: 'zakl_nepodl_dph',
    zaklDan1: 'zakl_dan1',
    dan1: 'dan1',
    zaklDan2: 'zakl_dan2',
    dan2: 'dan2',
    zaklDan3: 'zakl_dan3',
    dan3: 'dan3',
    cestSluz: 'cest_sluz',
    pouzitZboz1: 'pouzit_zboz1',
    pouzitZboz2: 'pouzit_zboz2',
    pouzitZboz3: 'pouzit_zboz3',
    urcenoCerpZuct: 'urceno_cerp_zuct',
    cerpZuct: 'cerp_zuct'
  }
  Object.keys(map)
  .filter(key => isDefinedAndNotNull(items[key]))
  .forEach(key => {
    validate.financialNumber(items[key])
    data[map[key]] = formatNumber(items[key])
  })

  return {
    attributes: data
  }
}
964130
public function getTagRelations()
    {
        //pobranie relacji
        return (new CmsTagRelationQuery)
                ->join('cms_tag')->on('cms_tag_id')
                ->whereObject()->equals($this->_object)
                ->andFieldObjectId()->equals($this->_objectId)
                ->findPairs('cms_tag.id', 'cms_tag.tag');
    }
987146
public function currentAction()
    {
        $objectId = !empty($this->getPost()->objectId) ? $this->getPost()->objectId : null;
        switch ($this->getPost()->fileTypes) {
            case 'images' :
                //zapytanie o obrazki
                $query = CmsFileQuery::imagesByObject($this->getPost()->object, $objectId);
                break;
            case 'notImages' :
                //wszystkie pliki bez obrazków
                $query = CmsFileQuery::notImagesByObject($this->getPost()->object, $objectId);
                break;
            default :
                //domyślne zapytanie o wszystkie pliki
                $query = CmsFileQuery::byObject($this->getPost()->object, $objectId);
        }

        $records = $query->find();
        foreach ($records as $record) {
            $record->data = $record->data->toArray();
        }

        //zwrot json'a z plikami
        return json_encode([
            'result' => 'OK',
            'files' => $records->toArray()
        ]);
    }
248333
private boolean readUsrTemplates(final ITemplateRepository templateRepository) throws IOException {
		// Mapa szablonów użytkownika (katalog domowy użytkownika):
		File usrSettingsFile = new File(settingsPath);
		if(usrSettingsFile.exists()) {
			try {
				tempelFileProcessor.process(usrSettingsFile, new ITempelEntryProcessor() {
					@Override
					public void processObject(Object object) {
						UsrTemplateProviderElement.this.processObject(object, null,
								templateRepository, new ITemplateSourceFactory() {
									@Override
									public ITemplateSource createTemplateSource(Template<?> template, String source) {
										String templatePath = getTemplatePath(template);
										if(templatePath == null) {
											return new NullTemplateSource();
										} else try {
											return new FileTemplateSource(templatePath, source);
										} catch(IOException e) {
											throw new RuntimeException(e);
										}
									}
								}
						);
					}
				});

				if(supportLogger.isDebugEnabled()) supportLogger.debug(Logs.LOG_01,
						ansiString(GREEN, usrSettingsFile.getCanonicalPath())
				);

				return true;
			} catch(Exception e) {
				supportLogger.error(e, Logs.LOG_02,
						ansiString(GREEN, usrSettingsFile.getCanonicalPath())
				);
				throw new RuntimeException(e);
			}
		} else {
			// TODO: Tworzenie pustego repozytorium użytkownika

			return false;
		}
	}
747476
function inputXML( )
    {
        $node = null;
        $dom = new DOMDocument( '1.0', 'utf-8' );
        $success = false;
        if ( $this->XMLData )
        {
            $success = $dom->loadXML( $this->XMLData );
        }

        eZDebugSetting::writeDebug( 'kernel-datatype-ezxmltext',
                                    $this->XMLData,
                                    __METHOD__ . ' xml string stored in database' );

        $output = '';
        $browserEngineName = self::browserSupportsDHTMLType();

        if ( $success )
        {
            $rootSectionNode = $dom->documentElement;
            $output .= $this->inputSectionXML( $rootSectionNode, 0 );
        }

        if ( $browserEngineName === 'Trident' )
        {
            $output = str_replace( '<p></p>', '<p>&nbsp;</p>', $output );
        }
        else /* if ( $browserEngineName !== 'Presto' ) */
        {
            $output = str_replace( '<p></p>', '<p><br /></p>', $output );
        }

        $output = str_replace( array( "\n", "\xC2\xA0" ), array( '', '&nbsp;' ), $output );

        if ( $output )
        {
            if ( $browserEngineName === 'Trident' )
            {
                $output .= '<p>&nbsp;</p>';
            }
            else
            {
                $output .= '<p><br /></p>';
            }
        }

        eZDebugSetting::writeDebug( 'kernel-datatype-ezxmltext',
                                    $output,
                                    __METHOD__ . ' xml output to return' );

        $output = htmlspecialchars( $output, ENT_COMPAT, 'UTF-8' );

        return $output;
    }
408807
public function toXML()
    {
        $namespace = 'tns';
        $writer = new XMLWriter();
        $writer->openMemory();
        $writer->setIndent(true);
        $writer->setIndentString('    ');
        $writer->startElementNs($namespace, $this->getRequestName(), 'http://www.apis-it.hr/fin/2012/types/f73');
        $writer->writeAttribute('Id', uniqid());
        $writer->startElementNs($namespace, 'Zaglavlje', null);
        $writer->writeElementNs($namespace, 'IdPoruke', null, $this->generateUUID());
        $writer->writeElementNs($namespace, 'DatumVrijeme', null, $this->generateDateTime());
        $writer->endElement();
        $writer->writeRaw($this->getRequest()->toXML());
        $writer->endElement();

        return $writer->outputMemory();
    }
103721
private function _buildFlatTree($prefix, array &$flatTree, array $categories, $categoryTypeKey)
    {
        //iteracja po kategoriach
        foreach ($categories as $id => $leaf) {
            if (null === $categoryTypeKey || $leaf['record']->getJoined('cms_category_type')->key === $categoryTypeKey) {
                //dodanie rekordu z prefixem i nazwą
                $flatTree[$id] = ltrim($prefix . ' > ' . $leaf['record']->name, ' >');
            }
            //zejście rekurencyjne
            $this->_buildFlatTree($prefix . ' > ' . $leaf['record']->name, $flatTree, $leaf['children'], $categoryTypeKey);
        }
    }
319344
private function _generateTree($node, $html)
    {
        //jeżeli nie ma węzłów z dzieciakami, to zwracam pusty html
        if (!isset($node['children']) || !is_array($node['children']) || count($node['children']) == 0) {
            return $html;
        }
        $acl = (new \CmsAdmin\Model\CategoryAclModel)->getAcl();
        $html .= '<ul>';
        //iteracja po dzieciakach i budowa węzłów drzewa
        foreach ($node['children'] as $child) {
            $icon = '';
            if (!$child['record']->active) {
                $icon = $this->view->baseUrl . '/resource/cmsAdmin/images/folder-inactive.png';
            }
            $selected = 'false';
            $disabled = 'false';
            //sprawdzenie uprawnień do węzła
            if (!$acl->isAllowed(\App\Registry::$auth->getRoles(), $child['record']->id)) {
                $disabled = 'true';
                $icon = $this->view->baseUrl . '/resource/cmsAdmin/images/folder-disabled.png';
            }
            $type = 'default';
            if (!isset($child['children']) || !count($child['children'])) {
                $type = 'leaf';
            }
            $html .= '<li id="' . $child['record']->id . '" class="' . (($type !== 'leaf') ? 'jstree-closed' : '') . '"';
            $html .= ' data-jstree=\'{"type":"' . $type . '"' . (($icon) ? ', "icon":"' . $icon . '"' : '');
            $html .= ', "disabled":' . $disabled . ', "selected":' . $selected . '}\'>' . $child['record']->name;
            $html = self::_generateTree($child, $html);
            $html .= '</li>';
        }
        $html .= '</ul>';
        return $html;
    }
515386
public function getCreationDate()
    {
        //DateTimeOriginal to najlepsze źródło
        if (isset($this->_exif['DateTimeOriginal']) && substr($this->_exif['DateTimeOriginal'], 0, 4) != '0000') {
            return date('Y-m-d H:i:s', strtotime($this->_exif['DateTimeOriginal']));
        }
        //brak DateTimeOriginal, próba z DateTime
        if (isset($this->_exif['DateTime']) && substr($this->_exif['DateTime'], 0, 4) != '0000') {
            return date('Y-m-d H:i:s', strtotime($this->_exif['DateTime']));
        }
        //w pozostałych przypadkach - data utworzenia pliku
        if (!isset($this->_exif['FileDateTime']) && substr($this->_exif['DateTime'], 0, 4) != '0000') {
            return date('Y-m-d H:i:s', strtotime($this->_exif['FileDateTime']));
        }
    }
319595
function getXmlElementFromRawIndexes(root, indexInfo) {
  let parentPackage = root;
  for (let j = 0; j < indexInfo.path.length; j++) {
    parentPackage = parentPackage.packagedElement[indexInfo.path[j]];
  }
  return parentPackage.packagedElement[indexInfo.index];
}
1177198
def data(self, root, preserve_root=False):
        ''''''
        # If preserve_root is False, return the root element. This is easiest
        # done by wrapping the XML in a dummy root element that will be ignored.
        if preserve_root:
            new_root = root.makeelement('dummy_root', {})
            new_root.insert(0, root)
            root = new_root

        # If no children, just return the text
        children = [node for node in root if isinstance(node.tag, basestring)]
        if len(children) == 0:
            return self._fromstring(root.text)

        # Element names become object properties
        count = Counter(child.tag for child in children)
        result = self.dict()
        for child in children:
            if count[child.tag] == 1:
                result[child.tag] = self.data(child)
            else:
                result.setdefault(child.tag, self.list()).append(self.data(child))

        return result
935613
def xmlGenBinaryDataArrayList(binaryDataInfo, binaryDataDict,
                              compression='zlib', arrayTypes=None):
    
    #Note: any other value for "compression" than "zlib" results in no
    #   compression
    #Note: Use arrayTypes parameter to specify the order of the arrays
    if arrayTypes is None:
        arrayTypes = [_ for _ in viewkeys(binaryDataInfo)]
    numEntries = len(binaryDataInfo)
    xmlBinaryDataArrayList = ETREE.Element('binaryDataArrayList',
                                           {'count': str(numEntries)}
                                           )
    for arrayType in arrayTypes:
        _, dataTypeParam = maspy.xml.findBinaryDataType(binaryDataInfo[arrayType]['params'])
        binaryData = binaryDataDict[arrayType]
        bitEncoding = '64' if binaryData.dtype.str == '<f8' else '32'
        if binaryData.size > 0:
            binaryData, arrayLength = maspy.xml.encodeBinaryData(binaryData,
                                                                 bitEncoding,
                                                                 compression
                                                                 )
        else:
            binaryData = ''
            arrayLength = 0

        # --- define binaryDataArray parameters --- #
        params = list()
        if bitEncoding == '64':
            params.append(('MS:1000523', None, None))
        else:
            params.append(('MS:1000521', None, None))
        if compression == 'zlib':
            params.append(('MS:1000574', None, None))
        else:
            params.append(('MS:1000576', None, None))
        mandatoryAccessions = ['MS:1000523', 'MS:1000521', 'MS:1000574',
                               'MS:1000576'
                               ]
        for param in binaryDataInfo[arrayType]['params']:
            if param[0] not in mandatoryAccessions:
                params.append(param)

        #Note: not all attributes supported
        binaryDataArrayAttrib = {'encodedLength': str(len(binaryData))}
        for attr in ['dataProcessingRef']:
            if binaryDataInfo[arrayType][attr] is not None:
                binaryDataArrayAttrib[attr] = binaryDataInfo[arrayType][attr]
        xmlBinaryDataArray = ETREE.Element('binaryDataArray',
                                           binaryDataArrayAttrib
                                           )
        maspy.xml.xmlAddParams(xmlBinaryDataArray, params)

        xmlBinary = ETREE.Element('binary')
        xmlBinary.text = binaryData
        xmlBinaryDataArray.append(xmlBinary)
        xmlBinaryDataArrayList.append(xmlBinaryDataArray)
    return xmlBinaryDataArrayList
943274
public function toArray()
    {
        //tworzy array z opcji
        $array = $this->_options;
        //dołącza joinowane tabele
        foreach ($this->_joined as $name => $value) {
            if ($value instanceof \Mmi\Orm\RecordRo) {
                $value = $value->toArray();
            }
            $array[$name] = $value;
        }
        //dołącza pola obiektu
        foreach ($this as $name => $value) {
            //tylko publiczne zmienne
            if (substr($name, 0, 1) == '_') {
                continue;
            }
            $array[$name] = $value;
        }
        return $array;
    }
863157
static function processElementTransformationList( $tpl, &$node, $elements, &$privateData )
    {
        $useComments = $privateData['use-comments'];
        $php =& $privateData['php-creator'];
        $resourceData =& $privateData['resource-data'];
        $elementTree = $elements;
        $newElements = eZTemplateCompiler::processElementTransformationChild( $useComments, $php, $tpl, $node,
                                                                              $elementTree, $elements, $resourceData );
        if ( $newElements )
            return $newElements;
        return $elements;
    }
1348928
def xmldeclarations(self):
        """"""
        l = []
        E = ElementMaker(namespace="http://ilk.uvt.nl/folia",nsmap={None: "http://ilk.uvt.nl/folia", 'xml' : "http://www.w3.org/XML/1998/namespace"})

        for annotationtype, set in self.annotations:
            label = None
            #Find the 'label' for the declarations dynamically (aka: AnnotationType --> String)
            for key, value in vars(AnnotationType).items():
                if value == annotationtype:
                    label = key
                    break
            #gather attribs

            if (annotationtype == AnnotationType.TEXT or annotationtype == AnnotationType.PHON) and set == 'undefined' and len(self.annotationdefaults[annotationtype][set]) == 0:
                #this is the implicit TextContent declaration, no need to output it explicitly
                continue

            attribs = {}
            if set and set != 'undefined':
                attribs['{' + NSFOLIA + '}set'] = set


            for key, value in self.annotationdefaults[annotationtype][set].items():
                if key == 'annotatortype':
                    if value == AnnotatorType.MANUAL:
                        attribs['{' + NSFOLIA + '}' + key] = 'manual'
                    elif value == AnnotatorType.AUTO:
                        attribs['{' + NSFOLIA + '}' + key] = 'auto'
                elif key == 'datetime':
                    attribs['{' + NSFOLIA + '}' + key] = value.strftime("%Y-%m-%dT%H:%M:%S") #proper iso-formatting
                elif value:
                    attribs['{' + NSFOLIA + '}' + key] = value
            if label:
                l.append( makeelement(E,'{' + NSFOLIA + '}' + label.lower() + '-annotation', **attribs) )
            else:
                raise Exception("Invalid annotation type")
        return l
800362
protected function _prepareData()
	{
        //próba pobrania struktury uprawnień z cache
        if (null !== $this->_acl = \App\Registry::$cache->load($cacheKey = 'categories-roles')) {
			return;
        }
		$this->_acl = [];
		//zapytanie o całą strukturę powiązań: kategorie - role
		foreach ((new \Cms\Orm\CmsCategoryRoleQuery())
					->join('cms_role')->on('cms_role_id')
					->orderAscCmsCategoryId()
					->find() as $record) {
			if (!array_key_exists($record->cmsCategoryId, $this->_acl)) {
				$this->_acl[$record->cmsCategoryId] = [];
			}
			$this->_acl[$record->cmsCategoryId][] = $record->getJoined('cms_role')->name;
		}
        //zapis struktury uprawnień do cache
        \App\Registry::$cache->save($this->_acl, $cacheKey, 0);
	}
440377
public function getGrouppedAttributeValues()
    {
        $grouppedByAttributeKey = new \Mmi\DataObject();
        //wyszukiwanie wartości
        foreach ($this->getAttributeValues() as $record) {
            //pobieranie klucza atrybutu (w celu zgrupowania
            $key = $record->getJoined('cms_attribute')->key;
            if ($record->getJoined('cms_attribute_type')->multiple) {
                if (!$grouppedByAttributeKey->$key) {
                    $grouppedByAttributeKey->$key = new \Mmi\Orm\RecordCollection;
                }
                $grouppedByAttributeKey->$key->append($record);
                continue;
            }
            //atrybut to uploader
            if ($record->getJoined('cms_attribute_type')->uploader) {
                //dołączanie plików
                $grouppedByAttributeKey->$key = \Cms\Orm\CmsFileQuery::byObject($record->value, $this->_objectId)->find();
                continue;
            }
            //atrybut zwykły
            $grouppedByAttributeKey->$key = $record->value;
        }
        //zwrot zgrupowanych wartości atrybutów
        return $grouppedByAttributeKey;
    }