ja.son-williams.ca/www/plugins/jasonwilliams/feed/controllers/Feed.php

58 lines
1.3 KiB
PHP
Raw Permalink Normal View History

<?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'
]);
}
}