
Public Member Functions | |
| getBasicFolder () | |
| getFolder () | |
| getCategoryName () | |
| getFamilyNames () | |
| & | getEditSelectList ($type, $parm, &$user) |
| isFieldHTML ($field) | |
| togglePublished (&$idlist, $value) | |
| resetDownloadCounts () | |
| getFilesSQL ($published, $count=false, $containerid=0, $descendants=false, $orderby=2, $search='', $limitstart=0, $limit=0, $submitter=0) | |
| popularLoggedFiles ($category, $max, $days, $user) | |
| popularDownloadedFiles ($category, $max, $user) | |
| newestFiles ($category, $max, $user) | |
| getCountInContainer ($id, $published, $search='') | |
| searchFilesSQL ($search_text, $seek_fields, &$user, $countOnly, $limitstart=0, $limit=0) | |
Protected Attributes | |
| $folderfield = 'folderid' | |
Definition at line 16 of file aliroFolderContent.php.
| aliroFolderContent::getBasicFolder | ( | ) |
Definition at line 19 of file aliroFolderContent.php.
References $folderfield, and aliroFolderHandler::getInstance().
Referenced by getCategoryName(), and getFamilyNames().
00019 { 00020 $folderfield = $this->folderfield; 00021 return aliroFolderHandler::getInstance()->getBasicFolder($this->$folderfield); 00022 }
| aliroFolderContent::getFolder | ( | ) |
Definition at line 24 of file aliroFolderContent.php.
References $folderfield, and aliroFolderHandler::getInstance().
00024 { 00025 $folderfield = $this->folderfield; 00026 return aliroFolderHandler::getInstance()->getFolder($this->$folderfield); 00027 }
| aliroFolderContent::getCategoryName | ( | ) |
Definition at line 29 of file aliroFolderContent.php.
References getBasicFolder().
00029 { 00030 $parent = $this->getBasicFolder(); 00031 return is_object($parent) ? $parent->getCategoryName(true) : ''; 00032 }
| aliroFolderContent::getFamilyNames | ( | ) |
Definition at line 34 of file aliroFolderContent.php.
References getBasicFolder().
00034 { 00035 $parent = $this->getBasicFolder(); 00036 return $parent->getFamilyNames(true); 00037 }
| & aliroFolderContent::getEditSelectList | ( | $ | type, | |
| $ | parm, | |||
| &$ | user | |||
| ) |
Definition at line 40 of file aliroFolderContent.php.
00040 { 00041 $repository =& remositoryRepository::getInstance(); 00042 $clist = $repository->getSelectList(false, $this->containerid, $type, $parm, $user); 00043 return $clist; 00044 }
| aliroFolderContent::isFieldHTML | ( | $ | field | ) |
| aliroFolderContent::togglePublished | ( | &$ | idlist, | |
| $ | value | |||
| ) |
Definition at line 52 of file aliroFolderContent.php.
00052 { 00053 $cids = implode( ',', $idlist ); 00054 $sql = "UPDATE #__downloads_files SET published=$value". "\nWHERE id IN ($cids)"; 00055 remositoryRepository::doSQL($sql); 00056 }
| aliroFolderContent::resetDownloadCounts | ( | ) |
| aliroFolderContent::getFilesSQL | ( | $ | published, | |
| $ | count = false, |
|||
| $ | containerid = 0, |
|||
| $ | descendants = false, |
|||
| $ | orderby = 2, |
|||
| $ | search = '', |
|||
| $ | limitstart = 0, |
|||
| $ | limit = 0, |
|||
| $ | submitter = 0 | |||
| ) |
Definition at line 63 of file aliroFolderContent.php.
00063 { 00064 $sorter = array ('', ' ORDER BY id', ' ORDER BY filetitle', ' ORDER BY downloads DESC', ' ORDER BY submitdate DESC', ' ORDER BY u.username'); 00065 if (!isset($sorter[$orderby]) OR $orderby == 0) $orderby = 2; 00066 if ($count) $results = 'count(f.id)'; 00067 else $results = 'f.*, AVG(l.value) AS vote_value, COUNT(l.value) AS vote_count'; 00068 if ($submitter) $results .= ', u.username'; 00069 if ($descendants AND $containerid) { 00070 $sql = "SELECT $results FROM #__downloads_structure AS s INNER JOIN #__downloads_files AS f ON f.containerid=s.item"; 00071 $where[] = "s.container = $containerid"; 00072 } 00073 else { 00074 $sql = "SELECT $results FROM #__downloads_files AS f "; 00075 if ($containerid) $where[] = "f.containerid = $this->id"; 00076 else $where[] = "f.metatype = 0"; 00077 } 00078 if ($submitter) $where[] = "f.submittedby = $submitter"; 00079 if (!$count) $sql .= ' LEFT JOIN #__downloads_log AS l ON l.type=3 AND l.fileid=f.id'; 00080 if ($submitter OR (5 == $orderby)) $sql .= ' LEFT JOIN #__users AS u ON u.id=f.submittedby'; 00081 if ($published) $where[] = 'f.published=1'; 00082 $interface =& remositoryInterface::getInstance(); 00083 if ($search) { 00084 $search = $interface->getEscaped($search); 00085 $where[] = "LOWER(f.filetitle) LIKE '%$search%'"; 00086 } 00087 if (isset($where)) $sql .= ' WHERE '.implode(' AND ',$where); 00088 $repository =& remositoryRepository::getInstance(); 00089 $user = $interface->getUser(); 00090 $sql .= remositoryAbstract::visibilitySQL ($user, $repository->See_Files_no_download); 00091 if (!$count) { 00092 $sql .= ' GROUP BY f.id'; 00093 $sql .= $sorter[$orderby]; 00094 } 00095 if ($limit) $sql .= " LIMIT $limitstart,$limit"; 00096 return $sql; 00097 }
| aliroFolderContent::popularLoggedFiles | ( | $ | category, | |
| $ | max, | |||
| $ | days, | |||
| $ | user | |||
| ) |
Definition at line 99 of file aliroFolderContent.php.
00099 { 00100 $interface =& remositoryInterface::getInstance(); 00101 $database =& $interface->getDB(); 00102 $sql = 'SELECT f.id, f.filetitle, f.autoshort, f.description, f.smalldesc, f.filedate, f.icon, f.containerid, c.name, COUNT( l.fileid ) AS downloads FROM #__downloads_log AS l, #__downloads_files AS f, #__downloads_containers AS c'; 00103 if ($category) $sql .= ', #__downloads_structure AS s'; 00104 $sql .= ' WHERE c.id = f.containerid AND f.published=1 AND l.type=1 AND l.fileid=f.id'; 00105 $repository =& remositoryRepository::getInstance(); 00106 $sql .= remositoryAbstract::visibilitySQL ($user, $repository->See_Files_no_download); 00107 if ($category) $sql .= " AND f.containerid=s.item AND s.container=$category"; 00108 $sql .= " AND DATE_SUB(CURDATE(),INTERVAL $days DAY ) <= l.date"; 00109 $sql .= " GROUP BY l.fileid ORDER BY downloads DESC LIMIT $max"; 00110 $database->setQuery($sql); 00111 $files = $database->loadObjectList(); 00112 if ($files) return $files; 00113 else return array(); 00114 }
| aliroFolderContent::popularDownloadedFiles | ( | $ | category, | |
| $ | max, | |||
| $ | user | |||
| ) |
Definition at line 116 of file aliroFolderContent.php.
00116 { 00117 $interface =& remositoryInterface::getInstance(); 00118 $database =& $interface->getDB(); 00119 $sql = 'SELECT f.id, f.downloads, f.filetitle, f.autoshort, f.description, f.smalldesc, f.filedate, f.icon, f.containerid, c.name from #__downloads_files AS f, #__downloads_containers AS c'; 00120 if ($category) $sql .= ', #__downloads_structure AS s'; 00121 $sql .= ' WHERE f.containerid = c.id AND f.published=1'; 00122 $repository =& remositoryRepository::getInstance(); 00123 $sql .= remositoryAbstract::visibilitySQL ($user, $repository->See_Files_no_download); 00124 if ($category) $sql .= " AND f.containerid=s.item AND s.container=$category"; 00125 $sql .= " ORDER BY downloads DESC LIMIT $max"; 00126 $database->setQuery($sql); 00127 $files = $database->loadObjectList(); 00128 if ($files) return $files; 00129 else return array(); 00130 }
| aliroFolderContent::newestFiles | ( | $ | category, | |
| $ | max, | |||
| $ | user | |||
| ) |
Definition at line 132 of file aliroFolderContent.php.
00132 { 00133 $interface =& remositoryInterface::getInstance(); 00134 $database =& $interface->getDB(); 00135 $sql = 'SELECT f.id, f.filetitle, f.autoshort, f.description, f.smalldesc, f.filedate, f.icon, f.containerid, c.name from #__downloads_files AS f, #__downloads_containers AS c'; 00136 if ($category) $sql .= ', #__downloads_structure AS s'; 00137 $sql .= ' WHERE f.containerid = c.id AND f.published=1'; 00138 $repository =& remositoryRepository::getInstance(); 00139 $sql .= remositoryAbstract::visibilitySQL ($user, $repository->See_Files_no_download); 00140 if ($category) $sql .= " AND f.containerid=s.item AND s.container=$category"; 00141 $sql .= " ORDER BY f.filedate DESC LIMIT $max"; 00142 $database->setQuery($sql); 00143 $files = $database->loadObjectList(); 00144 if ($files) return $files; 00145 else return array(); 00146 }
| aliroFolderContent::getCountInContainer | ( | $ | id, | |
| $ | published, | |||
| $ | search = '' | |||
| ) |
Definition at line 148 of file aliroFolderContent.php.
00148 { 00149 $interface =& remositoryInterface::getInstance(); 00150 $database =& $interface->getDB(); 00151 $sql = "SELECT COUNT(id) FROM #__downloads_files WHERE containerid = $id"; 00152 if ($published) $sql .= ' AND published=1'; 00153 if ($search) $sql .= " AND LOWER(filetitle) LIKE '%$search%'"; 00154 $database->setQuery($sql); 00155 return $database->loadResult(); 00156 }
| aliroFolderContent::searchFilesSQL | ( | $ | search_text, | |
| $ | seek_fields, | |||
| &$ | user, | |||
| $ | countOnly, | |||
| $ | limitstart = 0, |
|||
| $ | limit = 0 | |||
| ) |
Definition at line 158 of file aliroFolderContent.php.
00158 { 00159 $results = $countOnly ? 'COUNT(id)' : 'id,containerid,filetitle,description,icon,filesize,downloads'; 00160 $sql="SELECT $results FROM #__downloads_files AS f WHERE metatype = 0"; 00161 foreach ($seek_fields as $field) $orcondition[] = "$field LIKE '%$search_text%'"; 00162 if (isset($orcondition)) $sql .= ' AND ('.implode(' OR ', $orcondition).') '; 00163 else { 00164 echo '<br/> <br/>'._DOWN_SEARCH_ERR; 00165 exit; 00166 } 00167 $repository =& remositoryRepository::getInstance(); 00168 $sql .= remositoryAbstract::visibilitySQL ($user, $repository->See_Files_no_download); 00169 $sql .= ' ORDER BY filetitle'; 00170 if ($limit AND !$countOnly) $sql .= " LIMIT $limitstart,$limit"; 00171 return $sql; 00172 }
aliroFolderContent::$folderfield = 'folderid' [protected] |
Definition at line 17 of file aliroFolderContent.php.
Referenced by getBasicFolder(), and getFolder().
1.5.5