Exemple #1
0
 function display($tpl = null)
 {
     $params = JComponentHelper::getParams('com_k2store');
     $this->assignRef('params', $params);
     JHTML::_('behavior.formvalidation');
     parent::display($tpl);
 }
Exemple #2
0
 function display($tpl = null)
 {
     $this->form = $this->get('Form');
     // Get data from the model
     $this->item = $this->get('Item');
     $this->taxrules = $this->get('TaxRules');
     // inturn calls getState in parent class and populateState() in model
     $this->state = $this->get('State');
     $this->model = $this->getModel('taxprofile');
     $lists['taxrate'] = $this->get('TaxRateList');
     $lists['address'] = $this->get('AddressList');
     $this->lists = $lists;
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         JError::raiseError(500, implode('<br />', $errors));
         return false;
     }
     //add toolbar
     $this->addToolBar();
     $toolbar = new K2StoreToolBar();
     $toolbar->renderLinkbar();
     // Display the template
     parent::display($tpl);
     // Set the document
     $this->setDocument();
 }
Exemple #3
0
 function display($tpl = null)
 {
     $mainframe = JFactory::getApplication();
     $option = 'com_k2store';
     $ns = 'com_k2store.fields';
     $db = JFactory::getDBO();
     $uri = JFactory::getURI();
     $params = JComponentHelper::getParams('com_k2store');
     $filter_order = $mainframe->getUserStateFromRequest($ns . 'filter_order', 'filter_order', 'a.field_id', 'cmd');
     $filter_order_Dir = $mainframe->getUserStateFromRequest($ns . 'filter_order_Dir', 'filter_order_Dir', 'ASC', 'word');
     $filter_orderstate = $mainframe->getUserStateFromRequest($ns . 'filter_orderstate', 'filter_orderstate', '', 'string');
     $search = $mainframe->getUserStateFromRequest($ns . 'search', 'search', '', 'string');
     if (strpos($search, '"') !== false) {
         $search = str_replace(array('=', '<'), '', $search);
     }
     $search = JString::strtolower($search);
     // Get data from the model
     $items = $this->get('Data');
     $total = $this->get('Total');
     $pagination = $this->get('Pagination');
     // table ordering
     $lists['order_Dir'] = $filter_order_Dir;
     $lists['order'] = $filter_order;
     // search filter
     $lists['search'] = $search;
     $this->assignRef('lists', $lists);
     $this->assignRef('items', $items);
     $this->assignRef('pagination', $pagination);
     $this->params = $params;
     $model = $this->getModel();
     $this->addToolBar();
     $toolbar = new K2StoreToolBar();
     $toolbar->renderLinkbar();
     parent::display($tpl);
 }
Exemple #4
0
 function display($tpl = null)
 {
     //run the update if auto update is enabled
     require_once JPATH_SITE . '/components/com_k2store/helpers/cart.php';
     $storeprofile = K2StoreHelperCart::getStoreAddress();
     if ($storeprofile->config_currency_auto) {
         $model = $this->getModel('currencies');
         $model->updateCurrencies();
     }
     // Get data from the model
     $this->items = $this->get('Items');
     $this->pagination = $this->get('Pagination');
     // inturn calls getState in parent class and populateState() in model
     $this->state = $this->get('State');
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         JError::raiseError(500, implode('<br />', $errors));
         return false;
     }
     //add toolbar
     $this->addToolBar();
     $toolbar = new K2StoreToolBar();
     $toolbar->renderLinkbar();
     // Display the template
     parent::display($tpl);
     $this->setDocument();
 }
Exemple #5
0
 function display($tpl = null)
 {
     // Get data from the model
     $this->items = $this->get('Items');
     $this->pagination = $this->get('Pagination');
     // inturn calls getState in parent class and populateState() in model
     $this->state = $this->get('State');
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         JError::raiseError(500, implode('<br />', $errors));
         return false;
     }
     //get list of countries
     $this->countries = $this->get('Countries');
     //generate country filter list
     $lists = array();
     $country_options = array();
     $country_options[] = JHTML::_('select.option', '', JText::_('K2STORE_SELECT_COUNTRY'));
     foreach ($this->countries as $item) {
         $country_options[] = JHTML::_('select.option', $item->country_id, $item->country_name);
     }
     $lists['country_options'] = JHTML::_('select.genericlist', $country_options, 'filter_country_options', 'onchange="this.form.submit();"', 'value', 'text', $this->state->get('filter.country_options'));
     $this->assignRef('lists', $lists);
     //add toolbar
     $this->addToolBar();
     $toolbar = new K2StoreToolBar();
     $toolbar->renderLinkbar();
     // Display the template
     parent::display($tpl);
     $this->setDocument();
 }
