Example #1
0
/**
*   Get an individual field for the category admin list.
*
*   @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_Category($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?editcat=x&amp;id={$A['cat_id']}") . "</span>\n";
            if ($A['enabled'] == 1) {
                $ena_icon = 'on.png';
                $enabled = 1;
            } else {
                $ena_icon = 'off.png';
                $enabled = 0;
            }
            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['cat_id']}\"\n                onclick='PP_toggle(this,\"{$A['cat_id']}\",\"enabled\"," . "\"category\",\"" . PAYPAL_ADMIN_URL . "\");' />" . LB;
            break;
        case 'delete':
            if (!Category::isUsed($A['cat_id'])) {
                $retval .= COM_createLink($icon_arr['delete'], PAYPAL_ADMIN_URL . '/index.php?deletecat=x&amp;cat_id=' . $A['cat_id'], array('class' => 'gl_mootip', 'onclick' => 'return confirm(\'Do you really want to delete this item?\');', 'title' => 'Delete this item'));
            }
            break;
        default:
            $retval = htmlspecialchars($fieldvalue, ENT_QUOTES, COM_getEncodingt());
            break;
    }
    return $retval;
}
Example #2
0
/**
*   Get an individual field for the category admin list.
*
*   @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_Category($fieldname, $fieldvalue, $A, $icon_arr)
{
    global $_CONF, $_PP_CONF, $LANG_PP, $_TABLES, $is_uikit;
    $retval = '';
    static $grp_names = array();
    switch ($fieldname) {
        case 'edit':
            if ($is_uikit) {
                $retval .= COM_createLink('', PAYPAL_ADMIN_URL . "/index.php?editcat=x&amp;id={$A['cat_id']}", array('class' => 'uk-icon-edit'));
            } else {
                $retval .= COM_createLink($icon_arr['edit'], PAYPAL_ADMIN_URL . "/index.php?editcat=x&amp;id={$A['cat_id']}");
            }
            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['cat_id']}\"\n                onclick='PP_toggle(this,\"{$A['cat_id']}\",\"enabled\"," . "\"category\",\"" . PAYPAL_ADMIN_URL . "\");' />" . LB;
            break;
        case 'grp_access':
            $fieldvalue = (int) $fieldvalue;
            if (!isset($grp_names[$fieldvalue])) {
                $grp_names[$fieldvalue] = DB_getItem($_TABLES['groups'], 'grp_name', "grp_id = {$fieldvalue}");
            }
            $retval = $grp_names[$fieldvalue];
            break;
        case 'delete':
            if (!Category::isUsed($A['cat_id'])) {
                if ($is_uikit) {
                    $retval .= COM_createLink('', PAYPAL_ADMIN_URL . '/index.php?deletecat=x&amp;cat_id=' . $A['cat_id'], array('class' => 'uk-icon-trash-o pp-icon-danger', 'onclick' => 'return confirm(\'Do you really want to delete this item?\');', 'title' => 'Delete this item', 'data-uk-tooltip' => ''));
                } else {
                    $retval .= COM_createLink($icon_arr['delete'], PAYPAL_ADMIN_URL . '/index.php?deletecat=x&amp;cat_id=' . $A['cat_id'], array('class' => 'gl_mootip', 'onclick' => 'return confirm(\'Do you really want to delete this item?\');', 'title' => 'Delete this item'));
                }
            }
            break;
        case 'description':
            $retval = strip_tags($fieldvalue);
            if (utf8_strlen($retval) > 80) {
                $retval = substr($retval, 0, 80) . '...';
            }
            break;
        default:
            $retval = htmlspecialchars($fieldvalue, ENT_QUOTES, COM_getEncodingt());
            break;
    }
    return $retval;
}