예제 #1
0
 function Delete($ID, $CHECK_RIGHTS = "Y")
 {
     global $DB, $strError;
     $err_mess = CAllForm::err_mess() . "<br>Function: Delete<br>Line: ";
     $ID = intval($ID);
     if ($CHECK_RIGHTS != "Y" || CForm::IsAdmin()) {
         // delete form results
         if (CForm::Reset($ID, "N")) {
             // delete temporary template
             $tmp_filename = $_SERVER["DOCUMENT_ROOT"] . BX_PERSONAL_ROOT . "/tmp/form/form_" . $ID . ".php";
             if (file_exists($tmp_filename)) {
                 @unlink($tmp_filename);
             }
             // delete form statuses
             $rsStatuses = CFormStatus::GetList($ID, $by, $order, $arFilter, $is_filtered);
             while ($arStatus = $rsStatuses->Fetch()) {
                 CFormStatus::Delete($arStatus["ID"], "N");
             }
             // delete from fields & questions
             $rsFields = CFormField::GetList($ID, "ALL", $by, $order, array(), $is_filtered);
             while ($arField = $rsFields->Fetch()) {
                 CFormField::Delete($arField["ID"], "N");
             }
             // delete form image
             $strSql = "SELECT IMAGE_ID FROM b_form WHERE ID='{$ID}' and IMAGE_ID>0";
             $z = $DB->Query($strSql, false, $err_mess . __LINE__);
             while ($zr = $z->Fetch()) {
                 CFile::Delete($zr["IMAGE_ID"]);
             }
             // delete mail event type and mail templates, assigned to the current form
             $q = CForm::GetByID($ID);
             $qr = $q->Fetch();
             if (strlen(trim($qr["MAIL_EVENT_TYPE"])) > 0) {
                 // delete mail templates
                 $em = new CEventMessage();
                 $e = $em->GetList($by = "id", $order = "desc", array("EVENT_NAME" => $qr["MAIL_EVENT_TYPE"], "EVENT_NAME_EXACT_MATCH" => "Y"));
                 while ($er = $e->Fetch()) {
                     $em->Delete($er["ID"]);
                 }
                 // delete mail event type
                 $et = new CEventType();
                 $et->Delete($qr["MAIL_EVENT_TYPE"]);
             }
             // delete site assignment
             $DB->Query("DELETE FROM b_form_2_site WHERE FORM_ID='{$ID}'", false, $err_mess . __LINE__);
             // delete mail templates assignment
             $DB->Query("DELETE FROM b_form_2_mail_template WHERE FORM_ID='{$ID}'", false, $err_mess . __LINE__);
             // delete form menu
             $DB->Query("DELETE FROM b_form_menu WHERE FORM_ID='{$ID}'", false, $err_mess . __LINE__);
             // delete from rights
             $DB->Query("DELETE FROM b_form_2_group WHERE FORM_ID='{$ID}'", false, $err_mess . __LINE__);
             // and finally delete form
             $DB->Query("DELETE FROM b_form WHERE ID='{$ID}'", false, $err_mess . __LINE__);
             return true;
         }
     } else {
         $strError .= GetMessage("FORM_ERROR_ACCESS_DENIED") . "<br>";
     }
     return false;
 }
예제 #2
0
				}
				$DB->Commit();
			break;
		}
	}

	if (!$_REQUEST["mode"])
		LocalRedirect("form_status_list.php?lang=".LANGUAGE_ID."&WEB_FORM_ID=".$WEB_FORM_ID);
}



//////////////////////////////////////////////////////////////////////
// initialize list - preparing data

$rsData = CFormStatus::GetList($WEB_FORM_ID, $by, $order, $arFilter, $is_filtered);
$rsData = new CAdminResult($rsData, $sTableID);
$rsData->NavStart();

// set navigation
$lAdmin->NavText($rsData->GetNavPrint(GetMessage("FORM_PAGES")));

