//added rss and useful link on dashboard

This commit is contained in:
Vincent Augagneur
2013-09-09 18:44:34 +02:00
parent 69b38f4d6f
commit 4e1a513371
3 changed files with 69 additions and 22 deletions
@@ -52,33 +52,26 @@
<div class="col-lg-2">
<section class="dash_news panel">
<h4><i class="icon-rss"></i> PrestaShop News</h4>
<article>
<strong>Important it is to focus marketing efforts.</strong><br/>
Lets go over how to use newsletters to increase traffic to your online store and well review the benefits, what to include and how to get subscribers.
</article>
<br/>
<article>
<strong>Important it is to focus marketing efforts.</strong><br/>
Lets go over how to use newsletters to increase traffic to your online store and well review the benefits, what to include and how to get subscribers.
</article>
<br/>
<article>
<strong>Important it is to focus marketing efforts.</strong><br/>
Lets go over how to use newsletters to increase traffic to your online store and well review the benefits, what to include and how to get subscribers.
</article>
</section>
<section class="dash_links panel">
<h4><i class="icon-link"></i> Useful Links</h4>
<ul>
<li><a href="#">link</a></li>
<li><a href="#">link</a></li>
<li><a href="#">link</a></li>
<li><a href="#">link</a></li>
</ul>
<h4><i class="icon-link"></i>{l s="Useful PrestaShop Links"}</h4>
<dl>
<dt>{l s="Discover the latest official documentation :"}</dt>
<dd><a href="http://doc.prestashop.com/display/PS16?utm_source=backoffice_dashboard" target="_blank">{l s="PrestaShop documentation"}</a></dd>
</dl>
<dl>
<dt>{l s="Use the PrestaShop forum &amp; discover a great community :"}</dt>
<dd><a href="http://www.prestashop.com/forums?utm_source=backoffice_dashboard" target="_blank">{l s="Go to forums.prestashop.com"}</a></dd>
</dl>
<dl>
<dt>{l s="Enhance your Shop with new templates &amp; modules :"}</dt>
<dd><a href="http://addons.prestashop.com?utm_source=backoffice_dashboard" target="_blank">{l s="Go to addons.prestashop.com"}</a></dd>
</dl>
</section>
</div>
</div>
</div>
<script>
var testdata = [
{
@@ -91,4 +91,30 @@ class AdminDashboardControllerCore extends AdminController
die(Tools::jsonEncode(Hook::exec('dashboardData', $params, $id_module, true, true, (int)Tools::getValue('dashboard_use_push'))));
}
public function ajaxProcessGetBlogRss()
{
$return = array('has_errors' => false, 'rss' => array());
if (!$this->isFresh('/config/xml/blog-'.$this->context->language->iso_code.'.xml', 604800))
{
if (!$this->refresh('/config/xml/blog-'.$this->context->language->iso_code.'.xml', 'https://api.prestashop.com/rss/blog/blog-'.$this->context->language->iso_code.'.xml'))
$return['has_errors'] = true;
}
if (!$return['has_errors'])
{
$rss = simpleXML_load_file(_PS_ROOT_DIR_.'/config/xml/blog-'.$this->context->language->iso_code.'.xml');
$articles_limit = 3;
foreach ($rss->channel->item as $item)
{
if ($articles_limit > 0)
$return['rss'][] = array('title' => (string)$item->title, 'short_desc' => (string)$item->description);
else
break;
$articles_limit --;
}
}
die(Tools::jsonEncode($return));
}
}
+29 -1
View File
@@ -30,6 +30,7 @@ $(document).ready( function () {
});
refreshDashboard(false, false);
getBlogRss();
});
function refreshDashboard(module_name, use_push)
@@ -176,4 +177,31 @@ function data_chart(widget_name, charts)
{
for (chart_id in charts)
window[charts[chart_id].chart_type](widget_name, charts[chart_id]);
}
}
function getBlogRss()
{
$.ajax({
url : dashboard_ajax_url,
data : {
ajax:true,
action:'getBlogRss'
},
dataType: 'json',
success : function(jsonData){
if (!jsonData.has_errors)
{
for (var article in jsonData.rss)
{
article_html = '<article><strong>'+jsonData.rss[article].title+'</strong><br>'+jsonData.rss[article].short_desc+'</article><br>';
$('.dash_news h4').after(article_html);
}
}
else
$('.dash_news').hide();
},
error : function(data){
//@TODO display errors
}
});
}