XpressEngine Core  1.11.2
 All Classes Namespaces Files Functions Variables Pages
file.admin.model.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) NAVER <http://www.navercorp.com> */
7 class fileAdminModel extends file
8 {
13  function init()
14  {
15  }
16 
65  function getFileList($obj, $columnList = array())
66  {
67  $args = new stdClass();
68  $this->_makeSearchParam($obj, $args);
69 
70  // Set valid/invalid state
71  if($obj->isvalid == 'Y') $args->isvalid = 'Y';
72  elseif($obj->isvalid == 'N') $args->isvalid = 'N';
73  // Set multimedia/common file
74  if($obj->direct_download == 'Y') $args->direct_download = 'Y';
75  elseif($obj->direct_download == 'N') $args->direct_download= 'N';
76  // Set variables
77  $args->sort_index = $obj->sort_index;
78  $args->page = $obj->page?$obj->page:1;
79  $args->list_count = $obj->list_count?$obj->list_count:20;
80  $args->page_count = $obj->page_count?$obj->page_count:10;
81  $args->s_module_srl = $obj->module_srl;
82  $args->exclude_module_srl = $obj->exclude_module_srl;
83  // Execute the file.getFileList query
84  $output = executeQuery('file.getFileList', $args, $columnList);
85  // Return if no result or an error occurs
86  if(!$output->toBool()||!count($output->data)) return $output;
87 
88  $oFileModel = getModel('file');
89 
90  foreach($output->data as $key => $file)
91  {
92  if($_SESSION['file_management'][$file->file_srl]) $file->isCarted = true;
93  else $file->isCarted = false;
94 
95  $file->download_url = $oFileModel->getDownloadUrl($file->file_srl, $file->sid, $file->module_srl);
96  $output->data[$key] = $file;
97  }
98 
99  return $output;
100  }
101 
120  {
121  //$this->_makeSearchParam($obj, $args);
122 
123  $output = executeQueryArray('file.getFilesCountByGroupValid', $args);
124  return $output->data;
125  }
126 
133  function getFilesCountByDate($date = '')
134  {
135  if($date) $args->regDate = date('Ymd', strtotime($date));
136 
137  $output = executeQuery('file.getFilesCount', $args);
138  if(!$output->toBool()) return 0;
139 
140  return $output->data->count;
141  }
142 
151  {
152  // Search options
153  $search_target = $obj->search_target?$obj->search_target:trim(Context::get('search_target'));
154  $search_keyword = $obj->search_keyword?$obj->search_keyword:trim(Context::get('search_keyword'));
155 
156  if($search_target && $search_keyword)
157  {
158  switch($search_target)
159  {
160  case 'filename' :
161  if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
162  $args->s_filename = $search_keyword;
163  break;
164  case 'filesize_more' :
165  $args->s_filesize_more = (int)$search_keyword;
166  break;
167  case 'filesize_mega_more' :
168  $args->s_filesize_more = (int)$search_keyword * 1024 * 1024;
169  break;
170  case 'filesize_less' :
171  $args->s_filesize_less = (int)$search_keyword;
172  break;
173  case 'filesize_mega_less' :
174  $args->s_filesize_less = (int)$search_keyword * 1024 * 1024;
175  break;
176  case 'download_count' :
177  $args->s_download_count = (int)$search_keyword;
178  break;
179  case 'regdate' :
180  $args->s_regdate = $search_keyword;
181  break;
182  case 'ipaddress' :
183  $args->s_ipaddress = $search_keyword;
184  break;
185  case 'user_id' :
186  $args->s_user_id = $search_keyword;
187  break;
188  case 'user_name' :
189  $args->s_user_name = $search_keyword;
190  break;
191  case 'nick_name' :
192  $args->s_nick_name = $search_keyword;
193  break;
194  case 'isvalid' :
195  $args->isvalid = $search_keyword;
196  break;
197  }
198  }
199  }
200 }
201 /* End of file file.admin.model.php */
202 /* Location: ./modules/file/file.admin.model.php */
getFilesCountByGroupValid($obj= '')
$obj
Definition: ko.install.php:262
$output
Definition: ko.install.php:193
getFileList($obj, $columnList=array())
$args
Definition: ko.install.php:185
getFilesCountByDate($date= '')
getModel($module_name)
Definition: func.inc.php:145
executeQueryArray($query_id, $args=NULL, $arg_columns=NULL)
Definition: func.inc.php:219
executeQuery($query_id, $args=NULL, $arg_columns=NULL)
Definition: func.inc.php:203
_makeSearchParam(&$obj, &$args)