Exemple #6
0
 function display($tpl = null)
 {
     $this->form = $this->get('Form');
     // Get data from the model
     $this->item = $this->get('Item');
     // inturn calls getState in parent class and populateState() in model
     $this->state = $this->get('State');
     require_once JPATH_COMPONENT_ADMINISTRATOR . DS . 'models' . DS . 'zones.php';
     $model = new K2StoreModelZones();
     $countries = $model->getCountries();
     //generate country filter list
     $lists = array();
     $country_options = array();
     $country_options[] = JHTML::_('select.option', '', JText::_('K2STORE_SELECT_COUNTRY'));
     foreach ($countries as $row) {
         $country_options[] = JHTML::_('select.option', $row->country_id, $row->country_name);
     }
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         JError::raiseError(500, implode('<br />', $errors));
         return false;
     }
     //add toolbar
     $this->addToolBar();
     $toolbar = new K2StoreToolBar();
     $toolbar->renderLinkbar();
     // Display the template
     parent::display($tpl);
     // Set the document
     $this->setDocument();
 }
Exemple #7
0
 function display($tpl = null)
 {
     $this->addToolBar();
     $toolbar = new K2StoreToolBar();
     $toolbar->renderLinkbar();
     parent::display($tpl);
 }
Exemple #8
0
 function display($tpl = null)
 {
     JFormHelper::addFormPath(JPATH_ADMINISTRATOR . '/components/com_k2store/models/forms');
     JFormHelper::addFieldPath(JPATH_ADMINISTRATOR . '/components/com_k2store/models/fields');
     $this->form = JForm::getInstance('storeprofile', 'storeprofile');
     $this->addToolBar();
     parent::display();
 }
