<List noDataText="Drop list items here" id="list2">
<items>
<StandardListItem type="Navigation" title="List Item 1" description="Description text" icon="sap-icon://picture" id="item4"/>
</items>
</List>
define(
["sap/watt/platform/plugin/platform/service/ui/AbstractPart"],
function(AbstractPart) {
"use strict";
return AbstractPart.extend("twitterplugin.service.MyFirstViewService.", {
_oView: null,
getContent: function() {
var me = this;
return AbstractPart.prototype.getContent.apply(this, arguments).then(function() {
me._oView = sap.ui.view({
viewName: "twitterplugin.view.view.twitter",
type: sap.ui.core.mvc.ViewType.XML,
viewData: {
context: me.context
}
});
return me._oView;
});
}
});
});
{
"name":"twitterplugin",
"description":"twitterplugin",
"i18n":"twitterplugin/i18n/i18n",
"requires":{
"services":[
"usernotification",
"log",
"command",
"commandGroup",
"perspective"
]
},
"provides":{
"services":{
"sample":{
"implements":"twitterplugin.service.Sample",
"module":"twitterplugin/service/Sample"
},
"myfirstviewservice":{
"implements":"sap.watt.common.service.ui.Part",
"module":"twitterplugin/service/MyFirstViewService"
}
},
"interfaces":{
"twitterplugin.service.Sample":"twitterplugin/service/Sample"
}
},
"configures":{
"services":{
"perspective:views":[
{
"id":"myfirstview",
"service":"@myfirstviewservice"
}
],
"perspective:viewToAreaMapping":[
{
"view":"myfirstview",
"perspective":"development",
"area":"right"
}
],
"command:commands":[
{
"id":"myfirstviewcommand",
"label":"Open View",
"icon":"sap-icon://display",
"service":{
"implements":"sap.watt.common.service.ide.AbstractUIPartToggler",
"module":"sap.watt.common.perspective/command/AbstractUIPartToggler",
"configuration":{
"id":"myfirstviewcommand",
"service":"@myfirstviewservice",
"perspective":"development"
}
},
"keyBinding":"mod+shift+8"
},
{
"id":"twitterplugin.helloWorld",
"label":"{i18n>command_helloWorld}",
"service":"twitterplugin/command/HelloWorld"
}
],
"commandGroup:groups":[
{
"id":"tools.sample",
"label":"{i18n>commandgroup_sample}"
},
{
"id":"tools.sample.helloWorld"
}
],
"commandGroup:items":[
{
"parent":"applicationRightSidebar",
"command":"myfirstviewcommand",
"prio":101
},
{
"parent":"tools",
"type":"menu",
"group":"tools.sample",
"prio":100
},
{
"parent":"tools.sample",
"type":"inline",
"group":"tools.sample.helloWorld",
"prio":10
},
{
"parent":"tools.sample.helloWorld",
"type":"action",
"command":"twitterplugin.helloWorld",
"prio":10
}
]
}
},
"subscribes":{
"sample:notificationDisplayed":"sample:onAfterNotificationDisplayed"
}
}
<?php
require_once('TwitterAPIExchange.php');
/** Set access tokens here - see: https://dev.twitter.com/apps/ **/
$settings = array(
'oauth_access_token' => "<oauth token of your Twitter app>",
'oauth_access_token_secret' => "<oauth secret of your Twitter app>,
'consumer_key' => "< key of your Twitter app>",
'consumer_secret' => "<secret of your Twitter app>”
);
$url = "https://api.twitter.com/1.1/statuses/home_timeline.json";
$requestMethod = "GET";
if (isset($_GET['user'])) {$user = preg_replace("/[^A-Za-z0-9_]/", '', $_GET['user']);} else {$user = "nabheet";}
if (isset($_GET['count']) && is_numeric($_GET['count'])) {$count = $_GET['count'];}
else {
$count = 20;
}
$getfield = "?screen_name=$user&count=$count";
$twitter = new TwitterAPIExchange($settings);
$string = json_decode($twitter->setGetfield($getfield)
->buildOauth($url, $requestMethod)
->performRequest(),$assoc = TRUE);
if(array_key_exists("errors", $string)) {echo "<h3>Sorry, there was a problem.</h3><p>Twitter returned the following error message:</p><p><em>".$string[errors][0]["message"]."</em></p>";exit();}
$count = 0;
$items1 = array();
foreach($string as $items)
{
$items1[$count]['datetime'] = $items['created_at'];
$items1[$count]['user'] = $items['user']['name'];
$items1[$count]['Tweet'] = $items['text'];
$items1[$count]['url'] = $items['user']['profile_image_url'];
$count++;
}
echo json_encode(array("results"=>$items1));
?>
var oModel = new sap.ui.model.json.JSONModel("https://cors-anywhere.herokuapp.com/http://<site>/Twitter/twitter.php",);
this.getView().setModel(oModel);
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
7 | |
5 | |
5 | |
5 | |
5 | |
4 | |
4 | |
4 | |
3 | |
3 |