public function add_store_products(&$sorted, &$filters) { $registered = Base_EssClientCommon::has_license_key(); $filters_attrs = ''; if (!$registered) { if (TRIAL_MODE) { $msg = __('EPESI Store is not accessible during the trial.'); $filters_attrs = 'href="javascript:void(0);" onclick="alert(\'' . $msg . '\');"'; } else { $msg = __('To access EPESI Store it is necessary that you register your EPESI installation. Would you like to do this now?'); $filters_attrs = $this->create_confirm_callback_href($msg, array($this, 'jump_to_epesi_registration')); } } $filters[__('Updates')] = array('arg' => 'updates', 'attrs' => $filters_attrs); $filters[__('My Purchases')] = array('arg' => 'purchases', 'attrs' => $filters_attrs); $filters[__('Store')] = array('arg' => 'store', 'attrs' => $filters_attrs); if (!$registered) { return; } $store = Base_EpesiStoreCommon::get_modules_all_available(); print Base_EssClientCommon::client_messages_frame(); if (!$store) { return; } foreach ($store as $s) { $name = htmlspecialchars_decode($s['name']); // Module name is translated on the server $label = $s['action']; $downloaded = $label != Base_EpesiStoreCommon::ACTION_BUY && $label != Base_EpesiStoreCommon::ACTION_DOWNLOAD; if (!isset($s['total_price'])) { $s['total_price'] = $s['price']; } if ($label == Base_EpesiStoreCommon::ACTION_BUY && $s['total_price'] === 0) { $s['total_price'] = __('Free'); $label = 'obtain license'; } $b_label = _V(ucfirst($label)); // ****** EpesiStoreCommon - translations added in comments $button = array('label' => $b_label, 'style' => 'install', 'href' => Base_EpesiStoreCommon::action_href($s, $s['action'], array('Base_Setup', 'response_callback'))); if (isset($sorted[$name]) && $downloaded) { $sorted[$name]['filter'][] = 'purchases'; if ($label == Base_EpesiStoreCommon::ACTION_UPDATE) { $sorted[$name]['buttons'][] = $button; $sorted[$name]['filter'][] = 'updates'; $sorted[$name]['style'] = 'problem'; } if ($label == Base_EpesiStoreCommon::ACTION_RESTORE) { $button['style'] = 'problem'; $sorted[$name]['buttons'][] = $button; $sorted[$name]['style'] = 'disabled'; $sorted[$name]['status'] = __('Files modified'); } $sorted[$name]['url'] = $s['description_url']; $sorted[$name]['icon'] = $s['icon_url']; continue; } $sorted[$name] = array(); $sorted[$name]['core'] = 0; $sorted[$name]['url'] = $s['description_url']; $sorted[$name]['icon'] = $s['icon_url']; $sorted[$name]['name'] = $name; // ****** FIXME - modules names from the store $sorted[$name]['modules'] = array(); $sorted[$name]['options'] = array(); if (isset($s['paid']) && $s['paid']) { $status = __('Purchased'); $style = 'problem'; switch ($label) { case Base_EpesiStoreCommon::ACTION_RESTORE: $status = __('Files modified'); $button['style'] = 'uninstall'; $style = 'disabled'; break; case Base_EpesiStoreCommon::ACTION_INSTALL: $status = __('Ready to use'); $style = 'disabled'; break; case Base_EpesiStoreCommon::ACTION_UPDATE: $status = __('To update'); break; } $sorted[$name]['status'] = $status; $sorted[$name]['style'] = $style; $sorted[$name]['filter'] = array('purchases'); } else { $sorted[$name]['status'] = __('Price: %s', array($s['total_price'])); $sorted[$name]['style'] = 'store'; $sorted[$name]['filter'] = array('store'); $sorted[$name]['buttons_tooltip'] = $this->included_modules_text($s); } if ($label != Base_EpesiStoreCommon::ACTION_INSTALL) { $sorted[$name]['buttons'] = array($button); } $sorted[$name]['version'] = $s['version']; if ($label == Base_EpesiStoreCommon::ACTION_UPDATE) { $sorted[$name]['filter'][] = 'updates'; } $sorted[$name]['installed'] = null; $sorted[$name]['instalable'] = 0; $sorted[$name]['uninstalable'] = 0; } }