mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-06 10:11:38 +09:00
- 트리거 등 반환값이 필요하지 않은 곳에서 new BaseObject()를 반환하는 것 삭제 - 모듈 설치, 업데이트 후 무의미한 new BaseObject()를 반환하는 것 삭제 - 사용자에게 에러 메시지를 돌려주는 용도로 new BaseObject(-1, '에러메시지')를 사용하는 경우는 대부분 $this->setError()로 변경함. 언어 변환과 sprintf() 처리까지 한 번에 이루어지므로 이쪽이 더 편리함.
99 lines
2.2 KiB
PHP
99 lines
2.2 KiB
PHP
<?php
|
|
/* Copyright (C) NAVER <http://www.navercorp.com> */
|
|
/**
|
|
* @class tagController
|
|
* @author NAVER (developers@xpressengine.com)
|
|
* @brief tag module's controller class
|
|
*/
|
|
class tagController extends tag
|
|
{
|
|
/**
|
|
* @brief Initialization
|
|
*/
|
|
function init()
|
|
{
|
|
}
|
|
|
|
/**
|
|
* @brief , (Comma) to clean up the tags attached to the trigger
|
|
*/
|
|
function triggerArrangeTag(&$obj)
|
|
{
|
|
if(!$obj->tags) return;
|
|
// tags by variable
|
|
$arranged_tag_list = array();
|
|
$tag_list = explode(',', $obj->tags);
|
|
foreach($tag_list as $tag)
|
|
{
|
|
$tag = utf8_trim(utf8_normalize_spaces($tag));
|
|
if($tag)
|
|
{
|
|
$arranged_tag_list[$tag] = $tag;
|
|
}
|
|
}
|
|
if(!count($arranged_tag_list))
|
|
{
|
|
$obj->tags = null;
|
|
}
|
|
else
|
|
{
|
|
$obj->tags = implode(',', $arranged_tag_list);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* @brief Input trigger tag
|
|
* Enter a Tag to delete that article and then re-enter all the tags using a method
|
|
*/
|
|
function triggerInsertTag(&$obj)
|
|
{
|
|
$module_srl = $obj->module_srl;
|
|
$document_srl = $obj->document_srl;
|
|
$tags = $obj->tags;
|
|
if(!$document_srl) return;
|
|
// Remove all tags that article
|
|
$output = $this->triggerDeleteTag($obj);
|
|
if(!$output->toBool()) return $output;
|
|
// Re-enter the tag
|
|
$args = new stdClass();
|
|
$args->module_srl = $module_srl;
|
|
$args->document_srl = $document_srl;
|
|
|
|
$tag_list = explode(',', $tags);
|
|
foreach($tag_list as $tag)
|
|
{
|
|
$args->tag = utf8_trim(utf8_normalize_spaces($tag));
|
|
if(!$args->tag) continue;
|
|
$output = executeQuery('tag.insertTag', $args);
|
|
if(!$output->toBool()) return $output;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* @brief Delete the tag trigger a specific article
|
|
* document_srl delete tag belongs to
|
|
*/
|
|
function triggerDeleteTag(&$obj)
|
|
{
|
|
$document_srl = $obj->document_srl;
|
|
if(!$document_srl) return;
|
|
|
|
$args = new stdClass();
|
|
$args->document_srl = $document_srl;
|
|
return executeQuery('tag.deleteTag', $args);
|
|
}
|
|
|
|
/**
|
|
* @brief module delete trigger to delete all the tags
|
|
*/
|
|
function triggerDeleteModuleTags(&$obj)
|
|
{
|
|
$module_srl = $obj->module_srl;
|
|
if(!$module_srl) return;
|
|
|
|
$oTagController = getAdminController('tag');
|
|
return $oTagController->deleteModuleTags($module_srl);
|
|
}
|
|
}
|
|
/* End of file tag.controller.php */
|
|
/* Location: ./modules/tag/tag.controller.php */
|