2026e4a872
Moving update/import functionality back to the feed controller (removing the import controller previously created), added an option to the backend that triggers the update from the custom SocialApis class.
58 lines
1.3 KiB
PHP
58 lines
1.3 KiB
PHP
<?php namespace jasonwilliams\feed\Controllers;
|
|
|
|
use Backend\Classes\Controller;
|
|
use BackendMenu;
|
|
use JasonWilliams\Feed\Classes\SocialApis;
|
|
|
|
class Feed extends Controller
|
|
{
|
|
public $implement = [
|
|
'Backend\Behaviors\ListController',
|
|
'Backend\Behaviors\FormController'
|
|
];
|
|
|
|
public $listConfig = 'config_list.yaml';
|
|
public $formConfig = 'config_form.yaml';
|
|
|
|
public function __construct()
|
|
{
|
|
parent::__construct();
|
|
BackendMenu::setContext('jasonwilliams.feed', 'main-menu-item');
|
|
}
|
|
|
|
public function import()
|
|
{
|
|
$this->pageTitle = 'Fetch posts';
|
|
}
|
|
|
|
public function onImportTwitter()
|
|
{
|
|
SocialApis::updateTwitter();
|
|
|
|
return $this->makePartial('import', [
|
|
'importType' => 'Twitter',
|
|
'content' => 'Done'
|
|
]);
|
|
}
|
|
|
|
public function onImportInstagram()
|
|
{
|
|
SocialApis::updateInstagram();
|
|
|
|
return $this->makePartial('import', [
|
|
'importType' => 'Instagram',
|
|
'content' => 'Done'
|
|
]);
|
|
}
|
|
|
|
public function onImportFoursquare()
|
|
{
|
|
SocialApis::updateFoursquare();
|
|
|
|
return $this->makePartial('import', [
|
|
'importType' => 'Foursquare',
|
|
'content' => 'Done'
|
|
]);
|
|
}
|
|
}
|