mirror of
https://github.com/openclassify/openclassify.git
synced 2026-01-24 22:11:01 -06:00
Merge pull request #668 from openclassify/vedatakdgn
add popular ads limit && added Theme Settings Link For Settings
This commit is contained in:
commit
239689e5de
@ -21,6 +21,7 @@ return [
|
|||||||
'title' => 'visiosoft.module.advs::section.ads',
|
'title' => 'visiosoft.module.advs::section.ads',
|
||||||
'fields' => [
|
'fields' => [
|
||||||
'latest-limit',
|
'latest-limit',
|
||||||
|
'popular_ads_limit',
|
||||||
'default_view_type',
|
'default_view_type',
|
||||||
'hide_zero_price',
|
'hide_zero_price',
|
||||||
'auto_approve',
|
'auto_approve',
|
||||||
|
|||||||
@ -248,4 +248,11 @@ return [
|
|||||||
'default_value' => false,
|
'default_value' => false,
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
|
|
||||||
|
'popular_ads_limit' => [
|
||||||
|
'type' => 'anomaly.field_type.integer',
|
||||||
|
'config' => [
|
||||||
|
'default_value' => 15,
|
||||||
|
],
|
||||||
|
],
|
||||||
];
|
];
|
||||||
|
|||||||
@ -155,4 +155,7 @@ return [
|
|||||||
'tcmb_exchange_url' => [
|
'tcmb_exchange_url' => [
|
||||||
'name' => 'TCMB Exchange URL',
|
'name' => 'TCMB Exchange URL',
|
||||||
],
|
],
|
||||||
|
'popular_ads_limit' => [
|
||||||
|
'name' => 'Popular Ads Limit',
|
||||||
|
],
|
||||||
];
|
];
|
||||||
|
|||||||
@ -477,4 +477,14 @@ class AdvRepository extends EntryRepository implements AdvRepositoryInterface
|
|||||||
->where('advs_advs.status', 'approved')
|
->where('advs_advs.status', 'approved')
|
||||||
->where('advs_advs.finish_at', '>', date('Y-m-d H:i:s'));
|
->where('advs_advs.finish_at', '>', date('Y-m-d H:i:s'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getPopular()
|
||||||
|
{
|
||||||
|
return $this->newQuery()
|
||||||
|
->whereDate('finish_at', '>=', date("Y-m-d H:i:s"))
|
||||||
|
->where('status', '=', 'approved')
|
||||||
|
->where('slug', '!=', '')
|
||||||
|
->orderBy('count_show_ad', 'desc')
|
||||||
|
->paginate(setting_value('visiosoft.module.advs::popular_ads_limit', setting_value('streams::per_page')));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,20 @@
|
|||||||
|
<?php namespace Visiosoft\AdvsModule\Adv\Command;
|
||||||
|
|
||||||
|
use Visiosoft\AdvsModule\Adv\Contract\AdvRepositoryInterface;
|
||||||
|
|
||||||
|
class getPopular
|
||||||
|
{
|
||||||
|
public function handle(AdvRepositoryInterface $repository)
|
||||||
|
{
|
||||||
|
$ads = $repository->getPopular();
|
||||||
|
|
||||||
|
$ads = $repository->getModel()->getLocationNames($ads);
|
||||||
|
|
||||||
|
foreach ($ads as $index => $ad) {
|
||||||
|
$ads[$index]->detail_url = $repository->getModel()->getAdvDetailLinkByModel($ad, 'list');
|
||||||
|
$ads[$index] = $repository->getModel()->AddAdsDefaultCoverImage($ad);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $ads;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -39,4 +39,6 @@ interface AdvRepositoryInterface extends EntryRepositoryInterface
|
|||||||
public function extendAds($allAds, $isAdmin = false);
|
public function extendAds($allAds, $isAdmin = false);
|
||||||
|
|
||||||
public function getByUsersIDs($usersIDs);
|
public function getByUsersIDs($usersIDs);
|
||||||
|
|
||||||
|
public function getPopular();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,8 +6,10 @@ use Visiosoft\AdvsModule\Adv\AdvModel;
|
|||||||
use Visiosoft\AdvsModule\Adv\Command\appendRequestURL;
|
use Visiosoft\AdvsModule\Adv\Command\appendRequestURL;
|
||||||
use Visiosoft\AdvsModule\Adv\Command\GetAd;
|
use Visiosoft\AdvsModule\Adv\Command\GetAd;
|
||||||
use Visiosoft\AdvsModule\Adv\Command\getExchange;
|
use Visiosoft\AdvsModule\Adv\Command\getExchange;
|
||||||
|
use Visiosoft\AdvsModule\Adv\Command\getPopular;
|
||||||
use Visiosoft\AdvsModule\Adv\Command\isActive;
|
use Visiosoft\AdvsModule\Adv\Command\isActive;
|
||||||
use Visiosoft\AdvsModule\Adv\Command\LatestAds;
|
use Visiosoft\AdvsModule\Adv\Command\LatestAds;
|
||||||
|
use Visiosoft\AdvsModule\Adv\Contract\AdvRepositoryInterface;
|
||||||
use Visiosoft\AdvsModule\Currency\Currency;
|
use Visiosoft\AdvsModule\Currency\Currency;
|
||||||
use Visiosoft\AdvsModule\Currency\CurrencyFormat;
|
use Visiosoft\AdvsModule\Currency\CurrencyFormat;
|
||||||
|
|
||||||
@ -109,7 +111,15 @@ class AdvsModulePlugin extends Plugin
|
|||||||
}
|
}
|
||||||
return $exchange;
|
return $exchange;
|
||||||
}
|
}
|
||||||
)
|
), new \Twig_SimpleFunction(
|
||||||
|
'getPopular',
|
||||||
|
function () {
|
||||||
|
if (!$popular = $this->dispatch(new getPopular())) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return $popular;
|
||||||
|
}
|
||||||
|
),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -365,18 +365,24 @@ class AdvsModuleServiceProvider extends AddonServiceProvider
|
|||||||
{
|
{
|
||||||
// Run extra post-boot registration logic here.
|
// Run extra post-boot registration logic here.
|
||||||
// Use method injection or commands to bring in services.
|
// Use method injection or commands to bring in services.
|
||||||
$slug = 'general_settings';
|
$settings_url = [
|
||||||
$section = [
|
'general_settings' => [
|
||||||
'title' => 'visiosoft.module.advs::button.general_settings',
|
'title' => 'visiosoft.module.advs::button.general_settings',
|
||||||
'href' => '/admin/settings/modules/visiosoft.module.advs',
|
'href' => '/admin/settings/modules/visiosoft.module.advs',
|
||||||
|
],
|
||||||
|
'theme_settings' => [
|
||||||
|
'title' => 'visiosoft.theme.defaultadmin::section.theme_settings.name',
|
||||||
|
'href' => url('admin/settings/themes/' . setting_value('streams::standard_theme')),
|
||||||
|
],
|
||||||
|
'assets_clear' => [
|
||||||
|
'title' => 'visiosoft.module.advs::section.assets_clear.name',
|
||||||
|
'href' => route('assets_clear'),
|
||||||
|
],
|
||||||
];
|
];
|
||||||
$slug2 = 'assets_clear';
|
|
||||||
$section2 = [
|
foreach ($settings_url as $key => $value) {
|
||||||
'title' => 'visiosoft.module.advs::section.assets_clear.name',
|
$addonCollection->get('anomaly.module.settings')->addSection($key, $value);
|
||||||
'href' => '/admin/assets/clear',
|
}
|
||||||
];
|
|
||||||
$addonCollection->get('anomaly.module.settings')->addSection($slug, $section);
|
|
||||||
$addonCollection->get('anomaly.module.settings')->addSection($slug2, $section2);
|
|
||||||
|
|
||||||
// Disable file versioning
|
// Disable file versioning
|
||||||
$fileModel->disableVersioning();
|
$fileModel->disableVersioning();
|
||||||
|
|||||||
@ -0,0 +1,7 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
'theme_settings' => [
|
||||||
|
'name' => 'Theme Settings'
|
||||||
|
],
|
||||||
|
];
|
||||||
Loading…
Reference in New Issue
Block a user