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->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 static function getFields($table = "all", $active = 1)
 {
     $context = \CADB\Model\Context::instance();
     if (!is_array($table)) {
         if ($table != 'all') {
             $table = array($table);
         }
     }
     $fields = array();
     self::$fields = $context->getProperty('fields');
     if (!self::$fields) {
         $dbm = \CADB\DBM::instance();
         $que = "SELECT * FROM {fields} " . ($active ? "WHERE active = '" . $active . "' " : "") . "ORDER BY `table` ASC, idx ASC";
         while ($row = $dbm->getFetchArray($que)) {
             self::$fields[$row['fid']] = self::fetchFields($row);
         }
         $context->setProperty('fields', self::$fields);
     }
     if ($table == 'all') {
         $fields = self::$fields;
     } else {
         foreach (self::$fields as $f => $v) {
             if (in_array($v['table'], $table)) {
                 $fields[$f] = $v;
             }
         }
     }
     return $fields;
 }
 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()
 {
     if (!$this->params['output']) {
         $this->params['output'] = 'json';
     }
     $context = \CADB\Model\Context::instance();
     if (!$this->params['nid']) {
         if ($this->params['output'] != 'json') {
             \CADB\Lib\Error('복사할 모범단체협약서 번호를 입력하세요.');
         } else {
             \CADB\RespondJson::ResultPage(array(-1, '복사할 모범단체협약서 번호를 입력하세요.'));
         }
     }
     $this->nid = \CADB\Guide\DBM::fork($this->params['nid']);
     if (!$this->nid) {
         if ($this->params['output'] != 'json') {
             \CADB\Lib\Error(\CADB\Guide\DBM::error());
         } else {
             \CADB\RespondJson::ResultPage(array(-1, \CADB\Guide\DBM::error()));
         }
     } else {
         if ($this->params['output'] != 'json') {
             \CADB\Lib\RedirectURL(\CADB\Lib\url("admin/standards/edit") . "?nid=" . $this->nid);
         } else {
             \CADB\RespondJson::ResultPage(array($this->nid, \CADB\Lib\url("admin/standards/edit") . "?nid=" . $this->nid));
         }
     }
 }
 public function process()
 {
     $this->params['output'] = 'json';
     $context = \CADB\Model\Context::instance();
     if ($this->params['cid'] && $this->params['q']) {
         $this->taxonomy = \CADB\Taxonomy::search($this->params['cid'], $this->params['q']);
         $this->result = array('cid' => $this->params['cid'], 'q' => $this->params['q'], 'total_cnt' => @count($this->taxonomy));
     } else {
         if ($this->params['cid']) {
             $this->taxonomy = \CADB\Taxonomy::getTaxonomyTerms($this->params['cid']);
             if ($this->params['type'] == 1) {
                 $taxonomy = array();
                 foreach ($this->taxonomy as $c => $taxonomies) {
                     foreach ($taxonomies as $t => $taxo) {
                         $taxonomy[] = $taxo;
                     }
                 }
                 $this->taxonomy = $taxonomy;
             }
             $this->result = array('cid' => $this->params['cid'], 'total_cnt' => @count($this->taxonomy));
         } else {
             $this->result = array('error' => '잘못된 검색입니다');
         }
     }
 }
 public function process()
 {
     $context = \CADB\Model\Context::instance();
     $this->layout = 'admin';
     if (!$this->params['oid']) {
         \CADB\Lib\Error("조직 고유아이디를 입력하세요.");
     }
     $this->fields = \CADB\Organize::getFieldInfo(1);
     $this->organize = \CADB\Organize::getOrganizeByOid($this->params['oid']);
     if (!$this->organize) {
         \CADB\Lib\Error("조직정보를 검색할 수 없습니다.");
     }
     $ret = \CADB\Organize\DBM::delete($this->fields, $this->params['oid']);
     if (!$ret) {
         foreach ($this->params as $k => $v) {
             if (preg_match("/^o[0-9]+\$/i", $k)) {
                 $args[$k] = $v;
             }
         }
         $queryString = $this->makeQuery($this->params['q'], $args);
         \CADB\Lib\RedirectURL('/admin/orgs/' . ($queryString ? "?" . $queryString : ""));
     } else {
         \CADB\Lib\Error(\CADB\Organize\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();
     if (!($rdb = $context->getProperty('service.redis'))) {
         $this->result = array('found' => false, 'error' => "자동완성 기능이 활성화되어 있지 않습니다.");
     } else {
         if (!$this->params['q']) {
             $this->result = array('found' => false, 'error' => "자동완성할 키워드를 입력하세요.");
         } else {
             $redis = new \Redis();
             try {
                 $redis->connect('127.0.0.1', '6379', 2.5, NULL, 150);
                 if ($redis->select($rdb) == false) {
                     $this->result = array('found' => false, 'error' => "index 1 database 에 연결할 수 없습니다.");
                 } else {
                     $this->recommand = $redis->zRange($this->params['q'], 0, -1);
                     if (@count($this->recommand)) {
                         $this->result = array('found' => true, 'total_cnt' => @count($this->recommand));
                     } else {
                         $this->result = array('found' => true, 'total_cnt' => 0);
                     }
                 }
             } catch (RedisException $e) {
                 var_dump($e);
             }
             $redis->close();
         }
     }
 }
 public function process()
 {
     \CADB\Lib\importResource('app-field-edit');
     $context = \CADB\Model\Context::instance();
     $this->layout = 'admin';
     $this->taxonomy = \CADB\Taxonomy\DBM::getTaxonomyList();
     $this->fields = \CADB\Organize::getFieldInfo(0);
 }
 public function process()
 {
     \CADB\Lib\importResource('es6-promise');
     \CADB\Lib\importResource('jquery-scrollTo');
     $this->react[] = 'public/js/bundle.js';
     $this->css[] = 'app-front.css';
     $context = \CADB\Model\Context::instance();
 }
 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' => '검색결과가 없습니다.');
         }
     }
 }
