Skip to content
Taiwen Jiang edited this page Mar 14, 2013 · 1 revision

For tag module:

  • Auto-complete whit bootstrap Typeahead
  • Margin tags
  • Block for each module
  • Tag status ( tag publish just when content publish )

Functional requirements

Admin

  • List
  • View tag related items list
  • Search
  • Delete
  • Statistics
  • Data maintenance
    • isolated tag

Block

  • Top tags (Top 10)
  • The newest tags that are related (Top 10)

Api for module

  • Add tags for item
  • Update tags form module's item
  • Delete content related
  • Get item related tags
  • Get item related tags amount
  • Get Fuzzy match tags
  • Get top n tags

Design

Database design

  • tag
name type property default value description
id int(10) unsigned not null auto increment
title varchar(255) not null auto increment ''
count int(10) not null 0 relative item amount
  • link
name type property default value description
id int(10) unsigned not null auto increment
tag int(10) unsigned not null 0 tag's id
module varchar(255) not null '' module name to which tag is belonged
item int(10) not null 0 item's id
time int(10) not null 0 correlation time

Controller and action design

  • Admin
    • IndexController
      • listAction
      • viewAction
      • deleteAction
    • SearchController
      • listAction
    • Statistics
      • topAction
      • newestAction
    • VerifyController
      • listAction
      • deleteAction
  • Block
    • top
    • newest
  • Form
    • Admin
      • SearchForm
  • Configuration
    • config.php
    • navigation.php
    • route.php

Api

Using

Pi::service('api')->tag->function();

ex: Pi::service('api')->tag->add('article', 10, array(tag1,tag2,tag3), time())

add

boll add(string $module, int $item, array $tags, int $time)
add() set item related tags

update

boll update(string $module, int $item, array $tags, int $time)
update item related tags

delete

boll delete(string $module, int $item)
delete() delete link which item's tags. when delete a item , this function should be used

getTags

boll getTags(string $module, int $item [,$limit])
getTags() return item's tags

getCount

boll getCount(string $module, int $item)
getCount() return item's tags amount

fuzzyMatch

boll fuzzyMatch(string $str [,$limit])
fuzzyMatch() return match str tags

topTag

boll topTag([$module] [,$limit])
topTag() return Top tags

Config design*

  • item_per_page
    • display of items on list page default 10