Example #1
0
/**
*   Get an individual field for the history screen.
*
*   @param  string  $fieldname  Name of field (from the array, not the db)
*   @param  mixed   $fieldvalue Value of the field
*   @param  array   $A          Array of all fields from the database
*   @param  array   $icon_arr   System icon array (not used)
*   @param  object  $EntryList  This entry list object
*   @return string              HTML for field display in the table
*/
function PAYPAL_getAdminField_Product($fieldname, $fieldvalue, $A, $icon_arr)
{
    global $_CONF, $_PP_CONF, $LANG_PP;
    $retval = '';
    switch ($fieldname) {
        case 'edit':
            $retval .= '<span>' . COM_createLink($icon_arr['edit'], PAYPAL_ADMIN_URL . "/index.php?editproduct=x&amp;id={$A['id']}") . "</span>\n";
            break;
        case 'delete':
            if (!Product::isUsed($A['id'])) {
                $retval .= COM_createLink($icon_arr['delete'], PAYPAL_ADMIN_URL . '/index.php?deleteproduct=x&amp;id=' . $A['id'], array('class' => 'gl_mootip', 'onclick' => 'return confirm(\'Do you really want to delete this item?\');', 'title' => 'Delete this item'));
            } else {
                $retval = '';
            }
            break;
        case 'enabled':
            if ($fieldvalue == '1') {
                $switch = ' checked="checked"';
                $enabled = 1;
            } else {
                $switch = '';
                $enabled = 0;
            }
            $retval .= "<input type=\"checkbox\" {$switch} value=\"1\" name=\"ena_check\" \n                id=\"togenabled{$A['id']}\"\n                onclick='PP_toggle(this,\"{$A['id']}\",\"enabled\"," . "\"product\",\"" . PAYPAL_ADMIN_URL . "\");' />" . LB;
            break;
        case 'featured':
            if ($fieldvalue == '1') {
                $switch = ' checked="checked"';
                $enabled = 1;
            } else {
                $switch = '';
                $enabled = 0;
            }
            $retval .= "<input type=\"checkbox\" {$switch} value=\"1\" name=\"ena_check\" \n                id=\"togfeatured{$A['id']}\"\n                onclick='PP_toggle(this,\"{$A['id']}\",\"featured\"," . "\"product\",\"" . PAYPAL_ADMIN_URL . "\");' />" . LB;
            break;
        case 'name':
            $retval = COM_createLink($fieldvalue, PAYPAL_URL . '/index.php?detail=x&id=' . $A['id']);
            break;
        case 'prod_type':
            $retval = $LANG_PP['prod_types'][$A['prod_type']];
            break;
        case 'cat_name':
            $retval = COM_createLink($fieldvalue, PAYPAL_ADMIN_URL . '/index.php?cat_id=' . $A['cat_id']);
            break;
        default:
            $retval = htmlspecialchars($fieldvalue, ENT_QUOTES, COM_getEncodingt());
            break;
    }
    return $retval;
}