Пример #1
0
 /**
  * Modified by shumisha to handle SEF URLs 2008-06-28
  * @return string The html for the limit # input box
  */
 function getLimitBox($link = '')
 {
     $limits = array();
     if (!empty($link) && strpos('limitstart=', $link) === false) {
         // insert limitstart in url if missing // shumisha
         $link .= '&limitstart=' . $this->limitstart;
     }
     for ($i = 5; $i <= 30; $i += 5) {
         if (empty($link)) {
             $limits[$i] = $i;
         } else {
             $limits[vmRoute($link . '&limit=' . $i)] = $i;
         }
     }
     if (empty($link)) {
         $limits[50] = 50;
     } else {
         $limits[vmRoute($link . '&limit=50')] = 50;
     }
     // build the html select list
     if (empty($link)) {
         $html = ps_html::selectList('limit', $this->limit, $limits, 1, '', 'onchange="this.form.submit();"');
     } else {
         $current = vmRoute($link . '&limit=' . $this->limit);
         $html = ps_html::selectList('limit', $current, $limits, 1, '', 'onchange="location.href=this.value"');
     }
     $html .= "\n<input type=\"hidden\" name=\"limitstart\" value=\"{$this->limitstart}\" />";
     return $html;
 }
Пример #2
0
 /**
  * Build a Credit Card list for each CreditCard Payment Method
  * Uses JavsScript from mambojavascript: changeDynaList()
  *
  * @param ps_DB $db_cc
  * @return string
  */
 function creditcard_lists(&$db_cc)
 {
     global $mainframe;
     if (vmIsJoomla('1.5')) {
         $document = JFactory::getDocument();
         $document->addScript('includes/js/joomla.javascript.js');
     }
     $db = new ps_DB();
     $db_cc->next_record();
     // Build the Credit Card lists for each CreditCard Payment Method
     $script = "<script language=\"javascript\" type=\"text/javascript\">\n";
     $script .= "<!--\n";
     $script .= "var originalOrder = '1';\n";
     $script .= "var originalPos = '" . $db_cc->f("payment_method_name") . "';\n";
     $script .= "var orders = new Array();\t// array in the format [key,value,text]\n";
     $i = 0;
     $db_cc->reset();
     while ($db_cc->next_record()) {
         $accepted_creditcards = explode(",", $db_cc->f("accepted_creditcards"));
         $cards = array();
         foreach ($accepted_creditcards as $value) {
             if (!empty($value)) {
                 $q = 'SELECT creditcard_code,creditcard_name FROM #__{vm}_creditcard WHERE creditcard_id=' . (int) $value;
                 $db->query($q);
                 $db->next_record();
                 $cards[$db->f('creditcard_code')] = shopMakeHtmlSafe($db->f('creditcard_name'));
             }
         }
         foreach ($cards as $code => $name) {
             $script .= "orders[" . $i++ . "] = new Array( '" . addslashes($db_cc->f("payment_method_name")) . "','{$code}','{$name}' );\n";
         }
     }
     $script .= "function changeCreditCardList() { \n";
     $script .= "var selected_payment = null;\n      for (var i=0; i<document.adminForm.payment_method_id.length; i++)\n         if (document.adminForm.payment_method_id[i].checked)\n            selected_payment = document.adminForm.payment_method_id[i].id;\n";
     $script .= "changeDynaList('creditcard_code',orders,selected_payment, originalPos, originalOrder);\n";
     $script .= "}\n";
     $script .= "//-->\n";
     $script .= "</script>\n";
     $script .= '<noscript>' . ps_html::selectList('creditcard_code', key($cards), $cards) . '</noscript>';
     return $script;
 }
Пример #3
0
 /**
  * Funtion to create a select list holding all files for a special template section (e.g. order_emails)
  *
  * @param string $name
  * @param string $section
  * @param string $preselected
  * @return string
  */
 function list_template_files($name, $section = 'browse', $preselected = '')
 {
     $files = vmReadDirectory(VM_THEMEPATH . "templates/{$section}/");
     $array = array();
     foreach ($files as $file) {
         if (is_dir($file)) {
             continue;
         }
         $file_info = pathinfo($file);
         $filename = $file_info['basename'];
         if ($filename == 'index.html') {
             continue;
         }
         $array[basename($filename, '.' . $file_info['extension'])] = basename($filename, '.' . $file_info['extension']);
     }
     if ($section == 'browse') {
         $array = array_merge(array('managed' => 'managed'), $array);
     }
     return ps_html::selectList($name, $preselected, $array);
 }
