//added rss and useful link on dashboard

This commit is contained in:
Vincent Augagneur committed 2013-09-09 18:44:34 +02:00
1 parent 69b38f4d6f
commit 4e1a513371
3 files changed
+69 -22

No files matched your search

@@ -52,33 +52,26 @@
<div class="col-lg-2"> <div class="col-lg-2">
<section class="dash_news panel"> <section class="dash_news panel">
<h4><i class="icon-rss"></i> PrestaShop News</h4> <h4><i class="icon-rss"></i> PrestaShop News</h4>
<article>
<strong>Important it is to focus marketing efforts.</strong><br/>
Let’s go over how to use newsletters to increase traffic to your online store and we’ll review the benefits, what to include and how to get subscribers.
</article>
<br/>
<article>
<strong>Important it is to focus marketing efforts.</strong><br/>
Let’s go over how to use newsletters to increase traffic to your online store and we’ll review the benefits, what to include and how to get subscribers.
</article>
<br/>
<article>
<strong>Important it is to focus marketing efforts.</strong><br/>
Let’s go over how to use newsletters to increase traffic to your online store and we’ll review the benefits, what to include and how to get subscribers.
</article>
</section> </section>
<section class="dash_links panel"> <section class="dash_links panel">
<h4><i class="icon-link"></i> Useful Links</h4> <h4><i class="icon-link"></i>{l s="Useful PrestaShop Links"}</h4>
<ul> <dl>
<li><a href="#">link</a></li> <dt>{l s="Discover the latest official documentation :"}</dt>
<li><a href="#">link</a></li> <dd><a href="http://doc.prestashop.com/display/PS16?utm_source=backoffice_dashboard" target="_blank">{l s="PrestaShop documentation"}</a></dd>
<li><a href="#">link</a></li> </dl>
<li><a href="#">link</a></li> <dl>
</ul> <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> </section>
</div> </div>
</div> </div>
</div> </div>
<script> <script>
var testdata = [ 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')))); 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); refreshDashboard(false, false);
getBlogRss();
}); });
function refreshDashboard(module_name, use_push) function refreshDashboard(module_name, use_push)
@@ -176,4 +177,31 @@ function data_chart(widget_name, charts)
{ {
for (chart_id in charts) for (chart_id in charts)
window[charts[chart_id].chart_type](widget_name, charts[chart_id]); 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
}
});
}