Exemplo n.º 1
0
 function display($tpl = null)
 {
     // Load the helper(s)
     if (!class_exists('VmHTML')) {
         require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'html.php';
     }
     $model = VmModel::getModel();
     $layoutName = vRequest::getCmd('layout', 'default');
     // 'A' : sotck Available
     // 'O' : stock Out
     // 'R' : stock reserved
     $stockHandelList = array('A' => 'COM_VIRTUEMART_ORDER_STATUS_STOCK_AVAILABLE', 'R' => 'COM_VIRTUEMART_ORDER_STATUS_STOCK_RESERVED', 'O' => 'COM_VIRTUEMART_ORDER_STATUS_STOCK_OUT');
     if ($layoutName == 'edit') {
         $orderStatus = $model->getData();
         $this->SetViewTitle('', vmText::_($orderStatus->order_status_name));
         if ($orderStatus->virtuemart_orderstate_id < 1) {
             $this->assignRef('ordering', vmText::_('COM_VIRTUEMART_NEW_ITEMS_PLACE'));
         } else {
             if (!class_exists('ShopFunctions')) {
                 require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'shopfunctions.php';
             }
             $this->ordering = ShopFunctions::renderOrderingList('orderstates', 'order_status_name', $orderStatus->virtuemart_orderstate_id);
         }
         $lists['vmCoreStatusCode'] = $model->getVMCoreStatusCode();
         $this->assignRef('stockHandelList', $stockHandelList);
         // Vendor selection
         $vendor_model = VmModel::getModel('vendor');
         $vendor_list = $vendor_model->getVendors();
         $lists['vendors'] = JHtml::_('select.genericlist', $vendor_list, 'virtuemart_vendor_id', '', 'virtuemart_vendor_id', 'vendor_name', $orderStatus->virtuemart_vendor_id);
         $this->assignRef('orderStatus', $orderStatus);
         $this->assignRef('lists', $lists);
         $this->addStandardEditViewCommands();
     } else {
         $this->SetViewTitle('');
         $this->addStandardDefaultViewCommands();
         $this->addStandardDefaultViewLists($model);
         $this->lists['vmCoreStatusCode'] = $model->getVMCoreStatusCode();
         $orderStatusList = $model->getOrderStatusList();
         $this->assignRef('orderStatusList', $orderStatusList);
         $this->assignRef('stockHandelList', $stockHandelList);
         $pagination = $model->getPagination();
         $this->assignRef('pagination', $pagination);
     }
     parent::display($tpl);
 }
