XpressEngine Core  1.11.2
 All Classes Namespaces Files Functions Variables Pages
document.view.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) NAVER <http://www.navercorp.com> */
11 class documentView extends document
12 {
17  function init()
18  {
19  }
20 
26  function dispDocumentPrint()
27  {
28  // Bring a list of variables needed to implement
29  $document_srl = Context::get('document_srl');
30 
31  // module_info not use in UI
32  //$oModuleModel = getModel('module');
33  //$module_info = $oModuleModel->getModuleInfoByDocumentSrl($document_srl);
34 
35  // Create the document object. If the document module of basic data structures, write it all works .. -_-;
36  $oDocumentModel = getModel('document');
37  // Creates an object for displaying the selected document
38  $oDocument = $oDocumentModel->getDocument($document_srl, $this->grant->manager);
39  if(!$oDocument->isExists()) return new BaseObject(-1,'msg_invalid_request');
40  // Check permissions
41  if(!$oDocument->isAccessible()) return new BaseObject(-1,'msg_not_permitted');
42  // Information setting module
43  //Context::set('module_info', $module_info); //module_info not use in UI
44  // Browser title settings
45  Context::setBrowserTitle($oDocument->getTitleText());
46  Context::set('oDocument', $oDocument);
47 
48  Context::set('layout','none');
49  $this->setTemplatePath($this->module_path.'tpl');
50  $this->setTemplateFile('print_page');
51  }
52 
58  {
59  if(!checkCSRF())
60  {
61  return new BaseObject(-1, 'msg_invalid_request');
62  }
63 
64  if(Context::get('logged_info')->is_admin != 'Y')
65  {
66  Context::set('content', removeHackTag(Context::get('content')));
67  }
68 
69  $this->setTemplatePath($this->module_path.'tpl');
70  $this->setTemplateFile('preview_page');
71 
72  Context::set('layout', 'none');
73  }
74 
80  {
81  if(!Context::get('is_logged')) return new BaseObject(-1,'msg_not_permitted');
82  // Taken from a list of selected sessions
83  $flag_list = $_SESSION['document_management'];
84  if(count($flag_list))
85  {
86  foreach($flag_list as $key => $val)
87  {
88  if(!is_bool($val)) continue;
89  $document_srl_list[] = $key;
90  }
91  }
92 
93  if(count($document_srl_list))
94  {
95  $oDocumentModel = getModel('document');
96  $document_list = $oDocumentModel->getDocuments($document_srl_list, $this->grant->is_admin);
97  Context::set('document_list', $document_list);
98  }
99 
100  $oModuleModel = getModel('module');
101  // The combination of module categories list and the list of modules
102  if(count($module_list)>1) Context::set('module_list', $module_categories);
103 
104  $module_srl=Context::get('module_srl');
105  Context::set('module_srl',$module_srl);
106  $module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl);
107  Context::set('mid',$module_info->mid);
108  Context::set('browser_title',$module_info->browser_title);
109 
110  // Select Pop-up layout
111  $this->setLayoutPath('./common/tpl');
112  $this->setLayoutFile('popup_layout');
113 
114  $this->setTemplatePath($this->module_path.'tpl');
115  $this->setTemplateFile('checked_list');
116  }
117 
125  {
126  $current_module_srl = Context::get('module_srl');
127  $current_module_srls = Context::get('module_srls');
128 
129  if(!$current_module_srl && !$current_module_srls)
130  {
131  // Get information of the current module
132  $current_module_info = Context::get('current_module_info');
133  $current_module_srl = $current_module_info->module_srl;
134  if(!$current_module_srl) return new BaseObject();
135  }
136 
137  $oModuleModel = getModel('module');
138  if($current_module_srl)
139  {
140  $document_config = $oModuleModel->getModulePartConfig('document', $current_module_srl);
141  }
142  if(!$document_config)
143  {
144  $document_config = new stdClass();
145  }
146  if(!isset($document_config->use_history)) $document_config->use_history = 'N';
147  Context::set('document_config', $document_config);
148 
149  $oTemplate = &TemplateHandler::getInstance();
150  $tpl = $oTemplate->compile($this->module_path.'tpl', 'document_module_config');
151  $obj .= $tpl;
152 
153  return new BaseObject();
154  }
155 
160  function dispTempSavedList()
161  {
162  $this->setLayoutFile('popup_layout');
163 
164  $oMemberModel = getModel('member');
165  // A message appears if the user is not logged-in
166  if(!$oMemberModel->isLogged()) return $this->stop('msg_not_logged');
167  // Get the saved document (module_srl is set to member_srl instead)
168  $logged_info = Context::get('logged_info');
169  $args = new stdClass();
170  $args->member_srl = $logged_info->member_srl;
171  $args->statusList = array($this->getConfigStatus('temp'));
172  $args->page = (int)Context::get('page');
173  $args->list_count = 10;
174 
175  $oDocumentModel = getModel('document');
176  $output = $oDocumentModel->getDocumentList($args, true);
177  Context::set('total_count', $output->total_count);
178  Context::set('total_page', $output->total_page);
179  Context::set('page', $output->page);
180  Context::set('document_list', $output->data);
181  Context::set('page_navigation', $output->page_navigation);
182 
183  $this->setTemplatePath($this->module_path.'tpl');
184  $this->setTemplateFile('saved_list_popup');
185  }
186 
187 }
188 /* End of file document.view.php */
189 /* Location: ./modules/document/document.view.php */
getConfigStatus($key)
setTemplateFile($filename)
$oModuleModel
Definition: ko.install.php:236
$obj
Definition: ko.install.php:262
$output
Definition: ko.install.php:193
setLayoutFile($filename)
triggerDispDocumentAdditionSetup(&$obj)
set($key, $val, $set_to_get_vars=0)
setBrowserTitle($site_title)
dispDocumentManageDocument()
$module_srl
integer value to represent a run-time instance of Module (XE Module)
$args
Definition: ko.install.php:185
$module_info
an object containing the module information
checkCSRF()
Definition: func.inc.php:1623
$document_srl
Definition: ko.install.php:279
$oDocumentModel
Definition: ko.install.php:259
document the module&#39;s high class {
removeHackTag($content)
Definition: func.inc.php:1123
getModel($module_name)
Definition: func.inc.php:145