Пример #4
0
echo vmToolTip($VM_LANG->_('PHPSHOP_ADMIN_CFG_SHOW_PRODUCT_COUNT_TIP'));
?>
</td>
    </tr>
    <tr>
        <td class="labelcell"><?php 
echo $VM_LANG->_('PHPSHOP_ADMIN_CFG_NOIMAGEPAGE');
?>
</td>
        <td>
	        <?php 
$images = vmReadDirectory(VM_THEMEPATH . 'images', '\\.png$|\\.bmp$|\\.jpg$|\\.jpeg$|\\.gif$|\\.ico$');
foreach ($images as $image) {
    $imageArr[basename($image)] = $image;
}
echo ps_html::selectList('conf_NO_IMAGE', NO_IMAGE, $imageArr);
?>
        </td>
        <td><?php 
echo vmToolTip($VM_LANG->_('PHPSHOP_ADMIN_CFG_NOIMAGEPAGE_EXPLAIN'));
?>
        </td>
    </tr>
    <tr>
        <td class="labelcell"><?php 
echo $VM_LANG->_('PHPSHOP_ADMIN_CFG_SHOWPHPSHOP_VERSION');
?>
</td>
        <td>
            <input type="checkbox" name="conf_SHOWVERSION" class="inputbox" <?php 
if (SHOWVERSION == 1) {
Пример #5
0
 /**
  * lists all Product Types
  *
  * @param int $product_type_id
  * @param int $list_order
  * @return string
  */
 function list_order($product_type_id = '0', $list_order = 0)
 {
     $db = new ps_DB();
     if (!$product_type_id) {
         return $GLOBALS['VM_LANG']->_('CMN_NEW_ITEM_LAST');
     } else {
         $q = "SELECT product_type_list_order,product_type_name FROM #__{vm}_product_type ";
         if ($product_type_id) {
             $q .= 'WHERE product_type_id=' . $product_type_id;
         }
         $q .= " ORDER BY product_type_list_order ASC";
         $db->query($q);
         $array = array();
         while ($db->next_record()) {
             $array[$db->f("product_type_list_order")] = $db->f("product_type_list_order") . ". " . $db->f("product_type_name");
         }
         return ps_html::selectList('list_order', $list_order, $array);
     }
 }
Пример #6
0
 /**
  * Prints a drop-down list of manufacturer names and their ids.
  *
  * @param int $manufacturer_id
  */
 function list_manufacturer($manufacturer_id = '0')
 {
     $db = new ps_DB();
     $q = "SELECT manufacturer_id as id,mf_name as name FROM #__{vm}_manufacturer ORDER BY mf_name";
     $db->query($q);
     $db->next_record();
     // If only one vendor do not show list
     if ($db->num_rows() == 1) {
         echo '<input type="hidden" name="manufacturer_id" value="' . $db->f("id") . '" />';
         echo $db->f("name");
     } elseif ($db->num_rows() > 1) {
         $db->reset();
         $array = array();
         while ($db->next_record()) {
             $array[$db->f("id")] = $db->f("name");
         }
         $code = ps_html::selectList('manufacturer_id', $manufacturer_id, $array) . "<br />\n";
         echo $code;
     } else {
         echo '<input type="hidden" name="manufacturer_id" value="1" />Please create at least one Manufacturer!!';
     }
 }
Пример #7
0
 /**
  * @param string The name of the form element
  * @param string The value of the element
  * @param object The xml element for the parameter
  * @param string The control name
  * @return string The html for the element
  */
 function _form_list($name, $value, &$node, $control_name)
 {
     $size = $node->getAttribute('size');
     $options = array();
     foreach ($node->childNodes as $option) {
         $val = $option->getAttribute('value');
         $text = $option->gettext();
         $options[$val] = $text;
     }
     return ps_html::selectList($control_name . '[' . $name . ']', $value, $options);
 }
Пример #8
0
 /**
  * Enter description here...
  *
  * @param unknown_type $name
  * @param unknown_type $preselected
  * @return unknown
  */
 function list_available_classes($name, $preselected = 'ps_xmlexport')
 {
     $files = vmReadDirectory(CLASSPATH . "export/", ".php", true, true);
     $array = array();
     foreach ($files as $file) {
         $file_info = pathinfo($file);
         $filename = $file_info['basename'];
         if (stristr($filename, '.cfg')) {
             continue;
         }
         $array[basename($filename, '.php')] = basename($filename, '.php');
     }
     return ps_html::selectList($name, $preselected, $array);
 }
        $method_array = array();
        if (file_exists(CLASSPATH . $classfile)) {
            require_once CLASSPATH . $classfile;
            $class = str_replace('.class', '', $class);
            $methods = get_class_methods($class);
            if (empty($methods)) {
                $methods = get_class_methods('vm' . $class);
            }
            foreach ($methods as $method) {
                if ($method == $class) {
                    continue;
                }
                $method_array[$method] = $method;
            }
        }
        vmConnector::sendHeaderAndContent(200, ps_html::selectList('function_method', $function, $method_array));
        break;
    case 'checkforupdate':
        require_once CLASSPATH . 'update.class.php';
        $result = vmUpdate::checkLatestVersion();
        if (!empty($result)) {
            // Convert a String like "1.1.1" => "1.11", so we can use it as float in Javascript
            $version_as_float = substr($result, 0, 3) . substr($result, 4);
            $version_as_json = '{version_string:"' . $result . '",version:"' . $version_as_float . '"}';
            vmConnector::sendHeaderAndContent('200', $version_as_json);
        } else {
            vmConnector::sendHeaderAndContent('200', 'Connection Failed');
        }
    default:
        die;
}
Пример #10
0
 /**
  * prints the HTML code of selectable carrier list
  *
  * @param unknown_type $select_name
  * @param unknown_type $selected_carrier_id
  */
 function carrier_list($select_name, $selected_carrier_id)
 {
     global $VM_LANG;
     $db = new ps_DB();
     $carrier_arr[''] = $VM_LANG->_('PHPSHOP_SELECT');
     $q = "SELECT shipping_carrier_id,shipping_carrier_name FROM #__{vm}_shipping_carrier";
     // Get list of Values
     $db->query($q);
     while ($db->next_record()) {
         $carrier_arr[$db->f("shipping_carrier_id")] = $db->f("shipping_carrier_name");
     }
     echo ps_html::selectList($select_name, $selected_carrier_id, $carrier_arr);
 }
