Example #1
0
File: Yml.php Project: infrajs/yml
 public static function parse($data)
 {
     $gid = 0;
     $pid = 0;
     $groups = array();
     $poss = array();
     $conf = static::$conf;
     if (!$conf['name']) {
         throw new \Exception('В конфиге yml требуется указать name. Наименование компании без организационный формы');
     }
     if (!$conf['company']) {
         throw new \Exception('В конфиге yml требуется указать company, название компании с организационной формой ООО');
     }
     Xlsx::runPoss($data, function (&$pos) {
         $pos['Описание'] = Yml::tostr($pos['Описание']);
     });
     Xlsx::runGroups($data, function (&$group, $i, &$parent) use(&$gid, &$groups) {
         $group['id'] = ++$gid;
         if ($parent) {
             $group['parentId'] = $parent['id'];
         }
         $groups[] =& $group;
     });
     Xlsx::runPoss($data, function (&$pos, $i, &$group) use(&$pid, &$poss) {
         $pos['id'] = ++$pid;
         $pos['categoryId'] = $group['id'];
         $poss[] =& $pos;
     });
     $d = array("conf" => $conf, "support" => Access::$conf["admin"]["support"], "site" => View::getPath(), "poss" => $poss, "groups" => $groups);
     $html = Template::parse('-yml/yml.tpl', $d);
     return $html;
 }
Example #2
0
<?php

namespace infrajs\yml;

use infrajs\catalog\Catalog;
use infrajs\config\Config;
if (!is_file('vendor/autoload.php')) {
    chdir('../../../');
    require_once 'vendor/autoload.php';
}
$html = Catalog::cache('ymlshow', function () {
    return Yml::init();
});
header("Content-type: text/xml");
echo $html;