Exemple #9
0
    function display($tpl = null)
    {
        $mainframe = JFactory::getApplication();
        $option = 'com_k2store';
        $ns = 'com_k2store.options';
        $db = JFactory::getDBO();
        $uri = JFactory::getURI();
        $params = JComponentHelper::getParams('com_k2store');
        $filter_order = $mainframe->getUserStateFromRequest($ns . 'filter_order', 'filter_order', 'a.option_id', 'cmd');
        $filter_order_Dir = $mainframe->getUserStateFromRequest($ns . 'filter_order_Dir', 'filter_order_Dir', 'ASC', 'word');
        $filter_orderstate = $mainframe->getUserStateFromRequest($ns . 'filter_orderstate', 'filter_orderstate', '', 'string');
        $search = $mainframe->getUserStateFromRequest($ns . 'search', 'search', '', 'string');
        if (strpos($search, '"') !== false) {
            $search = str_replace(array('=', '<'), '', $search);
        }
        $search = JString::strtolower($search);
        // Get data from the model
        $items = $this->get('Data');
        $total = $this->get('Total');
        $pagination = $this->get('Pagination');
        $javascript = 'onchange="document.adminForm.submit();"';
        // table ordering
        $lists['order_Dir'] = $filter_order_Dir;
        $lists['order'] = $filter_order;
        // search filter
        $lists['search'] = $search;
        $this->assignRef('lists', $lists);
        $ordering = $this->lists['order'] == 'a.ordering';
        $this->assignRef('ordering', $ordering);
        // Joomla! 3.0 drag-n-drop sorting variables
        if (version_compare(JVERSION, '3.0', 'ge')) {
            JHtml::_('bootstrap.tooltip');
            if ($ordering) {
                JHtml::_('sortablelist.sortable', 'k2ItemsList', 'adminForm', strtolower($this->lists['order_Dir']), 'index.php?option=com_k2store&view=options&task=saveorder&format=raw');
            }
            $document = JFactory::getDocument();
            $document->addScriptDeclaration('
					Joomla.orderTable = function() {
					table = document.getElementById("sortTable");
					direction = document.getElementById("directionTable");
					order = table.options[table.selectedIndex].value;
					if (order != \'' . $this->lists['order'] . '\') {
					dirn = \'asc\';
		} else {
					dirn = direction.options[direction.selectedIndex].value;
		}
					Joomla.tableOrdering(order, dirn, "");
		}');
        }
        $this->assignRef('items', $items);
        $this->assignRef('pagination', $pagination);
        $model = $this->getModel();
        $this->addToolBar();
        $toolbar = new K2StoreToolBar();
        $toolbar->renderLinkbar();
        parent::display($tpl);
    }
Exemple #10
0
 function display($tpl = null)
 {
     require_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_k2store' . DS . 'library' . DS . 'prices.php';
     $mainframe = JFactory::getApplication();
     $option = 'com_k2store';
     $ns = $option . '.itemised';
     $params = JComponentHelper::getParams('com_k2store');
     $db = JFactory::getDBO();
     $uri = JFactory::getURI();
     $filter_order = $mainframe->getUserStateFromRequest($ns . 'filter_order', 'filter_order', 'oi.product_id', 'cmd');
     $filter_order_Dir = $mainframe->getUserStateFromRequest($ns . 'filter_order_Dir', 'filter_order_Dir', '', 'word');
     $filter_orderstate = $mainframe->getUserStateFromRequest($ns . 'filter_orderstate', 'filter_orderstate', '', 'string');
     $search = $mainframe->getUserStateFromRequest($ns . 'search', 'search', '', 'string');
     if (strpos($search, '"') !== false) {
         $search = str_replace(array('=', '<'), '', $search);
     }
     $search = JString::strtolower($search);
     $model = $this->getModel();
     // Get data from the model
     $items = $this->get('Data');
     $show_tax = $params->get('show_tax_total');
     foreach ($items as $item) {
         $item->orderitem_price = $item->orderitem_price + floatval($item->orderitem_attributes_price);
         $taxtotal = 0;
         if ($show_tax) {
             $taxtotal = $item->orderitem_tax / $item->orderitem_quantity;
         }
         $item->orderitem_price = $item->orderitem_price + $taxtotal;
         $item->orderitem_final_price = $item->orderitem_price * $item->orderitem_quantity;
     }
     $total = $this->get('Total');
     $pagination = $this->get('Pagination');
     $javascript = 'onchange="document.adminForm.submit();"';
     //order state filter
     $filter_orderstate_options[] = JHTML::_('select.option', 0, JText::_('K2STORE_ORDER_SELECT_STATE'));
     $filter_orderstate_options[] = JHTML::_('select.option', 'Confirmed', JText::_('K2STORE_CONFIRMED'));
     $filter_orderstate_options[] = JHTML::_('select.option', 'Pending', JText::_('K2STORE_PENDING'));
     $filter_orderstate_options[] = JHTML::_('select.option', 'Failed', JText::_('K2STORE_FAILED'));
     $lists['orderstate'] = JHTML::_('select.genericlist', $filter_orderstate_options, 'filter_orderstate', $javascript, 'value', 'text', $filter_orderstate);
     // table ordering
     $lists['order_Dir'] = $filter_order_Dir;
     $lists['order'] = $filter_order;
     // search filter
     $lists['search'] = $search;
     $this->assignRef('lists', $lists);
     $this->assignRef('items', $items);
     $this->assignRef('pagination', $pagination);
     $params = JComponentHelper::getParams('com_k2store');
     $this->addToolBar();
     $toolbar = new K2StoreToolBar();
     $toolbar->renderLinkbar();
     parent::display($tpl);
 }
Exemple #11
0
 function display($tpl = null)
 {
     $mainframe = JFactory::getApplication();
     $option = 'com_k2store';
     if ($this->getLayout() == 'form') {
         $model =& $this->getModel('');
         //get the address
         $address =& $this->get('Data');
         $this->assignRef('address', $address);
         $this->addToolBar();
         $toolbar = new K2StoreToolBar();
         $toolbar->renderLinkbar();
     }
     parent::display($tpl);
 }
Exemple #12
0
 function display($tpl = null)
 {
     require_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_k2store' . DS . 'library' . DS . 'prices.php';
     $mainframe = JFactory::getApplication();
     $option = 'com_k2store';
     $ns = $option . '.orders';
     $db = JFactory::getDBO();
     $uri = JFactory::getURI();
     $filter_order = $mainframe->getUserStateFromRequest($ns . 'filter_order', 'filter_order', 'a.id', 'cmd');
     $filter_order_Dir = $mainframe->getUserStateFromRequest($ns . 'filter_order_Dir', 'filter_order_Dir', '', 'word');
     $filter_orderstate = $mainframe->getUserStateFromRequest($ns . 'filter_orderstate', 'filter_orderstate', '', 'string');
     $search = $mainframe->getUserStateFromRequest($ns . 'search', 'search', '', 'string');
     if (strpos($search, '"') !== false) {
         $search = str_replace(array('=', '<'), '', $search);
     }
     $search = JString::strtolower($search);
     // Get data from the model
     $items = $this->get('Data');
     $total = $this->get('Total');
     $pagination = $this->get('Pagination');
     $javascript = 'onchange="document.adminForm.submit();"';
     require_once JPATH_ADMINISTRATOR . '/components/com_k2store/models/orderstatuses.php';
     $os_model = new K2StoreModelOrderstatuses();
     $statuses = $os_model->getOrderStatuses();
     $filter_orderstate_options[] = JHTML::_('select.option', 0, JText::_('K2STORE_ORDER_SELECT_STATE'));
     foreach ($statuses as $status) {
         //order state filter
         $filter_orderstate_options[] = JHTML::_('select.option', $status->orderstatus_id, JText::_($status->orderstatus_name));
     }
     $lists['orderstate'] = JHTML::_('select.genericlist', $filter_orderstate_options, 'filter_orderstate', $javascript, 'value', 'text', $filter_orderstate);
     // table ordering
     $lists['order_Dir'] = $filter_order_Dir;
     $lists['order'] = $filter_order;
     // search filter
     $lists['search'] = $search;
     $this->assignRef('lists', $lists);
     $this->assignRef('items', $items);
     $this->assignRef('pagination', $pagination);
     //$model = $this->getModel();
     $params = JComponentHelper::getParams('com_k2store');
     $this->assignRef('params', $params);
     $this->addToolBar();
     $toolbar = new K2StoreToolBar();
     $toolbar->renderLinkbar();
     parent::display($tpl);
 }
Exemple #13
0
 function display($tpl = null)
 {
     $this->form = $this->get('Form');
     // Get data from the model
     $this->item = $this->get('Item');
     // inturn calls getState in parent class and populateState($ordering = null, $direction = null) in model
     $this->state = $this->get('State');
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         JError::raiseError(500, implode('<br />', $errors));
         return false;
     }
     //add toolbar
     $this->addToolBar();
     // Display the template
     parent::display($tpl);
     // Set the document
     $this->setDocument();
 }