function requireMembership()
{
    $context = \CADB\Model\Context::instance();
    $domain = $context->getProperty('service.domain');
    $__Acl = \CADB\Acl::instance();
    if ($__Acl->getIdentity($domain) !== null) {
        return true;
    }
    \CADB\Lib\requireLogin();
}
 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(); */
 }
 function getPrivilege()
 {
     $context = \CADB\Model\Context::instance();
     $domain = $context->getProperty('service.domain');
     $session_type = $context->getProperty('session.type');
     if (!isset($this->acl)) {
         $classname = "CADB\\Model\\" . strtoupper($session_type);
         $acl = new $classname();
         $this->acl = $acl->getAcl($domain);
     }
 }
 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()
 {
     $this->layout = 'admin';
     //		$this->css[] = 'app-admin-member.css';
     $context = \CADB\Model\Context::instance();
     switch ($context->getProperty('session.type')) {
         case 'gnu5':
         default:
             $this->edit_component = 'member.gnu5.edit';
             break;
     }
 }
 public static function checkOrganize($oid)
 {
     $context = \CADB\Model\Context::instance();
     $domain = $context->getProperty('service.domain');
     $__Acl = \CADB\Acl::instance();
     if ($__Acl->imMaster()) {
         return true;
     }
     $role = $__Acl->getAcl();
     if ($_SESSION['acl'][$domain][$oid]) {
         return $__Acl->checkAcl($_SESSION['acl'][$domain][$oid]);
     }
     return false;
 }
 private static function getMember()
 {
     $context = \CADB\Model\Context::instance();
     switch ($context->getProperty('session.type')) {
         case 'gnu5':
         default:
             if ($_SESSION['user']['uid']) {
                 $member = \CADB\Member\Gnu5\User::getMember($_SESSION['user']['uid']);
                 $member['name'] = $member['mb_name'];
             }
             break;
     }
     return $member;
 }
 public function process()
 {
     $this->params['output'] = 'json';
     $context = \CADB\Model\Context::instance();
     $search_option = \CADB\Options::getOption('search_option');
     if ($search_option) {
         if (isset($this->params['option'])) {
             $this->search_option = $this->makeOption($search_option[$this->params['option']]);
         } else {
             foreach ($search_option as $i => $option) {
                 $this->search_option[$i] = $this->makeOption($option);
             }
         }
     }
 }
 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']);
     }
 }
