コード例 #1
0
ファイル: Catalog.php プロジェクト: oduvanio/catalog
 public static function init()
 {
     return self::cache('cat_init', function () {
         $conf = infra_config();
         $columns = array_merge(array("Наименование", "Артикул", "Производитель", "Цена", "Описание"), $conf['catalog']['columns']);
         $data =& Xlsx::init($conf['catalog']['dir'], array('more' => true, 'Имя файла' => $conf['catalog']['filename'], 'Известные колонки' => $columns));
         Xlsx::runGroups($data, function (&$gr) {
             $gr['data'] = array_reverse($gr['data']);
             // Возвращает массив с элементами в обратном порядке
         });
         Extend::init($data);
         return $data;
     });
 }
コード例 #2
0
ファイル: read.php プロジェクト: akiyatkin/files
}
$name = 'test.tpl';
$text = Mht::get('*files/tests/resources/' . $name);
if (mb_strlen($text) != 1935) {
    return Ans::err($ans, 'Cant read ' . $name . ' ' . strlen($text));
}
$name = 'test.html';
$text = Mht::get('*files/tests/resources/' . $name);
if (strlen($text) != 1073) {
    return Ans::err($ans, 'Cant read ' . $name . ' ' . strlen($text));
}
$data = Xlsx::init('*files/tests/resources/test.xlsx');
if (!$data) {
    return Ans::err($ans, 'Cant read test.xlsx');
}
$data = Xlsx::init('*files/tests/resources/test.csv');
if (!$data) {
    return Ans::err($ans, 'Cant read test.csv');
}
if (sizeof($data['childs']) != 1) {
    return Ans::err($ans, 'Cant read test.csv ' . sizeof($data['childs']));
}
$num = ini_get('mbstring.func_overload');
if ($num != 0) {
    $ans['class'] = 'bg-warning';
    return Ans::err($ans, 'mbstring.func_overload should be 0, not ' . $num);
} else {
    $data = Xlsx::get('*files/tests/resources/test.xls');
    if (sizeof($data['childs'][0]['data']) != 30) {
        return Ans::err($ans, 'Cant read test.xls ' . sizeof($data['childs'][0]['data']));
    }