mirror of
https://github.com/openclassify/openclassify.git
synced 2026-01-24 22:11:01 -06:00
Merge pull request #926 from openclassify/dia
#3025 Making the announcement status flexible.
This commit is contained in:
commit
7e93deea32
@ -0,0 +1,43 @@
|
|||||||
|
<?php namespace Visiosoft\AdvsModule\Http\Controller\Admin;
|
||||||
|
|
||||||
|
use Visiosoft\AdvsModule\Status\Form\StatusFormBuilder;
|
||||||
|
use Visiosoft\AdvsModule\Status\Table\StatusTableBuilder;
|
||||||
|
use Anomaly\Streams\Platform\Http\Controller\AdminController;
|
||||||
|
|
||||||
|
class StatusController extends AdminController
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display an index of existing entries.
|
||||||
|
*
|
||||||
|
* @param StatusTableBuilder $table
|
||||||
|
* @return \Symfony\Component\HttpFoundation\Response
|
||||||
|
*/
|
||||||
|
public function index(StatusTableBuilder $table)
|
||||||
|
{
|
||||||
|
return $table->render();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new entry.
|
||||||
|
*
|
||||||
|
* @param StatusFormBuilder $form
|
||||||
|
* @return \Symfony\Component\HttpFoundation\Response
|
||||||
|
*/
|
||||||
|
public function create(StatusFormBuilder $form)
|
||||||
|
{
|
||||||
|
return $form->render();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Edit an existing entry.
|
||||||
|
*
|
||||||
|
* @param StatusFormBuilder $form
|
||||||
|
* @param $id
|
||||||
|
* @return \Symfony\Component\HttpFoundation\Response
|
||||||
|
*/
|
||||||
|
public function edit(StatusFormBuilder $form, $id)
|
||||||
|
{
|
||||||
|
return $form->render($id);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,8 @@
|
|||||||
|
<?php namespace Visiosoft\AdvsModule\Status\Contract;
|
||||||
|
|
||||||
|
use Anomaly\Streams\Platform\Entry\Contract\EntryInterface;
|
||||||
|
|
||||||
|
interface StatusInterface extends EntryInterface
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,8 @@
|
|||||||
|
<?php namespace Visiosoft\AdvsModule\Status\Contract;
|
||||||
|
|
||||||
|
use Anomaly\Streams\Platform\Entry\Contract\EntryRepositoryInterface;
|
||||||
|
|
||||||
|
interface StatusRepositoryInterface extends EntryRepositoryInterface
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,66 @@
|
|||||||
|
<?php namespace Visiosoft\AdvsModule\Status\Form;
|
||||||
|
|
||||||
|
use Anomaly\Streams\Platform\Ui\Form\FormBuilder;
|
||||||
|
|
||||||
|
class StatusFormBuilder extends FormBuilder
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The form fields.
|
||||||
|
*
|
||||||
|
* @var array|string
|
||||||
|
*/
|
||||||
|
protected $fields = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Additional validation rules.
|
||||||
|
*
|
||||||
|
* @var array|string
|
||||||
|
*/
|
||||||
|
protected $rules = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fields to skip.
|
||||||
|
*
|
||||||
|
* @var array|string
|
||||||
|
*/
|
||||||
|
protected $skips = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The form actions.
|
||||||
|
*
|
||||||
|
* @var array|string
|
||||||
|
*/
|
||||||
|
protected $actions = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The form buttons.
|
||||||
|
*
|
||||||
|
* @var array|string
|
||||||
|
*/
|
||||||
|
protected $buttons = [
|
||||||
|
'cancel',
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The form options.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $options = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The form sections.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $sections = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The form assets.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $assets = [];
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,8 @@
|
|||||||
|
<?php namespace Visiosoft\AdvsModule\Status;
|
||||||
|
|
||||||
|
use Anomaly\Streams\Platform\Entry\EntryCollection;
|
||||||
|
|
||||||
|
class StatusCollection extends EntryCollection
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,8 @@
|
|||||||
|
<?php namespace Visiosoft\AdvsModule\Status;
|
||||||
|
|
||||||
|
use Anomaly\Streams\Platform\Entry\EntryCriteria;
|
||||||
|
|
||||||
|
class StatusCriteria extends EntryCriteria
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,9 @@
|
|||||||
|
<?php namespace Visiosoft\AdvsModule\Status;
|
||||||
|
|
||||||
|
use Visiosoft\AdvsModule\Status\Contract\StatusInterface;
|
||||||
|
use Anomaly\Streams\Platform\Model\Advs\AdvsStatusEntryModel;
|
||||||
|
|
||||||
|
class StatusModel extends AdvsStatusEntryModel implements StatusInterface
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,8 @@
|
|||||||
|
<?php namespace Visiosoft\AdvsModule\Status;
|
||||||
|
|
||||||
|
use Anomaly\Streams\Platform\Entry\EntryObserver;
|
||||||
|
|
||||||
|
class StatusObserver extends EntryObserver
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,8 @@
|
|||||||
|
<?php namespace Visiosoft\AdvsModule\Status;
|
||||||
|
|
||||||
|
use Anomaly\Streams\Platform\Entry\EntryPresenter;
|
||||||
|
|
||||||
|
class StatusPresenter extends EntryPresenter
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,25 @@
|
|||||||
|
<?php namespace Visiosoft\AdvsModule\Status;
|
||||||
|
|
||||||
|
use Visiosoft\AdvsModule\Status\Contract\StatusRepositoryInterface;
|
||||||
|
use Anomaly\Streams\Platform\Entry\EntryRepository;
|
||||||
|
|
||||||
|
class StatusRepository extends EntryRepository implements StatusRepositoryInterface
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The entry model.
|
||||||
|
*
|
||||||
|
* @var StatusModel
|
||||||
|
*/
|
||||||
|
protected $model;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new StatusRepository instance.
|
||||||
|
*
|
||||||
|
* @param StatusModel $model
|
||||||
|
*/
|
||||||
|
public function __construct(StatusModel $model)
|
||||||
|
{
|
||||||
|
$this->model = $model;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,8 @@
|
|||||||
|
<?php namespace Visiosoft\AdvsModule\Status;
|
||||||
|
|
||||||
|
use Anomaly\Streams\Platform\Entry\EntryRouter;
|
||||||
|
|
||||||
|
class StatusRouter extends EntryRouter
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,15 @@
|
|||||||
|
<?php namespace Visiosoft\AdvsModule\Status;
|
||||||
|
|
||||||
|
use Anomaly\Streams\Platform\Database\Seeder\Seeder;
|
||||||
|
|
||||||
|
class StatusSeeder extends Seeder
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Run the seeder.
|
||||||
|
*/
|
||||||
|
public function run()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,63 @@
|
|||||||
|
<?php namespace Visiosoft\AdvsModule\Status\Table;
|
||||||
|
|
||||||
|
use Anomaly\Streams\Platform\Ui\Table\TableBuilder;
|
||||||
|
|
||||||
|
class StatusTableBuilder extends TableBuilder
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The table views.
|
||||||
|
*
|
||||||
|
* @var array|string
|
||||||
|
*/
|
||||||
|
protected $views = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The table filters.
|
||||||
|
*
|
||||||
|
* @var array|string
|
||||||
|
*/
|
||||||
|
protected $filters = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The table columns.
|
||||||
|
*
|
||||||
|
* @var array|string
|
||||||
|
*/
|
||||||
|
protected $columns = [
|
||||||
|
'name',
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The table buttons.
|
||||||
|
*
|
||||||
|
* @var array|string
|
||||||
|
*/
|
||||||
|
protected $buttons = [
|
||||||
|
'edit'
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The table actions.
|
||||||
|
*
|
||||||
|
* @var array|string
|
||||||
|
*/
|
||||||
|
protected $actions = [
|
||||||
|
'delete'
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The table options.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $options = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The table assets.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $assets = [];
|
||||||
|
|
||||||
|
}
|
||||||
@ -6,20 +6,13 @@ use Anomaly\UsersModule\User\Authenticator\Contract\AuthenticatorExtensionInterf
|
|||||||
use Anomaly\UsersModule\User\Contract\UserInterface;
|
use Anomaly\UsersModule\User\Contract\UserInterface;
|
||||||
use Anomaly\UsersModule\User\Contract\UserRepositoryInterface;
|
use Anomaly\UsersModule\User\Contract\UserRepositoryInterface;
|
||||||
use Anomaly\UsersModule\User\Event\UserWasLoggedIn;
|
use Anomaly\UsersModule\User\Event\UserWasLoggedIn;
|
||||||
use Anomaly\UsersModule\User\User;
|
|
||||||
use Anomaly\UsersModule\User\UserPassword;
|
|
||||||
use http\Env\Response;
|
|
||||||
use Visiosoft\AdvsModule\Adv\AdvModel;
|
use Visiosoft\AdvsModule\Adv\AdvModel;
|
||||||
use Visiosoft\AdvsModule\Http\Controller\AdvsController;
|
|
||||||
use Visiosoft\CartsModule\Saleitem\Command\ProcessSaleitem;
|
|
||||||
use Visiosoft\CartsModule\Saleitem\SaleitemModel;
|
|
||||||
use Visiosoft\CloudsiteModule\Site\Event\CreateSite;
|
use Visiosoft\CloudsiteModule\Site\Event\CreateSite;
|
||||||
use Illuminate\Contracts\Auth\Guard;
|
use Illuminate\Contracts\Auth\Guard;
|
||||||
use Illuminate\Contracts\Container\Container;
|
use Illuminate\Contracts\Container\Container;
|
||||||
use Illuminate\Contracts\Events\Dispatcher;
|
use Illuminate\Contracts\Events\Dispatcher;
|
||||||
use Illuminate\Http\RedirectResponse;
|
use Illuminate\Http\RedirectResponse;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Support\Facades\Hash;
|
|
||||||
use Illuminate\Support\Facades\Redirect;
|
use Illuminate\Support\Facades\Redirect;
|
||||||
use Visiosoft\CloudsiteModule\Site\SiteModel;
|
use Visiosoft\CloudsiteModule\Site\SiteModel;
|
||||||
use Visiosoft\ProfileModule\Profile\ProfileRepository;
|
use Visiosoft\ProfileModule\Profile\ProfileRepository;
|
||||||
|
|||||||
@ -1,11 +1,23 @@
|
|||||||
<?php namespace Visiosoft\ProfileModule\Profile\Profile;
|
<?php namespace Visiosoft\ProfileModule\Profile\Profile;
|
||||||
|
|
||||||
|
use Anomaly\Streams\Platform\Addon\Extension\ExtensionCollection;
|
||||||
use Anomaly\Streams\Platform\Message\MessageBag;
|
use Anomaly\Streams\Platform\Message\MessageBag;
|
||||||
|
use Anomaly\UsersModule\User\Authenticator\Contract\AuthenticatorExtensionInterface;
|
||||||
|
use Anomaly\UsersModule\User\Contract\UserInterface;
|
||||||
use Anomaly\UsersModule\User\UserModel;
|
use Anomaly\UsersModule\User\UserModel;
|
||||||
|
use Illuminate\Http\RedirectResponse;
|
||||||
|
use Illuminate\Support\Facades\Redirect;
|
||||||
use Visiosoft\ProfileModule\Events\UserUpdated;
|
use Visiosoft\ProfileModule\Events\UserUpdated;
|
||||||
|
|
||||||
class ProfileFormHandler
|
class ProfileFormHandler
|
||||||
{
|
{
|
||||||
|
protected $extensions;
|
||||||
|
|
||||||
|
public function __construct(ExtensionCollection $extensions)
|
||||||
|
{
|
||||||
|
$this->extensions = $extensions;
|
||||||
|
}
|
||||||
|
|
||||||
public function handle(
|
public function handle(
|
||||||
ProfileFormBuilder $builder,
|
ProfileFormBuilder $builder,
|
||||||
MessageBag $messages,
|
MessageBag $messages,
|
||||||
@ -27,6 +39,11 @@ class ProfileFormHandler
|
|||||||
'google_address' => $builder->getPostValue('google_address') ?: null,
|
'google_address' => $builder->getPostValue('google_address') ?: null,
|
||||||
];
|
];
|
||||||
|
|
||||||
|
if (($valid = $this->validate($parameters)) !== true) {
|
||||||
|
$messages->error($valid['msg']);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (setting_value('visiosoft.module.profile::show_education_profession')) {
|
if (setting_value('visiosoft.module.profile::show_education_profession')) {
|
||||||
$parameters = array_merge($parameters, [
|
$parameters = array_merge($parameters, [
|
||||||
'education' => $builder->getPostValue('education'),
|
'education' => $builder->getPostValue('education'),
|
||||||
@ -70,4 +87,21 @@ class ProfileFormHandler
|
|||||||
}
|
}
|
||||||
return $changes;
|
return $changes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function validate(array $fields)
|
||||||
|
{
|
||||||
|
$validators = $this->extensions
|
||||||
|
->search('visiosoft.module.profile::validation.*')
|
||||||
|
->enabled();
|
||||||
|
|
||||||
|
foreach ($validators as $validator) {
|
||||||
|
$valid = $validator->validate($fields);
|
||||||
|
|
||||||
|
if ($valid['error']) {
|
||||||
|
return $valid;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,6 @@
|
|||||||
|
<?php namespace Visiosoft\ProfileModule\Profile\Validator\Contract;
|
||||||
|
|
||||||
|
interface ValidatorExtensionInterface
|
||||||
|
{
|
||||||
|
public function validate(array $fields);
|
||||||
|
}
|
||||||
@ -0,0 +1,12 @@
|
|||||||
|
<?php namespace Visiosoft\ProfileModule\Profile\Validator;
|
||||||
|
|
||||||
|
use Anomaly\Streams\Platform\Addon\Extension\Extension;
|
||||||
|
use Visiosoft\ProfileModule\Profile\Validator\Contract\ValidatorExtensionInterface;
|
||||||
|
|
||||||
|
class ValidatorExtension extends Extension implements ValidatorExtensionInterface
|
||||||
|
{
|
||||||
|
public function validate(array $fields)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user