XpressEngine Core  1.11.2
 All Classes Namespaces Files Functions Variables Pages
board.model.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) NAVER <http://www.navercorp.com> */
3 
9 class boardModel extends module
10 {
14  function init()
15  {
16  }
17 
22  {
23  $oModuleModel = getModel('module');
24  $oDocumentModel = getModel('document');
25 
26  // get the list config value, if it is not exitsted then setup the default value
27  $list_config = $oModuleModel->getModulePartConfig('board', $module_srl);
28  if(!$list_config || count($list_config) <= 0)
29  {
30  $list_config = array( 'no', 'title', 'nick_name','regdate','readed_count');
31  }
32 
33  // get the extra variables
34  $inserted_extra_vars = $oDocumentModel->getExtraKeys($module_srl);
35 
36  foreach($list_config as $key)
37  {
38  if(preg_match('/^([0-9]+)$/',$key))
39  {
40  if($inserted_extra_vars[$key])
41  {
42  $output['extra_vars'.$key] = $inserted_extra_vars[$key];
43  }
44  else
45  {
46  continue;
47  }
48  }
49  else
50  {
51  $output[$key] = new ExtraItem($module_srl, -1, Context::getLang($key), $key, 'N', 'N', 'N', null);
52  }
53  }
54  return $output;
55  }
56 
61  {
62  // add virtual srl, title, registered date, update date, nickname, ID, name, readed count, voted count etc.
63  $virtual_vars = array( 'no', 'title', 'regdate', 'last_update', 'last_post', 'nick_name',
64  'user_id', 'user_name', 'readed_count', 'voted_count', 'blamed_count', 'thumbnail', 'summary', 'comment_status');
65  foreach($virtual_vars as $key)
66  {
67  $extra_vars[$key] = new ExtraItem($module_srl, -1, Context::getLang($key), $key, 'N', 'N', 'N', null);
68  }
69 
70  // get the extra variables from the document model
71  $oDocumentModel = getModel('document');
72  $inserted_extra_vars = $oDocumentModel->getExtraKeys($module_srl);
73 
74  if(count($inserted_extra_vars))
75  {
76  foreach($inserted_extra_vars as $obj)
77  {
78  $extra_vars['extra_vars'.$obj->idx] = $obj;
79  }
80  }
81 
82  return $extra_vars;
83 
84  }
85 
90  {
91  array_push($obj, 'board');
92  }
93 }
$oModuleModel
Definition: ko.install.php:236
$obj
Definition: ko.install.php:262
$output
Definition: ko.install.php:193
init()
initialization
Definition: board.model.php:14
foreach($sitemap as $id=> &$val) $extra_vars
Definition: ko.install.php:180
$module_srl
integer value to represent a run-time instance of Module (XE Module)
getListConfig($module_srl)
get the list configuration
Definition: board.model.php:21
getDefaultListConfig($module_srl)
return the default list configration value
Definition: board.model.php:60
$oDocumentModel
Definition: ko.install.php:259
board module Model class
Definition: board.model.php:9
triggerModuleListInSitemap(&$obj)
return module name in sitemap
Definition: board.model.php:89
getLang($code)
getModel($module_name)
Definition: func.inc.php:145
high class of the module module
Definition: module.class.php:8