Пример #11
0
 /**
  * Prints a drop-down list with all affiliates
  *
  * @param unknown_type $affiliate_active
  */
 function get_affiliate_list($affiliate_active = 'Y')
 {
     global $ps_vendor_id;
     $db = new ps_DB();
     $i = 0;
     //get the affiliate id from affiliate table for this user
     $q = "SELECT affiliate_id,first_name,last_name,name,username FROM #__{vm}_affiliate, #__users";
     $q .= " WHERE #__{vm}_affiliate.user_id = #__users.user_info_id";
     if ($affiliate_active == 'Y') {
         $q .= " AND active = 'Y' ";
     }
     $db->query($q);
     $array['*'] = '*';
     while ($db->next_record()) {
         $i++;
         $array[$db->f("affiliate_id")] = $db->f("first_name") . " " . $db->f("first_name") . " (" . $db->f("username") . ")";
     }
     if (!$i) {
         $array[''] = '---------------------- No Affiliates to Display ------------------';
     }
     echo ps_html::selectList('affiliate_id', '', $array);
 }
Пример #12
0
 /**
  * Creates a Drop Down - List of Credit Card Records
  *
  * @param int $payment_method_id
  */
 function creditcard_selector($payment_method_id = "")
 {
     $db = new ps_DB();
     /*** Select all credit card records ***/
     if (empty($payment_method_id)) {
         $q = "SELECT creditcard_name, creditcard_id,creditcard_code FROM #__{vm}_creditcard WHERE vendor_id='" . $_SESSION['ps_vendor_id'] . "'";
     } else {
         $q = 'SELECT accepted_creditcards FROM #__{vm}_payment_method WHERE payment_method_id=' . (int) $payment_method_id;
         $db->query($q);
         $db->next_record();
         $cc_array = explode(",", $db->f("accepted_creditcards"));
         $q = "SELECT creditcard_name,creditcard_id,creditcard_code FROM #__{vm}_creditcard WHERE vendor_id='" . $_SESSION['ps_vendor_id'] . "' AND (";
         foreach ($cc_array as $idx => $creditcard_id) {
             $q .= "creditcard_id='{$creditcard_id}' ";
             if ($idx + 1 < sizeof($cc_array)) {
                 $q .= "OR ";
             } else {
                 $q .= ")";
             }
         }
     }
     $db->query($q);
     while ($db->next_record()) {
         $array[$db->f("creditcard_code")] = $db->f("creditcard_name");
     }
     echo ps_html::selectList('creditcard_code', '', $array);
 }