Exemple #14
0
 function display($tpl = null)
 {
     // Get data from the model
     $this->items = $this->get('Items');
     $this->pagination = $this->get('Pagination');
     // inturn calls getState in parent class and populateState() in model
     $this->state = $this->get('State');
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         JError::raiseError(500, implode('<br />', $errors));
         return false;
     }
     //add toolbar
     $this->addToolBar();
     $toolbar = new K2StoreToolBar();
     $toolbar->renderLinkbar();
     // Display the template
     parent::display($tpl);
     $this->setDocument();
 }
Exemple #15
0
 function display($tpl = null)
 {
     $app = JFactory::getApplication();
     $db = JFactory::getDbo();
     $query = $db->getQuery(true);
     $query->select('*');
     $query->from('#__k2store_storeprofiles');
     $query->where('state=1');
     $query->order('store_id ASC LIMIT 1');
     $db->setQuery($query);
     $store = $db->loadObject();
     if (!isset($store->store_id) || (int) $store->store_id < 1) {
         $redirect_url = 'index.php?option=com_k2store&view=postconfig';
         $app->redirect($redirect_url);
     }
     $this->assignRef('store', $store);
     $model = $this->getModel('cpanel');
     $model->checkCurrency();
     $params = JComponentHelper::getParams('com_k2store');
     $xmlfile = JPATH_ADMINISTRATOR . '/components/com_k2store/manifest.xml';
     $row = new JObject();
     $data = JApplicationHelper::parseXMLInstallFile($xmlfile);
     foreach ($data as $key => $value) {
         $row->{$key} = $value;
     }
     $this->assignRef('params', $params);
     $this->assignRef('row', $row);
     require_once JPATH_COMPONENT_ADMINISTRATOR . '/models/orders.php';
     require_once JPATH_COMPONENT_ADMINISTRATOR . '/library/prices.php';
     $order_model = new K2StoreModelOrders();
     $order_model->setState('filter_limit', 5);
     $latest_items = $order_model->getOrders();
     $this->orders = $latest_items;
     $this->order_model = $order_model;
     $this->params = $params;
     $this->addToolBar();
     $toolbar = new K2StoreToolBar();
     $toolbar->renderLinkbar();
     parent::display($tpl);
 }
