public function process()
 {
     if (!$this->params['table']) {
         \CADB\RespondJson::ResultPage(array(-1, '테이블을 지정하세요'));
     }
     \CADB\Fields\DBM::resort($this->params['table'], $this->params['index']);
     \CADB\RespondJson::ResultPage(array(0, '정렬이 완료되었습니다.'));
 }
 public function process()
 {
     $this->layout = 'admin';
     $context = \CADB\Model\Context::instance();
     if (!($rdb = $context->getProperty('service.redis'))) {
         \CADB\Lib\Error("자동완성 기능이 활성화 되어 있지 않습니다.");
     }
     if (!$this->themes) {
         $this->themes = $context->getProperty('service.themes');
     }
     $nid = \CADB\Guide::getCurrent();
     $cids = \CADB\Guide::getTaxonomy();
     $guide_taxonomy = \CADB\Taxonomy::getTaxonomy($cids);
     $fields = \CADB\Fields\DBM::searchField('autocomplete', 1);
     $field_cids = array();
     $this->fields = array();
     if (is_array($fields)) {
         foreach ($fields as $f) {
             switch ($f['type']) {
                 case 'taxonomy':
                     $field_cids[] = $f['cid'];
                     break;
                 case 'char':
                 case 'text':
                     $this->fields[] = $f;
                     break;
             }
         }
     }
     if (count($field_cids)) {
         $field_taxonomy = \CADB\Taxonomy::getTaxonomy($field_cids);
         $this->taxonomy = array_merge($guide_taxonomy, $field_taxonomy);
     } else {
         $this->taxonomy = $guide_taxonomy;
     }
 }
 public function process()
 {
     $this->output = 'json';
     $context = \CADB\Model\Context::instance();
     if (!($rdb = $context->getProperty('service.redis'))) {
         \CADB\RespondJson::ResultPage(array(-1, '자동완성 기능이 활성화 되어 있지 않습니다.'));
     }
     if (!$this->themes) {
         $this->themes = $context->getProperty('service.themes');
     }
     $nid = \CADB\Guide::getCurrent();
     $cids = \CADB\Guide::getTaxonomy();
     $guide_taxonomy = \CADB\Taxonomy::getTaxonomy($cids);
     $fields = \CADB\Fields\DBM::searchField('autocomplete', 1);
     $field_cids = array();
     $this->fields = array();
     if (is_array($fields)) {
         foreach ($fields as $fid => $f) {
             switch ($f['type']) {
                 case 'taxonomy':
                     $field_cids[] = $f['cid'];
                     break;
                 case 'char':
                     $this->fields[$f['table']][$fid] = $f;
                     break;
             }
         }
     }
     if (count($field_cids)) {
         $field_taxonomy = \CADB\Taxonomy::getTaxonomy($field_cids);
         $this->taxonomy = array_merge($guide_taxonomy, $field_taxonomy);
     } else {
         $this->taxonomy = $guide_taxonomy;
     }
     if (is_array($this->taxonomy) && @count($this->taxonomy)) {
         $txcids = array();
         foreach ($this->taxonomy as $cid => $tx) {
             $txcids[] = $cid;
         }
         $this->taxonomy_terms = \CADB\Taxonomy::getTaxonomyTerms($txcids);
         foreach ($this->taxonomy_terms as $cid => $taxo_terms) {
             foreach ($taxo_terms as $tid => $terms) {
                 $this->buildAutocomplete($terms['name'], $terms['name'], 20);
             }
         }
     }
     \CADB\Organize::setMode('admin');
     $total_cnt = \CADB\Organize::totalCnt('', null);
     $orgs = \CADB\Organize::getList('', -1, 0, null);
     for ($i = 0; $i < $total_cnt; $i++) {
         $row = $orgs[$i];
         if ($row['nojo']) {
             $nojo = trim($row['nojo']);
             $this->buildAutocomplete($nojo, $nojo, 15);
             $this->spaceBuildAutocomplete($nojo, $nojo, 15);
             if (preg_match("/^전국/i", $nojo)) {
                 $nojo2 = preg_replace("/^전국/i", "", trim($nojo));
                 $this->buildAutocomplete($nojo2, $nojo, 15);
                 $this->spaceBuildAutocomplete($nojo2, $nojo, 15);
             }
         }
         for ($s = 1; $s <= 4; $s++) {
             $score = 15 - $s * 3;
             if ($row['sub' . $s]) {
                 $name = trim($row['sub' . $s]);
                 $this->buildAutocomplete($name, $name, $score);
                 $this->spaceBuildAutocomplete($name, $name, $score);
             }
         }
         if (is_array($this->fields['organize'])) {
             foreach ($this->fields['organize'] as $fid => $f) {
                 if ($row['f' . $fid]) {
                     $v = explode(",", $row['f' . $fid]);
                     for ($k = 0; $k < @count($v); $k++) {
                         $name = trim($v[$k]);
                         $this->buildAutocomplete($name, $name, 1);
                         $this->spaceBuildAutocomplete($name, $name, 1);
                     }
                 }
             }
         }
     }
     if (is_array($this->fields)) {
         foreach ($this->fields as $table => $fieldlist) {
             if ($table == 'organize') {
                 continue;
             }
         }
     }
     $this->remakeRedis();
 }
 private function delete()
 {
     \CADB\Fields\DBM::delete($this->field);
     if ($this->field['iscolumn']) {
         \CADB\Fields\DBM::dropColumn($this->params);
     }
     $this->fid = $this->params['fid'];
     \CADB\RespondJson::ResultPage(array($this->fid, '삭제되었습니다.'));
 }