Exemplo n.º 2
0
    function display($tpl = null)
    {
        // Load the helper(s)
        if (!class_exists('VmHTML')) {
            require VMPATH_ADMIN . DS . 'helpers' . DS . 'html.php';
        }
        if (!class_exists('vmCustomPlugin')) {
            require VMPATH_PLUGINLIBS . DS . 'vmcustomplugin.php';
        }
        $model = VmModel::getModel('custom');
        // TODO Make an Icon for custom
        $this->SetViewTitle('PRODUCT_CUSTOM_FIELD');
        $layoutName = vRequest::getCmd('layout', 'default');
        if ($layoutName == 'edit') {
            $this->addStandardEditViewCommands();
            $this->customPlugin = '';
            $this->custom = $model->getCustom();
            $this->fieldTypes = VirtueMartModelCustom::getCustomTypes();
            $this->customfields = VmModel::getModel('customfields');
            //vmdebug('VirtuemartViewCustom',$this->custom);
            JPluginHelper::importPlugin('vmcustom');
            $dispatcher = JDispatcher::getInstance();
            $retValue = $dispatcher->trigger('plgVmOnDisplayEdit', array($this->custom->virtuemart_custom_id, &$this->customPlugin));
            $this->SetViewTitle('PRODUCT_CUSTOM_FIELD', $this->custom->custom_title);
            $selected = 0;
            $this->custom->form = false;
            if (!empty($this->custom->custom_jplugin_id)) {
                VmConfig::loadJLang('plg_vmpsplugin', false);
                JForm::addFieldPath(VMPATH_ADMIN . DS . 'fields');
                $selected = $this->custom->custom_jplugin_id;
                // Get the payment XML.
                $formFile = vRequest::filterPath(VMPATH_ROOT . DS . 'plugins' . DS . 'vmcustom' . DS . $this->custom->custom_element . DS . $this->custom->custom_element . '.xml');
                if (file_exists($formFile)) {
                    $this->custom->form = JForm::getInstance($this->custom->custom_element, $formFile, array(), false, '//vmconfig | //config[not(//vmconfig)]');
                    $this->custom->params = new stdClass();
                    $varsToPush = vmPlugin::getVarsToPushFromForm($this->custom->form);
                    VmTable::bindParameterableToSubField($this->custom, $varsToPush);
                    $this->custom->form->bind($this->custom->getProperties());
                }
            } else {
                $varsToPush = VirtueMartModelCustom::getVarsToPush($this->custom->field_type);
                if (!empty($varsToPush)) {
                    $formString = '<vmconfig>' . chr(10) . '<fields name="params">' . chr(10) . '<fieldset name="extraParams">' . chr(10);
                    //vmdebug('$varsToPush',$varsToPush);
                    foreach ($varsToPush as $key => $push) {
                        if ('_' == substr($key, 0, 1)) {
                            continue;
                        }
                        //$default = 0;
                        $formString .= '<field
						name="' . $key . '"
        				id="' . $key . 'Field"
        				label="COM_VIRTUEMART_CUSTOM_PARAM_' . strtoupper($key) . '"
        				description="COM_VIRTUEMART_CUSTOM_PARAM_' . strtoupper($key) . '_DESC"
        				default="' . $push[0] . '"
						';
                        if ($push[1] == 'int') {
                            $formString .= 'type="radio" >
    											<option value="0">JNO</option>
    											<option value="1">JYES</option>';
                        } else {
                            if ($push[1] == 'string') {
                                $formString .= 'type="text" >' . chr(10);
                            }
                        }
                        $formString .= chr(10) . '</field>' . chr(10);
                    }
                    $formString .= '</fieldset>' . chr(10) . '</fields>' . chr(10) . '</vmconfig>';
                    $this->custom->form = JForm::getInstance($this->custom->field_type, $formString, array(), false, '//vmconfig | //config[not(//vmconfig)]');
                    $this->custom->params = new stdClass();
                    VmTable::bindParameterableToSubField($this->custom, $varsToPush);
                    $this->custom->form->bind($this->custom->getProperties());
                }
            }
            if (!empty($this->custom->custom_parent_id)) {
                $list = ShopFunctions::renderOrderingList('customs', 'custom_title', $this->custom->ordering, 'WHERE custom_parent_id ="' . (int) $this->custom->custom_parent_id . '" ');
                $this->ordering = VmHTML::row('raw', 'COM_VIRTUEMART_ORDERING', $list);
            } else {
                $this->ordering = '';
                $this->addHidden('ordering', $this->custom->ordering);
            }
            $this->pluginList = self::renderInstalledCustomPlugins($selected);
        } else {
            JToolBarHelper::custom('createClone', 'copy', 'copy', vmText::_('COM_VIRTUEMART_CLONE'), true);
            JToolBarHelper::custom('toggle.admin_only.1', 'publish', '', vmText::_('COM_VIRTUEMART_TOGGLE_ADMIN'), true);
            JToolBarHelper::custom('toggle.admin_only.0', 'unpublish', '', vmText::_('COM_VIRTUEMART_TOGGLE_ADMIN'), true);
            JToolBarHelper::custom('toggle.is_hidden.1', 'publish', '', vmText::_('COM_VIRTUEMART_TOGGLE_HIDDEN'), true);
            JToolBarHelper::custom('toggle.is_hidden.0', 'unpublish', '', vmText::_('COM_VIRTUEMART_TOGGLE_HIDDEN'), true);
            $this->addStandardDefaultViewCommands();
            $this->addStandardDefaultViewLists($model);
            $this->custom_parent_id = vRequest::getInt('custom_parent_id', false);
            $this->customs = $model->getCustoms($this->custom_parent_id, vRequest::getCmd('keyword'));
            $this->pagination = $model->getPagination();
        }
        parent::display($tpl);
    }
