XpressEngine Core  1.11.2
 All Classes Namespaces Files Functions Variables Pages
document.model.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) NAVER <http://www.navercorp.com> */
11 class documentModel extends document
12 {
13  private $documentConfig = NULL;
14 
19  function init()
20  {
21  }
22 
29  {
30  return $_SESSION['own_document'][$document_srl];
31  }
32 
38  function getDocumentExtraVarsFromDB($documentSrls)
39  {
40  if(!is_array($documentSrls) || count($documentSrls) == 0)
41  {
42  return new BaseObject(-1, 'msg_invalid_request');
43  }
44 
45  $args = new stdClass();
46  $args->document_srl = $documentSrls;
47  $output = executeQueryArray('document.getDocumentExtraVars', $args);
48  return $output;
49  }
50 
56  {
57  static $checked_documents = array();
58  $_document_list = &$GLOBALS['XE_DOCUMENT_LIST'];
59 
60  // XE XE_DOCUMENT_LIST all documents that the object referred to the global variable settings
61  if(count($_document_list) <= 0) return;
62 
63  // Find all called the document object variable has been set extension
64  $document_srls = array();
65  foreach($_document_list as $key => $val)
66  {
67  if(!$val->document_srl || $checked_documents[$val->document_srl]) continue;
68  $checked_documents[$val->document_srl] = true;
69  $document_srls[] = $val->document_srl;
70  }
71  // If the document number, return detected
72  if(!count($document_srls)) return;
73  // Expand variables mijijeongdoen article about a current visitor to the extension of the language code, the search variable
74  //$obj->document_srl = implode(',',$document_srls);
75  $output = $this->getDocumentExtraVarsFromDB($document_srls);
76  if($output->toBool() && $output->data)
77  {
78  foreach($output->data as $key => $val)
79  {
80  if(!isset($val->value)) continue;
81  if(!$extra_vars[$val->module_srl][$val->document_srl][$val->var_idx][0]) $extra_vars[$val->module_srl][$val->document_srl][$val->var_idx][0] = trim($val->value);
82  $extra_vars[$val->document_srl][$val->var_idx][$val->lang_code] = trim($val->value);
83  }
84  }
85 
86  $user_lang_code = Context::getLangType();
87  for($i=0,$c=count($document_srls);$i<$c;$i++)
88  {
89  $document_srl = $document_srls[$i];
90  unset($vars);
91 
92  if(!$_document_list[$document_srl] || !is_object($_document_list[$document_srl]) || !$_document_list[$document_srl]->isExists()) continue;
93  $module_srl = $_document_list[$document_srl]->get('module_srl');
94  $extra_keys = $this->getExtraKeys($module_srl);
95  $vars = $extra_vars[$document_srl];
96  $document_lang_code = $_document_list[$document_srl]->get('lang_code');
97  // Expand the variable processing
98  if(count($extra_keys))
99  {
100  foreach($extra_keys as $idx => $key)
101  {
102  $extra_keys[$idx] = clone($key);
103  $val = $vars[$idx];
104  if(isset($val[$user_lang_code])) $v = $val[$user_lang_code];
105  else if(isset($val[$document_lang_code])) $v = $val[$document_lang_code];
106  else if(isset($val[0])) $v = $val[0];
107  else $v = null;
108  $extra_keys[$idx]->value = $v;
109  }
110  }
111 
112  unset($evars);
113  $evars = new ExtraVar($module_srl);
114  $evars->setExtraVarKeys($extra_keys);
115  // Title Processing
116  if($vars[-1][$user_lang_code]) $_document_list[$document_srl]->add('title',$vars[-1][$user_lang_code]);
117  // Information processing
118  if($vars[-2][$user_lang_code]) $_document_list[$document_srl]->add('content',$vars[-2][$user_lang_code]);
119 
120  // static 데이터를 갱신해주기 위해 들어간 코드같으나 어차피 언어 변경 자체는 페이지 전환이 일어나면서 발생하는게 대부분이라 효용이 없음. 또한 예기치않게 권한이 없는 다국어 문서 내용을 보여주는 부효과가 일어남
121  /*
122  if($vars[-1][$user_lang_code] || $vars[-2][$user_lang_code])
123  {
124  unset($checked_documents[$document_srl]);
125  }
126  */
127 
128  $GLOBALS['XE_EXTRA_VARS'][$document_srl] = $evars->getExtraVars();
129  }
130  }
131 
140  function getDocument($document_srl=0, $is_admin = false, $load_extra_vars=true, $columnList = array())
141  {
142  if(!$document_srl) return new documentItem();
143 
144  if(!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl])
145  {
146  $oDocument = new documentItem($document_srl, $load_extra_vars, $columnList);
147  if(!$oDocument->isExists())
148  {
149  return $oDocument;
150  }
151  $GLOBALS['XE_DOCUMENT_LIST'][$document_srl] = $oDocument;
152  if($load_extra_vars) $this->setToAllDocumentExtraVars();
153  }
154  if($is_admin) $GLOBALS['XE_DOCUMENT_LIST'][$document_srl]->setGrant();
155 
156  return $GLOBALS['XE_DOCUMENT_LIST'][$document_srl];
157  }
158 
167  function getDocuments($document_srls, $is_admin = false, $load_extra_vars=true, $columnList = array())
168  {
169  if(is_array($document_srls))
170  {
171  $list_count = count($document_srls);
172  $document_srls = implode(',',$document_srls);
173  }
174  else
175  {
176  $list_count = 1;
177  }
178  $args = new stdClass();
179  $args->document_srls = $document_srls;
180  $args->list_count = $list_count;
181  $args->order_type = 'asc';
182 
183  $output = executeQuery('document.getDocuments', $args, $columnList);
184  $document_list = $output->data;
185  if(!$document_list) return;
186  if(!is_array($document_list)) $document_list = array($document_list);
187 
188  $document_count = count($document_list);
189  foreach($document_list as $key => $attribute)
190  {
191  $document_srl = $attribute->document_srl;
192  if(!$document_srl) continue;
193 
194  if(!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl])
195  {
196  $oDocument = null;
197  $oDocument = new documentItem();
198  $oDocument->setAttribute($attribute, false);
199  if($is_admin) $oDocument->setGrant();
200  $GLOBALS['XE_DOCUMENT_LIST'][$document_srl] = $oDocument;
201  }
202 
203  $result[$attribute->document_srl] = $GLOBALS['XE_DOCUMENT_LIST'][$document_srl];
204  }
205 
206  if($load_extra_vars) $this->setToAllDocumentExtraVars();
207 
208  $output = null;
209  if(count($result))
210  {
211  foreach($result as $document_srl => $val)
212  {
213  $output[$document_srl] = $GLOBALS['XE_DOCUMENT_LIST'][$document_srl];
214  }
215  }
216 
217  return $output;
218  }
219 
228  function getDocumentList($obj, $except_notice = false, $load_extra_vars=true, $columnList = array())
229  {
230  $sort_check = $this->_setSortIndex($obj, $load_extra_vars);
231  $obj->sort_index = $sort_check->sort_index;
232  $obj->isExtraVars = $sort_check->isExtraVars;
233  unset($obj->use_alternate_output);
234  $obj->columnList = $columnList;
235  // Call trigger (before)
236  // This trigger can be used to set an alternative output using a different search method
237  $output = ModuleHandler::triggerCall('document.getDocumentList', 'before', $obj);
238  if($output instanceof BaseObject && !$output->toBool())
239  {
240  return $output;
241  }
242 
243  // If an alternate output is set, use it instead of running the default queries
244  $use_alternate_output = (isset($obj->use_alternate_output) && $obj->use_alternate_output instanceof BaseObject);
245  if (!$use_alternate_output)
246  {
247  $this->_setSearchOption($obj, $args, $query_id, $use_division);
248  }
249 
250  if ($use_alternate_output)
251  {
252  $output = $obj->use_alternate_output;
253  unset($obj->use_alternate_output);
254  }
255  elseif ($sort_check->isExtraVars && substr_count($obj->search_target,'extra_vars'))
256  {
257  $query_id = 'document.getDocumentListWithinExtraVarsExtraSort';
258  $args->sort_index = str_replace('documents.','',$args->sort_index);
259  $output = executeQueryArray($query_id, $args);
260  }
261  elseif ($sort_check->isExtraVars)
262  {
263  $output = executeQueryArray($query_id, $args);
264  }
265  else
266  {
267  // document.getDocumentList query execution
268  // Query_id if you have a group by clause getDocumentListWithinTag getDocumentListWithinComment or used again to perform the query because
269  $groupByQuery = array('document.getDocumentListWithinComment' => 1, 'document.getDocumentListWithinTag' => 1, 'document.getDocumentListWithinExtraVars' => 1);
270  if(isset($groupByQuery[$query_id]))
271  {
272  $group_args = clone($args);
273  $group_args->sort_index = 'documents.'.$args->sort_index;
274  $output = executeQueryArray($query_id, $group_args);
275  if(!$output->toBool()||!count($output->data)) return $output;
276 
277  foreach($output->data as $key => $val)
278  {
279  if($val->document_srl) $target_srls[] = $val->document_srl;
280  }
281 
282  $page_navigation = $output->page_navigation;
283  $keys = array_keys($output->data);
284  $virtual_number = $keys[0];
285 
286  $target_args = new stdClass();
287  $target_args->document_srls = implode(',',$target_srls);
288  $target_args->list_order = $args->sort_index;
289  $target_args->order_type = $args->order_type;
290  $target_args->list_count = $args->list_count;
291  $target_args->page = 1;
292  $output = executeQueryArray('document.getDocuments', $target_args);
293  $output->page_navigation = $page_navigation;
294  $output->total_count = $page_navigation->total_count;
295  $output->total_page = $page_navigation->total_page;
296  $output->page = $page_navigation->cur_page;
297  }
298  else
299  {
300  $output = executeQueryArray($query_id, $args, $columnList);
301  }
302  }
303  // Return if no result or an error occurs
304  if(!$output->toBool()||!count($output->data)) return $output;
305  $idx = 0;
306  $data = $output->data;
307  unset($output->data);
308 
309  if(!isset($virtual_number))
310  {
311  $keys = array_keys($data);
312  $virtual_number = $keys[0];
313  }
314 
315  if($except_notice)
316  {
317  foreach($data as $key => $attribute)
318  {
319  if($attribute->is_notice == 'Y') $virtual_number --;
320  }
321  }
322 
323  foreach($data as $key => $attribute)
324  {
325  if($except_notice && $attribute->is_notice == 'Y') continue;
326  $document_srl = $attribute->document_srl;
327  if(!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl])
328  {
329  $oDocument = null;
330  $oDocument = new documentItem();
331  $oDocument->setAttribute($attribute, false);
332  if($is_admin) $oDocument->setGrant();
333  $GLOBALS['XE_DOCUMENT_LIST'][$document_srl] = $oDocument;
334  }
335 
336  $output->data[$virtual_number] = $GLOBALS['XE_DOCUMENT_LIST'][$document_srl];
337  $virtual_number--;
338  }
339 
340  if($load_extra_vars) $this->setToAllDocumentExtraVars();
341 
342  if(count($output->data))
343  {
344  foreach($output->data as $number => $document)
345  {
346  $output->data[$number] = $GLOBALS['XE_DOCUMENT_LIST'][$document->document_srl];
347  }
348  }
349 
350  // Call trigger (after)
351  // This trigger can be used to modify search results
352  ModuleHandler::triggerCall('document.getDocumentList', 'after', $output);
353  return $output;
354  }
355 
362  function getNoticeList($obj, $columnList = array())
363  {
364  $args = new stdClass();
365  $args->module_srl = $obj->module_srl;
366  $args->category_srl= $obj->category_srl;
367  $output = executeQueryArray('document.getNoticeList', $args, $columnList);
368  if(!$output->toBool()||!$output->data) return;
369 
370  foreach($output->data as $key => $val)
371  {
372  $document_srl = $val->document_srl;
373  if(!$document_srl) continue;
374 
375  if(!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl])
376  {
377  $oDocument = null;
378  $oDocument = new documentItem();
379  $oDocument->setAttribute($val, false);
380  $GLOBALS['XE_DOCUMENT_LIST'][$document_srl] = $oDocument;
381  }
382  $result->data[$document_srl] = $GLOBALS['XE_DOCUMENT_LIST'][$document_srl];
383  }
384  $this->setToAllDocumentExtraVars();
385 
386  foreach($result->data as $document_srl => $val)
387  {
388  $result->data[$document_srl] = $GLOBALS['XE_DOCUMENT_LIST'][$document_srl];
389  }
390 
391  return $result;
392  }
393 
401  {
402  if(!isset($GLOBALS['XE_EXTRA_KEYS'][$module_srl]))
403  {
404  $keys = false;
405  $oCacheHandler = CacheHandler::getInstance('object', null, true);
406  if($oCacheHandler->isSupport())
407  {
408  $object_key = 'module_document_extra_keys:' . $module_srl;
409  $cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
410  $keys = $oCacheHandler->get($cache_key);
411  }
412 
413  $oExtraVar = ExtraVar::getInstance($module_srl);
414 
415  if($keys === false)
416  {
417  $obj = new stdClass();
418  $obj->module_srl = $module_srl;
419  $obj->sort_index = 'var_idx';
420  $obj->order = 'asc';
421  $output = executeQueryArray('document.getDocumentExtraKeys', $obj);
422 
423  // correcting index order
424  $isFixed = FALSE;
425  if(is_array($output->data))
426  {
427  $prevIdx = 0;
428  foreach($output->data as $no => $value)
429  {
430  // case first
431  if($prevIdx == 0 && $value->idx != 1)
432  {
433  $args = new stdClass();
434  $args->module_srl = $module_srl;
435  $args->var_idx = $value->idx;
436  $args->new_idx = 1;
437  executeQuery('document.updateDocumentExtraKeyIdx', $args);
438  executeQuery('document.updateDocumentExtraVarIdx', $args);
439  $prevIdx = 1;
440  $isFixed = TRUE;
441  continue;
442  }
443 
444  // case others
445  if($prevIdx > 0 && $prevIdx + 1 != $value->idx)
446  {
447  $args = new stdClass();
448  $args->module_srl = $module_srl;
449  $args->var_idx = $value->idx;
450  $args->new_idx = $prevIdx + 1;
451  executeQuery('document.updateDocumentExtraKeyIdx', $args);
452  executeQuery('document.updateDocumentExtraVarIdx', $args);
453  $prevIdx += 1;
454  $isFixed = TRUE;
455  continue;
456  }
457 
458  $prevIdx = $value->idx;
459  }
460  }
461 
462  if($isFixed)
463  {
464  $output = executeQueryArray('document.getDocumentExtraKeys', $obj);
465  }
466 
467  $oExtraVar->setExtraVarKeys($output->data);
468  $keys = $oExtraVar->getExtraVars();
469  if(!$keys) $keys = array();
470 
471  if($oCacheHandler->isSupport())
472  {
473  $oCacheHandler->put($cache_key, $keys);
474  }
475  }
476 
477 
478  $GLOBALS['XE_EXTRA_KEYS'][$module_srl] = $keys;
479  }
480 
481  return $GLOBALS['XE_EXTRA_KEYS'][$module_srl];
482  }
483 
491  {
492  if(!isset($GLOBALS['XE_EXTRA_VARS'][$document_srl]))
493  {
494  // Extended to extract the values of variables set
495  $oDocument = $this->getDocument($document_srl, false);
496  $GLOBALS['XE_DOCUMENT_LIST'][$document_srl] = $oDocument;
497  $this->setToAllDocumentExtraVars();
498  }
499  if(is_array($GLOBALS['XE_EXTRA_VARS'][$document_srl])) ksort($GLOBALS['XE_EXTRA_VARS'][$document_srl]);
500  return $GLOBALS['XE_EXTRA_VARS'][$document_srl];
501  }
502 
508  function getDocumentMenu()
509  {
510  // Post number and the current login information requested Wanted
511  $document_srl = Context::get('target_srl');
512  $mid = Context::get('cur_mid');
513  $logged_info = Context::get('logged_info');
514  $act = Context::get('cur_act');
515  // to menu_list "pyosihalgeul, target, url" put into an array
516  $menu_list = array();
517  // call trigger
518  ModuleHandler::triggerCall('document.getDocumentMenu', 'before', $menu_list);
519 
520  $oDocumentController = getController('document');
521  // Members must be a possible feature
522  if($logged_info->member_srl)
523  {
524  $oDocumentModel = getModel('document');
525  $columnList = array('document_srl', 'module_srl', 'member_srl', 'ipaddress');
526  $oDocument = $oDocumentModel->getDocument($document_srl, false, false, $columnList);
527  $module_srl = $oDocument->get('module_srl');
528  $member_srl = $oDocument->get('member_srl');
529  if(!$module_srl) return new BaseObject(-1, 'msg_invalid_request');
530 
531  $oModuleModel = getModel('module');
532  $document_config = $oModuleModel->getModulePartConfig('document',$module_srl);
533  if($document_config->use_vote_up!='N' && $member_srl!=$logged_info->member_srl)
534  {
535  // Add a Referral Button
536  $url = sprintf("doCallModuleAction('document','procDocumentVoteUp','%s')", $document_srl);
537  $oDocumentController->addDocumentPopupMenu($url,'cmd_vote','','javascript');
538  }
539 
540  if($document_config->use_vote_down!='N' && $member_srl!=$logged_info->member_srl)
541  {
542  // Add button to negative
543  $url= sprintf("doCallModuleAction('document','procDocumentVoteDown','%s')", $document_srl);
544  $oDocumentController->addDocumentPopupMenu($url,'cmd_vote_down','','javascript');
545  }
546 
547  // Adding Report
548  $url = sprintf("doCallModuleAction('document','procDocumentDeclare','%s')", $document_srl);
549  $oDocumentController->addDocumentPopupMenu($url,'cmd_declare','','javascript');
550 
551  // Add Bookmark button
552  $url = sprintf("doCallModuleAction('member','procMemberScrapDocument','%s')", $document_srl);
553  $oDocumentController->addDocumentPopupMenu($url,'cmd_scrap','','javascript');
554  }
555  // Add print button
556  $url = getUrl('','module','document','act','dispDocumentPrint','document_srl',$document_srl);
557  $oDocumentController->addDocumentPopupMenu($url,'cmd_print','','printDocument');
558  // Call a trigger (after)
559  ModuleHandler::triggerCall('document.getDocumentMenu', 'after', $menu_list);
560  if($this->grant->manager)
561  {
562  $str_confirm = Context::getLang('confirm_move');
563  $url = sprintf("if(!confirm('%s')) return; var params = new Array(); params['document_srl']='%s'; params['mid']=current_mid;params['cur_url']=current_url; exec_xml('document', 'procDocumentAdminMoveToTrash', params)", $str_confirm, $document_srl);
564  $oDocumentController->addDocumentPopupMenu($url,'cmd_trash','','javascript');
565  }
566 
567  // If you are managing to find posts by ip
568  if($logged_info->is_admin == 'Y')
569  {
570  $oDocumentModel = getModel('document');
571  $oDocument = $oDocumentModel->getDocument($document_srl); //before setting document recycle
572 
573  if($oDocument->isExists())
574  {
575  // Find a post equivalent to ip address
576  $url = getUrl('','module','admin','act','dispDocumentAdminList','search_target','ipaddress','search_keyword',$oDocument->getIpAddress());
577  $oDocumentController->addDocumentPopupMenu($url,'cmd_search_by_ipaddress',$icon_path,'TraceByIpaddress');
578 
579  $url = sprintf("var params = new Array(); params['ipaddress_list']='%s'; exec_xml('spamfilter', 'procSpamfilterAdminInsertDeniedIP', params, completeCallModuleAction)", $oDocument->getIpAddress());
580  $oDocumentController->addDocumentPopupMenu($url,'cmd_add_ip_to_spamfilter','','javascript');
581  }
582  }
583  // Changing the language of pop-up menu
584  $menus = Context::get('document_popup_menu_list');
585  $menus_count = count($menus);
586  for($i=0;$i<$menus_count;$i++)
587  {
588  $menus[$i]->str = Context::getLang($menus[$i]->str);
589  }
590  // Wanted to finally clean pop-up menu list
591  $this->add('menus', $menus);
592  }
593 
600  function getDocumentCount($module_srl, $search_obj = NULL)
601  {
602  if(is_null($search_obj)) $search_obj = new stdClass();
603  $search_obj->module_srl = $module_srl;
604 
605  $output = executeQuery('document.getDocumentCount', $search_obj);
606  // Return total number of
607  $total_count = $output->data->count;
608  return (int)$total_count;
609  }
610 
616  function getDocumentCountByGroupStatus($search_obj = NULL)
617  {
618  $output = executeQuery('document.getDocumentCountByGroupStatus', $search_obj);
619  if(!$output->toBool()) return array();
620 
621  return $output->data;
622  }
623 
624  function getDocumentExtraVarsCount($module_srl, $search_obj = NULL)
625  {
626  // Additional search options
627  $args->module_srl = $module_srl;
628 
629  $args->category_srl = $search_obj->category_srl;
630  $args->var_idx = $search_obj->s_var_idx;
631  $args->var_eid = $search_obj->s_var_eid;
632  $args->var_value = $search_obj->s_var_value;
633  $args->var_lang_code = Context::getLangType();
634 
635  $output = executeQuery('document.getDocumentExtraVarsCount', $args);
636  // Return total number of
637  $total_count = $output->data->count;
638  return (int)$total_count;
639  }
640 
647  function getDocumentPage($oDocument, $opt)
648  {
649  $sort_check = $this->_setSortIndex($opt, TRUE);
650  $opt->sort_index = $sort_check->sort_index;
651  $opt->isExtraVars = $sort_check->isExtraVars;
652 
653  $this->_setSearchOption($opt, $args, $query_id, $use_division);
654 
655  if($sort_check->isExtraVars)
656  {
657  return 1;
658  }
659  else
660  {
661  if($sort_check->sort_index === 'list_order' || $sort_check->sort_index === 'update_order')
662  {
663  if($args->order_type === 'desc')
664  {
665  $args->{'rev_' . $sort_check->sort_index} = $oDocument->get($sort_check->sort_index);
666  }
667  else
668  {
669  $args->{$sort_check->sort_index} = $oDocument->get($sort_check->sort_index);
670  }
671  }
672  elseif($sort_check->sort_index === 'regdate')
673  {
674 
675  if($args->order_type === 'asc')
676  {
677  $args->{'rev_' . $sort_check->sort_index} = $oDocument->get($sort_check->sort_index);
678  }
679  else
680  {
681  $args->{$sort_check->sort_index} = $oDocument->get($sort_check->sort_index);
682  }
683 
684  }
685  else
686  {
687  return 1;
688  }
689  }
690 
691  // Guhanhu total number of the article search page
692  $output = executeQuery($query_id . 'Page', $args);
693  $count = $output->data->count;
694  $page = (int)(($count-1)/$opt->list_count)+1;
695  return $page;
696  }
697 
704  function getCategory($category_srl, $columnList = array())
705  {
706  $args =new stdClass();
707  $args->category_srl = $category_srl;
708  $output = executeQuery('document.getCategory', $args, $columnList);
709 
710  $node = $output->data;
711  if(!$node) return;
712 
713  if($node->group_srls)
714  {
715  $group_srls = explode(',',$node->group_srls);
716  unset($node->group_srls);
717  $node->group_srls = $group_srls;
718  }
719  else
720  {
721  unset($node->group_srls);
722  $node->group_srls = array();
723  }
724  return $node;
725  }
726 
732  function getCategoryChlidCount($category_srl)
733  {
734  $args = new stdClass();
735  $args->category_srl = $category_srl;
736  $output = executeQuery('document.getChildCategoryCount',$args);
737  if($output->data->count > 0) return true;
738  return false;
739  }
740 
748  function getCategoryList($module_srl, $columnList = array())
749  {
750  $module_srl = (int)$module_srl;
751 
752  // Category of the target module file swollen
753  $filename = sprintf("%sfiles/cache/document_category/%s.php", _XE_PATH_, $module_srl);
754  // If the target file to the cache file regeneration category
755  if(!file_exists($filename))
756  {
757  $oDocumentController = getController('document');
758  if(!$oDocumentController->makeCategoryFile($module_srl)) return array();
759  }
760 
761  include($filename);
762 
763  // Cleanup of category
764  $document_category = array();
765  $this->_arrangeCategory($document_category, $menu->list, 0);
766  return $document_category;
767  }
768 
776  function _arrangeCategory(&$document_category, $list, $depth)
777  {
778  if(!count($list)) return;
779  $idx = 0;
780  $list_order = array();
781  foreach($list as $key => $val)
782  {
783  $obj = new stdClass;
784  $obj->mid = $val['mid'];
785  $obj->module_srl = $val['module_srl'];
786  $obj->category_srl = $val['category_srl'];
787  $obj->parent_srl = $val['parent_srl'];
788  $obj->title = $obj->text = $val['text'];
789  $obj->description = $val['description'];
790  $obj->expand = $val['expand']=='Y'?true:false;
791  $obj->color = $val['color'];
792  $obj->document_count = $val['document_count'];
793  $obj->depth = $depth;
794  $obj->child_count = 0;
795  $obj->childs = array();
796  $obj->grant = $val['grant'];
797 
798  if(Context::get('mid') == $obj->mid && Context::get('category') == $obj->category_srl) $selected = true;
799  else $selected = false;
800 
801  $obj->selected = $selected;
802 
803  $list_order[$idx++] = $obj->category_srl;
804  // If you have a parent category of child nodes apply data
805  if($obj->parent_srl)
806  {
807  $parent_srl = $obj->parent_srl;
808  $document_count = $obj->document_count;
809  $expand = $obj->expand;
810  if($selected) $expand = true;
811 
812  while($parent_srl)
813  {
814  $document_category[$parent_srl]->document_count += $document_count;
815  $document_category[$parent_srl]->childs[] = $obj->category_srl;
816  $document_category[$parent_srl]->child_count = count($document_category[$parent_srl]->childs);
817  if($expand) $document_category[$parent_srl]->expand = $expand;
818 
819  $parent_srl = $document_category[$parent_srl]->parent_srl;
820  }
821  }
822 
823  $document_category[$key] = $obj;
824 
825  if(count($val['list'])) $this->_arrangeCategory($document_category, $val['list'], $depth+1);
826  }
827  $document_category[$list_order[0]]->first = true;
828  $document_category[$list_order[count($list_order)-1]]->last = true;
829  }
830 
837  function getCategoryDocumentCount($module_srl, $category_srl)
838  {
839  $args = new stdClass;
840  $args->module_srl = $module_srl;
841  $args->category_srl = $category_srl;
842  $output = executeQuery('document.getCategoryDocumentCount', $args);
843  return (int)$output->data->count;
844  }
845 
852  {
853  $xml_file = sprintf('files/cache/document_category/%s.xml.php',$module_srl);
854  if(!file_exists($xml_file))
855  {
856  $oDocumentController = getController('document');
857  $oDocumentController->makeCategoryFile($module_srl);
858  }
859  return $xml_file;
860  }
861 
868  {
869  $php_file = sprintf('files/cache/document_category/%s.php',$module_srl);
870  if(!file_exists($php_file))
871  {
872  $oDocumentController = getController('document');
873  $oDocumentController->makeCategoryFile($module_srl);
874  }
875  return $php_file;
876  }
877 
884  {
885  if($obj->mid)
886  {
887  $oModuleModel = getModel('module');
888  $obj->module_srl = $oModuleModel->getModuleSrlByMid($obj->mid);
889  unset($obj->mid);
890  }
891  // Module_srl passed the array may be a check whether the array
892  $args = new stdClass;
893  if(is_array($obj->module_srl)) $args->module_srl = implode(',', $obj->module_srl);
894  else $args->module_srl = $obj->module_srl;
895 
896  $output = executeQuery('document.getMonthlyArchivedList', $args);
897  if(!$output->toBool()||!$output->data) return $output;
898 
899  if(!is_array($output->data)) $output->data = array($output->data);
900 
901  return $output;
902  }
903 
910  {
911  if($obj->mid)
912  {
913  $oModuleModel = getModel('module');
914  $obj->module_srl = $oModuleModel->getModuleSrlByMid($obj->mid);
915  unset($obj->mid);
916  }
917  // Module_srl passed the array may be a check whether the array
918  $args = new stdClass;
919  if(is_array($obj->module_srl)) $args->module_srl = implode(',', $obj->module_srl);
920  else $args->module_srl = $obj->module_srl;
921  $args->regdate = $obj->regdate;
922 
923  $output = executeQuery('document.getDailyArchivedList', $args);
924  if(!$output->toBool()) return $output;
925 
926  if(!is_array($output->data)) $output->data = array($output->data);
927 
928  return $output;
929  }
930 
936  {
937  if(!Context::get('is_logged')) return new BaseObject(-1,'msg_not_permitted');
938  $module_srl = Context::get('module_srl');
939  $categories= $this->getCategoryList($module_srl);
940  $lang = Context::get('lang');
941  // No additional category
942  $output = "0,0,{$lang->none_category}\n";
943  if($categories)
944  {
945  foreach($categories as $category_srl => $category)
946  {
947  $output .= sprintf("%d,%d,%s\n",$category_srl, $category->depth,$category->title);
948  }
949  }
950  $this->add('categories', $output);
951  }
952 
957  function getDocumentConfig()
958  {
959  if($this->documentConfig === NULL)
960  {
961  $oModuleModel = getModel('module');
962  $config = $oModuleModel->getModuleConfig('document');
963 
964  if (!$config)
965  {
966  $config = new stdClass();
967  }
968  $this->documentConfig = $config;
969  }
970  return $this->documentConfig;
971  }
972 
980  {
981  // Bringing existing extra_keys
982  $extra_keys = $this->getExtraKeys($module_srl);
983  Context::set('extra_keys', $extra_keys);
984  $security = new Security();
985  $security->encodeHTML('extra_keys..', 'selected_var_idx');
986 
987  // Get information of module_grants
988  $oTemplate = &TemplateHandler::getInstance();
989  return $oTemplate->compile($this->module_path.'tpl', 'extra_keys');
990  }
991 
998  {
999  $category_xml_file = $this->getCategoryXmlFile($module_srl);
1000 
1001  Context::set('category_xml_file', $category_xml_file);
1002 
1003  Context::loadJavascriptPlugin('ui.tree');
1004 
1005  // Get a list of member groups
1006  $oMemberModel = getModel('member');
1007  $group_list = $oMemberModel->getGroups($module_info->site_srl);
1008  Context::set('group_list', $group_list);
1009 
1010  $security = new Security();
1011  $security->encodeHTML('group_list..title');
1012 
1013  // Get information of module_grants
1014  $oTemplate = &TemplateHandler::getInstance();
1015  return $oTemplate->compile($this->module_path.'tpl', 'category_list');
1016  }
1017 
1024  {
1025  $oModuleModel = getModel('module');
1026  $oMemberModel = getModel('member');
1027  // Get information on the menu for the parameter settings
1028  $module_srl = Context::get('module_srl');
1029  $module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl);
1030  // Check permissions
1031  $grant = $oModuleModel->getGrant($module_info, Context::get('logged_info'));
1032  if(!$grant->manager) return new BaseObject(-1,'msg_not_permitted');
1033 
1034  $category_srl = Context::get('category_srl');
1035  $category_info = $this->getCategory($category_srl);
1036  if(!$category_info)
1037  {
1038  return new BaseObject(-1, 'msg_invalid_request');
1039  }
1040 
1041  $this->add('category_info', $category_info);
1042  }
1043 
1050  function getDocumentSrlByAlias($mid, $alias)
1051  {
1052  if(!$mid || !$alias) return null;
1053  $site_module_info = Context::get('site_module_info');
1054  $args = new stdClass;
1055  $args->mid = $mid;
1056  $args->alias_title = $alias;
1057  $args->site_srl = $site_module_info->site_srl;
1058  $output = executeQuery('document.getDocumentSrlByAlias', $args);
1059  if(!$output->data) return null;
1060  else return $output->data->document_srl;
1061  }
1062 
1070  {
1071  if(!$module_srl || !$title) return null;
1072  $args = new stdClass;
1073  $args->module_srl = $module_srl;
1074  $args->title = $title;
1075  $output = executeQuery('document.getDocumentSrlByTitle', $args);
1076  if(!$output->data) return null;
1077  else
1078  {
1079  if(is_array($output->data)) return $output->data[0]->document_srl;
1080  return $output->data->document_srl;
1081  }
1082  }
1083 
1090  {
1091  if(!$document_srl) return null;
1092  $args = new stdClass;
1093  $args->document_srl = $document_srl;
1094  $output = executeQueryArray('document.getAliases', $args);
1095 
1096  if(!$output->data) return null;
1097  else return $output->data[0]->alias_title;
1098  }
1099 
1107  function getHistories($document_srl, $list_count, $page)
1108  {
1109  $args = new stdClass;
1110  $args->list_count = $list_count;
1111  $args->page = $page;
1112  $args->document_srl = $document_srl;
1113  $output = executeQueryArray('document.getHistories', $args);
1114  return $output;
1115  }
1116 
1122  function getHistory($history_srl)
1123  {
1124  $args = new stdClass;
1125  $args->history_srl = $history_srl;
1126  $output = executeQuery('document.getHistory', $args);
1127  return $output->data;
1128  }
1129 
1135  function getTrashList($obj)
1136  {
1137  // Variable check
1138  $args = new stdClass;
1139  $args->category_srl = $obj->category_srl?$obj->category_srl:null;
1140  $args->sort_index = $obj->sort_index;
1141  $args->order_type = $obj->order_type?$obj->order_type:'desc';
1142  $args->page = $obj->page?$obj->page:1;
1143  $args->list_count = $obj->list_count?$obj->list_count:20;
1144  $args->page_count = $obj->page_count?$obj->page_count:10;
1145  // Search options
1146  $search_target = $obj->search_target;
1147  $search_keyword = $obj->search_keyword;
1148  if($search_target && $search_keyword)
1149  {
1150  switch($search_target)
1151  {
1152  case 'title' :
1153  case 'content' :
1154  if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
1155  $args->{"s_".$search_target} = $search_keyword;
1156  $use_division = true;
1157  break;
1158  case 'title_content' :
1159  if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
1160  $args->s_title = $search_keyword;
1161  $args->s_content = $search_keyword;
1162  break;
1163  case 'user_id' :
1164  if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
1165  $args->s_user_id = $search_keyword;
1166  $args->sort_index = 'documents.'.$args->sort_index;
1167  break;
1168  case 'user_name' :
1169  case 'nick_name' :
1170  case 'email_address' :
1171  case 'homepage' :
1172  if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
1173  $args->{"s_".$search_target} = $search_keyword;
1174  break;
1175  case 'is_notice' :
1176  case 'is_secret' :
1177  if($search_keyword=='N') $args->statusList = array($this->getConfigStatus('public'));
1178  elseif($search_keyword=='Y') $args->statusList = array($this->getConfigStatus('secret'));
1179  break;
1180  case 'member_srl' :
1181  case 'readed_count' :
1182  case 'voted_count' :
1183  case 'blamed_count' :
1184  case 'comment_count' :
1185  case 'trackback_count' :
1186  case 'uploaded_count' :
1187  $args->{"s_".$search_target} = (int)$search_keyword;
1188  break;
1189  case 'regdate' :
1190  case 'last_update' :
1191  case 'ipaddress' :
1192  case 'tag' :
1193  $args->{"s_".$search_target} = $search_keyword;
1194  break;
1195  }
1196  }
1197 
1198  $output = executeQueryArray('document.getTrashList', $args);
1199  if($output->data)
1200  {
1201  foreach($output->data as $key => $attribute)
1202  {
1203  $oDocument = null;
1204  $oDocument = new documentItem();
1205  $oDocument->setAttribute($attribute, false);
1206  $attribute = $oDocument;
1207  }
1208  }
1209  return $output;
1210  }
1211 
1217  {
1218  $args = new stdClass;
1219  $document_srl = Context::get('document_srl');
1220  if(!$document_srl) return new BaseObject(-1,'msg_invalid_request');
1221 
1222  $point = Context::get('point');
1223  if($point != -1) $point = 1;
1224 
1225  $oDocumentModel = getModel('document');
1226  $columnList = array('document_srl', 'module_srl');
1227  $oDocument = $oDocumentModel->getDocument($document_srl, false, false, $columnList);
1228  $module_srl = $oDocument->get('module_srl');
1229  if(!$module_srl) return new BaseObject(-1, 'msg_invalid_request');
1230 
1231  $oModuleModel = getModel('module');
1232  $document_config = $oModuleModel->getModulePartConfig('document',$module_srl);
1233  if($point == -1)
1234  {
1235  if($document_config->use_vote_down!='S') return new BaseObject(-1, 'msg_invalid_request');
1236  $args->below_point = 0;
1237  }
1238  else
1239  {
1240  if($document_config->use_vote_up!='S') return new BaseObject(-1, 'msg_invalid_request');
1241  $args->more_point = 0;
1242  }
1243 
1244  $args->document_srl = $document_srl;
1245 
1246  $output = executeQueryArray('document.getVotedMemberList',$args);
1247  if(!$output->toBool()) return $output;
1248 
1249  $oMemberModel = getModel('member');
1250  if($output->data)
1251  {
1252  foreach($output->data as $k => $d)
1253  {
1254  $profile_image = $oMemberModel->getProfileImage($d->member_srl);
1255  $output->data[$k]->src = $profile_image->src;
1256  }
1257  }
1258 
1259  $this->add('voted_member_list',$output->data);
1260  }
1261 
1267  {
1268  global $lang;
1269  if(!isset($lang->status_name_list))
1270  return array_flip($this->getStatusList());
1271  else return $lang->status_name_list;
1272  }
1273 
1280  function _setSortIndex($obj, $load_extra_vars)
1281  {
1282  $sortIndex = $obj->sort_index;
1283  $isExtraVars = false;
1284  if(!in_array($sortIndex, array('list_order','regdate','last_update','update_order','readed_count','voted_count','blamed_count','comment_count','trackback_count','uploaded_count','title','category_srl')))
1285  {
1286  // get module_srl extra_vars list
1287  if ($load_extra_vars)
1288  {
1289  $extra_args = new stdClass();
1290  $extra_args->module_srl = $obj->module_srl;
1291  $extra_output = executeQueryArray('document.getGroupsExtraVars', $extra_args);
1292  if (!$extra_output->data || !$extra_output->toBool())
1293  {
1294  $sortIndex = 'list_order';
1295  }
1296  else
1297  {
1298  $check_array = array();
1299  foreach($extra_output->data as $val)
1300  {
1301  $check_array[] = $val->eid;
1302  }
1303  if(!in_array($sortIndex, $check_array)) $sortIndex = 'list_order';
1304  else $isExtraVars = true;
1305  }
1306  }
1307  else
1308  $sortIndex = 'list_order';
1309  }
1310  $returnObj = new stdClass();
1311  $returnObj->sort_index = $sortIndex;
1312  $returnObj->isExtraVars = $isExtraVars;
1313 
1314  return $returnObj;
1315  }
1316 
1327  function _setSearchOption($searchOpt, &$args, &$query_id, &$use_division)
1328  {
1329  // Variable check
1330  $args = new stdClass();
1331  $args->category_srl = $searchOpt->category_srl?$searchOpt->category_srl:null;
1332  $args->order_type = $searchOpt->order_type;
1333  $args->page = $searchOpt->page?$searchOpt->page:1;
1334  $args->list_count = $searchOpt->list_count?$searchOpt->list_count:20;
1335  $args->page_count = $searchOpt->page_count?$searchOpt->page_count:10;
1336  $args->start_date = $searchOpt->start_date?$searchOpt->start_date:null;
1337  $args->end_date = $searchOpt->end_date?$searchOpt->end_date:null;
1338  $args->member_srl = $searchOpt->member_srl;
1339  $args->member_srls = $searchOpt->member_srls;
1340 
1341  $logged_info = Context::get('logged_info');
1342 
1343  $args->sort_index = $searchOpt->sort_index;
1344 
1345  // Check the target and sequence alignment
1346  $orderType = array('desc' => 1, 'asc' => 1);
1347  if(!isset($orderType[$args->order_type])) $args->order_type = 'asc';
1348 
1349  // If that came across mid module_srl instead of a direct module_srl guhaejum
1350  if($searchOpt->mid)
1351  {
1352  $oModuleModel = getModel('module');
1353  $args->module_srl = $oModuleModel->getModuleSrlByMid($obj->mid);
1354  unset($searchOpt->mid);
1355  }
1356 
1357  // Module_srl passed the array may be a check whether the array
1358  if(is_array($searchOpt->module_srl)) $args->module_srl = implode(',', $searchOpt->module_srl);
1359  else $args->module_srl = $searchOpt->module_srl;
1360 
1361  // Except for the test module_srl
1362  if(is_array($searchOpt->exclude_module_srl)) $args->exclude_module_srl = implode(',', $searchOpt->exclude_module_srl);
1363  else $args->exclude_module_srl = $searchOpt->exclude_module_srl;
1364 
1365  // only admin document list, temp document showing
1366  if($searchOpt->statusList) $args->statusList = $searchOpt->statusList;
1367  else
1368  {
1369  if($logged_info->is_admin == 'Y' && !$searchOpt->module_srl)
1370  $args->statusList = array($this->getConfigStatus('secret'), $this->getConfigStatus('public'), $this->getConfigStatus('temp'));
1371  else
1372  $args->statusList = array($this->getConfigStatus('secret'), $this->getConfigStatus('public'));
1373  }
1374 
1375  // Category is selected, further sub-categories until all conditions
1376  if($args->category_srl)
1377  {
1378  $category_list = $this->getCategoryList($args->module_srl);
1379  $category_info = $category_list[$args->category_srl];
1380  $category_info->childs[] = $args->category_srl;
1381  $args->category_srl = implode(',',$category_info->childs);
1382  }
1383 
1384  // Used to specify the default query id (based on several search options to query id modified)
1385  $query_id = 'document.getDocumentList';
1386 
1387  // If the search by specifying the document division naeyonggeomsaekil processed for
1388  $use_division = false;
1389 
1390  // Search options
1391  $search_target = $searchOpt->search_target;
1392  $search_keyword = $searchOpt->search_keyword;
1393 
1394  if($search_target && $search_keyword)
1395  {
1396  switch($search_target)
1397  {
1398  case 'title' :
1399  case 'content' :
1400  if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
1401  $args->{"s_".$search_target} = $search_keyword;
1402  $use_division = true;
1403  break;
1404  case 'title_content' :
1405  if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
1406  $args->s_title = $search_keyword;
1407  $args->s_content = $search_keyword;
1408  $use_division = true;
1409  break;
1410  case 'user_id' :
1411  if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
1412  $args->s_user_id = $search_keyword;
1413  $args->sort_index = 'documents.'.$args->sort_index;
1414  break;
1415  case 'user_name' :
1416  case 'nick_name' :
1417  case 'email_address' :
1418  case 'homepage' :
1419  if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
1420  $args->{"s_".$search_target} = $search_keyword;
1421  break;
1422  case 'is_notice' :
1423  if($search_keyword=='N') $args->{"s_".$search_target} = 'N';
1424  elseif($search_keyword=='Y') $args->{"s_".$search_target} = 'Y';
1425  else $args->{"s_".$search_target} = '';
1426  break;
1427  case 'is_secret' :
1428  if($search_keyword=='N') $args->statusList = array($this->getConfigStatus('public'));
1429  elseif($search_keyword=='Y') $args->statusList = array($this->getConfigStatus('secret'));
1430  elseif($search_keyword=='temp') $args->statusList = array($this->getConfigStatus('temp'));
1431  break;
1432  case 'member_srl' :
1433  case 'readed_count' :
1434  case 'voted_count' :
1435  case 'comment_count' :
1436  case 'trackback_count' :
1437  case 'uploaded_count' :
1438  $args->{"s_".$search_target} = (int)$search_keyword;
1439  break;
1440  case 'member_srls' :
1441  $args->{"s_".$search_target} = (int)$search_keyword;
1442 
1443  if($logged_info->member_srl)
1444  {
1445  $srls = explode(',', $search_keyword);
1446  foreach($srls as $srl)
1447  {
1448  if(abs($srl) != $logged_info->member_srl)
1449  {
1450  break; // foreach
1451  }
1452 
1453  $args->{"s_".$search_target} = $search_keyword;
1454  break; // foreach
1455  }
1456  }
1457  break;
1458  case 'blamed_count' :
1459  $args->{"s_".$search_target} = (int)$search_keyword * -1;
1460  break;
1461  case 'regdate' :
1462  case 'last_update' :
1463  case 'ipaddress' :
1464  $args->{"s_".$search_target} = $search_keyword;
1465  break;
1466  case 'comment' :
1467  $args->s_comment = $search_keyword;
1468  $query_id = 'document.getDocumentListWithinComment';
1469  $use_division = true;
1470  break;
1471  case 'tag' :
1472  $args->s_tags = str_replace(' ','%',$search_keyword);
1473  $query_id = 'document.getDocumentListWithinTag';
1474  break;
1475  case 'extra_vars':
1476  $args->var_value = str_replace(' ', '%', $search_keyword);
1477  $query_id = 'document.getDocumentListWithinExtraVars';
1478  break;
1479  default :
1480  if(strpos($search_target,'extra_vars')!==false) {
1481  $args->var_idx = substr($search_target, strlen('extra_vars'));
1482  $args->var_value = str_replace(' ','%',$search_keyword);
1483  $args->sort_index = 'documents.'.$args->sort_index;
1484  $query_id = 'document.getDocumentListWithExtraVars';
1485  }
1486  break;
1487  }
1488  }
1489 
1490  if ($searchOpt->isExtraVars)
1491  {
1492  $query_id = 'document.getDocumentListExtraSort';
1493  }
1494  else
1495  {
1499  if($args->sort_index != 'list_order' || $args->order_type != 'asc') $use_division = false;
1500 
1504  if($use_division)
1505  {
1506  // Division begins
1507  $division = (int)Context::get('division');
1508 
1509  // order by list_order and (module_srl===0 or module_srl may count), therefore case table full scan
1510  if($args->sort_index == 'list_order' && ($args->exclude_module_srl === '0' || count(explode(',', $args->module_srl)) > 5))
1511  {
1512  $listSqlID = 'document.getDocumentListUseIndex';
1513  $divisionSqlID = 'document.getDocumentDivisionUseIndex';
1514  }
1515  else
1516  {
1517  $listSqlID = 'document.getDocumentList';
1518  $divisionSqlID = 'document.getDocumentDivision';
1519  }
1520 
1521  // If you do not value the best division top
1522  if(!$division)
1523  {
1524  $division_args = new stdClass();
1525  $division_args->module_srl = $args->module_srl;
1526  $division_args->exclude_module_srl = $args->exclude_module_srl;
1527  $division_args->list_count = 1;
1528  $division_args->sort_index = $args->sort_index;
1529  $division_args->order_type = $args->order_type;
1530  $division_args->statusList = $args->statusList;
1531 
1532  $output = executeQuery($divisionSqlID, $division_args, array('list_order'));
1533  if($output->data)
1534  {
1535  $item = array_pop($output->data);
1536  $division = $item->list_order;
1537  }
1538  $division_args = null;
1539  }
1540 
1541  // The last division
1542  $last_division = (int)Context::get('last_division');
1543 
1544  // Division after division from the 5000 value of the specified Wanted
1545  if(!$last_division)
1546  {
1547  $last_division_args = new stdClass();
1548  $last_division_args->module_srl = $args->module_srl;
1549  $last_division_args->exclude_module_srl = $args->exclude_module_srl;
1550  $last_division_args->list_count = 1;
1551  $last_division_args->sort_index = $args->sort_index;
1552  $last_division_args->order_type = $args->order_type;
1553  $last_division_args->list_order = $division;
1554  $last_division_args->page = 5001;
1555 
1556  $output = executeQuery($divisionSqlID, $last_division_args, array('list_order'));
1557  if($output->data)
1558  {
1559  $item = array_pop($output->data);
1560  $last_division = $item->list_order;
1561  }
1562  }
1563 
1564  // Make sure that after last_division article
1565  if($last_division)
1566  {
1567  $last_division_args = new stdClass();
1568  $last_division_args->module_srl = $args->module_srl;
1569  $last_division_args->exclude_module_srl = $args->exclude_module_srl;
1570  $last_division_args->list_order = $last_division;
1571  $output = executeQuery('document.getDocumentDivisionCount', $last_division_args);
1572  if($output->data->count<1) $last_division = null;
1573  }
1574 
1575  $args->division = $division;
1576  $args->last_division = $last_division;
1577  Context::set('division', $division);
1578  Context::set('last_division', $last_division);
1579  }
1580  }
1581  }
1582 
1588  function getDocumentCountByMemberSrl($member_srl)
1589  {
1590  $args = new stdClass();
1591  $args->member_srl = $member_srl;
1592  $output = executeQuery('document.getDocumentCountByMemberSrl', $args);
1593  return (int) $output->data->count;
1594  }
1595 
1605  function getDocumentListByMemberSrl($member_srl, $columnList = array(), $page = 0, $is_admin = FALSE, $count = 0 )
1606  {
1607  $args = new stdClass();
1608  $args->member_srl = $member_srl;
1609  $args->list_count = $count;
1610  $output = executeQuery('document.getDocumentListByMemberSrl', $args, $columnList);
1611  $document_list = $output->data;
1612 
1613  if(!$document_list) return array();
1614  if(!is_array($document_list)) $document_list = array($document_list);
1615 
1616  return $document_list;
1617  }
1618 
1624  {
1625  $documentConfig = getModel('document')->getDocumentConfig();
1627  {
1628  $iconSkin = $documentConfig->micons;
1629  }
1630  else
1631  {
1632  $iconSkin = $documentConfig->icons;
1633  }
1634  $path = sprintf('%s%s',getUrl(), "modules/document/tpl/icons/$iconSkin/");
1635 
1636  return $path;
1637  }
1638 }
1639 /* End of file document.model.php */
1640 /* Location: ./modules/document/document.model.php */
getAlias($document_srl)
getCategoryDocumentCount($module_srl, $category_srl)
getDocumentPage($oDocument, $opt)
$oModuleModel
Definition: ko.install.php:236
getController($module_name)
Definition: func.inc.php:90
getDocumentCountByMemberSrl($member_srl)
$obj
Definition: ko.install.php:262
if(file_exists(_XE_PATH_. 'config/config.user.inc.php')) if(!defined('__DEBUG__')) if(!defined('__DEBUG_OUTPUT__')) if(!defined('__DEBUG_PROTECT__')) if(!defined('__DEBUG_PROTECT_IP__')) if(!defined('__DEBUG_DB_OUTPUT__')) if(!defined('__LOG_SLOW_QUERY__')) if(!defined('__LOG_SLOW_TRIGGER__')) if(!defined('__LOG_SLOW_ADDON__')) if(!defined('__LOG_SLOW_WIDGET__')) if(!defined('__DEBUG_QUERY__')) if(!defined('__OB_GZHANDLER_ENABLE__')) if(!defined('__ENABLE_PHPUNIT_TEST__')) if(!defined('__PROXY_SERVER__')) if(!defined('__ERROR_LOG__')) if(!defined('__DISABLE_DEFAULT_CSS__')) if(!defined('__AUTO_OPCACHE_INVALIDATE__')) if((__DEBUG_OUTPUT__==2)&&version_compare(PHP_VERSION, '6.0.0')===-1) if(version_compare(PHP_VERSION, '5.3.0') >=0) $GLOBALS['__xe_autoload_file_map']
Definition: config.inc.php:324
$output
Definition: ko.install.php:193
add($key, $val)
$module_info
Definition: ko.install.php:289
getCategoryChlidCount($category_srl)
getDocumentSrlByTitle($module_srl, $title)
& getInstance($target= 'object', $info=null, $always_use_file=false)
getHistories($document_srl, $list_count, $page)
$act
a string value to contain the action name
foreach($sitemap as $id=> &$val) $extra_vars
Definition: ko.install.php:180
getDocument($document_srl=0, $is_admin=false, $load_extra_vars=true, $columnList=array())
set($key, $val, $set_to_get_vars=0)
getDailyArchivedList($obj)
loadJavascriptPlugin($plugin_name)
$module_srl
integer value to represent a run-time instance of Module (XE Module)
getDocumentCountByGroupStatus($search_obj=NULL)
_setSortIndex($obj, $load_extra_vars)
$args
Definition: ko.install.php:185
$mid
string to represent run-time instance of Module (XE Module)
getExtraVarsHTML($module_srl)
& getInstance($module_srl)
$document_srl
Definition: ko.install.php:279
isGranted($document_srl)
getCategoryList($module_srl, $columnList=array())
getDocumentExtraVarsFromDB($documentSrls)
getCategory($category_srl, $columnList=array())
$oDocumentModel
Definition: ko.install.php:259
isFromMobilePhone()
getDocuments($document_srls, $is_admin=false, $load_extra_vars=true, $columnList=array())
document the module&#39;s high class {
getLang($code)
const _XE_PATH_
Definition: config.inc.php:49
_setSearchOption($searchOpt, &$args, &$query_id, &$use_division)
getDocumentExtraVarsCount($module_srl, $search_obj=NULL)
getExtraKeys($module_srl)
getMonthlyArchivedList($obj)
getCategoryHTML($module_srl)
$oDocumentController
Definition: ko.install.php:260
$obj member_srl
Definition: ko.install.php:264
getModel($module_name)
Definition: func.inc.php:145
getCategoryXmlFile($module_srl)
getExtraVars($module_srl, $document_srl)
executeQueryArray($query_id, $args=NULL, $arg_columns=NULL)
Definition: func.inc.php:219
getDocumentCount($module_srl, $search_obj=NULL)
$module_srl
Definition: ko.install.php:254
getDocumentList($obj, $except_notice=false, $load_extra_vars=true, $columnList=array())
getDocumentListByMemberSrl($member_srl, $columnList=array(), $page=0, $is_admin=FALSE, $count=0)
executeQuery($query_id, $args=NULL, $arg_columns=NULL)
Definition: func.inc.php:203
getNoticeList($obj, $columnList=array())
getUrl()
Definition: func.inc.php:297
triggerCall($trigger_name, $called_position, &$obj)
getHistory($history_srl)
getCategoryPhpFile($module_srl)
_arrangeCategory(&$document_category, $list, $depth)
if(isset($_REQUEST['encode'])) if(isset($_REQUEST['decode'])) $lang
Definition: example.php:23
getDocumentSrlByAlias($mid, $alias)