Example #1
0
 /** {@inheritDoc} */
 public function process()
 {
     $content = $this->gl->getFileContent($this->classKey);
     if ($content == false) {
         return $this->failure($this->gl->lexicon('err_file_ns'));
     }
     $this->clearTable();
     $this->gl->createDefault();
     $lines = explode("\n", $content);
     array_pop($lines);
     $sql = "INSERT INTO {$this->modx->getTableName($this->classKey)} " . "(`id`, `iso`, `continent`, `name_ru`, `name_en`, `lat`, `lon`, `timezone`) VALUES " . "(:id, :iso, :continent, :name_ru, :name_en, :lat, :lon, :timezone)";
     $stmt = $this->modx->prepare($sql);
     foreach ($lines as $line) {
         $fields = explode("\t", $line);
         if ($stmt instanceof PDOStatement) {
             $stmt->bindValue(':id', $fields[0]);
             $stmt->bindValue(':iso', $fields[1]);
             $stmt->bindValue(':continent', $fields[2]);
             $stmt->bindValue(':name_ru', $fields[3]);
             $stmt->bindValue(':name_en', $fields[4]);
             $stmt->bindValue(':lat', $fields[5]);
             $stmt->bindValue(':lon', $fields[6]);
             $stmt->bindValue(':timezone', $fields[7]);
             if ($stmt->execute()) {
             } else {
                 throw new Exception('Error add - ' . $this->modx->lastInsertId());
             }
         }
     }
     return $this->success();
 }
Example #2
0
 /** {@inheritDoc} */
 public function process()
 {
     $id = (int) $this->getProperty('id');
     $class = trim($this->getProperty('class'));
     if (empty($class)) {
         return $this->modx->lexicon('gl_err_ns');
     }
     $current = $this->gl->getCurrentData($id, $class);
     if (!empty($current)) {
         $this->gl->opts['current'] = $current;
     }
     $this->gl->opts['set'] = true;
     return $this->success('', $this->gl->opts);
 }
Example #3
0
 /**
  * @return void
  */
 public function initialize()
 {
     $corePath = $this->modx->getOption('gl_core_path', null, $this->modx->getOption('core_path') . 'components/gl/');
     require_once $corePath . 'model/gl/gl.class.php';
     $this->gl = new gl($this->modx);
     $this->gl->initialize($this->modx->context->key);
     $this->addCss($this->gl->config['cssUrl'] . 'mgr/main.css');
     $this->addCss($this->gl->config['cssUrl'] . 'mgr/bootstrap.buttons.css');
     $this->addCss($this->gl->config['assetsUrl'] . 'vendor/fontawesome/css/font-awesome.min.css');
     $this->addJavascript($this->gl->config['jsUrl'] . 'mgr/gl.js');
     $config = $this->gl->config;
     $config['connector_url'] = $this->gl->config['connectorUrl'];
     $this->addHtml("<script type='text/javascript'>gl.config={$this->modx->toJSON($config)}</script>");
     parent::initialize();
 }
Example #4
0
 /**
  * @return void
  */
 public function initialize()
 {
     $corePath = $this->modx->getOption('gl_core_path', null, $this->modx->getOption('core_path') . 'components/gl/');
     require_once $corePath . 'model/gl/gl.class.php';
     $this->gl = new gl($this->modx);
     $this->gl->initialize($this->modx->context->key);
     $this->addCss($this->gl->config['cssUrl'] . 'mgr/main.css');
     $this->addCss($this->gl->config['cssUrl'] . 'mgr/bootstrap.buttons.css');
     $this->addJavascript($this->gl->config['jsUrl'] . 'mgr/gl.js');
     $config = $this->gl->config;
     $config['connector_url'] = $this->gl->config['connectorUrl'];
     $config['fields_grid_countries'] = $this->gl->getFieldsGridCountries();
     $config['fields_grid_regions'] = $this->gl->getFieldsGridRegions();
     $config['fields_grid_cities'] = $this->gl->getFieldsGridCities();
     $config['fields_grid_data'] = $this->gl->getFieldsGridData();
     $config['fields_window_data'] = $this->gl->getFieldsWindowData();
     $this->addHtml("<script type='text/javascript'>gl.config={$this->modx->toJSON($config)}</script>");
     parent::initialize();
 }
Example #5
0
File: lt.php Project: 871263000/zdl
                    if ($value['path'] == 0 && $value['pid'] == 0) {
                        continue;
                    }
                    $dmt = explode(',', $value['path']);
                    if (count($dmt) == 2) {
                        $resu[] = $value;
                    }
                }
                $resData = $resu;
                break;
        }
        //Return
        return $resData;
    }
}
$r = new gl('presonfl');
if (@$_POST['Dep']) {
    $json = $r->getNode('', $_POST['Dep']);
    die(json_encode($json));
}
if ($_POST) {
    switch ($_POST['model']) {
        case 1:
            die($r->doadd1($_POST['fname']) ? '添加成功' : '添加失败');
        case 2:
            die($r->doadd2($_POST['fname'], $_POST['sid'], $_POST['spath']) ? '添加成功' : '添加失败');
        case 3:
            die($r->rename($_POST['id'], $_POST['newname']) ? '命名成功' : '命名失败');
        case 4:
            die($r->del($_POST['spath'], $_POST['id']) ? '删除成功' : '删除失败');
        case 5: