コード例 #1
0
ファイル: culture.php プロジェクト: ASDAFF/open_bx
 /**
  * @param int $cultureId
  * @return Culture
  */
 public static function wakeUp($cultureId)
 {
     $cultureDb = CultureTable::getById($cultureId);
     if ($arCulture = $cultureDb->fetch()) {
         return new static($arCulture);
     }
     return null;
 }
コード例 #2
0
ファイル: culture_admin.php プロジェクト: ASDAFF/open_bx
        switch ($request['action_button']) {
            case "delete":
                $result = CultureTable::delete($ID);
                if (!$result->isSuccess()) {
                    $adminList->AddGroupError("(ID=" . $ID . ") " . implode("<br>", $result->getErrorMessages()), $ID);
                }
                break;
        }
    }
}
$APPLICATION->SetTitle(Loc::getMessage("TITLE"));
/**
 * @global $by
 * @global $order
 */
$cultureList = CultureTable::getList(array('order' => array($by => $order)));
$data = new CAdminResult($cultureList, $tableID);
$data->NavStart();
$adminList->NavText($data->GetNavPrint(Loc::getMessage("PAGES"), false));
$adminList->AddHeaders(array(array("id" => "ID", "content" => "ID", "sort" => "ID", "default" => true), array("id" => "NAME", "content" => Loc::getMessage("NAME"), "sort" => "name", "default" => true), array("id" => "CODE", "content" => Loc::getMessage("culture_code"), "sort" => "CODE", "default" => true), array("id" => "FORMAT_DATE", "content" => Loc::getMessage("culture_date"), "sort" => "FORMAT_DATE", "default" => true), array("id" => "FORMAT_DATETIME", "content" => Loc::getMessage("culture_datetime"), "sort" => "FORMAT_DATETIME", "default" => true), array("id" => "FORMAT_NAME", "content" => Loc::getMessage("culture_name"), "sort" => "FORMAT_NAME", "default" => true), array("id" => "CHARSET", "content" => Loc::getMessage("culture_charset"), "sort" => "CHARSET", "default" => true), array("id" => "WEEK_START", "content" => Loc::getMessage("culture_week"), "sort" => "WEEK_START", "default" => false), array("id" => "DIRECTION", "content" => Loc::getMessage("culture_direction"), "sort" => "DIRECTION", "default" => false)));
$days = array(Loc::getMessage("culture_su"), Loc::getMessage("culture_mo"), Loc::getMessage("culture_tu"), Loc::getMessage("culture_we"), Loc::getMessage("culture_th"), Loc::getMessage("culture_fr"), Loc::getMessage("culture_sa"));
while ($culture = $data->Fetch()) {
    $id = htmlspecialcharsbx($culture["ID"]);
    $name = htmlspecialcharsbx($culture["NAME"]);
    $row =& $adminList->AddRow($id, $culture, "culture_edit.php?ID=" . $id . "&lang=" . LANGUAGE_ID, Loc::getMessage("LANG_EDIT_TITLE"));
    $row->AddViewField("ID", $id);
    $row->AddField("NAME", '<a href="culture_edit.php?ID=' . $id . '&amp;lang=' . LANGUAGE_ID . '" title="' . Loc::getMessage("LANG_EDIT_TITLE") . '">' . $name . '</a>', $name);
    $row->AddInputField("CODE");
    $row->AddInputField("FORMAT_DATE");
    $row->AddInputField("FORMAT_DATETIME");
    $row->AddInputField("FORMAT_NAME");
コード例 #3
0
ファイル: lang_edit.php プロジェクト: ASDAFF/open_bx
		<td><?echo Loc::getMessage('NAME')?></td>
		<td><input type="text" name="NAME" size="30" maxlength="50" value="<? echo $langField["NAME"]?>"></td>
	</tr>
	<tr>
		<td><label for="def"><?echo Loc::getMessage('DEF')?></label></td>
		<td><input type="checkbox" name="DEF" id="def" value="Y"<?if($language["DEF"] == "Y") echo " checked"?>></td>
	</tr>
	<tr class="adm-detail-required-field">
		<td><?echo Loc::getMessage('SORT')?></td>
		<td><input type="text" name="SORT" size="10" maxlength="10" value="<? echo $langField["SORT"]?>"></td>
	</tr>
	<tr class="adm-detail-required-field">
		<td><?echo Loc::getMessage("lang_edit_culture")?></td>
		<td>
<?
$cultureRes = \Freetrix\Main\Localization\CultureTable::getList(array('order'=>array('name'=>'asc')));
$cultures = array();
while($cult = $cultureRes->fetch())
{
	$cult["WEEK_START"] = Loc::getMessage('DAY_OF_WEEK_'.$cult["WEEK_START"]);
	$cult["DIRECTION"] = ($cult["DIRECTION"] == "Y"? Loc::getMessage('DIRECTION_LTR') : Loc::getMessage('DIRECTION_RTL'));
	$cultures[] = $cult;
}
?>
<script type="text/javascript">
function BXSetCulture()
{
	var selObj = BX('bx_culture_select');
	var form = selObj.form;
	var cultures = <?php 
echo CUtil::PhpToJSObject($cultures);
コード例 #4
0
ファイル: culture_edit.php プロジェクト: ASDAFF/open_bx
			LocalRedirect(FX_ROOT."/admin/culture_edit.php?lang=".LANGUAGE_ID."&ID=".$ID."&".$tabControl->ActiveTabParam());
	}
	else
	{
		$errors = $result->getErrorMessages();
	}

}

