XpressEngine Core  1.11.2
 All Classes Namespaces Files Functions Variables Pages
board.wap.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) NAVER <http://www.navercorp.com> */
3 
10 class boardWAP extends board
11 {
15  function procWAP(&$oMobile)
16  {
17  // check grant
18  if(!$this->grant->list || $this->module_info->consultation == 'Y')
19  {
20  return $oMobile->setContent(Context::getLang('msg_not_permitted'));
21  }
22 
23  // generate document model object
24  $oDocumentModel = getModel('document');
25 
26  // if the doument is existed
27  $document_srl = Context::get('document_srl');
28  if($document_srl)
29  {
30  $oDocument = $oDocumentModel->getDocument($document_srl);
31  if($oDocument->isExists())
32  {
33  // check the grant
34  if(!$this->grant->view)
35  {
36  return $oMobile->setContent(Context::getLang('msg_not_permitted'));
37  }
38 
39  // setup the browser title
40  Context::setBrowserTitle($oDocument->getTitleText());
41 
42  // if the act is display comment list
43  if($this->act=='dispBoardContentCommentList')
44  {
45 
46  $oCommentModel = getModel('comment');
47  $output = $oCommentModel->getCommentList($oDocument->document_srl, 0, false, $oDocument->getCommentCount());
48 
49  $content = '';
50  if(count($output->data))
51  {
52  foreach($output->data as $key => $val)
53  {
54  $oComment = new commentItem();
55  $oComment->setAttribute($val);
56 
57  if(!$oComment->isAccessible()) continue;
58 
59  $content .= "<b>".$oComment->getNickName()."</b> (".$oComment->getRegdate("Y-m-d").")<br>\r\n".$oComment->getContent(false,false)."<br>\r\n";
60  }
61  }
62 
63  // setup mobile contents
64  $oMobile->setContent( $content );
65 
66  // setup upper URL
67  $oMobile->setUpperUrl( getUrl('act',''), Context::getLang('cmd_go_upper') );
68 
69  // display the document if the act is not display the comment list
70  } else {
71 
72  // setup contents (strip all html tags)
73  $content = strip_tags(str_replace('<p>','<br>&nbsp;&nbsp;&nbsp;',$oDocument->getContent(false,false,false)),'<br><b><i><u><em><small><strong><big>');
74 
75 
76  // setup content information(include the comments link)
77  $content = Context::getLang('replies').' : <a href="'.getUrl('act','dispBoardContentCommentList').'">'.$oDocument->getCommentCount().'</a><br>'."\r\n".$content;
78  $content = '<b>'.$oDocument->getNickName().'</b> ('.$oDocument->getRegdate("Y-m-d").")<br>\r\n".$content;
79 
80  // setup mobile contents
81  $oMobile->setContent( $content );
82 
83  // setup upper URL
84  $oMobile->setUpperUrl( getUrl('document_srl',''), Context::getLang('cmd_list') );
85 
86  }
87 
88  return;
89  }
90  }
91 
92  // board index
93  $args = new stdClass;
94  $args->module_srl = $this->module_srl;
95  $args->page = Context::get('page');;
96  $args->list_count = 9;
97  $args->sort_index = $this->module_info->order_target?$this->module_info->order_target:'list_order';
98  $args->order_type = $this->module_info->order_type?$this->module_info->order_type:'asc';
99  $output = $oDocumentModel->getDocumentList($args, $this->except_notice);
100  $document_list = $output->data;
101  $page_navigation = $output->page_navigation;
102 
103  $childs = array();
104  if($document_list && count($document_list))
105  {
106  foreach($document_list as $key => $val)
107  {
108  $href = getUrl('mid',$_GET['mid'],'document_srl',$val->document_srl);
109  $obj = null;
110  $obj['href'] = $val->getPermanentUrl();
111 
112  $title = htmlspecialchars($val->getTitleText());
113  if($val->getCommentCount()) $title .= ' ['.$val->getCommentCount().']';
114  $obj['link'] = $obj['text'] = '['.$val->getNickName().'] '.$title;
115  $childs[] = $obj;
116  }
117  $oMobile->setChilds($childs);
118  }
119 
120  $totalPage = $page_navigation->last_page;
121  $page = (int)Context::get('page');
122  if(!$page) $page = 1;
123 
124  // next/prevUrl specification
125  if($page > 1)
126  {
127  $oMobile->setPrevUrl(getUrl('mid',$_GET['mid'],'page',$page-1), sprintf('%s (%d/%d)', Context::getLang('cmd_prev'), $page-1, $totalPage));
128  }
129 
130  if($page < $totalPage)
131  {
132  $oMobile->setNextUrl(getUrl('mid',$_GET['mid'],'page',$page+1), sprintf('%s (%d/%d)', Context::getLang('cmd_next'), $page+1, $totalPage));
133  }
134 
135  $oMobile->mobilePage = $page;
136  $oMobile->totalPage = $totalPage;
137  }
138 }
$obj
Definition: ko.install.php:262
$output
Definition: ko.install.php:193
board module WAP class
Definition: board.wap.php:10
setBrowserTitle($site_title)
$module_srl
integer value to represent a run-time instance of Module (XE Module)
$args
Definition: ko.install.php:185
$document_srl
Definition: ko.install.php:279
$oDocumentModel
Definition: ko.install.php:259
procWAP(&$oMobile)
wap procedure method
Definition: board.wap.php:15
getLang($code)
getModel($module_name)
Definition: func.inc.php:145
getUrl()
Definition: func.inc.php:297
board module high class
Definition: board.class.php:10