Exemplo n.º 3
0
 function display($tpl = null)
 {
     VmConfig::loadJLang('com_virtuemart_shoppers', TRUE);
     $option = vRequest::getCmd('option');
     $mainframe = JFactory::getApplication();
     if (!class_exists('VmHTML')) {
         require VMPATH_ADMIN . DS . 'helpers' . DS . 'html.php';
     }
     $layoutName = vRequest::getCmd('layout', 'default');
     $model = VmModel::getModel();
     // The list of fields which can't be toggled
     //$lists['coreFields']= array( 'name','username', 'email', 'password', 'password2' );
     $lists['coreFields'] = $model->getCoreFields();
     if ($layoutName == 'edit') {
         $this->editor = JFactory::getEditor();
         $this->userField = $model->getUserfield();
         //vmdebug('user plugin $this->userField',$this->userField);
         $this->SetViewTitle('USERFIELD', $this->userField->name);
         $this->assignRef('viewName', $viewName);
         $userFieldPlugin = '';
         if (!class_exists('ShopFunctions')) {
             require VMPATH_ADMIN . DS . 'helpers' . DS . 'shopfunctions.php';
         }
         $this->ordering = ShopFunctions::renderOrderingList('userfields', 'name', $this->userField->ordering);
         if ($this->userField->virtuemart_userfield_id < 1) {
             // Insert new userfield
             $userFieldValues = array();
             $attribs = '';
             $lists['type'] = JHtml::_('select.genericlist', $this->_getTypes(), 'type', $attribs, 'type', 'text', $this->userField->type);
         } else {
             // Update existing userfield
             // Ordering dropdown
             $userFieldValues = $model->getUserfieldValues();
             $lists['type'] = $this->_getTypes($this->userField->type) . '<input id="type" type="hidden" name="type" value="' . $this->userField->type . '" />';
             if (strpos($this->userField->type, 'plugin') !== false) {
                 $userFieldPlugin = self::renderUserfieldPlugin(substr($this->userField->type, 6), $this->userField);
             }
         }
         $this->assignRef('userFieldPlugin', $userFieldPlugin);
         JToolBarHelper::divider();
         JToolBarHelper::save();
         JToolBarHelper::apply();
         JToolBarHelper::cancel();
         $notoggle = '';
         // (in_array($this->userField->name, $lists['coreFields']) ? 'class="readonly"' : '');
         // Vendor selection
         if (Vmconfig::get('multix', 'none') !== 'none') {
             $lists['vendors'] = ShopFunctions::renderVendorList($this->userField->virtuemart_vendor_id);
         }
         // Shopper groups for EU VAT Id
         $shoppergroup_model = VmModel::getModel('shoppergroup');
         $shoppergroup_list = $shoppergroup_model->getShopperGroups(true);
         array_unshift($shoppergroup_list, '0');
         $lists['shoppergroups'] = JHtml::_('select.genericlist', $shoppergroup_list, 'virtuemart_shoppergroup_id', '', 'virtuemart_shoppergroup_id', 'shopper_group_name', $this->userField->get('virtuemart_shoppergroup_id'));
         // Minimum age select
         $ages = array();
         for ($i = 13; $i <= 25; $i++) {
             $ages[] = array('key' => $i, 'value' => $i . ' ' . vmText::_('COM_VIRTUEMART_YEAR_S'));
         }
         $lists['minimum_age'] = JHtml::_('select.genericlist', $ages, 'minimum_age', '', 'key', 'value', $this->userField->get('minimum_age', 18));
         // Web address types
         $webaddress_types = array(array('key' => 0, 'value' => vmText::_('COM_VIRTUEMART_USERFIELDS_URL_ONLY')), array('key' => 2, 'value' => vmText::_('COM_VIRTUEMART_USERFIELDS_HYPERTEXT_URL')));
         $lists['webaddresstypes'] = JHtml::_('select.genericlist', $webaddress_types, 'webaddresstype', '', 'key', 'value', $this->userField->get('webaddresstype'));
         // Userfield values
         if (($n = count($userFieldValues)) < 1) {
             $lists['userfield_values'] = '<tr>' . '<td><input type="text" value="" name="vValues[0]" /></td>' . '<td><input type="text" size="50" value="" name="vNames[0]" /></td>' . '</tr>';
             $i = 1;
         } else {
             $lists['userfield_values'] = '';
             $lang = JFactory::getLanguage();
             for ($i = 0; $i < $n; $i++) {
                 $translate = $lang->hasKey($userFieldValues[$i]->fieldtitle) ? " (" . vmText::_($userFieldValues[$i]->fieldtitle) . ")" : "";
                 $lists['userfield_values'] .= '<tr>' . '<td><input type="text" value="' . $userFieldValues[$i]->fieldvalue . '" name="vValues[' . $i . ']" /></td>' . '<td><input type="text" size="50" value="' . $userFieldValues[$i]->fieldtitle . '" name="vNames[' . $i . ']"   />' . $translate . '<input type="button" class="button deleteRow" value=" - " /></td>' . '</tr>';
             }
         }
         $this->valueCount = --$i;
         $userFieldTable = $model->getTable();
         $this->existingFields = '"' . implode('","', $userFieldTable->showFullColumns(0, 'Field')) . '"';
         // Toggles
         $lists['required'] = VmHTML::row('booleanlist', 'COM_VIRTUEMART_FIELDMANAGER_REQUIRED', 'required', $this->userField->required, $notoggle);
         $lists['published'] = VmHTML::row('booleanlist', 'COM_VIRTUEMART_PUBLISHED', 'published', $this->userField->published, $notoggle);
         $lists['cart'] = VmHTML::row('booleanlist', 'COM_VIRTUEMART_FIELDMANAGER_SHOW_ON_CART', 'cart', $this->userField->cart, $notoggle);
         $lists['shipment'] = VmHTML::row('booleanlist', 'COM_VIRTUEMART_FIELDMANAGER_SHOW_ON_SHIPPING', 'shipment', $this->userField->shipment, $notoggle);
         $lists['account'] = VmHTML::row('booleanlist', 'COM_VIRTUEMART_FIELDMANAGER_SHOW_ON_ACCOUNT', 'account', $this->userField->account, $notoggle);
         $lists['readonly'] = VmHTML::row('booleanlist', 'COM_VIRTUEMART_USERFIELDS_READONLY', 'readonly', $this->userField->readonly, $notoggle);
         $this->assignRef('lists', $lists);
         $this->assignRef('userFieldValues', $userFieldValues);
     } else {
         JToolBarHelper::title(vmText::_('COM_VIRTUEMART_MANAGE_USER_FIELDS'), 'vm_user_48 head');
         JToolBarHelper::addNew();
         JToolBarHelper::editList();
         JToolBarHelper::divider();
         JToolBarHelper::custom('toggle.required.1', 'publish', '', 'COM_VIRTUEMART_FIELDMANAGER_REQUIRE');
         JToolBarHelper::custom('toggle.required.0', 'unpublish', '', 'COM_VIRTUEMART_FIELDMANAGER_UNREQUIRE');
         JToolBarHelper::publishList();
         JToolBarHelper::unpublishList();
         JToolBarHelper::divider();
         $barText = vmText::_('COM_VIRTUEMART_FIELDMANAGER_SHOW_HIDE');
         $bar = JToolBar::getInstance('toolbar');
         $bar->appendButton('Separator', '"><span class="bartext">' . $barText . '</span><hr style="display: none;');
         //$bar->appendButton( 'publish', 'upload', $alt, '', 550, 400 );
         JToolBarHelper::custom('toggle.registration.1', 'publish', '', 'COM_VIRTUEMART_FIELDMANAGER_SHOW_REGISTRATION');
         JToolBarHelper::custom('toggle.registration.0', 'unpublish', '', 'COM_VIRTUEMART_FIELDMANAGER_HIDE_REGISTRATION');
         JToolBarHelper::custom('toggle.shipment.1', 'publish', '', 'COM_VIRTUEMART_FIELDMANAGER_SHOW_SHIPPING');
         JToolBarHelper::custom('toggle.shipment.0', 'unpublish', '', 'COM_VIRTUEMART_FIELDMANAGER_HIDE_SHIPPING');
         JToolBarHelper::custom('toggle.account.1', 'publish', '', 'COM_VIRTUEMART_FIELDMANAGER_SHOW_ACCOUNT');
         JToolBarHelper::custom('toggle.account.0', 'unpublish', '', 'COM_VIRTUEMART_FIELDMANAGER_HIDE_ACCOUNT');
         JToolBarHelper::divider();
         JToolBarHelper::deleteList();
         $this->addStandardDefaultViewLists($model, 'ordering', 'ASC');
         $this->userfieldsList = $model->getUserfieldsList();
         $this->pagination = $model->getPagination();
         // search filter
         $search = $mainframe->getUserStateFromRequest($option . 'search', 'search', '', 'string');
         $search = JString::strtolower($search);
         $this->lists['search'] = $search;
     }
     $this->lists['coreFields'] = $lists['coreFields'];
     parent::display($tpl);
 }