Пример #13
0
    if (file_exists($mosConfig_absolute_path . '/components/com_yanc/yanc.php')) {
        $types['yanc_subscription'] = $VM_LANG->_('VM_FIELDS_NEWSLETTER') . ' (YaNC)';
    }
    if (file_exists($mosConfig_absolute_path . '/components/com_anjel/anjel.php')) {
        $types['anjel_subscription'] = $VM_LANG->_('VM_FIELDS_NEWSLETTER') . ' (ANJEL)';
    }
    if (file_exists($mosConfig_absolute_path . '/components/com_letterman/letterman.php')) {
        $types['letterman_subscription'] = $VM_LANG->_('VM_FIELDS_NEWSLETTER') . ' (Letterman)';
    }
    if (file_exists($mosConfig_absolute_path . '/components/com_ccnewsletter/ccnewsletter.php')) {
        $types['ccnewsletter_subscription'] = $VM_LANG->_('VM_FIELDS_NEWSLETTER') . ' (ccNewsletter)';
    }
    $types['delimiter'] = $VM_LANG->_('VM_FIELDS_DELIMITER');
    $lists['type'] = ps_html::selectList('type', $db->f('type'), $types, 1, '', 'onchange="toggleType(this.options[this.selectedIndex].value);"');
}
$lists['webaddresstypes'] = ps_html::selectList('webaddresstypes', $db->f('rows'), $webaddrtypes);
if (in_array($db->f('name'), ps_userfield::getSkipFields())) {
    $lists['required'] = '<input type="hidden" name="required" class="inputbox" value="' . $db->sf('required') . '" />' . ($db->sf('required') ? $VM_LANG->_('PHPSHOP_ADMIN_CFG_YES') : $VM_LANG->_('PHPSHOP_ADMIN_CFG_NO'));
    $lists['published'] = '<input type="hidden" name="published" class="inputbox" value="' . $db->sf('required') . '" />' . ($db->sf('required') ? $VM_LANG->_('PHPSHOP_ADMIN_CFG_YES') : $VM_LANG->_('PHPSHOP_ADMIN_CFG_NO'));
    $lists['registration'] = '<input type="hidden" name="registration" class="inputbox" value="' . $db->sf('required') . '" />' . ($db->sf('required') ? $VM_LANG->_('PHPSHOP_ADMIN_CFG_YES') : $VM_LANG->_('PHPSHOP_ADMIN_CFG_NO'));
} else {
    $lists['required'] = ps_html::yesnoSelectList('required', $db->sf('required') ? $db->sf('required') : '0');
    $lists['published'] = ps_html::yesnoSelectList('published', $db->sf('published'));
    $lists['registration'] = ps_html::yesnoSelectList('registration', $db->sf('registration'));
}
$lists['readonly'] = ps_html::yesnoSelectList('readonly', $db->sf('readonly') != '' ? $db->sf('readonly') : '0');
$lists['shipping'] = ps_html::yesnoSelectList('shipping', $db->sf('shipping') != '' ? $db->sf('shipping') : '0');
$lists['account'] = ps_html::yesnoSelectList('account', $db->sf('account'));
?>
	<table cellpadding="4" cellspacing="0" border="0" width="100%">
		<tr>
Пример #14
0
        <table class="adminform">
          <tr class="row1">
			<td style="vertical-align:top;"><br />
			<?php 
echo $VM_LANG->_('VM_PRODUCT_RELATED_SEARCH');
?>
			<input type="text" size="40" name="search" id="relatedProductSearch" value="" />
			</td>
			<td><input type="button" name="remove_related" onclick="removeSelectedOptions(relatedSelection, 'related_products');" value="&nbsp; &lt; &nbsp;" /></td>
			<td>
			<?php 
$relProducts = array();
foreach ($related_products as $relProd) {
    $relProducts[$relProd] = $ps_product->get_field($relProd, 'product_name');
}
echo ps_html::selectList('relProds', '', $relProducts, 10, 'multiple="multiple"', 'id="relatedSelection" ondblclick="removeSelectedOptions(relatedSelection, \'related_products\');"');
?>
			<input type="hidden" name="related_products" value="<?php 
echo implode('|', $related_products);
?>
" />
			</td>			
		</tr>
	</table>
