From ee497f0f0e91caa007ea7d6bd514b65f907cb76c Mon Sep 17 00:00:00 2001 From: ngleader Date: Mon, 4 May 2009 02:17:10 +0000 Subject: [PATCH] add function for tag model git-svn-id: http://xe-core.googlecode.com/svn/sandbox@6253 201d5d3c-b55e-5fd7-737f-ddc643e51545 --- modules/tag/queries/getDocumentSrlByTag.xml | 12 ++++++ modules/tag/queries/getDocumentsTagList.xml | 18 ++++++++ modules/tag/tag.model.php | 46 +++++++++++++++++++++ 3 files changed, 76 insertions(+) create mode 100644 modules/tag/queries/getDocumentSrlByTag.xml create mode 100644 modules/tag/queries/getDocumentsTagList.xml diff --git a/modules/tag/queries/getDocumentSrlByTag.xml b/modules/tag/queries/getDocumentSrlByTag.xml new file mode 100644 index 000000000..1ed8cc737 --- /dev/null +++ b/modules/tag/queries/getDocumentSrlByTag.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/modules/tag/queries/getDocumentsTagList.xml b/modules/tag/queries/getDocumentsTagList.xml new file mode 100644 index 000000000..0ecee7415 --- /dev/null +++ b/modules/tag/queries/getDocumentsTagList.xml @@ -0,0 +1,18 @@ + + +
+ + + + + + + + + + + + + + + diff --git a/modules/tag/tag.model.php b/modules/tag/tag.model.php index 606058384..d6b36cf77 100644 --- a/modules/tag/tag.model.php +++ b/modules/tag/tag.model.php @@ -34,5 +34,51 @@ return $output; } + + + /** + * @brief tag로 document_srl를 가져오기 + **/ + function getDocumentSrlByTag($obj){ + if(is_array($obj->module_srl)) $args->module_srl = implode(',', $obj->module_srl); + else $args->module_srl = $obj->module_srl; + + $args->tag = $obj->tag; + $output = executeQueryArray('tag.getDocumentSrlByTag', $args); + if(!$output->toBool()) return $output; + + return $output; + } + + /** + * @brief document 에서 사용된 tag 가져오기 + **/ + function getDocumentsTagList($obj){ + if(is_array($obj->document_srl)) $args->document_srl = implode(',', $obj->document_srl); + else $args->document_srl = $obj->document_srl; + + $output = executeQueryArray('tag.getDocumentsTagList', $args); + if(!$output->toBool()) return $output; + + return $output; + } + + /** + * @brief 특정tag과 함께 사용된 tag목록 + **/ + function getTagWithUsedList($obj){ + if(is_array($obj->module_srl)) $args->module_srl = implode(',', $obj->module_srl); + else $args->module_srl = $obj->module_srl; + + $args->tag = $obj->tag; + $output = $this->getDocumentSrlByTag($args); + $document_srl = array(); + + foreach($output->data as $k => $v) $document_srl[] = $v->document_srl; + unset($args); + $args->document_srl = $document_srl; + $output = $this->getDocumentsTagList($args); + return $output; + } } ?>