diff --git a/htdocs/admin/dolistore/class/dolistore.class.php b/htdocs/admin/dolistore/class/dolistore.class.php
index 0c5a7f08568..18fa6e17e14 100644
--- a/htdocs/admin/dolistore/class/dolistore.class.php
+++ b/htdocs/admin/dolistore/class/dolistore.class.php
@@ -20,145 +20,10 @@ include_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
include_once DOL_DOCUMENT_ROOT.'/admin/dolistore/class/PSWebServiceLibrary.class.php';
-
-/**
- * Class DolistoreModel
- */
-class DolistoreModel
-{
-
- function get_categories($parent = 0)
- {
- if (!isset($this->categories)) die('not possible');
- if ($parent != 0) {
- $html = '
';
- } else {
- $html = '';
- }
-
- $nbofcateg = count($this->categories);
- for ($i = 0; $i < $nbofcateg; $i++)
- {
- $cat = $this->categories[$i];
- if ($cat->is_root_category == 1 && $parent == 0) {
- $html .= '- ';
- $html .= self::get_categories($cat->id);
- $html .= "
\n";
- } elseif (trim($cat->id_parent) == $parent && $cat->active == 1 && trim($cat->id_parent) != 0) { // si cat est de ce niveau
- $select = ($cat->id == $this->categorie) ? ' selected' : '';
- $html .= '- '.$cat->name->language[$this->lang].' '.$cat->nb_products_recursive.'';
- $html .= self::get_categories($cat->id);
- $html .= "
\n";
- } else {
-
- }
- }
-
- if ($html == '') {
- return '';
- }
- if ($parent != 0) {
- return $html.'
';
- } else {
- return $html;
- }
- }
-
- function get_products()
- {
- global $langs, $conf;
- $html = "";
- $parity = "pair";
- $last_month = time() - (30 * 24 * 60 * 60);
- foreach ($this->products as $product) {
- $parity = ($parity == "impair") ? 'pair' : 'impair';
-
- // check new product ?
- $newapp = '';
- if ($last_month < strtotime($product->date_add)) {
- $newapp .= ''.$langs->trans('New').' ';
- }
-
- // check updated ?
- if ($last_month < strtotime($product->date_upd) && $newapp == '') {
- $newapp .= ''.$langs->trans('Updated').' ';
- }
-
- // add image or default ?
- if ($product->id_default_image != '') {
- $image_url = dol_buildPath('/dolistore/ajax/image.php?id_product=', 2).$product->id.'&id_image='.$product->id_default_image;
- $images = ''.
- '
';
- } else {
- $images = '
';
- }
-
- // free or pay ?
- if ($product->price > 0) {
- $price = ''.price(round((float) $product->price * $this->vat_rate, 2)).' €
';
- $download_link = '
';
- } else {
- $price = $langs->trans('Free');
- $download_link = '
';
- }
-
- //checking versions
- if ($this->version_compare($product->dolibarr_min, DOL_VERSION) <= 0) {
- if ($this->version_compare($product->dolibarr_max, DOL_VERSION) >= 0) {
- //compatible
- $version = ''.$langs->trans('CompatibleUpTo', $product->dolibarr_max,
- $product->dolibarr_min, $product->dolibarr_max).'';
- $compatible = '';
- } else {
- //never compatible, module expired
- $version = ''.$langs->trans('NotCompatible', DOL_VERSION,
- $product->dolibarr_min, $product->dolibarr_max).'';
- $compatible = 'NotCompatible';
- }
- } else {
- //need update
- $version = ''.$langs->trans('CompatibleAfterUpdate', DOL_VERSION,
- $product->dolibarr_min, $product->dolibarr_max).'';
- $compatible = 'NotCompatible';
- }
-
- //output template
- $html .= '
- '.$newapp.$images.' |
-
- '.dol_print_date(strtotime($product->date_upd)).' - '.$langs->trans('Référence').': '.$product->reference.' - '.$langs->trans('Id').': '.$product->id.'
'.$product->description_short->language[$this->lang].' |
- '.$product->description->language[$this->lang].' |
- '.$price.' |
- '.$download_link.' |
-
';
- }
- return $html;
- }
-
- function get_previous_link($text = '<<')
- {
- return ''.$text.'';
- }
-
- function get_next_link($text = '>>')
- {
- return ''.$text.'';
- }
-}
-
-
-
/**
* Class Dolistore
*/
-class Dolistore extends DolistoreModel
+class Dolistore
{
// params
public $start // beginning of pagination
@@ -173,6 +38,11 @@ class Dolistore extends DolistoreModel
, $lang // the integer representing the lang in the store
, $debug_api; // usefull if no dialog
+ /**
+ * Constructor
+ *
+ * @param array $options
+ */
function __construct($options = array('start' => 0, 'end' => 10, 'per_page' => 50, 'categorie' => 0))
{
global $conf, $langs;
@@ -254,6 +124,139 @@ class Dolistore extends DolistoreModel
}
}
+
+ function get_categories($parent = 0)
+ {
+ if (!isset($this->categories)) die('not possible');
+ if ($parent != 0) {
+ $html = '';
+ } else {
+ $html = '';
+ }
+
+ $nbofcateg = count($this->categories);
+ for ($i = 0; $i < $nbofcateg; $i++)
+ {
+ $cat = $this->categories[$i];
+ if ($cat->is_root_category == 1 && $parent == 0) {
+ $html .= '- ';
+ $html .= self::get_categories($cat->id);
+ $html .= "
\n";
+ } elseif (trim($cat->id_parent) == $parent && $cat->active == 1 && trim($cat->id_parent) != 0) { // si cat est de ce niveau
+ $select = ($cat->id == $this->categorie) ? ' selected' : '';
+ $html .= '- '.$cat->name->language[$this->lang].' '.$cat->nb_products_recursive.'';
+ $html .= self::get_categories($cat->id);
+ $html .= "
\n";
+ } else {
+
+ }
+ }
+
+ if ($html == '') {
+ return '';
+ }
+ if ($parent != 0) {
+ return $html.'
';
+ } else {
+ return $html;
+ }
+ }
+
+ /**
+ * Return list of product formated for output
+ *
+ * @return string HTML output
+ */
+ function get_products()
+ {
+ global $langs, $conf;
+ $html = "";
+ $parity = "pair";
+ $last_month = time() - (30 * 24 * 60 * 60);
+ foreach ($this->products as $product) {
+ $parity = ($parity == "impair") ? 'pair' : 'impair';
+
+ // check new product ?
+ $newapp = '';
+ if ($last_month < strtotime($product->date_add)) {
+ $newapp .= ''.$langs->trans('New').' ';
+ }
+
+ // check updated ?
+ if ($last_month < strtotime($product->date_upd) && $newapp == '') {
+ $newapp .= ''.$langs->trans('Updated').' ';
+ }
+
+ // add image or default ?
+ if ($product->id_default_image != '') {
+ $image_url = DOL_URL_ROOT.'/dolistore/ajax/image.php?id_product='.$product->id.'&id_image='.$product->id_default_image;
+ $images = ''.
+ '
';
+ } else {
+ $images = '
';
+ }
+
+ // free or pay ?
+ if ($product->price > 0) {
+ $price = ''.price(round((float) $product->price * $this->vat_rate, 2)).' €
';
+ $download_link = '
';
+ } else {
+ $price = ''.$langs->trans('Free').'
';
+ $download_link = '
';
+ $download_link.= '
';
+ }
+
+ //checking versions
+ if ($this->version_compare($product->dolibarr_min, DOL_VERSION) <= 0) {
+ if ($this->version_compare($product->dolibarr_max, DOL_VERSION) >= 0) {
+ //compatible
+ $version = ''.$langs->trans('CompatibleUpTo', $product->dolibarr_max,
+ $product->dolibarr_min, $product->dolibarr_max).'';
+ $compatible = '';
+ } else {
+ //never compatible, module expired
+ $version = ''.$langs->trans('NotCompatible', DOL_VERSION,
+ $product->dolibarr_min, $product->dolibarr_max).'';
+ $compatible = 'NotCompatible';
+ }
+ } else {
+ //need update
+ $version = ''.$langs->trans('CompatibleAfterUpdate', DOL_VERSION,
+ $product->dolibarr_min, $product->dolibarr_max).'';
+ $compatible = 'NotCompatible';
+ }
+
+ //.'
'.$langs->trans("SeeInMarkerPlace").'
+
+ //output template
+ $html .= '
+ '.$newapp.$images.' |
+ '.$product->name->language[$this->lang]
+ .' '.$version.'
+ '.dol_print_date(dol_stringtotime($product->date_upd), 'dayhour').' - '.$langs->trans('Ref').': '.$product->reference.' - '.$langs->trans('Id').': '.$product->id.'
'.$product->description_short->language[$this->lang].' |
+ '.$product->description->language[$this->lang].' |
+ '.$price.'
+ |
+ '.$download_link.' |
+
';
+ }
+ return $html;
+ }
+
+ function get_previous_link($text = '<<')
+ {
+ return ''.$text.'';
+ }
+
+ function get_next_link($text = '>>')
+ {
+ return ''.$text.'';
+ }
+
function get_previous_url()
{
$param_array = array();
diff --git a/htdocs/admin/dolistore/css/dolistore.css b/htdocs/admin/dolistore/css/dolistore.css
index 18549c3ed83..bba808a21a0 100644
--- a/htdocs/admin/dolistore/css/dolistore.css
+++ b/htdocs/admin/dolistore/css/dolistore.css
@@ -115,7 +115,9 @@ div.divsearchfield {
tr.app {
height:250px;
}
-
+tr.app td {
+ border-bottom: 1px solid #888;
+}
div#newsDoli.tabBar {
margin-top: 50px;
margin-right: 30px;
@@ -225,6 +227,7 @@ tr.NotCompatible:hover{
}
#listing-content{
width: 75%;
+ float: right;
}
}
span.details{
diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php
index 26d45e23c6a..53c497c74fe 100644
--- a/htdocs/admin/modules.php
+++ b/htdocs/admin/modules.php
@@ -832,44 +832,50 @@ if ($mode == 'marketplace')
if (empty($conf->global->MAIN_DISABLE_DOLISTORE_SEARCH) && $conf->global->MAIN_FEATURES_LEVEL >= 1)
{
- print ''.$langs->trans('DOLISTOREdescriptionLong').'';
+ print ''.$langs->trans('DOLISTOREdescriptionLong').'
';
+ $previouslink = $dolistore->get_previous_link();
+ $nextlink = $dolistore->get_next_link();
+
+ print '';
+ print '
';
+
+ ?>
+
-
-
-
- | get_previous_link() ?> get_next_link() ?> trans('AchatTelechargement') ?> |
-
-
+
get_products($categorie); ?>
-
-
- | get_previous_link() ?> get_next_link() ?> trans('AchatTelechargement') ?> |
-
-
diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang
index 0ce5a7f1fc0..5277db3dea4 100644
--- a/htdocs/langs/en_US/admin.lang
+++ b/htdocs/langs/en_US/admin.lang
@@ -201,8 +201,9 @@ DOLISTOREdescriptionLong=Instead of switching on