public function process() { $context = \CADB\Model\Context::instance(); $this->layout = 'admin'; if (!$this->themes) { $this->themes = $context->getProperty('service.themes'); } $this->fields = \CADB\Agreement::getFieldInfo(1); $g_cids = \CADB\Guide::getTaxonomy(); foreach ($g_cids as $id) { $this->guide_taxonomy_terms[$id] = \CADB\Guide::getRelativeGuideTerm($id); } $this->taxonomy = $this->fields['taxonomy']; $taxonomy_cids = array(); foreach ($this->fields['field'] as $fid => $f) { if ($f['table'] == 'agreement') { if ($f['type'] == 'taxonomy') { $taxonomy_cids[] = $f['cid']; } } } if (count($taxonomy_cids)) { $this->taxonomy += \CADB\Taxonomy::getTaxonomy($taxonomy_cids); } $cids = array_keys($this->taxonomy); if ($cids) { $taxonomy_terms = \CADB\Taxonomy::getTaxonomyTerms($cids); foreach ($taxonomy_terms as $cid => $terms) { $this->taxonomy_terms[$cid] = \CADB\Taxonomy::makeTree($terms); } } }
public function process() { $context = \CADB\Model\Context::instance(); $this->layout = 'admin'; if (!$this->params['nid']) { \CADB\Lib\Error("단체협약서 번호를 입력하세요."); } if (!$this->themes) { $this->themes = $context->getProperty('service.themes'); } $this->fields = \CADB\Agreement::getFieldInfo(1); $this->articles = \CADB\Agreement::getAgreement($this->params['nid'], $this->params['did'] ? $this->params['did'] : 0); if (!$this->articles) { \CADB\Lib\Error("존재하지 않는 단체협약입니다."); } if (\CADB\Privilege::checkAgreement($this->articles) == false) { \CADB\Lib\Error('접근 권한이 없습니다.'); } $ret = \CADB\Agreement\DBM::delete($this->fields, $this->params['nid']); if (!$ret) { foreach ($this->params as $k => $v) { if (preg_match("/^[ao]{1}[0-9]+\$/i", $k)) { $args[$k] = $v; } } $queryString = $this->makeQuery($this->params['q'], $args); \CADB\Lib\RedirectURL('/admin/articles/' . ($queryString ? "?" . $queryString : "")); } else { \CADB\Lib\Error(\CADB\Agreement\DBM::errorMsg()); } }
public function process() { $this->layout = 'admin'; $this->css[] = 'app-admin-article.css'; $context = \CADB\Model\Context::instance(); \CADB\Agreement::setMode('admin'); $fields = \CADB\Agreement::getFieldInfo(1); foreach ($fields['field'] as $f => $v) { if ($v['table'] == 'agreement') { $this->fields['article'][] = array('field' => 'f' . $f, 'subject' => $v['subject'], 'type' => $v['type'], 'multiple' => $v['multiple'] ? true : false, 'cid' => $v['cid']); } } foreach ($this->params as $k => $v) { if (preg_match("/^[ao]{1}[0-9]+\$/i", $k)) { $args[$k] = $v; } } if (!$this->params['page']) { $this->params['page'] = 1; } $this->total_cnt = \CADB\Agreement::totalCnt($this->params['q'], $args); $this->page = $this->params['page']; $this->limit = $this->params['limit'] ? $this->params['limit'] : 15; $this->total_page = (int) (($this->total_cnt - 1) / $this->limit) + 1; if ($this->total_cnt && $this->params['page'] <= $this->total_page) { $this->articles = \CADB\Agreement::getList($this->params['q'], $this->params['page'], $this->limit, $args); } $this->queryString = "?" . $this->makeQuery($this->params['q'], $args); $this->pagelink = \CADB\Lib\url("admin/articles") . "?" . $this->makeQuery($this->params['q'], $args); }
public function process() { $this->params['output'] = 'json'; $context = \CADB\Model\Context::instance(); $fields = \CADB\Agreement::getFieldInfo(1); $this->fields['standard'] = array(); $this->fields['article'] = array(); foreach ($fields['field'] as $f => $v) { if ($v['table'] == 'agreement') { $this->fields['article'][] = array('field' => 'f' . $f, 'subject' => $v['subject'], 'type' => $v['type'], 'multiple' => $v['multiple'] ? true : false, 'cid' => $v['cid']); } } 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'); } foreach ($this->params as $k => $v) { if (preg_match("/^[ao]{1}[0-9]+\$/i", $k)) { $args[$k] = $v; } } if ($this->params['nid']) { $this->articles = \CADB\Agreement::getAgreement($this->params['nid'], $this->params['did'] ? $this->params['did'] : 0, $this->params['q'], $args); if (\CADB\Privilege::checkAgreement($this->articles)) { $this->articles['owner'] = 1; } else { $this->articles['owner'] = 0; } if ($this->articles) { $this->result = array('found' => true); } else { $this->result = array('found' => false, 'error' => '존재하지 않는 단협입니다.'); } } else { if (!$this->params['page']) { $this->params['page'] = 1; } $this->standard = array(); if ($this->params['mode'] == 'init') { $nid = \CADB\Guide::getCurrent($this->params['nid'] ? $this->params['nid'] : 1); $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)) { $g_args[$k] = $v; } } $this->standard = \CADB\Guide::getList($this->params['q'], $g_args); $this->result['standard'] = array('q' => $this->params['q'], 'taxonomy' => $args, 'count' => @count($this->standard) > 0 ? @count($this->standard) : 0); } $total_cnt = \CADB\Agreement::totalCnt($this->params['q'], $args); $total_page = (int) (($total_cnt - 1) / ($this->params['limit'] ? $this->params['limit'] : 20)) + 1; if ($total_cnt && $this->params['page'] <= $total_page) { $this->articles = \CADB\Agreement::getList($this->params['q'], $this->params['page'], $this->params['limit'] ? $this->params['limit'] : 20, $args); $this->result['articles'] = array('total_cnt' => $total_cnt, 'total_page' => $total_page, 'page' => $this->params['page'], 'count' => @count($this->articles)); } else { $this->result['articles'] = array('total_cnt' => $total_cnt, 'total_page' => $total_page, 'page' => $this->params['page'], 'count' => 0, 'error' => '검색결과가 없습니다.'); } } }
public function process() { $context = \CADB\Model\Context::instance(); if (!$this->params['nid']) { Error('단체협약서 번호를 입력하세요.'); } if (!$this->themes) { $this->themes = $context->getProperty('service.themes'); } $this->fields = \CADB\Agreement::getFieldInfo(1); $this->articles = \CADB\Agreement::getAgreement($this->params['nid'], $this->params['did'] ? $this->params['did'] : 0); if (!$this->articles) { Error('존재하지 않는 단체협약입니다.'); } if (\CADB\Privilege::checkAgreement($this->articles) == false) { Error('접근 권한이 없습니다.'); } $g_cids = \CADB\Guide::getTaxonomy(); foreach ($g_cids as $id) { $this->guide_taxonomy_terms[$id] = \CADB\Guide::getRelativeGuideTerm($id); } $this->taxonomy = $this->fields['taxonomy']; $taxonomy_cids = array(); foreach ($this->fields['field'] as $fid => $f) { if ($f['table'] == 'agreement') { if ($f['type'] == 'taxonomy') { $taxonomy_cids[] = $f['cid']; } } } if (count($taxonomy_cids)) { $this->taxonomy += \CADB\Taxonomy::getTaxonomy($taxonomy_cids); } $cids = array_keys($this->taxonomy); if ($cids) { $taxonomy_terms = \CADB\Taxonomy::getTaxonomyTerms($cids); foreach ($taxonomy_terms as $cid => $terms) { $this->taxonomy_terms[$cid] = \CADB\Taxonomy::makeTree($terms); } } /* ob_start(); $theme_html_file = ""; if($this->themes) { $theme_html_file = CADB_PATH."/themes/".$this->themes."/articles/pdf.html.php"; if($theme_html_file && file_exists($theme_html_file)) { include $theme_html_file; } else { include dirname(__FILE__)."/pdf.html.php"; } } else { include dirname(__FILE__)."/pdf.html.php"; } $content = ob_get_contents(); ob_end_clean(); */ }
public function process() { $context = \CADB\Model\Context::instance(); $this->layout = 'admin'; if (!$this->params['nid']) { \CADB\Lib\Error('단체협약서 번호를 입력하세요.'); } if (!$this->themes) { $this->themes = $context->getProperty('service.themes'); } $this->fields = \CADB\Agreement::getFieldInfo(1); $this->articles = \CADB\Agreement::getAgreement($this->params['nid'], $this->params['did'] ? $this->params['did'] : 0); if (!$this->articles) { \CADB\Lib\Error('존재하지 않는 단체협약입니다.'); } if (\CADB\Privilege::checkAgreement($this->articles) == false) { \CADB\Lib\Error('접근 권한이 없습니다.'); } $g_cids = \CADB\Guide::getTaxonomy(); foreach ($g_cids as $id) { $this->guide_taxonomy_terms[$id] = \CADB\Guide::getRelativeGuideTerm($id); } $this->taxonomy = $this->fields['taxonomy']; $taxonomy_cids = array(); foreach ($this->fields['field'] as $fid => $f) { if ($f['table'] == 'agreement') { if ($f['type'] == 'taxonomy') { $taxonomy_cids[] = $f['cid']; } } } if (count($taxonomy_cids)) { $this->taxonomy += \CADB\Taxonomy::getTaxonomy($taxonomy_cids); } $cids = array_keys($this->taxonomy); if ($cids) { $taxonomy_terms = \CADB\Taxonomy::getTaxonomyTerms($cids); foreach ($taxonomy_terms as $cid => $terms) { $this->taxonomy_terms[$cid] = \CADB\Taxonomy::makeTree($terms); } } }
public function process() { $context = \CADB\Model\Context::instance(); $this->layout = 'admin'; if (!$this->params['oid']) { \CADB\Lib\Error("조직 고유아이디를 입력하세요."); } if (!$this->themes) { $this->themes = $context->getProperty('service.themes'); } $this->fields = \CADB\Organize::getFieldInfo(1); $this->organize = \CADB\Organize::getOrganizeByOid($this->params['oid']); if (!$this->organize) { \CADB\Lib\Error("조직정보를 검색할 수 없습니다."); } $agreement = \CADB\Agreement::getAgreementsByOid($this->params['oid']); // $this->fields['nid'] = array('subject' => '단체협약','type'=>'int','multiple'=>true); if ($agreement && is_array($agreement)) { foreach ($agreement as $ag) { $this->organize['nid'][] = array('nid' => $ag['nid'], 'did' => $ag['did'], 'subject' => $ag['subject']); } } foreach ($this->fields as $fid => $f) { if ($f['type'] == 'taxonomy') { $taxonomy_cids[] = $f['cid']; } } if (count($taxonomy_cids)) { $this->taxonomy = \CADB\Taxonomy::getTaxonomy($taxonomy_cids); } $cids = array_keys($this->taxonomy); if ($cids) { $taxonomy_terms = \CADB\Taxonomy::getTaxonomyTerms($cids); foreach ($taxonomy_terms as $cid => $terms) { $this->taxonomy_terms[$cid] = \CADB\Taxonomy::makeTree($terms); } } }
public function process() { $this->params['output'] = 'json'; $context = \CADB\Model\Context::instance(); $fields = \CADB\Fields::getFields('all', 1); $this->fields = array(); foreach ($fields as $f => $v) { if (!$this->fields[$v['table']]) { $this->fields[$v['table']] = array(); } $this->fields[$v['table']][] = array('field' => 'f' . $f, 'subject' => $v['subject'], 'type' => $v['type'], 'multiple' => $v['multiple'] ? true : false, 'cid' => $v['cid']); } $this->fields['owner'][] = array('field' => 'owner', 'subject' => '운영자', 'type' => 'int', 'multiple' => false); $this->fields['organize'][] = array('field' => 'nid', 'subject' => '단체협약', 'type' => 'int', 'multiple' => true); $nid = \CADB\Guide::getCurrent($this->params['nid'] ? $this->params['nid'] : 1); foreach ($this->params as $k => $v) { if (preg_match("/^[ao]{1}[0-9]+\$/i", $k)) { $args[$k] = $v; } } 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'); } $this->params['page'] = 1; /* organize search */ $organize_total_cnt = \CADB\Organize::totalCnt($this->params['q'], $args); $organize_total_page = (int) (($organize_total_cnt - 1) / ($this->params['limit'] ? $this->params['limit'] : 10)) + 1; if ($organize_total_cnt) { $this->organize = \CADB\Organize::getList($this->params['q'], 1, $this->params['limit'] ? $this->params['limit'] : 10, $args); for ($i = 0; $i < count($this->organize); $i++) { if (\CADB\Privilege::checkOrganizes($this->organize[$i])) { $this->organize[$i]['owner'] = 1; } else { $this->organize[$i]['owner'] = 0; } $this->organize[$i]['nid'] = array(); $agreement = \CADB\Agreement::getAgreementsByOid($this->organize[$i]['oid'], $this->organize[$i]['vid']); if ($agreement && is_array($agreement)) { foreach ($agreement as $ag) { $this->organize[$i]['nid'][] = array('nid' => $ag['nid'], 'did' => $ag['did'], 'subject' => $ag['subject']); } } } $this->result['orgs'] = array('total_cnt' => $organize_total_cnt, 'total_page' => $organize_total_page, 'count' => @count($this->organize), 'more' => $organize_total_cnt > @count($this->organize) ? 1 : 0); } else { $this->result['orgs'] = array('total_cnt' => 0, 'total_page' => 0, 'count' => 0, 'more' => 0, 'error' => '검색결과가 없습니다.'); } /* standard guide */ $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)) { $g_args[$k] = $v; } } $this->standard = \CADB\Guide::getList($this->params['q'], $g_args); $this->result['standard'] = array('q' => $this->params['q'], 'taxonomy' => $args, 'count' => @count($this->standard) > 0 ? @count($this->standard) : 0); /* articles */ \CADB\Agreement::setTaxonomy($taxonomys); $total_cnt = \CADB\Agreement::totalCnt($this->params['q'], $args); $total_page = (int) (($total_cnt - 1) / ($this->params['limit'] ? $this->params['limit'] : 10)) + 1; if ($total_cnt) { $this->articles = \CADB\Agreement::getList($this->params['q'], 1, $this->params['limit'] ? $this->params['limit'] : 10, $args); $this->result['articles'] = array('total_cnt' => $total_cnt, 'total_page' => $total_page, 'count' => @count($this->articles), 'more' => $total_cnt > @count($this->articles) ? 1 : 0); } else { $this->result['articles'] = array('total_cnt' => 0, 'total_page' => 0, 'count' => 0, 'more' => 0, 'error' => '검색결과가 없습니다.'); } }
public function process() { $context = \CADB\Model\Context::instance(); if (!$this->params['nid']) { Error('단체협약서 번호를 입력하세요.'); } if (!$this->themes) { $this->themes = $context->getProperty('service.themes'); } $this->fields = \CADB\Agreement::getFieldInfo(1); $this->articles = \CADB\Agreement::getAgreement($this->params['nid'], $this->params['did'] ? $this->params['did'] : 0); if (!$this->articles) { Error('존재하지 않는 단체협약입니다.'); } \CADB\Log::articleLog('pdf', $this->params['nid'], $this->params['did'] ? $this->params['did'] : 0, "단체협약: [" . $this->articles['subject'] . "]을 PDF 조회했습니다."); $pdf = new \TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); // set document information $pdf->SetCreator(PDF_CREATOR); $pdf->SetAuthor($context->getProperty('service.title')); $pdf->SetTitle($this->articles['subject']); $pdf->SetSubject($this->articles['subject']); $pdf->SetKeywords(preg_replace("/[ ]{1,}/i", ", ", $this->article['subject'])); // set default header data $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, $context->getProperty('service.title'), $context->getProperty('service.domain'), array(0, 64, 255), array(0, 64, 128)); $pdf->setFooterData(array(0, 64, 0), array(0, 64, 128)); // set header and footer fonts $pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); $pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); // set default monospaced font $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); // set margins $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); $pdf->SetHeaderMargin(PDF_MARGIN_HEADER); $pdf->SetFooterMargin(PDF_MARGIN_FOOTER); // set auto page breaks $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); // set image scale factor $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); // set default font subsetting mode $pdf->setFontSubsetting(true); $pdf->SetFont('nanumbarungothic', '', 14, '', true); $pdf->AddPage(); // set text shadow effect $pdf->setTextShadow(array('enabled' => true, 'depth_w' => 0.2, 'depth_h' => 0.2, 'color' => array(196, 196, 196), 'opacity' => 1, 'blend_mode' => 'Normal')); $pdf->writeHTMLCell(0, 0, '', '', '<h1>' . $this->articles['subject'] . '</h1><br><br>', 0, 1, 0, true, '', true); ob_start(); $theme_html_file = ""; if ($this->themes) { $theme_html_file = CADB_PATH . "/themes/" . $this->themes . "/articles/pdf.html.php"; if ($theme_html_file && file_exists($theme_html_file)) { include $theme_html_file; } else { include dirname(__FILE__) . "/pdf.html.php"; } } else { include dirname(__FILE__) . "/pdf.html.php"; } $content = ob_get_contents(); ob_end_clean(); $pdf->SetFont('nanumbarungothic', '', 12, '', true); $pdf->writeHTML($content, true, false, false, false, 'center'); $pdf->SetFont('nanumbarungothic', '', 14, '', true); $pdf->writeHTMLCell(0, 0, '', '', $this->articles['content'], 0, 1, 0, true, '', true); $pdf->Output($this->articles['subject'] . '.pdf', 'I'); }
public function process() { $this->params['output'] = 'json'; $context = \CADB\Model\Context::instance(); $fields = \CADB\Agreement::getFieldInfo(1); $this->fields = array(); foreach ($fields['field'] as $f => $v) { if ($v['table'] == 'agreement') { $this->fields[$f] = $v; } } /* check field type */ if ($this->params['mode'] == 'delete' || $this->params['mode'] == 'fork') { if (!$this->params['nid']) { \CADB\RespondJson::ResultPage(array(-1, '단체협약 번호를 입력하세요')); } if ($this->params['mode'] == 'fork') { if (!$this->params['did']) { \CADB\RespondJson::ResultPage(array(-1, '단체협약 버젼번호를 입력하세요')); } } } else { if (!$this->params['subject']) { \CADB\RespondJson::ResultPage(array(-1, '단협 제목을 입력하세요')); } if (!$this->params['content']) { \CADB\RespondJson::ResultPage(array(-2, '단협 내용을 입력하세요')); } foreach ($this->fields as $fid => $v) { if ($v['required']) { if (!$this->params['f' . $fid]) { \CADB\RespondJson::ResultPage(array($fid, $v['subject'] . '을 입력하세요')); } } } } if ($this->params['nid']) { $this->articles = \CADB\Agreement::getAgreement($this->params['nid'], $this->params['did']); if (!$this->articles) { \CADB\RespondJson::ResultPage(array(-3, '존재하지 않는 단협입니다.')); } if ($this->params['mode'] == 'delete') { $ret = \CADB\Agreement\DBM::delete($this->fields, $this->params['nid']); } else { if ($this->params['mode'] == 'fork') { $ret = \CADB\Agreement\DBM::fork($this->fields, $this->params['nid'], $this->params['did']); } else { $ret = \CADB\Agreement\DBM::modify($this->fields, $this->articles, $this->params); } } if ($ret < 0) { \CADB\RespondJson::ResultPage(array(-4, '데이터베이스를 수정하는 도중 장애가 발생했습니다.')); } } else { $ret = \CADB\Agreement\DBM::insert($this->fields, $this->params); if ($ret < 0) { \CADB\RespondJson::ResultPage(array(-4, \CADB\Agreement\DBM::errorMsg() ? \CADB\Agreement\DBM::errorMsg() : '데이터베이스에 입력하는 도중 장애가 발생했습니다.')); } } $this->nid = $ret; }