本文整理汇总了PHP中CForm::GetSiteArray方法的典型用法代码示例。如果您正苦于以下问题:PHP CForm::GetSiteArray方法的具体用法?PHP CForm::GetSiteArray怎么用?PHP CForm::GetSiteArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CForm
的用法示例。
在下文中一共展示了CForm::GetSiteArray方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
$headers[] = array("id" => "NAME", "content" => GetMessage("FORM_NAME"), "sort" => "s_name", "default" => true);
$headers[] = array("id" => "QUESTIONS", "content" => GetMessage("FORM_QUESTIONS"), "default" => true);
if (COption::GetOptionString("form", "SIMPLE") != "Y") {
$headers[] = array("id" => "C_FIELDS", "content" => GetMessage("FORM_FIELDS"), "default" => true);
$headers[] = array("id" => "STATUSES", "content" => GetMessage("FORM_STATUSES"), "default" => true);
}
$headers[] = array("id" => "RESULTS", "content" => GetMessage("FORM_RESULTS"), "default" => true);
$lAdmin->AddHeaders($headers);
while ($arRes = $rsData->NavNext(true, "f_")) {
//echo "<pre>"; print_r($arRes); echo "</pre>";
$row =& $lAdmin->AddRow($f_ID, $arRes);
//$F_RIGHT = CForm::GetPermission($f_ID);
$F_RIGHT = $f_F_RIGHT;
//echo $F_RIGHT;
unset($txt);
$arrSITE = CForm::GetSiteArray($f_ID);
reset($arrSITE);
if (is_array($arrSITE)) {
foreach ($arrSITE as $sid) {
$txt .= "<a href='/bitrix/admin/site_edit.php?LID=" . htmlspecialcharsbx($sid, ENT_QUOTES) . "&lang=" . LANGUAGE_ID . "'>" . htmlspecialcharsbx($sid) . "</a>,";
}
} else {
$txt = " ";
}
$txt = trim($txt, ",");
$row->AddViewField("SITE", $txt);
if ($bSimple) {
$f_QUESTIONS += $f_C_FIELDS;
$txt = "<a title=\"" . GetMessage("FORM_QUESTIONS_ALT") . "\" href=\"form_field_list.php?lang=" . LANGUAGE_ID . "&WEB_FORM_ID={$f_ID}\">{$f_QUESTIONS}</a> [<a title=\"" . GetMessage("FORM_ADD_QUESTION") . "\" href=\"form_field_edit_simple.php?lang=" . LANGUAGE_ID . "&WEB_FORM_ID={$f_ID}\">+</a>]";
} else {
$txt = "<a title=\"" . GetMessage("FORM_QUESTIONS_ALT") . "\" href=\"form_field_list.php?lang=" . LANGUAGE_ID . "&WEB_FORM_ID={$f_ID}\">{$f_QUESTIONS}</a> [<a title=\"" . GetMessage("FORM_ADD_QUESTION") . "\" href=\"form_field_edit.php?lang=" . LANGUAGE_ID . "&WEB_FORM_ID={$f_ID}\">+</a>]";
示例2: SetMailTemplate
function SetMailTemplate($WEB_FORM_ID, $ADD_NEW_TEMPLATE = "Y", $old_SID = "", $bReturnFullInfo = false)
{
global $DB, $MESS, $strError;
$err_mess = CAllForm::err_mess() . "<br>Function: SetMailTemplates<br>Line: ";
$arrReturn = array();
$WEB_FORM_ID = intval($WEB_FORM_ID);
$q = CForm::GetByID($WEB_FORM_ID);
if ($arrForm = $q->Fetch()) {
$MAIL_EVENT_TYPE = "FORM_FILLING_" . $arrForm["SID"];
if (strlen($old_SID) > 0) {
$old_MAIL_EVENT_TYPE = "FORM_FILLING_" . $old_SID;
}
$et = new CEventType();
$em = new CEventMessage();
if (strlen($MAIL_EVENT_TYPE) > 0) {
$et->Delete($MAIL_EVENT_TYPE);
}
$z = CLanguage::GetList($v1, $v2);
$OLD_MESS = $MESS;
while ($arLang = $z->Fetch()) {
IncludeModuleLangFile($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/form/admin/form_mail.php", $arLang["LID"]);
$str = "";
$str .= "#RS_FORM_ID# - " . GetMessage("FORM_L_FORM_ID") . "\n";
$str .= "#RS_FORM_NAME# - " . GetMessage("FORM_L_NAME") . "\n";
$str .= "#RS_FORM_SID# - " . GetMessage("FORM_L_SID") . "\n";
$str .= "#RS_RESULT_ID# - " . GetMessage("FORM_L_RESULT_ID") . "\n";
$str .= "#RS_DATE_CREATE# - " . GetMessage("FORM_L_DATE_CREATE") . "\n";
$str .= "#RS_USER_ID# - " . GetMessage("FORM_L_USER_ID") . "\n";
$str .= "#RS_USER_EMAIL# - " . GetMessage("FORM_L_USER_EMAIL") . "\n";
$str .= "#RS_USER_NAME# - " . GetMessage("FORM_L_USER_NAME") . "\n";
$str .= "#RS_USER_AUTH# - " . GetMessage("FORM_L_USER_AUTH") . "\n";
$str .= "#RS_STAT_GUEST_ID# - " . GetMessage("FORM_L_STAT_GUEST_ID") . "\n";
$str .= "#RS_STAT_SESSION_ID# - " . GetMessage("FORM_L_STAT_SESSION_ID") . "\n";
$strFIELDS = "";
$w = CFormField::GetList($WEB_FORM_ID, "ALL", $by, $order, array(), $is_filtered);
while ($wr = $w->Fetch()) {
if (strlen($wr["RESULTS_TABLE_TITLE"]) > 0) {
$FIELD_TITLE = $wr["RESULTS_TABLE_TITLE"];
} elseif (strlen($wr["TITLE"]) > 0) {
$FIELD_TITLE = $wr["TITLE_TYPE"] == "html" ? htmlspecialcharsback(strip_tags($wr["TITLE"])) : $wr["TITLE"];
} else {
$FIELD_TITLE = TrimEx($wr["FILTER_TITLE"], ":");
}
$str .= "#" . $wr["SID"] . "# - " . $FIELD_TITLE . "\n";
$str .= "#" . $wr["SID"] . "_RAW# - " . $FIELD_TITLE . " (" . GetMessage('FORM_L_RAW') . ")\n";
$strFIELDS .= $FIELD_TITLE . "\n*******************************\n#" . $wr["SID"] . "#\n\n";
}
$et->Add(array("LID" => $arLang["LID"], "EVENT_NAME" => $MAIL_EVENT_TYPE, "NAME" => GetMessage("FORM_FILLING") . " \"" . $arrForm["SID"] . "\"", "DESCRIPTION" => $str));
}
// задаем новый тип событи¤ дл¤ старых шаблонов
if (strlen($old_MAIL_EVENT_TYPE) > 0 && $old_MAIL_EVENT_TYPE != $MAIL_EVENT_TYPE) {
$e = $em->GetList($by = "id", $order = "desc", array("EVENT_NAME" => $old_MAIL_EVENT_TYPE));
while ($er = $e->Fetch()) {
$em->Update($er["ID"], array("EVENT_NAME" => $MAIL_EVENT_TYPE));
}
if (strlen($old_MAIL_EVENT_TYPE) > 0) {
$et->Delete($old_MAIL_EVENT_TYPE);
}
}
if ($ADD_NEW_TEMPLATE == "Y") {
$z = CSite::GetList($v1, $v2);
while ($arSite = $z->Fetch()) {
$arrSiteLang[$arSite["ID"]] = $arSite["LANGUAGE_ID"];
}
$arrFormSite = CForm::GetSiteArray($WEB_FORM_ID);
if (is_array($arrFormSite) && count($arrFormSite) > 0) {
foreach ($arrFormSite as $sid) {
IncludeModuleLangFile($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/form/admin/form_mail.php", $arrSiteLang[$sid]);
$SUBJECT = "#SERVER_NAME#: " . GetMessage("FORM_FILLING_S") . " [#RS_FORM_ID#] #RS_FORM_NAME#";
$MESSAGE = "#SERVER_NAME#\n\n" . GetMessage("FORM_FILLING") . ": [#RS_FORM_ID#] #RS_FORM_NAME#\n-------------------------------------------------------\n\n" . GetMessage("FORM_DATE_CREATE") . "#RS_DATE_CREATE#\n" . GetMessage("FORM_RESULT_ID") . "#RS_RESULT_ID#\n" . GetMessage("FORM_USER") . "[#RS_USER_ID#] #RS_USER_NAME# #RS_USER_AUTH#\n" . GetMessage("FORM_STAT_GUEST_ID") . "#RS_STAT_GUEST_ID#\n" . GetMessage("FORM_STAT_SESSION_ID") . "#RS_STAT_SESSION_ID#\n\n\n{$strFIELDS}\n" . GetMessage("FORM_VIEW") . "\nhttp://#SERVER_NAME#/bitrix/admin/form_result_view.php?lang=" . $arrSiteLang[$sid] . "&WEB_FORM_ID=#RS_FORM_ID#&RESULT_ID=#RS_RESULT_ID#\n\n-------------------------------------------------------\n" . GetMessage("FORM_GENERATED_AUTOMATICALLY") . "\n\t\t\t\t\t\t";
// добавл¤ем новый шаблон
$arFields = array("ACTIVE" => "Y", "EVENT_NAME" => $MAIL_EVENT_TYPE, "LID" => $sid, "EMAIL_FROM" => "#DEFAULT_EMAIL_FROM#", "EMAIL_TO" => "#DEFAULT_EMAIL_FROM#", "SUBJECT" => $SUBJECT, "MESSAGE" => $MESSAGE, "BODY_TYPE" => "text");
$TEMPLATE_ID = $em->Add($arFields);
if ($bReturnFullInfo) {
$arrReturn[] = array('ID' => $TEMPLATE_ID, 'FIELDS' => $arFields);
} else {
$arrReturn[] = $TEMPLATE_ID;
}
}
}
}
$MESS = $OLD_MESS;
}
return $arrReturn;
}
示例3: GetMessage
$str_DESCRIPTION_TYPE = "text";
$str_BUTTON = GetMessage("FORM_SAVE");
$str_C_SORT = CForm::GetNextSort();
$str_USE_CAPTCHA = "N";
$str_USE_DEFAULT_TEMPLATE = "N";
$str_USE_RESTRICTIONS = "N";
$str_RESTRICT_USER = 0;
$str_RESTRICT_TIME = 0;
$arRESTRICT_STATUS = array();
} else {
if (strlen($strError) <= 0) {
$z = CForm::GetMenuList(array("FORM_ID" => $ID), "N");
while ($zr = $z->Fetch()) {
${"MENU_" . $zr["LID"]} = $zr["MENU"];
}
$arSITE = CForm::GetSiteArray($ID);
$arMAIL_TEMPLATE = CForm::GetMailTemplateArray($ID);
if (!is_set($str_FORM_TEMPLATE)) {
$str_FORM_TEMPLATE = CForm::GetFormTemplateByID($ID);
}
$arRESTRICT_STATUS = explode(",", $str_RESTRICT_STATUS);
}
}
if (strlen($strError) > 0) {
$DB->InitTableVarsForEdit("b_form", "", "str_");
}
if ($ID > 0) {
$sDocTitle = str_replace("#ID#", $ID, GetMessage("FORM_EDIT_RECORD"));
$sDocTitle = str_replace("#NAME#", $str_NAME, $sDocTitle);
} else {
$sDocTitle = GetMessage("FORM_NEW_RECORD");
示例4: SetMailTemplate
public static function SetMailTemplate($WEB_FORM_ID, $STATUS_ID, $ADD_NEW_TEMPLATE="Y", $old_SID="", $bReturnFullInfo = false)
{
global $DB, $MESS, $strError;
$err_mess = (CAllForm::err_mess())."<br>Function: SetMailTemplate<br>Line: ";
$arrReturn = array();
$WEB_FORM_ID = intval($WEB_FORM_ID);
$q = CForm::GetByID($WEB_FORM_ID);
if ($arrForm = $q->Fetch())
{
$dbRes = CFormStatus::GetByID($STATUS_ID);
if ($arrStatus = $dbRes->Fetch())
{
$MAIL_EVENT_TYPE = "FORM_STATUS_CHANGE_".$arrForm["SID"]."_".$arrStatus['ID'];
if (strlen($old_SID)>0)
$old_MAIL_EVENT_TYPE = "FORM_STATUS_CHANGE_".$old_SID."_".$arrStatus['ID'];
$et = new CEventType;
$em = new CEventMessage;
if (strlen($MAIL_EVENT_TYPE)>0)
$et->Delete($MAIL_EVENT_TYPE);
$z = CLanguage::GetList($v1, $v2);
$OLD_MESS = $MESS;
$MESS = array();
while ($arLang = $z->Fetch())
{
IncludeModuleLangFile($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/form/admin/form_status_mail.php", $arLang["LID"]);
$str = "";
$str .= "#EMAIL_TO# - ".GetMessage("FORM_L_EMAIL_TO")."\n";
$str .= "#RS_FORM_ID# - ".GetMessage("FORM_L_FORM_ID")."\n";
$str .= "#RS_FORM_NAME# - ".GetMessage("FORM_L_NAME")."\n";
$str .= "#RS_FORM_SID# - ".GetMessage("FORM_L_SID")."\n";
$str .= "#RS_RESULT_ID# - ".GetMessage("FORM_L_RESULT_ID")."\n";
$str .= "#RS_DATE_CREATE# - ".GetMessage("FORM_L_DATE_CREATE")."\n";
$str .= "#RS_USER_ID# - ".GetMessage("FORM_L_USER_ID")."\n";
$str .= "#RS_USER_EMAIL# - ".GetMessage("FORM_L_USER_EMAIL")."\n";
$str .= "#RS_USER_NAME# - ".GetMessage("FORM_L_USER_NAME")."\n";
$str .= "#RS_STATUS_ID# - ".GetMessage("FORM_L_STATUS_ID")."\n";
$str .= "#RS_STATUS_NAME# - ".GetMessage("FORM_L_STATUS_NAME")."\n";
$et->Add(
Array(
"LID" => $arLang["LID"],
"EVENT_NAME" => $MAIL_EVENT_TYPE,
"NAME" => str_replace(array('#FORM_SID#', '#STATUS_NAME#'), array($arrForm['SID'], $arrStatus['TITLE']), GetMessage("FORM_CHANGE_STATUS")),
"DESCRIPTION" => $str
)
);
}
// create new event type for old templates
if (strlen($old_MAIL_EVENT_TYPE)>0 && $old_MAIL_EVENT_TYPE!=$MAIL_EVENT_TYPE)
{
$e = $em->GetList($by="id",$order="desc",array("EVENT_NAME"=>$old_MAIL_EVENT_TYPE));
while ($er=$e->Fetch())
{
$em->Update($er["ID"],array("EVENT_NAME"=>$MAIL_EVENT_TYPE));
}
if (strlen($old_MAIL_EVENT_TYPE)>0)
$et->Delete($old_MAIL_EVENT_TYPE);
}
if ($ADD_NEW_TEMPLATE=="Y")
{
$z = CSite::GetList($v1, $v2);
while ($arSite = $z->Fetch()) $arrSiteLang[$arSite["ID"]] = $arSite["LANGUAGE_ID"];
$arrFormSite = CForm::GetSiteArray($WEB_FORM_ID);
if (is_array($arrFormSite) && count($arrFormSite)>0)
{
foreach($arrFormSite as $sid)
{
IncludeModuleLangFile($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/form/admin/form_status_mail.php", $arrSiteLang[$sid]);
$SUBJECT = GetMessage("FORM_CHANGE_STATUS_S");
$MESSAGE = GetMessage("FORM_CHANGE_STATUS_B");
// добавляем новый шаблон
$arFields = Array(
"ACTIVE" => "Y",
"EVENT_NAME" => $MAIL_EVENT_TYPE,
"LID" => $sid,
"EMAIL_FROM" => "#DEFAULT_EMAIL_FROM#",
"EMAIL_TO" => "#EMAIL_TO#",
"SUBJECT" => $SUBJECT,
"MESSAGE" => $MESSAGE,
"BODY_TYPE" => "text"
);
//echo '<pre>'; print_r($arFields); echo '</pre>';
$TEMPLATE_ID = $em->Add($arFields);
if ($bReturnFullInfo)
$arrReturn[] = array(
'ID' => $TEMPLATE_ID,
'FIELDS' => $arFields,
);
else
$arrReturn[] = $TEMPLATE_ID;
}
//.........这里部分代码省略.........
示例5: Mail
/**
* <p>Создает почтовое событие для отсылки данных <a href="http://dev.1c-bitrix.ru/api_help/form/terms.php#result">результата</a> по e-mail. Возвращает "true" в случае успеха, в противном случае - "false".</p>
*
*
*
*
* @param int $result_id ID <a href="http://dev.1c-bitrix.ru/api_help/form/terms.php#result">результата</a>.
*
*
*
* @param mixed $template_id = false ID почтового шаблона.<br><br> Параметр необязательный. По умолчанию -
* "false" (будут использованы почтовые шаблоны из настроек
* соответствующей веб-формы).
*
*
*
* @return bool
*
*
* <h4>Example</h4>
* <pre>
* <?
* $RESULT_ID = 189; // ID результата
*
* // создадим почтовое событие для отсылки по EMail данных результата
* if (<b>CFormResult::Mail</b>($RESULT_ID))
* {
* echo "Почтовое событие успешно создано.";
* }
* else // ошибка
* {
* global $strError;
* echo $strError;
* }
* ?>
* </pre>
*
*
* @static
* @link http://dev.1c-bitrix.ru/api_help/form/classes/cformresult/mail.php
* @author Bitrix
*/
public static function Mail($RESULT_ID, $TEMPLATE_ID = false)
{
global $APPLICATION, $DB, $MESS, $strError;
$err_mess = (CAllFormResult::err_mess())."<br>Function: Mail<br>Line: ";
$RESULT_ID = intval($RESULT_ID);
CTimeZone::Disable();
$arrResult = CFormResult::GetDataByID($RESULT_ID, array(), $arrRES, $arrANSWER);
CTimeZone::Enable();
if ($arrResult)
{
$z = CForm::GetByID($arrRES["FORM_ID"]);
if ($arrFORM = $z->Fetch())
{
$TEMPLATE_ID = intval($TEMPLATE_ID);
$arrFormSites = CForm::GetSiteArray($arrRES["FORM_ID"]);
$arrFormSites = (is_array($arrFormSites)) ? $arrFormSites : array();
if (!defined('SITE_ID') || !in_array(SITE_ID, $arrFormSites))
return true;
$rs = CSite::GetList(($by="sort"), ($order="asc"), array('ID' => implode('|', $arrFormSites)));
$arrSites = array();
while ($ar = $rs->Fetch())
{
if ($ar["DEF"]=="Y") $def_site_id = $ar["ID"];
$arrSites[$ar["ID"]] = $ar;
}
$arrFormTemplates = CForm::GetMailTemplateArray($arrRES["FORM_ID"]);
$arrFormTemplates = (is_array($arrFormTemplates)) ? $arrFormTemplates : array();
$arrTemplates = array();
$rs = CEventMessage::GetList($by="id", $order="asc", array(
"ACTIVE" => "Y",
"SITE_ID" => SITE_ID,
"EVENT_NAME" => $arrFORM["MAIL_EVENT_TYPE"]
));
while ($ar = $rs->Fetch())
{
if ($TEMPLATE_ID>0)
{
if ($TEMPLATE_ID == $ar["ID"])
{
$arrTemplates[$ar["ID"]] = $ar;
break;
}
}
elseif (in_array($ar["ID"],$arrFormTemplates)) $arrTemplates[$ar["ID"]] = $ar;
}
foreach($arrTemplates as $arrTemplate)
{
$OLD_MESS = $MESS;
//.........这里部分代码省略.........