Пример #1
0
 public function serviceGetTemplates($bEnabledOnly = true, $bShortInfo = true)
 {
     $aValues = get_templates_array($bEnabledOnly, $bShortInfo);
     $aResult = array();
     foreach ($aValues as $sKey => $sValue) {
         $aResult[] = array('key' => $sKey, 'value' => $sValue);
     }
     return $aResult;
 }
Пример #2
0
 function getListTemplate($sCurrent)
 {
     $sOutputCode = "";
     $aTemplates = get_templates_array();
     if (count($aTemplates) < 2) {
         return $sOutputCode;
     }
     $sGetTransfer = bx_encode_url_params($_GET, array('skin'));
     $aTmplVars = array();
     foreach ($aTemplates as $sName => $sTitle) {
         $aTmplVars[] = array('bx_if:show_icon' => array('condition' => false, 'content' => array()), 'class' => $sName == $sCurrent ? 'sys-bm-sub-item-selected' : '', 'link' => bx_html_attribute($_SERVER['PHP_SELF']) . '?' . $sGetTransfer . 'skin=' . $sName, 'onclick' => '', 'title' => $sTitle);
     }
     $sOutputCode .= $GLOBALS['oSysTemplate']->parseHtmlByName('extra_bottom_menu_sub_items.html', array('name_method' => 'Template', 'name_block' => 'template', 'bx_repeat:items' => $aTmplVars));
     return PopupBox('sys-bm-switcher-template', _t('_sys_bm_popup_cpt_design'), $sOutputCode);
 }
Пример #3
0
 protected function loadData()
 {
     $this->setSelected('', $this->_oTemplate->getCode());
     $aPage = explode('?', $_SERVER['HTTP_REFERER']);
     $aPageParams = array();
     if (!empty($aPage[1])) {
         parse_str($aPage[1], $aPageParams);
     }
     $aTemplates = get_templates_array(true, true);
     $aItems = array();
     foreach ($aTemplates as $sName => $sTemplate) {
         $aPageParams['skin'] = $sName;
         $aItems[] = array('id' => $sName, 'name' => $sName, 'class' => '', 'title' => $sTemplate, 'target' => '_self', 'icon' => '', 'link' => bx_html_attribute(bx_append_url_params($aPage[0], $aPageParams)), 'onclick' => '');
     }
     $this->_aObject['menu_items'] = $aItems;
 }
Пример #4
0
function PageCodeTemplates($sResult)
{
    $a = get_templates_array(true);
    $aTemplates = array();
    foreach ($a as $k => $r) {
        $aTemplates[] = array('key' => $k, 'name' => htmlspecialchars_adv($r['name']), 'ver' => htmlspecialchars_adv($r['ver']), 'vendor' => htmlspecialchars_adv($r['vendor']), 'desc' => $r['desc'], 'bx_if:preview' => array('condition' => (bool) $r['preview'], 'content' => array('img' => $r['preview'])), 'bx_if:no_preview' => array('condition' => !$r['preview'], 'content' => array()), 'bx_if:default' => array('condition' => $k == getParam('template'), 'content' => array()), 'bx_if:make_default' => array('condition' => $k != getParam('template'), 'content' => array('key' => $k)), 'bx_if:delete' => array('condition' => $k != getParam('template') && $k != 'uni' && $k != 'alt', 'content' => array('key' => $k)));
    }
    $s = $sResult ? MsgBox($sResult, 10) : '';
    $s .= $GLOBALS['oAdmTemplate']->parseHtmlByName('templates.html', array('bx_repeat:templates' => $aTemplates));
    $sCode = DesignBoxAdmin($GLOBALS['sPageTitle'], $s, $GLOBALS['aTopItems'], '', 11);
    if ('on' == getParam('feeds_enable')) {
        $sCode = $sCode . DesignBoxAdmin(_t('_adm_box_cpt_design_templates'), '<div class="RSSAggrCont" rssid="boonex_unity_market_templates" rssnum="5" member="0">' . $GLOBALS['oFunctions']->loadingBoxInline() . '</div>');
    }
    $GLOBALS['oAdmTemplate']->addJsTranslation(array('_Are_you_sure'));
    return $sCode;
}
Пример #5
0
 function getSwitcherTemplate()
 {
     $sContent = '';
     if (getParam('enable_template') != 'on') {
         return $sContent;
     }
     $iTmplsCount = count(get_templates_array());
     if ($iTmplsCount <= 1) {
         return $sContent;
     }
     $sTemplName = $GLOBALS['oSysTemplate']->getCode();
     $aTmplVars = array();
     $aTmplVars[] = array('caption' => _t('_sys_bm_design', $sTemplName), 'link' => 'javascript:void(0)', 'script' => 'onclick="javascript:showPopupTemplate()"', 'target' => '');
     $sContent .= $GLOBALS['oSysTemplate']->parseHtmlByName('extra_' . $this->sName . '_menu.html', array('bx_repeat:items' => $aTmplVars));
     $sContent .= $GLOBALS['oFunctions']->getTemplateSwitcher($sTemplName);
     return $sContent;
 }
