XpressEngine Core  1.11.2
 All Classes Namespaces Files Functions Variables Pages
board.mobile.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) NAVER <http://www.navercorp.com> */
3 
4 require_once(_XE_PATH_.'modules/board/board.view.php');
5 
6 class boardMobile extends boardView
7 {
8  function init()
9  {
10  $oSecurity = new Security();
11  $oSecurity->encodeHTML('document_srl', 'comment_srl', 'vid', 'mid', 'page', 'category', 'search_target', 'search_keyword', 'sort_index', 'order_type', 'trackback_srl');
12 
13  if($this->module_info->list_count) $this->list_count = $this->module_info->list_count;
14  if($this->module_info->mobile_list_count) $this->list_count = $this->module_info->mobile_list_count;
15  if($this->module_info->search_list_count) $this->search_list_count = $this->module_info->search_list_count;
16  if($this->module_info->mobile_search_list_count) $this->search_list_count = $this->module_info->mobile_search_list_count;
17  if($this->module_info->page_count) $this->page_count = $this->module_info->page_count;
18  if($this->module_info->mobile_page_count) $this->page_count = $this->module_info->mobile_page_count;
19  $this->except_notice = $this->module_info->except_notice == 'N' ? false : true;
20 
21  // $this->_getStatusNameListecret option backward compatibility
22  $oDocumentModel = getModel('document');
23 
24  $statusList = $this->_getStatusNameList($oDocumentModel);
25  if(isset($statusList['SECRET']))
26  {
27  $this->module_info->secret = 'Y';
28  }
29 
30  // use_category <=1.5.x, hide_category >=1.7.x
31  $count_category = count($oDocumentModel->getCategoryList($this->module_info->module_srl));
32  if($count_category)
33  {
34  if($this->module_info->hide_category)
35  {
36  $this->module_info->use_category = ($this->module_info->hide_category == 'Y') ? 'N' : 'Y';
37  }
38  else if($this->module_info->use_category)
39  {
40  $this->module_info->hide_category = ($this->module_info->use_category == 'Y') ? 'N' : 'Y';
41  }
42  else
43  {
44  $this->module_info->hide_category = 'N';
45  $this->module_info->use_category = 'Y';
46  }
47  }
48  else
49  {
50  $this->module_info->hide_category = 'Y';
51  $this->module_info->use_category = 'N';
52  }
53 
58  if($this->module_info->consultation == 'Y' && !$this->grant->manager && !$this->grant->consultation_read)
59  {
60  $this->consultation = true;
61  if(!Context::get('is_logged')) $this->grant->list = $this->grant->write_document = $this->grant->write_comment = $this->grant->view = false;
62  } else {
63  $this->consultation = false;
64  }
65 
66  $oDocumentModel = getModel('document');
67  $extra_keys = $oDocumentModel->getExtraKeys($this->module_info->module_srl);
68  Context::set('extra_keys', $extra_keys);
69 
70  $template_path = sprintf("%sm.skins/%s/",$this->module_path, $this->module_info->mskin);
71  if(!is_dir($template_path)||!$this->module_info->mskin)
72  {
73  $this->module_info->mskin = 'default';
74  $template_path = sprintf("%sm.skins/%s/",$this->module_path, $this->module_info->mskin);
75  }
77  Context::addJsFilter($this->module_path.'tpl/filter', 'input_password.xml');
78  }
79 
80  function dispBoardCategory()
81  {
82  $this->dispBoardCategoryList();
83  $category_list = Context::get('category_list');
84  $this->setTemplateFile('category.html');
85  }
86 
88  {
89  $document_srl = Context::get('document_srl');
90  $oDocumentModel =& getModel('document');
91  if(!$document_srl)
92  {
93  return new BaseObject(-1, "msg_invalid_request");
94  }
95 
96  if($this->grant->view == false || ($this->module_info->consultation == 'Y' && !$this->grant->manager && !$this->grant->consultation_read))
97  {
98  return new BaseObject(-1, "msg_not_permitted");
99  }
100 
101  $oDocument = $oDocumentModel->getDocument($document_srl);
102  if(!$oDocument->isExists())
103  {
104  return new BaseObject(-1, "msg_invalid_request");
105  }
106  Context::set('oDocument', $oDocument);
107  $oTemplate = TemplateHandler::getInstance();
108  $html = $oTemplate->compile($this->getTemplatePath(), "comment.html");
109  $this->add("html", $html);
110  }
111 
112  function dispBoardMessage($msg_code)
113  {
114  $msg = Context::getLang($msg_code);
115  $oMessageObject = &ModuleHandler::getModuleInstance('message','mobile');
116  $oMessageObject->setError(-1);
117  $oMessageObject->setMessage($msg);
118  $oMessageObject->dispMessage();
119 
120  $this->setTemplatePath($oMessageObject->getTemplatePath());
121  $this->setTemplateFile($oMessageObject->getTemplateFile());
122  }
123 }
setTemplateFile($filename)
& getModuleInstance($module, $type= 'view', $kind= '')
$template_path
a path of directory where template files reside
add($key, $val)
_getStatusNameList(&$oDocumentModel)
Definition: board.view.php:757
$category_list
category list
Definition: board.class.php:19
board module View class
Definition: board.view.php:9
set($key, $val, $set_to_get_vars=0)
$document_srl
Definition: ko.install.php:279
$oDocumentModel
Definition: ko.install.php:259
getLang($code)
const _XE_PATH_
Definition: config.inc.php:49
getModel($module_name)
Definition: func.inc.php:145
dispBoardCategoryList()
display the category list
Definition: board.view.php:221
addJsFilter($path, $filename)
dispBoardMessage($msg_code)