<!-- Changed Product Type - Begin -->
<?php 
$tabs->endTab();
// Get Product Types
$dba = new ps_DB();
################################
# Alatis Mod
Пример #15
0
 /**
  * Creates a Drop Down list of available Shopper Groups
  *
  * @param string $name
  * @param int $shopper_group_id
  * @param string $extra
  * @return string
  */
 function list_shopper_groups($name, $shopper_group_id = '0', $extra = '')
 {
     $ps_vendor_id = $_SESSION["ps_vendor_id"];
     global $perm;
     $db = new ps_DB();
     if (!$perm->check("admin")) {
         $q = "SELECT shopper_group_id,shopper_group_name,vendor_id,'' AS vendor_name FROM #__{vm}_shopper_group ";
         $q .= "WHERE vendor_id = '{$ps_vendor_id}' ";
     } else {
         $q = "SELECT shopper_group_id,shopper_group_name,#__{vm}_shopper_group.vendor_id,vendor_name FROM #__{vm}_shopper_group ";
         $q .= ",#__{vm}_vendor WHERE #__{vm}_shopper_group.vendor_id = #__{vm}_vendor.vendor_id ";
     }
     $q .= "ORDER BY shopper_group_name";
     $db->query($q);
     while ($db->next_record()) {
         $shopper_groups[$db->f("shopper_group_id")] = $db->f("shopper_group_name");
         // . '; '.$db->f('vendor_name').' (Vendor ID: '.$db->f('vendor_id').")";
     }
     return ps_html::selectList($name, $shopper_group_id, $shopper_groups, 1, '', $extra);
 }
Пример #16
0
 /**
  * Returns a DropDown List of all available Order Status Codes
  *
  * @param string $order_status_code
  * @param string $extra
  * @return string
  */
 function getOrderStatusList($order_status_code, $extra = "")
 {
     $db = new ps_DB();
     $q = "SELECT order_status_id, order_status_code, order_status_name FROM #__{vm}_order_status ORDER BY list_order";
     $db->query($q);
     $array = array();
     while ($db->next_record()) {
         $array[$db->f("order_status_code")] = $db->f("order_status_name");
     }
     return ps_html::selectList('order_status', $order_status_code, $array, 1, '', $extra);
 }
Пример #17
0
 /**
  * Lists all available files from the /classes directory
  *
  * @param string $name
  * @param string $preselected
  * @return string
  */
 function list_classes($name, $preselected)
 {
     global $mosConfig_absolute_path;
     $classes = vmReadDirectory(CLASSPATH, '\\.php$', false, true);
     $array = array();
     foreach ($classes as $class) {
         if (is_dir($class) || $class[0] == '.') {
             continue;
         }
         $classname = basename($class, '.php');
         if ($classname != 'ps_main' && $classname != 'ps_ini') {
             $array[$classname] = $classname;
         }
     }
     return ps_html::selectList($name, $preselected, $array, 1, '', 'id="' . $name . '"');
 }
Пример #18
0
 /**
  * Prints a drop-down list of vendor names and their ids.
  *
  * @param int $vendor_id
  */
 function list_vendor($vendor_id = '1')
 {
     $db = new ps_DB();
     $q = "SELECT vendor_id,vendor_name FROM #__{vm}_vendor ORDER BY vendor_name";
     $db->query($q);
     $db->next_record();
     // If only one vendor do not show list
     if ($db->num_rows() == 1) {
         echo '<input type="hidden" name="vendor_id" value="' . $db->f("vendor_id") . '" />';
         echo $db->f("vendor_name");
     } elseif ($db->num_rows() > 1) {
         $db->reset();
         $array = array();
         while ($db->next_record()) {
             $array[$db->f("vendor_id")] = $db->f("vendor_name");
         }
         echo ps_html::selectList('vendor_id', $vendor_id, $array);
     }
 }
Пример #19
0
 /**
  * lists the permission levels in a select box
  * @author pablo
  * @param string $name The name of the select element
  * @param string $group_name The preselected key
  */
 function list_perms($name, $group_name, $size = 1, $multi = false)
 {
     global $VM_LANG;
     $auth = $_SESSION['auth'];
     if ($multi) {
         $multi = 'multiple="multiple"';
     }
     $db = new ps_DB();
     // Get users current permission value
     $dvalue = $this->user_groups[$auth["perms"]];
     $perms = $this->getUserGroups();
     arsort($perms);
     if ($size == 1) {
         $values[0] = $VM_LANG->_('PHPSHOP_SELECT');
     }
     while (list($key, $value) = each($perms)) {
         // Display only those permission that this user can set
         if ($value >= $dvalue) {
             $values[$key] = $key;
         }
     }
     if ($size > 1) {
         $name .= '[]';
         $values['none'] = $VM_LANG->_('NO_RESTRICTION');
     }
     echo ps_html::selectList($name, $group_name, $values, $size, $multi);
 }