Пример #6
0
 protected function getGeneral()
 {
     $sJsObject = $this->getPageJsObject();
     $oTemplate = BxDolStudioTemplate::getInstance();
     $sResult = '';
     $sTemplate = getParam('template');
     $aTemplates = get_templates_array(true, false);
     $aTmplVarsTemplates = array();
     foreach ($aTemplates as $sUri => $aTemplate) {
         $sIcon = $this->getModuleIcon($aTemplate, 'store');
         $bIcon = strpos($sIcon, '.') === false;
         $aTmplVarsTemplates[] = array('uri' => $sUri, 'title' => htmlspecialchars_adv($aTemplate['title']), 'version' => htmlspecialchars_adv($aTemplate['version']), 'vendor' => htmlspecialchars_adv($aTemplate['vendor']), 'bx_if:icon' => array('condition' => $bIcon, 'content' => array('icon' => $sIcon)), 'bx_if:image' => array('condition' => !$bIcon, 'content' => array('icon_url' => $sIcon)), 'bx_if:default' => array('condition' => $sUri == $sTemplate, 'content' => array()), 'bx_if:make_default' => array('condition' => $sUri != $sTemplate, 'content' => array('js_object' => $sJsObject, 'uri' => $sUri)));
     }
     $sContent = $sResult ? MsgBox($sResult, 10) : '';
     $sContent .= $oTemplate->parseHtmlByName('templates.html', array('bx_repeat:templates' => $aTmplVarsTemplates));
     return $oTemplate->parseHtmlByName('designer.html', array('js_object' => $this->getPageJsObject(), 'content' => $sContent));
 }
Пример #7
0
 protected function _isVisible($a)
 {
     if (!parent::_isVisible($a)) {
         return false;
     }
     $bResult = true;
     switch ($a['name']) {
         case 'switch_language':
             $aLanguages = BxDolLanguagesQuery::getInstance()->getLanguages(false, true);
             if (count($aLanguages) <= 1) {
                 $bResult = false;
             }
             break;
         case 'switch_template':
             $aTemplates = get_templates_array(true, true);
             if (count($aTemplates) <= 1) {
                 $bResult = false;
             }
             break;
     }
     return $bResult;
 }
Пример #8
0
function templates_select_txt()
{
    $templ_choices = get_templates_array();
    $current_template = strlen($_GET['skin']) ? $_GET['skin'] : $_COOKIE['skin'];
    foreach ($templ_choices as $tmpl_key => $tmpl_value) {
        if ($current_template == $tmpl_key) {
            $ReturnResult .= $tmpl_value . ' | ';
        } else {
            $sGetTransfer = bx_encode_url_params($_GET, array('skin'));
            $ReturnResult .= '<a href="' . bx_html_attribute($_SERVER['PHP_SELF']) . '?' . $sGetTransfer . 'skin=' . $tmpl_key . '">' . $tmpl_value . '</a> | ';
        }
    }
    return $ReturnResult;
}
function templates_select_txt()
{
    global $dir;
    $templ_choices = get_templates_array();
    $current_template = strlen($_GET['skin']) ? $_GET['skin'] : $_COOKIE['skin'];
    foreach ($templ_choices as $tmpl_key => $tmpl_value) {
        if ($current_template == $tmpl_key) {
            $ReturnResult .= $tmpl_value;
            $ReturnResult .= ' | ';
        } else {
            foreach ($_GET as $param_key => $param_value) {
                if ('skin' != $param_key) {
                    $sGetTransfer .= "&{$param_key}={$param_value}";
                }
            }
            $ReturnResult .= '<a href="' . $_SERVER['PHP_SELF'] . '?skin=' . $tmpl_key . $sGetTransfer . '">' . $tmpl_value . '</a>';
            $ReturnResult .= ' | ';
        }
    }
    return $ReturnResult;
}
/**
 * Display controls for editing category settings.
 * The enclosing form must be defined outside of the function, this is done to be able
 * to display controls for editing a single category or a group of categories.
 * @param $cat -- Category for which to display controls.
 * The function makes use of $errors global variable.  This is an array of invalid parameters and
 * it is used to highligh those paramters while displaying.
 */
