Exemplo n.º 1
0
        case 'check':
            $site = isset($_REQUEST['site']) ? $_REQUEST['site'] : null;
            $type = isset($_REQUEST['type']) ? $_REQUEST['type'] : null;
            $value = isset($_REQUEST['value']) ? $_REQUEST['value'] : null;
            if (empty($site) || empty($type) || empty($value)) {
                $error = getMessage('ABTEST_AJAX_ERROR');
            }
            if (!in_array($type, array('page'))) {
                $error = getMessage('ABTEST_AJAX_ERROR');
            }
            if (!in_array($site, $arSites)) {
                $error = getMessage('ABTEST_AJAX_ERROR');
            }
            if ($error === false) {
                $value = Bitrix\Main\Text\Encoding::convertEncodingToCurrent($value);
                $value = Bitrix\ABTest\AdminHelper::getRealPath($site, $value);
                if (empty($value)) {
                    $error = getMessage('ABTEST_UNKNOWN_PAGE');
                }
                if ($error === false) {
                    $result = $value;
                }
            }
            break;
        default:
            $error = getMessage('ABTEST_AJAX_ERROR');
    }
}
if ($error === false) {
    $data = array('result' => Bitrix\Main\Text\Encoding::convertEncoding($result, LANG_CHARSET, 'UTF-8'), 'error' => false);
} else {
Exemplo n.º 2
0
$context->Show();
$aTabs = array(array('DIV' => 'edit1', 'TAB' => getMessage('ABTEST_TAB_NAME'), 'TITLE' => getMessage('ABTEST_TAB_TITLE')));
$tabControl = new CAdminTabControl("tabControl", $aTabs, false);
?>

<?php 
$tabControl->Begin();
$tabControl->BeginNextTab();
?>


<?php 
$estDays = null;
if ($abtest['MIN_AMOUNT'] > 0 && $abtest['PORTION'] > 0) {
    $siteCapacity = Bitrix\ABTest\AdminHelper::getSiteCapacity($abtest['SITE_ID']);
    $testCapacity = Bitrix\ABTest\AdminHelper::getTestCapacity($abtest['ID']);
    if ($siteCapacity['daily'] > 0) {
        $rem = $abtest['MIN_AMOUNT'] - min($testCapacity);
        $est = $rem > 0 ? $rem / ($siteCapacity['daily'] / 2) : 0;
        $estDays = ceil(100 * $est / $abtest['PORTION']);
    }
}
$end_date = null;
if ($abtest['ACTIVE'] == 'Y' && $abtest['DURATION'] != 0) {
    if ($abtest['DURATION'] > 0) {
        $end = clone $abtest['START_DATE'];
        $end->add(intval($abtest['DURATION']) . ' days');
        $end_date = $end->format(Bitrix\Main\Type\Date::convertFormatToPhp($arLang['FORMAT_DATE']));
    } else {
        if (isset($estDays)) {
            $end = new Bitrix\Main\Type\DateTime();
Exemplo n.º 3
0
$abtest = Bitrix\ABTest\ABTestTable::getById($ID)->fetch();
if (empty($abtest)) {
    $ID = 0;
}
$arSites = array();
$dbSites = Bitrix\Main\SiteTable::getList(array('order' => array('DEF' => 'DESC', 'SORT' => 'ASC')));
while ($arSite = $dbSites->fetch()) {
    $arSites[$arSite['LID']] = $arSite;
}
$arTemplates = array();
$dbTemplates = CSiteTemplate::getList(array('ID' => 'ASC'), array('TYPE' => ''), array('ID', 'NAME'));
while ($arTemplate = $dbTemplates->fetch()) {
    $arTemplates[$arTemplate['ID']] = $arTemplate;
}
$arEstDays = array();
foreach (Bitrix\ABTest\AdminHelper::getSiteCapacity(array_keys($arSites)) as $lid => $value) {
    $arEstDays[$lid] = $value['est'];
}
if ($REQUEST_METHOD == "POST" && (strlen($save) > 0 || strlen($apply) > 0) && check_bitrix_sessid()) {
    $arFields = array('SITE_ID' => $SITE, 'NAME' => $NAME, 'DESCR' => $DESCR, 'DURATION' => intval($DURATION) < 0 ? -1 : intval($DURATION), 'PORTION' => intval($PORTION));
    if ($ID > 0) {
        $arFields['TEST_DATA'] = $abtest['TEST_DATA'];
        $arFields['TEST_DATA']['list'] = array();
    }
    if (empty($arFields['SITE_ID'])) {
        $message = new CAdminMessage(array('MESSAGE' => getMessage('ABTEST_EMPTY_SITE')));
    } else {
        if (!is_set($arSites, $arFields['SITE_ID'])) {
            $message = new CAdminMessage(array('MESSAGE' => str_replace('#VALUE#', htmlspecialcharsbx($arFields['SITE_ID']), getMessage('ABTEST_UNKNOWN_SITE'))));
        }
    }