Exemple #16
0
 function display($tpl = null)
 {
     $app = JFactory::getApplication();
     $user = JFactory::getUser();
     if (empty(JFactory::getUser()->id)) {
         $url = JRoute::_("index.php?option=com_k2store&view=downloads");
         $redirect = "index.php?option=com_users&view=login&return=" . base64_encode($url);
         $redirect = JRoute::_($redirect, false);
         $msg = JText::_('K2STORE_LOGIN_TO_DOWNLOAD');
         $app->redirect($redirect, $msg);
         return;
     }
     $params = JComponentHelper::getParams('com_k2store');
     $model = $this->getModel('downloads');
     $ns = 'com_k2store.downloads';
     //get the files for this user
     $files = $model->getItems();
     $this->assignRef('model', $model);
     $this->assignRef('files', $files);
     $this->assignRef('params', $params);
     parent::display($tpl);
 }
Exemple #17
0
 function display($tpl = null)
 {
     $app = JFactory::getApplication();
     $option = 'com_k2store';
     $model = $this->getModel();
     //is it ok to migrate
     if (!$model->canMigrate() || K2StoreVersion::getPreviousVersion() != '3.0.3' || K2STORE_ATTRIBUTES_MIGRATED == 1) {
         $msg = JText::_('K2STORE_MIGRATE_CURRENT_VERSION');
         $app->redirect('index.php?option=com_k2store&view=cpanel', $msg);
     }
     $db = JFactory::getDBO();
     $params = JComponentHelper::getParams('com_k2store');
     // Get data from the model
     $items = $this->get('Data');
     $total = count($items);
     $this->assignRef('items', $items);
     $this->assignRef('total', $total);
     $this->addToolBar();
     $toolbar = new K2StoreToolBar();
     $toolbar->renderLinkbar();
     parent::display($tpl);
 }
Exemple #18
0
 function display($tpl = null)
 {
     $app = JFactory::getApplication();
     $country_id = $app->input->getInt('country_id', 1);
     $view = $app->input->getWord('view', 'cpanel');
     $model = $this->getModel('geozone');
     $path = JPATH_ADMINISTRATOR . '/components/com_k2store/views/' . JString::strtolower($view) . '/tmpl';
     $this->addTemplatePath($path);
     $this->form = $this->get('Form');
     // Get data from the model
     $this->model = $this->getModel('geozone');
     $this->item = $this->get('Item');
     //$this->geozonerules = $this->get('GeoZoneRules');
     $this->geozonerules = $model->getGeoZoneRules($this->item->geozone_id);
     // inturn calls getState in parent class and populateState() in model
     $this->state = $this->get('State');
     //get list of countries
     $country_options = $this->get('CountryOptions');
     //generate country filter list
     $lists = array();
     $lists['country'] = JHTML::_('select.genericlist', $country_options, 'jform[country_id]', '', 'value', 'text', $this->state->get('filter.country_options'));
     $this->lists = $lists;
     $this->countryList = $this->model->getCountryList();
     $this->countries = $this->model->getCountry();
     $this->zones = $this->model->getZone($country_id);
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         JError::raiseError(500, implode('<br />', $errors));
         return false;
     }
     //add toolbar
     $this->addToolBar();
     $toolbar = new K2StoreToolBar();
     $toolbar->renderLinkbar();
     //Display the template
     parent::display($tpl);
     // Set the document
     $this->setDocument();
 }
Exemple #19
0
 function display($tpl = null)
 {
     require_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_k2store' . DS . 'library' . DS . 'prices.php';
     $mainframe = JFactory::getApplication();
     $option = 'com_k2store';
     $ns = $option . '.report';
     $db = JFactory::getDBO();
     $uri = JFactory::getURI();
     $task = $mainframe->input->getWord('task', '');
     $filter_order = $mainframe->getUserStateFromRequest($ns . 'filter_order', 'filter_order', 'tbl.id', 'cmd');
     $filter_order_Dir = $mainframe->getUserStateFromRequest($ns . 'filter_order_Dir', 'filter_order_Dir', '', 'word');
     $filter_orderstate = $mainframe->getUserStateFromRequest($ns . 'filter_orderstate', 'filter_orderstate', '', 'string');
     $search = $mainframe->getUserStateFromRequest($ns . 'search', 'search', '', 'string');
     if (strpos($search, '"') !== false) {
         $search = str_replace(array('=', '<'), '', $search);
     }
     $search = JString::strtolower($search);
     // Get data from the model
     $model = $this->getModel('report');
     $items = $model->getList();
     $total = $this->get('Total');
     $pagination = $this->get('Pagination');
     $javascript = 'onchange="document.adminForm.submit();"';
     // table ordering
     $lists['order_Dir'] = $filter_order_Dir;
     $lists['order'] = $filter_order;
     // search filter
     $lists['search'] = $search;
     $this->assignRef('lists', $lists);
     $this->assignRef('items', $items);
     $this->assignRef('pagination', $pagination);
     $this->params = $params = JComponentHelper::getParams('com_k2store');
     $this->addToolBar();
     $toolbar = new K2StoreToolBar();
     $toolbar->renderLinkbar();
     parent::display($tpl);
 }
