public function process() { $this->params['output'] = 'json'; $context = \CADB\Model\Context::instance(); $fields = \CADB\Guide::getFieldInfo(1); if (!$this->params['id']) { $this->result = array('found' => false, 'error' => '모범단협 조항번호를 입력하세요'); } else { $this->fields = array(); foreach ($fields as $f => $v) { $this->fields[] = array('field' => 'f' . $f, 'subject' => $v['subject'], 'type' => $v['type'], 'multiple' => $v['multiple'] ? true : false, 'cid' => $v['cid']); } $this->standard = \CADB\Guide::getClause($this->params['id']); if (!$this->standard) { $this->result = array('found' => false, 'error' => '존재하지 않는 모범단협 조항입니다'); } else { $this->result = array('found' => true); $terms = \CADB\Guide\DBM::getClauseTaxonomyTerms($this->standard['nid'], $this->standard['id']); $this->standard['taxonomy'] = []; if (is_array($terms)) { $this->standard['taxonomy'] = []; foreach ($terms as $t => $taxo) { $this->standard['taxonomy'][] = array('tid' => $t, 'cid' => $taxo['cid'], 'name' => $taxo['name']); } } } } }
public function process() { $this->params['output'] = 'json'; $context = \CADB\Model\Context::instance(); $fields = \CADB\Guide::getFieldInfo(1); if ($this->params['q'] && !mb_detect_encoding($this->params['q'], 'UTF-8', true)) { $this->params['q'] = mb_convert_encoding($this->params['q'], 'utf-8', 'euckr'); } $nid = \CADB\Guide::getCurrent($this->params['nid'] ? $this->params['nid'] : 1); if ($this->params['id'] || $this->params['tid']) { $this->fields = array(); foreach ($fields as $f => $v) { $this->fields[] = array('field' => 'f' . $f, 'subject' => $v['subject'], 'type' => $v['type'], 'multiple' => $v['multiple'] ? true : false, 'cid' => $v['cid']); } if ($this->params['id']) { $this->standard = \CADB\Guide::getClause($this->params['id']); } else { if ($this->params['tid']) { $this->standard = \CADB\Guide::getClauseByTaxonomy($this->params['tid']); } } if ($this->standard) { $this->result = array('found' => true); } else { $this->result = array('found' => false, 'error' => '존재하지 모범단협 조항입니다.'); } $this->indexes = array(); if ($this->params['mode'] == 'init') { $clauses = \CADB\Guide::getClauses(); foreach ($clauses as $i => $cl) { if (!$cl['parent']) { $cl['nsubs'] = 0; $cl['articles'] = array(); $this->indexes[$i] = $cl; $index_map[$cl['id']] = $i; } else { $idx = $index_map[$cl['parent']]; $this->indexes[$idx]['articles'][] = $cl; $this->indexes[$idx]['nsubs']++; } } } } else { $taxonomys = \CADB\Guide::getTaxonomy($nid); foreach ($this->params as $k => $v) { if (preg_match("/^a[0-9]+\$/i", $k) && in_array((int) substr($k, 1), $taxonomys)) { $args[$k] = $v; } } $this->standard = \CADB\Guide::getList($this->params['q'], $args); $this->result = array('standards' => array('q' => $this->params['q'], 'taxonomy' => $args, 'count' => @count($this->standard) > 0 ? @count($this->standard) : 0)); } }
public function process() { $context = \CADB\Model\Context::instance(); \CADB\Lib\importResource('app-guide-edit'); $this->layout = 'admin'; if (!$this->params['nid']) { \CADB\Lib\Error('모범단체협약서 번호를 입력하세요.'); } if (!$this->themes) { $this->themes = $context->getProperty('service.themes'); } $this->fields = \CADB\Guide::getFieldInfo(1); $this->guide = \CADB\Guide\DBM::getGuide($this->params['nid']); if (!$this->guide) { \CADB\Lib\Error('존재하지않는 모범단체협약서입니다.'); } $this->taxonomylist = \CADB\Taxonomy\DBM::getTaxonomyList(); $taxonomys = \CADB\Guide\DBM::getTaxonomy($this->guide['cid']); $this->taxonomy = \CADB\Taxonomy::getTaxonomy($taxonomys); $taxonomy_terms = \CADB\Taxonomy::getTaxonomyTerms($taxonomys); foreach ($taxonomy_terms as $c => $taxo) { foreach ($taxo as $t => $term) { $this->taxonomy_terms[$c][$term['parent']][$t] = $term; } } $this->current_taxonomys = $taxonomys; $clauses = \CADB\Guide\DBM::getClauses($this->params['nid']); $c = 0; foreach ($clauses as $i => $cl) { if (!$c) { $this->preamble = \CADB\Guide::getClause($cl['id']); } if (!$cl['parent']) { $cl['nsubs'] = 0; $cl['articles'] = array(); $this->indexes[$i] = $cl; $index_map[$cl['id']] = $i; } else { $idx = $index_map[$cl['parent']]; $this->indexes[$idx]['articles'][] = $cl; $this->indexes[$idx]['nsubs']++; } $c++; } if ($this->preamble) { $this->preamble['terms'] = \CADB\Guide\DBM::getClauseTerms($this->guide['vid'], $this->preamble['id']); } }
private function validateClause() { if ($this->params['mode'] != 'add') { if (!$this->params['id']) { \CADB\RespondJson::ResultPage(array(-1, '모범단협 조항번호를 지정하세요')); } $this->clause = \CADB\Guide::getClause($this->params['id']); if (!$this->clause) { \CADB\RespondJson::ResultPage(array(-1, '존재하지 않는 모범단협 조항번호입니다')); } } if ($this->params['mode'] != 'delete') { if (!$this->params['subject']) { \CADB\RespondJson::ResultPage(array(-2, '모범단협 조항제목을 입력하세요')); } } }