コード例 #1
0
ファイル: editor.php プロジェクト: nabab/appui-ide
    if (!$current_dir && $ctrl->inc->session->has('ide', 'dir')) {
        $current_dir = $ctrl->inc->session->get('ide', 'dir');
    }
    $ide_cfg = $ctrl->inc->user->get_cfg('ide');
    echo $ctrl->set_title("IDE")->add_js('./functions', ['dirs' => $model['dirs'], 'root' => $ctrl->data['root'], 'baseURL' => $ctrl->say_path() . '/', 'theme' => empty($ide_cfg['theme']) ? '' : $ide_cfg['theme'], 'font' => empty($ide_cfg['font']) ? '' : $ide_cfg['font'], 'font_size' => empty($ide_cfg['font_size']) ? '' : $ide_cfg['font_size']])->add_js(['menu' => $model['menu'], 'config' => $list, 'dirs' => $model['dirs'], 'root' => $ctrl->data['root'], 'url' => implode('/', $ctrl->params), 'current_dir' => $current_dir ? $current_dir : $model['default_dir']])->get_view() . $ctrl->get_less();
    $ctrl->obj->url = 'ide/editor';
} else {
    $dirs = new \bbn\ide\directories($ctrl->inc->options, $ctrl->get_routes());
    //$dir = array_shift($ctrl->arguments);
    $tab = array_pop($ctrl->arguments);
    $url = implode('/', $ctrl->arguments);
    // Case where it's a new file and we need to provide the tabNav info
    if (strpos($url, $ctrl->baseURL) === false) {
        if ($dir = $dirs->dir_from_url($url)) {
            $info = $dirs->dir($dir);
            $ctrl->obj = $dirs->load($url, $dir, $tab, $ctrl->inc->pref);
        }
    } else {
        $res = $dirs->load($url, $dir, $tab, $ctrl->inc->pref);
    }
    /*
    \bbn\x::hdump(
      $res,
      $ctrl->arguments,
      $ctrl->baseURL,
      $ctrl->say_path(),
      $ctrl->say_dir(),
      $ctrl->say_local_path(),
      $ctrl->say_local_route(),
      $ctrl->say_controller(),
      $ctrl->say_all()
コード例 #2
0
ファイル: load.php プロジェクト: nabab/appui-ide
<?php

if (!empty($model->data['file']) && !empty($model->data['dir']) && isset($model->data['routes'])) {
    $dirs = new \bbn\ide\directories($model->inc->options, $model->data['routes']);
    if ($res = $dirs->load($model->data['file'], $model->data['dir'], isset($model->data['tab']) ? $model->data['tab'] : false, $model->inc->pref)) {
        return $res;
    }
    return ['error' => $dirs->get_last_error()];
}