Exemple #20
0
 function display($tpl = null)
 {
     $db = JFactory::getDBO();
     $uri = JFactory::getURI();
     $model = $this->getModel('option');
     $params = JComponentHelper::getParams('com_k2store');
     // get order data
     $data = $this->get('Data');
     $data->optionvalues = $model->getOptionValues($data->option_id);
     $isNew = $data->option_id < 1;
     if ($isNew) {
         $data->state = 1;
     }
     $lists = array();
     $arr = array(JHTML::_('select.option', '0', JText::_('K2STORE_NO')), JHTML::_('select.option', '1', JText::_('K2STORE_YES')));
     $lists['published'] = JHTML::_('select.genericlist', $arr, 'state', null, 'value', 'text', $data->state);
     $this->assignRef('data', $data);
     $this->assignRef('lists', $lists);
     $this->assignRef('params', $params);
     $this->addToolBar();
     $toolbar = new K2StoreToolBar();
     $toolbar->renderLinkbar();
     parent::display($tpl);
 }
Exemple #21
0
 function display($tpl = null)
 {
     $baseURL = JURI::root();
     $document = JFactory::getDocument();
     $this->form = $this->get('Form');
     // Get data from the model
     $this->item = $this->get('Item');
     // inturn calls getState in parent class and populateState($ordering = null, $direction = null) in model
     $this->state = $this->get('State');
     $this->params = JComponentHelper::getParams('com_k2store');
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         JError::raiseError(500, implode('<br />', $errors));
         return false;
     }
     //add toolbar
     $this->addToolBar();
     $toolbar = new K2StoreToolBar();
     $toolbar->renderLinkbar();
     // Display the template
     parent::display($tpl);
     // Set the document
     $this->setDocument();
 }
Exemple #22
0
 function display($tpl = null)
 {
     parent::display($tpl);
 }