if(empty($errors))
{
	$culture = false;
	if($ID > 0 || $COPY_ID > 0)
	{
		$cultureId = ($COPY_ID > 0? $COPY_ID : $ID);
		$culture = CultureTable::getById($cultureId)->fetch();
	}

	if($culture == false)
	{
		$weekStart = Loc::getMessage('LANG_EDIT_WEEK_START_DEFAULT');
		if($weekStart == '')
			$weekStart = 1;
		$culture = array(
			"WEEK_START" => $weekStart,
			"FORMAT_NAME" => CSite::GetDefaultNameFormat(),
		);
	}
}
else
{
コード例 #5
0
ファイル: main.php プロジェクト: ASDAFF/open_bx
 function CheckFields($arFields, $ID = false)
 {
     /** @global CMain $APPLICATION */
     global $APPLICATION, $DB;
     $this->LAST_ERROR = "";
     $arMsg = array();
     if (($ID === false || isset($arFields["LID"])) && strlen($arFields["LID"]) != 2) {
         $this->LAST_ERROR .= GetMessage("BAD_LANG_LID") . " ";
         $arMsg[] = array("id" => "LID", "text" => GetMessage("BAD_LANG_LID"));
     }
     if ($ID === false && !isset($arFields["CULTURE_ID"])) {
         $this->LAST_ERROR .= GetMessage("lang_check_culture_not_set") . " ";
         $arMsg[] = array("id" => "CULTURE_ID", "text" => GetMessage("lang_check_culture_not_set"));
     }
     if (isset($arFields["CULTURE_ID"])) {
         if (CultureTable::getRowById($arFields["CULTURE_ID"]) === null) {
             $this->LAST_ERROR .= GetMessage("lang_check_culture_incorrect") . " ";
             $arMsg[] = array("id" => "CULTURE_ID", "text" => GetMessage("lang_check_culture_incorrect"));
         }
     }
     if (isset($arFields["NAME"]) && strlen($arFields["NAME"]) < 2) {
         $this->LAST_ERROR .= GetMessage("BAD_LANG_NAME") . " ";
         $arMsg[] = array("id" => "NAME", "text" => GetMessage("BAD_LANG_NAME"));
     }
     if (isset($arFields["SORT"]) && intval($arFields["SORT"]) <= 0) {
         $this->LAST_ERROR .= GetMessage("BAD_LANG_SORT") . " ";
         $arMsg[] = array("id" => "SORT", "text" => GetMessage("BAD_LANG_SORT"));
     }
     if (!empty($arMsg)) {
         $e = new CAdminException($arMsg);
         $APPLICATION->ThrowException($e);
     }
     if ($this->LAST_ERROR != "") {
         return false;
     }
     if ($ID === false) {
         $r = $DB->Query("SELECT 'x' FROM b_language WHERE LID='" . $DB->ForSQL($arFields["LID"], 2) . "'");
         if ($r->Fetch()) {
             $this->LAST_ERROR .= GetMessage("BAD_LANG_DUP") . " ";
             $e = new CAdminException(array(array("id" => "LID", "text" => GetMessage("BAD_LANG_DUP"))));
             $APPLICATION->ThrowException($e);
             return false;
         }
     }
     return true;
 }