mirror of
https://github.com/openclassify/openclassify.git
synced 2026-01-11 18:01:10 -06:00
commit
d74597c5d0
@ -1,16 +0,0 @@
|
||||
<?php namespace Visiosoft\AdvsModule\Adv\Event;
|
||||
|
||||
|
||||
class ChangeStatusAd
|
||||
{
|
||||
public function __construct($request,$settings)
|
||||
{
|
||||
$this->request = $request;
|
||||
$this->settings = $settings;
|
||||
}
|
||||
|
||||
public function getRequest()
|
||||
{
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,19 @@
|
||||
<?php namespace Visiosoft\AdvsModule\Adv\Event;
|
||||
|
||||
use Visiosoft\AdvsModule\Adv\AdvModel;
|
||||
|
||||
class ChangedStatusAd
|
||||
{
|
||||
private $ad;
|
||||
|
||||
public function __construct(AdvModel $ad)
|
||||
{
|
||||
$this->ad = $ad;
|
||||
}
|
||||
|
||||
public function getAdDetail()
|
||||
{
|
||||
return $this->ad;
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,18 @@
|
||||
<?php namespace Visiosoft\AdvsModule\Adv\Event;
|
||||
|
||||
use Visiosoft\AdvsModule\Adv\AdvModel;
|
||||
|
||||
class CreatedAd
|
||||
{
|
||||
private $ad;
|
||||
|
||||
public function __construct(AdvModel $ad)
|
||||
{
|
||||
$this->ad = $ad;
|
||||
}
|
||||
|
||||
public function getAdDetail()
|
||||
{
|
||||
return $this->ad;
|
||||
}
|
||||
}
|
||||
@ -2,6 +2,7 @@
|
||||
|
||||
use Anomaly\SettingsModule\Setting\Contract\SettingRepositoryInterface;
|
||||
use Anomaly\Streams\Platform\Ui\Table\Component\Action\ActionHandler;
|
||||
use Visiosoft\AdvsModule\Adv\Event\ChangedStatusAd;
|
||||
use Visiosoft\AdvsModule\Adv\Table\AdvTableBuilder;
|
||||
|
||||
|
||||
@ -14,11 +15,14 @@ class Approve extends ActionHandler
|
||||
foreach ($selected as $id) {
|
||||
$defaultAdPublishTime = $settingRepository->value('visiosoft.module.advs::default_published_time');
|
||||
|
||||
$model->newQuery()->find($id)->update([
|
||||
$ad = $model->newQuery()->find($id);
|
||||
$ad->update([
|
||||
'status' => 'approved',
|
||||
'finish_at' => date('Y-m-d H:i:s', strtotime(date('Y-m-d H:i:s') . ' + ' . $defaultAdPublishTime . ' day')),
|
||||
'publish_at' => date('Y-m-d H:i:s')
|
||||
]);
|
||||
event(new ChangedStatusAd($ad));//Create Notify
|
||||
|
||||
}
|
||||
|
||||
if ($selected) {
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
<?php namespace Visiosoft\AdvsModule\Adv\Table\Handler;
|
||||
|
||||
use Anomaly\Streams\Platform\Ui\Table\Component\Action\ActionHandler;
|
||||
use Visiosoft\AdvsModule\Adv\Event\ChangedStatusAd;
|
||||
use Visiosoft\AdvsModule\Adv\Table\AdvTableBuilder;
|
||||
|
||||
|
||||
@ -12,11 +13,12 @@ class Decline extends ActionHandler
|
||||
|
||||
foreach ($selected as $id) {
|
||||
|
||||
$entry = $model->find($id);
|
||||
$ad = $model->find($id);
|
||||
$ad->status = 'declined';
|
||||
$ad->update();
|
||||
|
||||
$entry->status = 'declined';
|
||||
event(new ChangedStatusAd($ad));//Create Notify
|
||||
|
||||
$entry->update();
|
||||
}
|
||||
|
||||
if ($selected) {
|
||||
|
||||
@ -15,7 +15,7 @@ use Visiosoft\AdvsModule\Adv\Table\Filter\CityFilterQuery;
|
||||
use Visiosoft\AdvsModule\Adv\Table\Filter\StatusFilterQuery;
|
||||
use Visiosoft\AdvsModule\Adv\Table\Filter\UserFilterQuery;
|
||||
use Visiosoft\AdvsModule\Adv\AdvModel;
|
||||
use Visiosoft\AdvsModule\Adv\Event\ChangeStatusAd;
|
||||
use Visiosoft\AdvsModule\Adv\Event\ChangedStatusAd;
|
||||
use Visiosoft\AdvsModule\Adv\Form\AdvFormBuilder;
|
||||
use Visiosoft\AdvsModule\Adv\Table\AdvTableBuilder;
|
||||
use Anomaly\Streams\Platform\Http\Controller\AdminController;
|
||||
@ -76,7 +76,7 @@ class AdvsController extends AdminController
|
||||
'change_owner' => [
|
||||
'data-toggle' => 'modal',
|
||||
'data-target' => '#modal',
|
||||
'href' => 'admin/advs-users/choose/{entry.id}',
|
||||
'href' => 'admin/advs-users/choose/{entry.id}',
|
||||
]
|
||||
]);
|
||||
|
||||
@ -209,25 +209,24 @@ class AdvsController extends AdminController
|
||||
return $form->render($id);
|
||||
}
|
||||
|
||||
public function actions($id, $type, SettingRepositoryInterface $settings, Dispatcher $events)
|
||||
public function actions($id, $type, SettingRepositoryInterface $settings, AdvModel $advModel)
|
||||
{
|
||||
|
||||
$adv = AdvsAdvsEntryModel::query()->where('advs_advs.id', '=', $id)->first();
|
||||
$adv->status = $type;
|
||||
$ad = $advModel->where('advs_advs.id', '=', $id)->first();
|
||||
$ad->status = $type;
|
||||
|
||||
$default_adv_publish = $settings->value('visiosoft.module.advs::default_published_time');
|
||||
$adv->finish_at = date('Y-m-d H:i:s', strtotime(date('Y-m-d H:i:s') . ' + ' . $default_adv_publish . ' day'));
|
||||
$adv->publish_at = date('Y-m-d H:i:s');
|
||||
$ad->finish_at = date('Y-m-d H:i:s', strtotime(date('Y-m-d H:i:s') . ' + ' . $default_adv_publish . ' day'));
|
||||
$ad->publish_at = date('Y-m-d H:i:s');
|
||||
|
||||
//algolia Search Module
|
||||
$isActiveAlgolia = new AdvModel();
|
||||
$isActiveAlgolia = $isActiveAlgolia->is_enabled('algolia');
|
||||
$isActiveAlgolia = $advModel->is_enabled('algolia');
|
||||
if ($isActiveAlgolia) {
|
||||
$algolia = new SearchModel();
|
||||
$algolia->updateStatus($id, $type, $settings);
|
||||
}
|
||||
$adv->update();
|
||||
$events->dispatch(new ChangeStatusAd($id, $settings));//Create Notify
|
||||
$ad->update();
|
||||
event(new ChangedStatusAd($ad));//Create Notify
|
||||
return back();
|
||||
}
|
||||
|
||||
|
||||
@ -8,6 +8,8 @@ use Anomaly\Streams\Platform\Model\Complaints\ComplaintsComplainTypesEntryModel;
|
||||
use Anomaly\Streams\Platform\Model\Options\OptionsAdvertisementEntryModel;
|
||||
use Anomaly\UsersModule\User\Contract\UserRepositoryInterface;
|
||||
use Visiosoft\AdvsModule\Adv\Command\appendRequestURL;
|
||||
use Visiosoft\AdvsModule\Adv\Event\ChangedStatusAd;
|
||||
use Visiosoft\AdvsModule\Adv\Event\CreatedAd;
|
||||
use Visiosoft\AdvsModule\Adv\Event\showAdPhone;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
@ -15,9 +17,6 @@ use Illuminate\Support\Facades\Cookie;
|
||||
use Visiosoft\LocationModule\City\CityRepository;
|
||||
use function PMA\Util\get;
|
||||
use Visiosoft\AdvsModule\Adv\AdvModel;
|
||||
use Visiosoft\AdvsModule\Adv\Event\ChangeStatusAd;
|
||||
use Visiosoft\AdvsModule\Adv\Event\CreateAd;
|
||||
use Visiosoft\AdvsModule\Adv\Event\EditAd;
|
||||
use Visiosoft\AdvsModule\Adv\Event\priceChange;
|
||||
use Visiosoft\AdvsModule\Adv\Event\UpdateAd;
|
||||
use Visiosoft\AdvsModule\Adv\Event\viewAd;
|
||||
@ -282,11 +281,13 @@ class AdvsController extends PublicController
|
||||
return $this->viewTypeBasedRedirect($viewType, $compact);
|
||||
}
|
||||
|
||||
public function fullLink($request, $url, $newParameters) {
|
||||
public function fullLink($request, $url, $newParameters)
|
||||
{
|
||||
return $this->dispatch(new appendRequestURL($request, $url, $newParameters));
|
||||
}
|
||||
|
||||
public function viewTypeBasedRedirect($viewType, $compact) {
|
||||
public function viewTypeBasedRedirect($viewType, $compact)
|
||||
{
|
||||
if (isset($viewType) and $viewType == 'table') {
|
||||
return $this->view->make('visiosoft.module.advs::list/table', $compact);
|
||||
} elseif (isset($viewType) and $viewType == 'map') {
|
||||
@ -367,10 +368,10 @@ class AdvsController extends PublicController
|
||||
$this->template->set('meta_keywords', implode(',', explode(' ', $adv->name)));
|
||||
$this->template->set('meta_description', strip_tags($adv->advs_desc, ''));
|
||||
$this->template->set('meta_title', $adv->name . "|" . end($categories)['name']);
|
||||
if (substr($adv->cover_photo, 0, 4 ) === "http") {
|
||||
if (substr($adv->cover_photo, 0, 4) === "http") {
|
||||
$coverPhoto = $adv->cover_photo;
|
||||
} else {
|
||||
if (substr($adv->cover_photo, 0, 1 ) === "/") {
|
||||
if (substr($adv->cover_photo, 0, 1) === "/") {
|
||||
$coverPhoto = \Illuminate\Support\Facades\Request::root() . $adv->cover_photo;
|
||||
} else {
|
||||
$coverPhoto = \Illuminate\Support\Facades\Request::root() . '/' . $adv->cover_photo;
|
||||
@ -588,7 +589,6 @@ class AdvsController extends PublicController
|
||||
// Auto approve
|
||||
if (setting_value('visiosoft.module.advs::auto_approve')) {
|
||||
$defaultAdPublishTime = setting_value('visiosoft.module.advs::default_published_time');
|
||||
|
||||
$adv->update([
|
||||
'status' => 'approved',
|
||||
'finish_at' => date('Y-m-d H:i:s', strtotime(date('Y-m-d H:i:s') . ' + ' . $defaultAdPublishTime . ' day')),
|
||||
@ -621,13 +621,7 @@ class AdvsController extends PublicController
|
||||
}
|
||||
return redirect('/advs/edit_advs/' . $request->update_id)->with('cats_d', $cats_d)->with('request', $request);
|
||||
}
|
||||
|
||||
if ($adv->slug == "") {
|
||||
$events->dispatch(new CreateAd($request->update_id, $settings));//Create Notify
|
||||
} else {
|
||||
$events->dispatch(new EditAd($request->update_id, $settings, $adv));//Update Notify
|
||||
}
|
||||
|
||||
event(new CreatedAd($adv));
|
||||
return redirect(route('advs_preview', [$request->update_id]));
|
||||
}
|
||||
|
||||
@ -732,7 +726,7 @@ class AdvsController extends PublicController
|
||||
}
|
||||
|
||||
$this->adv_model->statusAds($id, $type);
|
||||
$events->dispatch(new ChangeStatusAd($id, $settings));//Create Notify
|
||||
event(new ChangedStatusAd($ad));//Create Notify
|
||||
$this->messages->success(trans('streams::message.edit_success', ['name' => 'Status']));
|
||||
return back();
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user