Exemple #23
0
    function display($tpl = null)
    {
        $app = JFactory::getApplication();
        $doc = JFactory::getDocument();
        $model = $this->getModel('field');
        $params = JComponentHelper::getParams('com_k2store');
        require_once JPATH_COMPONENT_ADMINISTRATOR . '/library/selectable/base.php';
        $selectableBase = new K2StoreSelectableBase();
        $fieldid = $app->input->getInt('field_id');
        if (!empty($fieldid)) {
            $field = $selectableBase->getField($fieldid);
            $data = null;
            $allFields = $selectableBase->getFields('', $data, $field->field_table);
        } else {
            $field = $model->getTable();
            $field->field_table = 'address';
            $field->field_published = 1;
            $field->field_type = 'text';
            $field->field_backend = 1;
            $allFields = array();
        }
        $this->allFields = $allFields;
        $this->field = $field;
        $this->fieldsClass = $selectableBase;
        $lists = array();
        //get the field type
        require_once JPATH_COMPONENT_ADMINISTRATOR . '/library/selectable/fields.php';
        $fieldtype = new K2StoreSelectableFields();
        $this->assignRef('fieldtype', $fieldtype);
        $script = 'function addLine(){
		var myTable=window.document.getElementById("tablevalues");
		var newline = document.createElement(\'tr\');
		var column = document.createElement(\'td\');
		var column2 = document.createElement(\'td\');
		var column3 = document.createElement(\'td\');
		var input = document.createElement(\'input\');
		var input2 = document.createElement(\'input\');
		var input3 = document.createElement(\'select\');
		var option1 = document.createElement(\'option\');
		var option2 = document.createElement(\'option\');
		input.type = \'text\';
		input2.type = \'text\';
		option1.value= \'0\';
		option2.value= \'1\';
		input.name = \'field_values[title][]\';
		input2.name = \'field_values[value][]\';
		input3.name = \'field_values[disabled][]\';
		option1.text= \'' . JText::_('K2STORE_NO', true) . '\';
		option2.text= \'' . JText::_('K2STORE_YES', true) . '\';
		try { input3.add(option1, null); } catch(ex) { input3.add(option1); }
		try { input3.add(option2, null); } catch(ex) { input3.add(option2); }
		column.appendChild(input);
		column2.appendChild(input2);
		column3.appendChild(input3);
		newline.appendChild(column);
		newline.appendChild(column2);
		newline.appendChild(column3);
		myTable.appendChild(newline);
		}

		function deleteRow(divName,inputName,rowName){
			var d = document.getElementById(divName);
			var olddiv = document.getElementById(inputName);
			if(d && olddiv){
				d.removeChild(olddiv);
				document.getElementById(rowName).style.display="none";
			}
			return false;
		}

		function setVisible(value){
			if(value=="product" || value=="item" || value=="category"){
				document.getElementById(\'category_field\').style.display = "";
			}else{
				document.getElementById(\'category_field\').style.display = \'none\';
			}
		}';
        $doc->addScriptDeclaration($script);
        //	$lists['value_type'] = JHTML::_('select.radiolist', $value_type_options, 'value_type', null, 'value', 'text', $data->value_type);
        //	$logged_options = array(JHTML::_('select.option', '0', JText::_('No') ),
        //			JHTML::_('select.option', '1', JText::_('Yes') )	);
        //	$lists['logged'] = JHTML::_('select.radiolist', $logged_options, 'logged', null, 'value', 'text', $data->logged);
        //country, zone type
        $zoneType = new k2storeZoneType();
        $this->assignRef('zoneType', $zoneType);
        $this->assignRef('lists', $lists);
        $this->assignRef('params', $params);
        $this->addToolBar();
        $toolbar = new K2StoreToolBar();
        $toolbar->renderLinkbar();
        parent::display($tpl);
    }
Exemple #24
0
 function _form($tpl = null)
 {
     parent::_form($tpl);
     $row = $this->getModel()->getItem();
     $import = JPluginHelper::importPlugin('k2store', $row->element);
 }
Exemple #25
0
 function display($tpl = null)
 {
     $mainframe = JFactory::getApplication();
     $option = 'com_k2store';
     $ns = 'com_k2store.payment';
     $task = $mainframe->input->getCmd('task');
     $session = JFactory::getSession();
     $db = JFactory::getDBO();
     $uri = JFactory::getURI();
     $params = JComponentHelper::getParams('com_k2store');
     $filter_order = $mainframe->getUserStateFromRequest($ns . 'filter_order', 'filter_order', 'tbl.id', 'cmd');
     $filter_order_Dir = $mainframe->getUserStateFromRequest($ns . 'filter_order_Dir', 'filter_order_Dir', '', 'word');
     $filter_orderstate = $mainframe->getUserStateFromRequest($ns . 'filter_orderstate', 'filter_orderstate', '', 'string');
     $filter_name = $mainframe->getUserStateFromRequest($ns . 'filter_name', 'filter_name', 'tbl.name', 'cmd');
     $search = $mainframe->getUserStateFromRequest($ns . 'search', 'search', '', 'string');
     if (strpos($search, '"') !== false) {
         $search = str_replace(array('=', '<'), '', $search);
     }
     $search = JString::strtolower($search);
     $model = $this->getModel('payment');
     // Get data from the model
     $items = $model->getList();
     $total = $model->getTotal();
     $pagination = $model->getPagination();
     // table ordering
     $lists['order_Dir'] = $filter_order_Dir;
     $lists['order'] = $filter_order;
     $lists['filter_name'] = $filter_name;
     $update = array();
     $warning = '';
     //only call once per session. Dont call this often
     if (!$session->has('plugin_update_data', 'k2store')) {
         try {
             require_once JPATH_ADMINISTRATOR . '/components/com_k2store/liveupdate/classes/download.php';
             $xmlfile = 'http://cdn.k2store.org/extensions.xml';
             $result = LiveUpdateDownloadHelper::downloadAndReturn($xmlfile);
             if ($result) {
                 $extensions = simplexml_load_string($result, 'SimpleXMLElement');
                 if (is_object($extensions)) {
                     $type = (string) $extensions->extension->attributes()->type;
                     if ($type == 'payment') {
                         $plugins = $extensions->extension->plugins->plugin;
                         foreach ($plugins as $plugin) {
                             $update[(string) $plugin->attributes()->element] = (array) $plugin;
                         }
                     }
                     if (count($update)) {
                         $session->set('plugin_update_data', $update, 'k2store');
                     }
                 }
             }
         } catch (Exception $e) {
             $warning = JText::_('K2STORE_PAYMENT_XML_REMOTE_ERROR');
             $this->assignRef('warning', $warning);
         }
     } else {
         $update = $session->get('plugin_update_data', array(), 'k2store');
     }
     $this->assignRef('update', $update);
     // search filter
     $lists['search'] = $search;
     $this->assignRef('lists', $lists);
     $this->assignRef('items', $items);
     $this->assignRef('pagination', $pagination);
     JToolBarHelper::title(JText::_('K2STORE_PAYMENT_PLUGINS'), 'k2store-logo');
     $toolbar = new K2StoreToolBar();
     $toolbar->renderLinkbar();
     parent::display($tpl);
 }
Exemple #26
0
    function display($tpl = null)
    {
        // initialize the appllication
        $app = JFactory::getApplication();
        $model = $this->getModel('products');
        // get the Layout
        $layout = $this->getLayout();
        $option = 'com_k2store';
        $ns = 'com_k2store.products';
        // Initialize the DB connection
        $db = JFactory::getDbo();
        $uri = JFactory::getURI();
        $params = JComponentHelper::getParams('com_k2store');
        $javascript = 'onchange="document.adminForm.submit();"';
        // Order option based on the user request
        $filter_articles = $app->getUserStateFromRequest($ns . 'filter_article_type', 'filter_article_type', '', 'cmd');
        $filter_order = $app->getUserStateFromRequest($ns . 'filter_order', 'filter_order', 'p.id', 'cmd');
        $filter_order_Dir = $app->getUserStateFromRequest($ns . 'filter_order_Dir', 'filter_order_Dir', 'ASC', 'word');
        $filter_orderstate = $app->getUserStateFromRequest($ns . 'filter_orderstate', 'filter_orderstate', '', 'string');
        // Get the  user Reguested String
        $search = $app->getUserStateFromRequest($ns . 'search', 'search', '', 'string');
        if (strpos($search, '"') !== false) {
            $search = str_replace(array('=', '<'), '', $search);
        }
        $search = JString::strtolower($search);
        // table ordering
        $lists['order_Dir'] = $filter_order_Dir;
        $lists['order'] = $filter_order;
        // search filter
        $lists['search'] = $search;
        $this->lists = $lists;
        require_once JPATH_ADMINISTRATOR . '/components/com_k2/models/categories.php';
        $categoriesModel = K2Model::getInstance('Categories', 'K2Model');
        $categories_option = array('' => JText::_('JOPTION_SELECT_CATEGORY'));
        $categories = $categoriesModel->categoriesTree(NULL, true, false);
        $categories_options = @array_merge($categories_option, $categories);
        $ordering = $this->lists['order'] == 'p.ordering';
        $this->assignRef('ordering', $ordering);
        // Joomla! 3.0 drag-n-drop sorting variables
        if (version_compare(JVERSION, '3.0', 'ge')) {
            JHtml::_('bootstrap.tooltip');
            if ($ordering) {
                JHtml::_('sortablelist.sortable', 'productsList', 'adminForm', strtolower($this->lists['order_Dir']), 'index.php?option=com_k2store&view=products&task=saveorder&format=raw');
            }
            $document = JFactory::getDocument();
            $document->addScriptDeclaration('
					Joomla.orderTable = function() {
					table = document.getElementById("sortTable");
					direction = document.getElementById("directionTable");
					order = table.options[table.selectedIndex].value;
					if (order != \'' . $this->lists['order'] . '\') {
					dirn = \'asc\';
		} else {
					dirn = direction.options[direction.selectedIndex].value;
		}
					Joomla.tableOrdering(order, dirn, "");
		}');
        }
        // Get data from the model
        $this->items = $this->get('Data');
        $this->total = $this->get('Total');
        $this->state = $this->get('State');
        $this->pagination = $this->get('Pagination');
        $this->page = $model->getPagination();
        $article_options = array();
        $article_options[] = JHtml::_('select.option', '0', JText::_('K2STORE_PRODUCT_SHOW_ALL_ARTICLES'));
        $article_options[] = JHtml::_('select.option', '1', JText::_('K2STORE_PRODUCT_SHOW_K2STORE_ARTICLES'));
        $this->f_levels = $article_options;
        $javascript = 'onchange="document.adminForm.submit();"';
        $this->category_options = JHTML::_('select.genericlist', $categories_options, 'filter_category_id', $javascript, 'value', 'text', $this->state->get('filter.category_id'));
        $this->params = $params;
        $this->addToolBar();
        $toolbar = new K2StoreToolBar();
        $toolbar->renderLinkbar();
        parent::display($tpl);
    }