XpressEngine Core  1.11.2
 All Classes Namespaces Files Functions Variables Pages
tag.controller.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) NAVER <http://www.navercorp.com> */
8 class tagController extends tag
9 {
13  function init()
14  {
15  }
16 
21  {
22  if(!$obj->tags) return new BaseObject();
23  // tags by variable
24  $tag_list = explode(',', $obj->tags);
25  $tag_count = count($tag_list);
26  $tag_list = array_unique($tag_list);
27  if(!count($tag_list)) return new BaseObject();
28 
29  foreach($tag_list as $tag)
30  {
31  if(!trim($tag)) continue;
32  $arranged_tag_list[] = trim($tag);
33  }
34  if(!count($arranged_tag_list)) $obj->tags = null;
35  else $obj->tags = implode(',',$arranged_tag_list);
36  return new BaseObject();
37  }
38 
44  {
45  $module_srl = $obj->module_srl;
46  $document_srl = $obj->document_srl;
47  $tags = $obj->tags;
48  if(!$document_srl) return new BaseObject();
49  // Remove all tags that article
50  $output = $this->triggerDeleteTag($obj);
51  if(!$output->toBool()) return $output;
52  // Re-enter the tag
53  $args = new stdClass();
54  $args->module_srl = $module_srl;
55  $args->document_srl = $document_srl;
56 
57  $tag_list = explode(',',$tags);
58  $tag_count = count($tag_list);
59  for($i=0;$i<$tag_count;$i++)
60  {
61  unset($args->tag);
62  $args->tag = trim($tag_list[$i]);
63  if(!$args->tag) continue;
64  $output = executeQuery('tag.insertTag', $args);
65  if(!$output->toBool()) return $output;
66  }
67 
68  return new BaseObject();
69  }
70 
76  {
77  $document_srl = $obj->document_srl;
78  if(!$document_srl) return new BaseObject();
79 
80  $args = new stdClass();
81  $args->document_srl = $document_srl;
82  return executeQuery('tag.deleteTag', $args);
83  }
84 
89  {
90  $module_srl = $obj->module_srl;
91  if(!$module_srl) return new BaseObject();
92 
93  $oTagController = getAdminController('tag');
94  return $oTagController->deleteModuleTags($module_srl);
95  }
96 }
97 /* End of file tag.controller.php */
98 /* Location: ./modules/tag/tag.controller.php */
$obj
Definition: ko.install.php:262
high class of the tag module
Definition: tag.class.php:8
$output
Definition: ko.install.php:193
tag module&#39;s controller class
init()
Initialization.
triggerDeleteTag(&$obj)
Delete the tag trigger a specific article document_srl delete tag belongs to.
triggerArrangeTag(&$obj)
, (Comma) to clean up the tags attached to the trigger
$module_srl
integer value to represent a run-time instance of Module (XE Module)
$args
Definition: ko.install.php:185
triggerDeleteModuleTags(&$obj)
module delete trigger to delete all the tags
triggerInsertTag(&$obj)
Input trigger tag Enter a Tag to delete that article and then re-enter all the tags using a method...
$document_srl
Definition: ko.install.php:279
getAdminController($module_name)
Definition: func.inc.php:101
executeQuery($query_id, $args=NULL, $arg_columns=NULL)
Definition: func.inc.php:203