[+] CORE : Add statistic request for theme too (refacto of the last commit for module)

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@15351 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
vSchoener committed 2012-05-16 15:22:09 +00:00
1 parent dfaf16185f
commit 232d487b67
2 files changed
+52 -18

No files matched your search

+28 -17
View File
@@ -341,22 +341,10 @@ class AdminModulesControllerCore extends AdminController
} }
/** private function sendStatisticRequest($object_key)
* Ajax call for statistic
*
* @result : die the request
*/
public function ajaxProcessWsModuleCall()
{
if (($list = Tools::getValue('modules_list')) && is_array($list))
{
foreach ($list as $id)
if ($obj = Module::getInstanceById($id))
{
if (isset($obj->module_key) && isset($obj->version))
{ {
$post_data = http_build_query(array( $post_data = http_build_query(array(
'key' => urlencode($obj->module_key), 'key' => urlencode($object_key),
'url' => urlencode(Tools::getShopDomain()), 'url' => urlencode(Tools::getShopDomain()),
'mail' => urlencode(Configuration::get('PS_SHOP_EMAIL')), 'mail' => urlencode(Configuration::get('PS_SHOP_EMAIL')),
'version' => urlencode(_PS_VERSION_), 'version' => urlencode(_PS_VERSION_),
@@ -374,12 +362,35 @@ class AdminModulesControllerCore extends AdminController
$context = stream_context_create($opts); $context = stream_context_create($opts);
file_get_contents('http://api.addons.prestashop.com/', false, $context); file_get_contents('http://api.addons.prestashop.com/', false, $context);
} }
}
} /**
* Ajax call for statistic
*
* @result : die the request
*/
public function ajaxProcessWsModuleCall()
{
if (($list = Tools::getValue('modules_list')) && is_array($list))
foreach ($list as $id)
if ($obj = Module::getInstanceById($id) && (isset($obj->module_key)))
$this->sendStatisticRequest($obj->module_key);
die(); die();
} }
/**
* Ajax call for statistic
*
* @result : die the request
*/
public function ajaxProcessWsThemeCall()
{
// Theme list contains just the key for each theme
if (($list = Tools::getValue('theme_list')) && is_array($list))
foreach ($list as $theme_key)
if (!empty($theme_key))
$this->sendStatisticRequest($theme_key);
die();
}
/* /*
** Get current URL ** Get current URL
+24 -1
View File
@@ -663,7 +663,30 @@ class ThemeInstallator extends Module
<input type="submit" class="button" name="prevThemes" value="'.$this->l('Previous').'" /> <input type="submit" class="button" name="prevThemes" value="'.$this->l('Previous').'" />
<input type="submit" class="button" name="submitModules" value="'.$this->l('Next').'" /> <input type="submit" class="button" name="submitModules" value="'.$this->l('Next').'" />
</fieldset> </fieldset>
</form>'; </form>
<script type="text/javascript">
$(document).ready(function() {
$.ajax({
type : "POST",
url : "'. str_replace('index', 'ajax-tab', AdminController::$currentIndex) .'",
data : {
"theme_list" : '.Tools::jsonEncode(array((string)$this->xml->theme_key)).',
"controller" : "AdminModules",
"action" : "wsThemeCall",
"token" : "'. Tools::getAdminToken('AdminModules'.(int)(Tab::getIdFromClassName('AdminModules')).(int)$this->context->employee->id) .'"
},
dataType: "json",
success: function(json)
{
//console.log(json);
},
error: function(xhr, ajaxOptions, thrownError)
{
//jAlert("TECHNICAL ERROR"+res);
}
});
});
</script>';
} }
private function _displayForm2() private function _displayForm2()