本文整理汇总了PHP中Frontend\Core\Engine\Model::getThumbnailFolders方法的典型用法代码示例。如果您正苦于以下问题:PHP Model::getThumbnailFolders方法的具体用法?PHP Model::getThumbnailFolders怎么用?PHP Model::getThumbnailFolders使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Frontend\Core\Engine\Model
的用法示例。
在下文中一共展示了Model::getThumbnailFolders方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getImagesForAlbum
/**
* Get the images for an album
*
* @param int $id
*
* @return bool
*/
public static function getImagesForAlbum($id, $limit = 0, $random = false)
{
if ($random == true) {
$orderBy = "RAND()";
} else {
$orderBy = "sequence";
}
if ($limit > 0) {
$records = (array) FrontendModel::getContainer()->get('database')->getRecords('SELECT i.*
FROM gallery_images AS i
WHERE i.language = ? AND i.album_id = ?
ORDER BY ' . $orderBy . '
LIMIT ?', array(FRONTEND_LANGUAGE, (int) $id, $limit));
} else {
$records = (array) FrontendModel::getContainer()->get('database')->getRecords('SELECT i.*
FROM gallery_images AS i
WHERE i.language = ? AND i.album_id = ?
ORDER BY ' . $orderBy, array(FRONTEND_LANGUAGE, (int) $id));
}
//--Loop records
if (!empty($records)) {
//--Get the thumbnail-folders
$folders = FrontendModel::getThumbnailFolders(FRONTEND_FILES_PATH . '/Gallery/Images', true);
//--Create the image-links to the thumbnail folders
foreach ($records as &$row) {
foreach ($folders as $folder) {
$row['image_' . $folder['dirname']] = $folder['url'] . '/' . $folder['dirname'] . '/' . $row['filename'];
}
}
//--Destroy the last $image (because of the reference) -- sugested by http://php.net/manual/en/control-structures.foreach.php
unset($row);
}
return $records;
}
示例2: getRevision
/**
* Get a revision for an item
*
* @param string $URL The URL for the item to get.
* @param int $revision The revisionID.
* @return array
*/
public static function getRevision($URL, $revision)
{
$return = (array) FrontendModel::getContainer()->get('database')->getRecord('SELECT i.id, i.revision_id, i.language, i.title, i.introduction, i.text, i.image,
c.title AS category_title, m2.url AS category_url,
UNIX_TIMESTAMP(i.publish_on) AS publish_on, i.user_id,
i.allow_comments,
m.keywords AS meta_keywords, m.keywords_overwrite AS meta_keywords_overwrite,
m.description AS meta_description, m.description_overwrite AS meta_description_overwrite,
m.title AS meta_title, m.title_overwrite AS meta_title_overwrite,
m.url,
m.data AS meta_data
FROM blog_posts AS i
INNER JOIN blog_categories AS c ON i.category_id = c.id
INNER JOIN meta AS m ON i.meta_id = m.id
INNER JOIN meta AS m2 ON c.meta_id = m2.id
WHERE i.language = ? AND i.revision_id = ? AND m.url = ?
LIMIT 1', array(FRONTEND_LANGUAGE, (int) $revision, (string) $URL));
// unserialize
if (isset($return['meta_data'])) {
$return['meta_data'] = @unserialize($return['meta_data']);
}
// image?
if (isset($return['image'])) {
$folders = FrontendModel::getThumbnailFolders(FRONTEND_FILES_PATH . '/Blog/Images', true);
foreach ($folders as $folder) {
$return['image_' . $folder['dirname']] = $folder['url'] . '/' . $folder['dirname'] . '/' . $return['image'];
}
}
// return
return $return;
}
示例3: get
/**
* Get an item
*
* @param string $URL The URL for the item.
*
* @return array
*/
public static function get($URL)
{
$return = (array) FrontendModel::getContainer()->get('database')->getRecord('SELECT i.*, l.*,
m.keywords AS meta_keywords, m.keywords_overwrite AS meta_keywords_overwrite,
m.description AS meta_description, m.description_overwrite AS meta_description_overwrite,
m.title AS meta_title, m.title_overwrite AS meta_title_overwrite,
m.url,
m.data AS meta_data
FROM addresses AS i
INNER JOIN addresses_lang AS l ON i.id = l.id AND l.language = ?
INNER JOIN meta AS m ON i.meta_id = m.id
WHERE i.hidden = ? AND m.url = ?
LIMIT 1', array(FRONTEND_LANGUAGE, 'N', (string) $URL));
if (empty($return)) {
return array();
}
// unserialize
if (isset($return['meta_data'])) {
$return['meta_data'] = @unserialize($return['meta_data']);
}
// image?
if (isset($return['image'])) {
$folders = FrontendModel::getThumbnailFolders(FRONTEND_FILES_PATH . '/Addresses/Images', true);
foreach ($folders as $folder) {
$return['image_' . $folder['dirname']] = $folder['url'] . '/' . $folder['dirname'] . '/' . $return['image'];
}
}
if (isset($return["country"])) {
//--Get country
$return["country"] = Intl::getRegionBundle()->getCountryName($return['country'], FRONTEND_LANGUAGE);
}
$return['company'] = self::replaceCharacters($return['company']);
// return
return $return;
}
示例4: getForTags
/**
* Fetch the list of tags for a list of items
*
* @param array $ids The ids of the items to grab.
* @return array
*/
public static function getForTags(array $ids)
{
// fetch items
$items = (array) FrontendModel::getContainer()->get('database')->getRecords('SELECT i.title, m.url
FROM blog_posts AS i
INNER JOIN meta AS m ON m.id = i.meta_id
WHERE i.status = ? AND i.hidden = ? AND i.id IN (' . implode(',', $ids) . ')
ORDER BY i.publish_on DESC', array('active', 'N'));
// has items
if (!empty($items)) {
// init var
$link = FrontendNavigation::getURLForBlock('Catalog', 'Detail');
$folders = FrontendModel::getThumbnailFolders(FRONTEND_FILES_PATH . '/Catalog/Images', true);
// reset url
foreach ($items as &$row) {
$row['full_url'] = $link . '/' . $row['url'];
// image?
if (isset($row['image'])) {
foreach ($folders as $folder) {
$row['image_' . $folder['dirname']] = $folder['url'] . '/' . $folder['dirname'] . '/' . $row['image'];
}
}
}
}
// return
return $items;
}