function user_logged_in()
{
    $context = \CADB\Model\Context::instance();
    if ($_SESSION['user']['uid']) {
        return true;
    }
    switch ($context->getProperty('session.type')) {
        case "gnu5":
        default:
            if ($_SESSION['mb_id']) {
                return true;
            }
            break;
    }
    return false;
}
 public function process()
 {
     $this->layout = 'admin';
     //		$this->css[] = 'app-admin-member.css';
     $context = \CADB\Model\Context::instance();
     switch ($context->getProperty('session.type')) {
         case 'gnu5':
         default:
             $this->member = \CADB\Member\Gnu5\User::getMember($this->params['mb_no']);
             if (!$this->member) {
                 \CADB\Lib\Error('존재하지 않는 회원입니다.');
             }
             $this->edit_component = 'member.gnu5.edit';
             break;
     }
 }
 public function themeFooter()
 {
     $context = \CADB\Model\Context::instance();
     if (!$this->themes) {
         $this->themes = $context->getProperty('service.themes');
     }
     $this->initTheme();
     $footer_file = $this->LayoutFooter();
     if ($footer_file) {
         extract((array) $this);
         ob_start();
         include_once $footer_file;
         $html = ob_get_contents();
         ob_end_clean();
         print $html;
     }
 }
 public function process()
 {
     $this->layout = 'admin';
     //		$this->css[] = 'app-admin-standard.css';
     $context = \CADB\Model\Context::instance();
     if (!$this->params['page']) {
         $this->params['page'] = 1;
     }
     $this->total_cnt = \CADB\Guide\DBM::totalCnt($this->params['q']);
     $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->standards = \CADB\Guide\DBM::getList($this->params['q'], $this->params['page'], $this->limit);
     }
     $this->queryString = "?" . $this->makeQuery($this->params['q']);
     $this->pagelink = \CADB\Lib\url("admin/standards") . "?" . $this->makeQuery($this->params['q']);
 }
 public function readResourceMap()
 {
     if (!$this->resoure_map) {
         $context = \CADB\Model\Context::instance();
         $map_file = CADB_PATH . "/config/resources.map.json";
         if (file_exists($map_file)) {
             $fp = fopen($map_file, "r");
             $json = trim(fread($fp, filesize($map_file)));
             fclose($fp);
             $this->resource_map = json_decode($json, true);
         }
         $browser = new \Browser();
         if ($browser->getBrowser() == \Browser::BROWSER_IE && $browser->getVersion() <= 9) {
             $fallback_map_file = CADB_PATH . "/config/resources.map.fallback.json";
             $this->mergeMap($fallback_map_file, "", true);
         }
     }
     return $this->resource_map;
 }
 public function process()
 {
     $context = \CADB\Model\Context::instance();
     $this->params['table'] = 'guide';
     $this->params['mode'] = 'delete';
     if (!$this->params['nid']) {
         \CADB\Lib\Error('모범단협 번호를 지정하세요');
     }
     $this->guide = \CADB\Guide\DBM::getGuide($this->params['nid']);
     if (!$this->guide) {
         \CADB\Lib\Error('존재하지 않는 모범단협번호입니다');
     }
     if (!$this->themes) {
         $this->themes = $context->getProperty('service.themes');
     }
     \CADB\Guide\DBM::deleteGuide($this->guide);
     $this->nid = $this->params['nid'];
     \CADB\Lib\RedirectURL('/admin/standards');
 }
 public function process()
 {
     $this->params['output'] = 'json';
     $context = \CADB\Model\Context::instance();
     $this->fields = \CADB\Organize::getFieldInfo(1);
     /* check field type */
     if ($this->params['mode'] == 'delete') {
         if (!$this->params['oid']) {
             \CADB\RespondJson::ResultPage(array(-1, '삭제할 단체 번호를 입력하세요'));
         }
     } else {
         if (!$this->params['nojo']) {
             \CADB\RespondJson::ResultPage(array(-1, '노조명을 입력하세요'));
         }
         foreach ($this->fields as $fid => $v) {
             if ($v['required']) {
                 if (!$this->params['f' . $fid]) {
                     \CADB\RespondJson::ResultPage(array($fid, $v['subject'] . '을 입력하세요'));
                 }
             }
         }
     }
     if ($this->params['oid']) {
         $this->organize = \CADB\Organize::getOrganizeByOid($this->params['oid']);
         if (!$this->organize) {
             \CADB\RespondJson::ResultPage(array(-2, '존재하지 않는 단체입니다.'));
         }
         if ($this->params['mode'] == 'delete') {
             $ret = \CADB\Organize\DBM::delete($this->fields, $this->params['oid']);
         } else {
             $ret = \CADB\Organize\DBM::modify($this->fields, $this->organize, $this->params);
         }
         if ($ret < 0) {
             \CADB\RespondJson::ResultPage(array(-3, '데이터베이스를 수정하는 도중 장애가 발생했습니다.'));
         }
     } else {
         $ret = \CADB\Organize\DBM::insert($this->fields, $this->params);
         if ($ret < 0) {
             \CADB\RespondJson::ResultPage(array(-3, \CADB\Organize\DBM::errorMsg() ? \CADB\Organize\DBM::errorMsg() : '데이터베이스에 입력하는 도중 장애가 발생했습니다.'));
         }
     }
     $this->oid = $ret;
 }
 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()
 {
     $this->params['output'] = 'json';
     $context = \CADB\Model\Context::instance();
     switch ($context->getProperty('session.type')) {
         case 'gnu5':
         default:
             $this->checkfield_gnu5();
             if ($this->params['mode'] == 'modify') {
                 $ret = \CADB\Member\Gnu5\User::modify($this->member, $this->params);
             } else {
                 $ret = \CADB\Member\Gnu5\User::add($this->params);
             }
             if ($ret < 0) {
                 \CADB\RespondJson::ResultPage(array(-10, \CADB\Member\Gnu5\User::errorMsg() ? \CADB\Member\Gnu5\User::errorMsg() : '데이터베이스에 입력하는 도중 장애가 발생했습니다.'));
             }
             $this->mb_no = $ret;
             break;
     }
 }