コード例 #1
0
ファイル: TagController.php プロジェクト: jaakkop/site
 /**
  *	viewAction
  *
  *	Tag index
  *
  */
 public function viewAction()
 {
     $this->view->title = 'tag-view-title';
     //$params = $this->getRequest()->getParams();
     $tagId = $this->getRequest()->getParam('id');
     //$data = array();
     $result = array();
     $tag = new Default_Model_Tags();
     $contentList = $tag->getTagContentById($tagId);
     $tagName = $tag->getTagNameById($tagId);
     /* What is this
        $contentTypesModel = new Default_Model_ContentTypes();
        $contentTypes = $contentTypesModel->getAllNamesAndIds();
        
        // match content type with data
        $i = 0;
        foreach ($data as $dat) {   // for each content that has tag
            if ($dat['published_cnt'] == 1) {
                $result[$i] = $dat;
                
                $break = false;
                
                $j = 0;                 // go through content types until hit
                while (!$break) {
                    if (isset($result[$i]) && isset($contentTypes[$j])){
                        if ($dat['id_cty_cnt'] == $contentTypes[$j]['id_cty']) {
                            $result[$i]['type'] = $contentTypes[$j]['key_cty'];
                            $break = true;  // break if hit
                        }
                    }
                    
                    $j++;
                    
                    if ($j > 100) {     // break if appears to be infinite...
                        $break = true;
                    }
                }
                
                $i++;
            }
        }
        */
     $this->view->content = $contentList;
     $this->view->tagName = $tagName;
 }