writeSearchHeader($VM_LANG->_PHPSHOP_PRODUCT_LIST_LBL, IMAGEURL."ps_image/product_code.png", $modulename, "product_list"); * * // start the list table * $listObj->startTable(); * * // these are the columns in the table * $columns = Array( "#" => "width=\"20\"", * "" => "width=\"20\"",* * $VM_LANG->_PHPSHOP_PRODUCT_LIST_NAME => '', * $VM_LANG->_PHPSHOP_PRODUCT_LIST_SKU => '', * _E_REMOVE => "width=\"5%\"" * ); * $listObj->writeTableHeader( $columns ); * * ###BEGIN LOOPING THROUGH RECORDS ########## * * $listObj->newRow(); * * // The row number * $listObj->addCell( $pageNav->rowNumber( $i ) ); * * // The Checkbox * $listObj->addCell( mosHTML::idBox( $i, $db->f("product_id"), false, "product_id" ) ); * ... * ###FINISH THE RECENT LOOP######## * $listObj->addCell( $ps_html->deleteButton( "product_id", $db->f("product_id"), "productDelete", $keyword, $limitstart ) ); * * $i++; * * #### * $listObj->writeTable(); * $listObj->endTable(); * $listObj->writeFooter( $keyword ); * * @package SupaCart * @subpackage Classes * @author soeren */ class listFactory { /** @var int the number of rows in the table */ var $columnCount = 0; /** @var array css classes for alternating rows (row0 and row1 ) */ var $alternateColors; /** @var int The column number */ var $x = -1; /** @var int The row number */ var $y = -1; /** @var array The table cells */ var $cells = Array(); /** @var vmPageNavigation The Page Navigation Object */ var $pageNav; /** @var int The smallest number of results that shows the page navigation */ var $_resultsToShowPageNav = 6; function listFactory( $pageNav=null ) { if( defined('_PSHOP_ADMIN')) { $this->alternateColors = array( 0 => 'row0', 1 => 'row1' ); } else { $this->alternateColors = array( 0 => 'sectiontableentry1', 1 => 'sectiontableentry2' ); } $this->pageNav = $pageNav; } /** * Writes the start of the button bar table */ function startTable() { ?> columnCount = intval( $columnNames ); else { $this->columnCount = count( $columnNames ); echo ''; foreach( $columnNames as $name => $attributes ) { $name = html_entity_decode( $name ); echo "\n"; } echo "\n"; } } function newRow( $class='', $id='', $attributes='') { $this->y++; $this->x = 0; if( $class != '') { $this->cells[$this->y]['class']; } if( $id != '') { $this->cells[$this->y]['id']; } if( $attributes != '' ) { $this->cells[$this->y]['attributes']; } } function addCell( $data, $attributes="" ) { $this->cells[$this->y][$this->x]["data"] = $data; $this->cells[$this->y][$this->x]["attributes"] = $attributes; $this->x++; } /** * Writes a table row with data * Array * $row[0]["data"] = "Cell Value"; * $row[0]["attributes"] = "align=\"center\""; */ function writeTable() { if( !is_array( $this->cells )) return false; else { $i = 0; foreach( $this->cells as $row ) { echo "alternateColors[$i]; if( !empty($row['class'])) { echo ' '.$row['class']; } echo '"'; if( !empty($row['id'])) { echo ' id="'.$row['id'].'" '; } if( !empty($row['attributes'])) { echo $row['attributes']; } echo ">\n"; foreach( $row as $cell ) { if( !isset( $cell["data"] )) continue; $value = $cell["data"]; $attributes = $cell["attributes"]; echo "\n"; } echo "\n"; $i == 0 ? $i++ : $i--; } } } function endTable() { echo "
$name
$value
\n"; } /** * This creates a header above the list table, containing a search box * @param The Label for the list (will be used as list heading!) * @param The core module name (e.g. "product") * @param The page name (e.g. "product_list" ) * @param Additional varaibles to include as hidden input fields */ function writeSearchHeader( $title, $image="", $modulename, $pagename) { global $sess, $keyword, $VM_LANG, $option; if( !empty( $keyword )) { $keyword = urldecode( $keyword ); } else { $keyword = ""; } $category_id = mosGetParam( $_REQUEST, 'category_id', null); $search_date = mosGetParam( $_REQUEST, 'search_date', null); $show = mosGetParam( $_REQUEST, "show", "" ); $header = "
\n \n getSessionId())."\" /> \n"; if( defined( "_PSHOP_ADMIN") || @$_REQUEST['pshop_mode'] == "admin" ) $header .= "\n"; if( $title != "" ) { $style = ($image != '') ? 'style="background-image:url('.$image.');"' : ''; $header .= "

$title

\n"; } if( !empty( $pagename )) $header .= "

_PHPSHOP_SEARCH_TITLE."\" />
"; $header .= "
"; if ( !empty($search_date) ) // Changed search by date $header .= "\n"; if( !empty($show) ) { $header .= "\n"; } echo $header; } /** * This creates a list footer (page navigation) * @param The core module name (e.g. "product") * @param The page name (e.g. "product_list" ) * @param The Keyword from a search by keyword * @param Additional varaibles to include as hidden input fields */ function writeFooter($keyword, $extra="") { $footer= ""; if( $this->pageNav !== null ) { if( $this->_resultsToShowPageNav <= $this->pageNav->total ) { $footer = $this->pageNav->getListFooter(); } } else { $footer = ""; } if(!empty( $extra )) { $extrafields = explode("&", $extra); array_shift($extrafields); foreach( $extrafields as $key => $value) { $field = explode("=", $value); $footer .= "\n"; } } $footer .= "
"; echo $footer; } } /** * This is the class for creating regular forms used in SupaCart * * Usage: * //First create the object and let it print a form heading * $formObj = &new formFactory( "My Form" ); * //Then Start the form * $formObj->startForm(); * // Add necessary hidden fields * $formObj->hiddenField( 'country_id', $country_id ); * * // Write your form with mixed tags and text fields * // and finally close the form: * $formObj->finishForm( $funcname, $modulename.'.country_list', $option ); * * @package supacart * @subpackage Core * @author soeren */ class formFactory { /** * Constructor * Prints the Form Heading if provided */ function formFactory( $title = '' ) { if( $title != "" ) { echo "
$title
"; } } /** * Writes the form start tag */ function startForm( $formname = 'adminForm', $extra = "" ) { echo '
'; } function hiddenField( $name, $value ) { echo ' '; } /** * Writes necessary hidden input fields * and closes the form */ function finishForm( $func, $page, $option='com_supacart' ) { $html = ' '; if( defined( "_PSHOP_ADMIN") || @$_REQUEST['pshop_mode'] == "admin" ) $html .= ''; $html .= '
'; echo $html; } } /** * Tab Creation handler * @package SupaCart * @subpackage core * @author Phil Taylor * @author Soeren Eberhardt * Modified to use Panel-in-Panel functionality */ class mShopTabs { /** @var int Use cookies */ var $useCookies = 0; /** @var string Panel ID */ var $panel_id; /** * Constructor * Includes files needed for displaying tabs and sets cookie options * @param int useCookies, if set to 1 cookie will hold last used tab between page refreshes * @param int show_js, if set to 1 the Javascript Link and Stylesheet will not be printed */ function mShopTabs($useCookies, $show_js, $panel_id) { global $mosConfig_live_site; if( $show_js == 1 ) { echo ""; echo ""; } $this->useCookies = $useCookies; $this->panel_id = $panel_id; } /** * creates a tab pane and creates JS obj * @param string The Tab Pane Name */ function startPane($id){ echo "
"; echo "\n"; } /** * Ends Tab Pane */ function endPane() { echo "
"; } /* * Creates a tab with title text and starts that tabs page * @param tabText - This is what is displayed on the tab * @param paneid - This is the parent pane to build this tab on */ function startTab( $tabText, $paneid ) { echo "
"; echo "

".$tabText."

"; echo ""; } /* * Ends a tab page */ function endTab() { echo "
"; } } class vmCommonHTML { /** * Writes a "Save Ordering" Button * @param int the number of rows */ function getSaveOrderButton( $num_rows, $funcname='reorder') { global $mosConfig_live_site; $n = $num_rows-1; return ' Save Order'; } function getOrderingField( $ordering ) { return ''; } function getYesNoIcon( $condition, $pos_alt = "Published", $neg_alt = "Unpublished" ) { global $mosConfig_live_site; if( $condition===true || strtoupper( $condition ) == "Y" ) return ''.$pos_alt.''; else return ''.$neg_alt.''; } /* * Loads all necessary files for JS Overlib tooltips */ function loadOverlib() { global $mosConfig_live_site; if( !defined( "_OVERLIB_LOADED" )) { ?> '.$msg.''; return $html; } /** * Returns a div element of the class "shop_error" * containing $msg to print out an error * * @param string $msg * @return string HTML code */ function getInfoField( $msg ) { $html = '
'.$msg.'
'; return $html; } /** * Prints a JS function to validate all fields * given in the array $required_fields * Does only test if non-empty (or if no options are selected) * Includes a check for a valid email-address * * @param array $required_fields The list of form elements that are to be validated * @param string $formname The name for the form element * @param string $div_id_postfix The ID postfix to identify the label for the field */ function printJS_formvalidation( $required_fields, $formname = 'adminForm', $functioname='submitregistration', $div_id_postfix = '_div' ) { global $VM_LANG; echo ' '; } } /** * Utility function to provide ToolTips * @param string ToolTip text * @param string Box title * @returns HTML code for ToolTip */ function mm_ToolTip( $tooltip, $title='Tip!', $image = "{mosConfig_live_site}/images/M_images/con_info.png", $width='', $text='', $href='#', $link=false ) { global $mosConfig_live_site, $database; defined( 'vmToolTipCalled') or define('vmToolTipCalled', 1); $tooltip = @htmlentities( $database->getEscaped($tooltip), ENT_QUOTES, vmGetCharset() ); if ( !empty($width) ) { $width = 'this.T_WIDTH=\''.$width .'\';'; } if ( $title ) { $title = 'this.T_TITLE=\''.$title .'\';'; } $image = str_replace( "{mosConfig_live_site}", $mosConfig_live_site, $image); $text = ' '.$text; $style = 'style="text-decoration: none; color: #333;"'; if ( $href ) { $style = ''; } if ( $link ) { $tip = "". $text .""; } else { $tip = "". $text .""; } return $tip; } // borrowed from mambo.php function shopMakeHtmlSafe( $string, $quote_style=ENT_QUOTES, $exclude_keys='' ) { $string = htmlspecialchars( $string, $quote_style ); return $string; } function mm_showMyFileName( $filename ) { if (DEBUG == '1' ) { echo mm_ToolTip( '
Begin of File: '. $filename.'
'); } } /** * Wraps HTML Code or simple Text into Javascript * and uses the noscript Tag to support browsers with JavaScript disabled **/ function mm_writeWithJS( $textToWrap, $noscriptText ) { $text = ""; if( !empty( $textToWrap )) { $text = "\n"; } if( !empty( $noscriptText )) { $text .= "\n"; } return $text; } /** * A function to create a XHTML compliant and JS-disabled-safe pop-up link */ function vmPopupLink( $link, $text, $popupWidth=640, $popupHeight=480, $target='_blank', $title='' ) { $jslink = "$text"; $noscriptlink = "$text"; return mm_writeWithJS( $jslink, $noscriptlink ); } ?>