本文整理汇总了PHP中CForm::ExecHandlerAfterChangeStatus方法的典型用法代码示例。如果您正苦于以下问题:PHP CForm::ExecHandlerAfterChangeStatus方法的具体用法?PHP CForm::ExecHandlerAfterChangeStatus怎么用?PHP CForm::ExecHandlerAfterChangeStatus使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CForm
的用法示例。
在下文中一共展示了CForm::ExecHandlerAfterChangeStatus方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: SetStatus
//.........这里部分代码省略.........
* // с проверкой прав текущего пользователя
* if (<b>CFormResult::SetStatus</b>($RESULT_ID, $STATUS_ID))
* {
* echo "Статус #".$STATUS_ID." для результата #".$RESULT_ID." успешно установлен.";
* }
* else // ошибка
* {
* global $strError;
* echo $strError;
* }
* ?>
* </pre>
*
*
* @static
* @link http://dev.1c-bitrix.ru/api_help/form/classes/cformresult/setstatus.php
* @author Bitrix
*/
public static function SetStatus($RESULT_ID, $NEW_STATUS_ID, $CHECK_RIGHTS="Y")
{
$err_mess = (CAllFormResult::err_mess())."<br>Function: SetStatus<br>Line: ";
global $DB, $USER, $strError, $APPLICATION;
$NEW_STATUS_ID = intval($NEW_STATUS_ID);
$RESULT_ID = intval($RESULT_ID);
if ($RESULT_ID <= 0 || $NEW_STATUS_ID <= 0)
return false;
$strSql = "SELECT USER_ID, FORM_ID FROM b_form_result WHERE ID='".$RESULT_ID."'";
$z = $DB->Query($strSql, false, $err_mess.__LINE__);
if ($zr = $z->Fetch())
{
$WEB_FORM_ID = intval($zr["FORM_ID"]);
// rights check
$RIGHT_OK = "N";
if ($CHECK_RIGHTS!="Y")
{
$dbRes = CFormStatus::GetByID($NEW_STATUS_ID);
if ($dbRes->Fetch())
{
$RIGHT_OK="Y";
}
}
else
{
// form rights
$F_RIGHT = CForm::GetPermission($WEB_FORM_ID);
if ($F_RIGHT>=20 || ($F_RIGHT>=15 && $USER->GetID()==$zr["USER_ID"]))
{
// result rights
$arrRESULT_PERMISSION = CFormResult::GetPermissions($RESULT_ID, $v);
// new status rights
$arrNEW_STATUS_PERMISSION = CFormStatus::GetPermissions($NEW_STATUS_ID);
if (in_array("EDIT", $arrRESULT_PERMISSION) && in_array("MOVE", $arrNEW_STATUS_PERMISSION))
{
$RIGHT_OK = "Y";
}
}
}
if ($RIGHT_OK=="Y")
{
$dbEvents = GetModuleEvents('form', 'onBeforeResultStatusChange');
while ($arEvent = $dbEvents->Fetch())
{
ExecuteModuleEventEx($arEvent, array($WEB_FORM_ID, $RESULT_ID, &$NEW_STATUS_ID, $CHECK_RIGHTS));
if ($ex = $APPLICATION->GetException())
$strError .= $ex->GetString().'<br />';
}
if (strlen($strError) <= 0)
{
// call handler before change status
CForm::ExecHandlerBeforeChangeStatus($RESULT_ID, "SET_STATUS", $NEW_STATUS_ID);
$arFields = Array(
"TIMESTAMP_X" => $DB->GetNowFunction(),
"STATUS_ID" => "'".intval($NEW_STATUS_ID)."'"
);
$DB->Update("b_form_result",$arFields,"WHERE ID='".$RESULT_ID."'",$err_mess.__LINE__);
$dbEvents = GetModuleEvents('form', 'onAfterResultStatusChange');
while ($arEvent = $dbEvents->Fetch())
{
ExecuteModuleEventEx($arEvent, array($WEB_FORM_ID, $RESULT_ID, $NEW_STATUS_ID, $CHECK_RIGHTS));
}
// call handler after change status
CForm::ExecHandlerAfterChangeStatus($RESULT_ID, "SET_STATUS");
return true;
}
}
else $strError .= GetMessage("FORM_ERROR_ACCESS_DENIED")."<br>";
}
else $strError .= GetMessage("FORM_ERROR_RESULT_NOT_FOUND")."<br>";
return false;
}