$lAdmin->AddHeaders(array(
	array("id"=>"ID", "content"=>"ID", "sort"=>"s_id", "default"=>true),
	array("id"=>"TIMESTAMP_X", "content"=>GetMessage("FORM_TIMESTAMP"), "sort"=>"s_timestamp", "default"=>true),
	array("id"=>"ACTIVE", "content"=>GetMessage("FORM_ACTIVE"), "sort"=>"s_active", "default"=>true),
	array("id"=>"C_SORT", "content"=>GetMessage("FORM_C_SORT"), "sort"=>"s_sort", "default"=>true),
	array("id"=>"DEFAULT_VALUE", "content"=>GetMessage("FORM_DEFAULT"), "sort"=>"s_default", "default"=>true),
	array("id"=>"TITLE", "content"=>GetMessage("FORM_TITLE"), "sort"=>"s_title", "default"=>true),
	array("id"=>"DESCRIPTION", "content"=>GetMessage("FORM_DESCRIPTION"), "sort"=>"s_description", "default"=>true),
	array("id"=>"RESULTS", "content"=>GetMessage("FORM_RESULTS"), "sort"=>"s_results", "default"=>true),
예제 #3
0
 function GetStatusList($WEB_FORM_ID, &$by, &$order, $arFilter = array(), &$is_filtered)
 {
     return CFormStatus::GetList($WEB_FORM_ID, $by, $order, $arFilter, $is_filtered);
 }
예제 #4
0
    ?>
"<?php 
    echo $mult == $RESTRICT_TIME_MULTIPLYER ? " selected=\"selected\"" : "";
    ?>
><?php 
    echo $title;
    ?>
</option>
	<?php 
}
?>
		</select></td>
	</tr>
	<?php 
if (!$bSimple && $ID > 0) {
    $rsStatusList = CFormStatus::GetList($ID, $by = "s_sort", $order = "asc", array("ACTIVE" => "Y"), $is_filtered);
    ?>
	<tr>
		<td><?php 
    echo GetMessage('FORM_RESTRICT_STATUS');
    ?>
: </td>
		<td><select name="RESTRICT_STATUS[]" id="RESTRICT_STATUS" multiple="multiple" rows="3" <?php 
    echo $str_USE_RESTRICTIONS == "Y" ? "" : "disabled=\"1\"";
    ?>
>
			<?php 
    while ($arStatus = $rsStatusList->GetNext()) {
        ?>
		<option value="<?php 
        echo $arStatus["ID"];
예제 #5
0
 function Delete($ID, $CHECK_RIGHTS = "Y")
 {
     global $DB, $strError;
     $err_mess = CAllForm::err_mess() . "<br>Function: Delete<br>Line: ";
     $ID = intval($ID);
     if ($CHECK_RIGHTS != "Y" || CForm::IsAdmin()) {
         // удаляем результаты формы
         if (CForm::Reset($ID, "N")) {
             // удаляем статусы формы
             $rsStatuses = CFormStatus::GetList($ID, $by, $order, $arFilter, $is_filtered);
             while ($arStatus = $rsStatuses->Fetch()) {
                 CFormStatus::Delete($arStatus["ID"], "N");
             }
             // удаляем поля и вопросы формы
             $rsFields = CFormField::GetList($ID, "ALL", $by, $order, array(), $is_filtered);
             while ($arField = $rsFields->Fetch()) {
                 CFormField::Delete($arField["ID"], "N");
             }
             // удаляем изображения формы
             $strSql = "SELECT IMAGE_ID FROM b_form WHERE ID='{$ID}' and IMAGE_ID>0";
             $z = $DB->Query($strSql, false, $err_mess . __LINE__);
             while ($zr = $z->Fetch()) {
                 CFile::Delete($zr["IMAGE_ID"]);
             }
             // удаляем тип почтового события и почтовые шаблоны приписанные данной форме
             $q = CForm::GetByID($ID);
             $qr = $q->Fetch();
             if (strlen(trim($qr["MAIL_EVENT_TYPE"])) > 0) {
                 // удалим почтовые шаблоны
                 $em = new CEventMessage();
                 $e = $em->GetList($by = "id", $order = "desc", array("EVENT_NAME" => $qr["MAIL_EVENT_TYPE"], "EVENT_NAME_EXACT_MATCH" => "Y"));
                 while ($er = $e->Fetch()) {
                     $em->Delete($er["ID"]);
                 }
                 // удалим тип почтового события
                 $et = new CEventType();
                 $et->Delete($qr["MAIL_EVENT_TYPE"]);
             }
             // удаляем привязку к сайтам
             $DB->Query("DELETE FROM b_form_2_site WHERE FORM_ID='{$ID}'", false, $err_mess . __LINE__);
             // удаляем привязку к почтовым шаблонам
             $DB->Query("DELETE FROM b_form_2_mail_template WHERE FORM_ID='{$ID}'", false, $err_mess . __LINE__);
             // удаляем меню формы
             $DB->Query("DELETE FROM b_form_menu WHERE FORM_ID='{$ID}'", false, $err_mess . __LINE__);
             // удаляем права групп
             $DB->Query("DELETE FROM b_form_2_group WHERE FORM_ID='{$ID}'", false, $err_mess . __LINE__);
             // удаляем форму
             $DB->Query("DELETE FROM b_form WHERE ID='{$ID}'", false, $err_mess . __LINE__);
             return true;
         }
     } else {
         $strError .= GetMessage("FORM_ERROR_ACCESS_DENIED") . "<br>";
     }
     return false;
 }