function display_category_settings($cat)
{
    global $errors;
    global $dir;
    $cat = (int) $cat;
    // Get category name.
    $q_str = "SELECT `name` FROM `GlParamsKateg` WHERE `ID` = '{$cat}'";
    $row = db_arr($q_str);
    $cat_name = $row['name'];
    // Get a list of category items.
    $q_str = "\r\n    \t\tSELECT\r\n    \t\t\t\t`Name`,\r\n    \t\t\t\t`VALUE`,\r\n    \t\t\t\t`desc`,\r\n    \t\t\t\t`Type`\r\n    \t\tFROM\r\n    \t\t\t\t`GlParams`\r\n    \t\tWHERE\r\n    \t\t\t\t`kateg` = '{$cat}' AND `Name` NOT LIKE '%_subject' ORDER BY `order_in_kateg` ASC";
    $items = db_res($q_str);
    // Display controls for editing items.
    ?>
    <center>
    <table width="100%" cellspacing="0" cellpadding="3" class="text" style="border-collapse: collapse; border: 1px solid silver" border="0">
        
        <?php 
    // Iterate thru items.
    $i = 0;
    while ($row = mysql_fetch_array($items)) {
        $param_name = $row['Name'];
        $param_value = $row['VALUE'];
        $param_type = $row['Type'];
        $param_desc = $row['desc'];
        if (1 == $errors[$param_name]) {
            $class = 'table_err';
        } else {
            if (0 == $i % 2) {
                $class = 'table';
            } else {
                $class = 'table_odd';
            }
        }
        $i++;
        echo "<tr class=\"{$class}\"><td align=\"left\" class=\"small1\"";
        // Display item caption.
        if ('text' == $param_type) {
            echo ' valign="top"';
        }
        echo ">{$param_desc}</td><td align=\"right\" width=\"200\">";
        // Display item control.
        if ('text' == $param_type) {
            if (EMAIL_TEMPLATE_CATEGORY == $cat) {
                // Get email subject.
                $subject_name = $param_name . '_subject';
                $q_str = "SELECT `VALUE` FROM `GlParams` WHERE `Name` = '{$subject_name}'";
                $res = db_res($q_str);
                if ($row = mysql_fetch_array($res)) {
                    $subject_value = $row['VALUE'];
                } else {
                    $subject_value = '';
                }
                echo "<b>HTML version</b>&nbsp;(";
                echo "<a href=\"javascript:void(0);\" onClick=\"javascript:docOpen('" . rawurlencode($param_value) . "');\">";
                echo _t("_Preview");
                echo "</a>)<br>";
                echo 'Subject:<br />';
                echo "<input type=\"text\" class=\"no\" size=\"50\" name=\"{$param_name}_subject\" value=\"{$subject_value}\"/><br /><br />";
                echo 'Body:<br />';
                echo "<textarea cols=\"50\" rows=\"10\" class=\"no\" name=\"{$param_name}\">" . htmlspecialchars($param_value) . "</textarea>";
                $tags = '<RealName> <SiteName> <ConfCode> <ConfirmationLink> <StrID> <Email> <Password>    <YourRealName> <NickName>
                        <Domain> <ID> <TEXT> <VKissLink> <ContactInfo> <DomainName> <FromName> <Link> <NickSpamer> <IDspamer>
                        <LinkSpamer> <MatchProfileLink>    <Requester> <Profile> <site> <PrivPhotosMember> <LoginLink> <Title>
                        <Message_Text> <MessageText> <LinkSDatingEvent> <NameSDating> <PlaceSDating> <WhenStarSDating> <PersonalUID>
                        <MatchLink>';
                echo '<br><br><br><b>Text version</b><br>';
                echo 'Subject:<br />';
                echo "<input readonly type=\"text\" class=\"no\" size=\"50\" name=\"{$param_name}_subject_ro\" value=\"{$subject_value}\"/><br /><br />";
                echo 'Body:<br />';
                echo "<textarea readonly cols=\"50\" rows=\"10\" class=\"no\" name=\"{$param_name}_ro\">" . htmlspecialchars(html2txt($param_value, $tags)) . "</textarea>";
            } else {
                echo "<textarea cols=\"50\" rows=\"10\" class=\"no\" name=\"{$param_name}\">{$param_value}</textarea>";
            }
        } elseif ('digit' == $param_type) {
            echo "<input type=\"text\" class=\"no\" name=\"{$param_name}\" size=\"15\" value=\"{$param_value}\" />";
        } elseif ('checkbox' == $param_type) {
            echo "<input type=\"checkbox\" name=\"{$param_name}\" " . ('on' == $param_value ? 'checked' : '') . '>';
        } elseif ('select' == $param_type) {
            if ('chicks_for_free' == $param_name) {
                $vals = getParam('chicks_for_free', false);
                $query = "SELECT `extra` FROM `ProfilesDesc` WHERE name='Sex'";
                $result = db_arr($query);
                $result['extra'] = str_replace('\'', '', $result['extra']);
                $sex = split(',', $result['extra']);
                echo "<select name=\"{$param_name}[]\" multiple>";
                foreach ($sex as $sex_key) {
                    if (strstr($vals, '\'' . $sex_key . '\'')) {
                        $selected = 'selected';
                    } else {
                        $selected = '';
                    }
                    echo "<option value=\"{$sex_key}\" {$selected} >{$sex_key}</option>";
                }
                echo "</select>";
            } else {
                echo "&nbsp;";
            }
        } elseif ('combobox' == $param_type) {
            if ('chicks_for_free_membership' == $param_name) {
                $memberships_arr = getMemberships();
                $vals = getParam('chicks_for_free_membership', false);
                echo "<select name=\"{$param_name}\">";
                foreach ($memberships_arr as $membershipID => $membershipName) {
                    if ($membershipID == MEMBERSHIP_ID_NON_MEMBER) {
                        continue;
                    }
                    $selected = (int) $vals == $membershipID ? ' selected ' : '';
                    echo "<option value=\"{$membershipID}\" {$selected} >{$membershipName}</option>";
                }
                echo "</select>";
            } elseif ('template' == $param_name) {
                $old_val = getParam('template');
                $templ_choices = get_templates_array();
                echo "<select name=\"{$param_name}\">";
                foreach ($templ_choices as $key => $value) {
                    echo "<option value=\"{$key}\" " . ($old_val == $key ? 'selected="selected"' : '') . ">{$value}</option>\n";
                }
                echo "</select>";
            }
        } else {
            echo "<input type=\"text\" name=\"{$param_name}\" value=\"{$param_value}\" size=\"30\" />";
        }
        echo "</td></tr>";
    }
    ?>
    </table>
    </center><br />
    <?php 
    return ' ';
}
Пример #11
0
 function genMoreTemplatesElement()
 {
     if (!getParam("enable_template")) {
         return;
     }
     $aExistedTemplates = get_templates_array();
     if (count($aExistedTemplates) <= 1) {
         return;
     }
     $sCurTemplate = strlen($_GET['skin']) ? $_GET['skin'] : $_COOKIE['skin'];
     $sTemplateElement = '';
     foreach ($aExistedTemplates as $sTemplateID => $sTemplateVal) {
         $sIActiveClass = $sCurTemplate == $sTemplateID ? ' active' : '';
         $sTemplateUrl = '';
         if ($sCurTemplate == $sTemplateID) {
             $sTemplateUrl = 'javascript: void(0)';
         } else {
             if (defined('BX_PROFILE_PAGE')) {
                 global $profileID;
                 $sTemplateUrl = getProfileLink($profileID) . '&skin=' . $sTemplateID;
             } else {
                 $sGetTransfer = bx_encode_url_params($_GET, array('skin'));
                 $sTemplateUrl = bx_html_attribute($_SERVER['PHP_SELF']) . '?' . $sGetTransfer . 'skin=' . $sTemplateID;
             }
         }
         //$sIOnclick = "window.open('{$sTemplateUrl}','_self');"; // old version
         $sTemplateElement .= '<li><a href="' . $sTemplateUrl . '" class="button more_ntop_element' . $sIActiveClass . '">' . $sTemplateVal . '</a>';
     }
     if ($sTemplateElement == '') {
         return;
     }
     return array('icon_url' => getTemplateIcon('tm_item_templates.png'), 'element_content' => $sTemplateElement);
 }