本文整理汇总了PHP中CIBlockElement::WF_GetLast方法的典型用法代码示例。如果您正苦于以下问题:PHP CIBlockElement::WF_GetLast方法的具体用法?PHP CIBlockElement::WF_GetLast怎么用?PHP CIBlockElement::WF_GetLast使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CIBlockElement
的用法示例。
在下文中一共展示了CIBlockElement::WF_GetLast方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ShowError
if ($arParams["SHOW_WORKFLOW"] || $this->StartResultCache(false, $arParams["CACHE_GROUPS"] === "N" ? false : $USER->GetGroups())) {
if (!CModule::IncludeModule("iblock")) {
$this->AbortResultCache();
ShowError(GetMessage("IBLOCK_MODULE_NOT_INSTALLED"));
return;
}
if ($arParams["ELEMENT_ID"] > 0) {
$ELEMENT_ID = $arParams["ELEMENT_ID"];
} else {
//Handle case when ELEMENT_CODE used
$ELEMENT_ID = CIBlockFindTools::GetElementID($arParams["ELEMENT_ID"], $arParams["ELEMENT_CODE"], false, false, array("IBLOCK_ACTIVE" => "Y", "IBLOCK_ID" => $arParams["IBLOCK_ID"], "ACTIVE_DATE" => "Y", "ACTIVE" => "Y", "CHECK_PERMISSIONS" => "Y"));
}
if ($ELEMENT_ID) {
$WF_SHOW_HISTORY = "N";
if ($arParams["SHOW_WORKFLOW"] && CModule::IncludeModule("workflow")) {
$WF_ELEMENT_ID = CIBlockElement::WF_GetLast($ELEMENT_ID);
$WF_STATUS_ID = CIBlockElement::WF_GetCurrentStatus($WF_ELEMENT_ID, $WF_STATUS_TITLE);
$WF_STATUS_PERMISSION = CIBlockElement::WF_GetStatusPermission($WF_STATUS_ID);
if ($WF_STATUS_ID == 1 || $WF_STATUS_PERMISSION < 1) {
$WF_ELEMENT_ID = $ELEMENT_ID;
} else {
$WF_SHOW_HISTORY = "Y";
}
$ELEMENT_ID = $WF_ELEMENT_ID;
}
//SELECT
$arSelect = array_merge($arParams["FIELD_CODE"], array("ID", "CODE", "IBLOCK_ID", "IBLOCK_SECTION_ID", "SECTION_PAGE_URL", "NAME", "DETAIL_PICTURE", "PREVIEW_PICTURE", "DETAIL_TEXT", "DETAIL_PAGE_URL", "PREVIEW_TEXT_TYPE", "DETAIL_TEXT_TYPE"));
$bGetProperty = count($arParams["PROPERTY_CODE"]) > 0 || $arParams["BROWSER_TITLE"] != "-" || $arParams["META_KEYWORDS"] != "-" || $arParams["META_DESCRIPTION"] != "-";
if ($bGetProperty) {
$arSelect[] = "PROPERTY_*";
}
示例2: Update
function Update($ID, $arFields, $bWorkFlow = false, $bUpdateSearch = true, $bResizePictures = false, $bCheckDiskQuota = true)
{
global $DB, $USER;
$ID = intval($ID);
$db_element = CIBlockElement::GetList(array(), array("ID" => $ID, "SHOW_HISTORY" => "Y"), false, false, array("ID", "TIMESTAMP_X", "MODIFIED_BY", "DATE_CREATE", "CREATED_BY", "IBLOCK_ID", "ACTIVE", "ACTIVE_FROM", "ACTIVE_TO", "SORT", "NAME", "PREVIEW_PICTURE", "PREVIEW_TEXT", "PREVIEW_TEXT_TYPE", "DETAIL_PICTURE", "DETAIL_TEXT", "DETAIL_TEXT_TYPE", "WF_STATUS_ID", "WF_PARENT_ELEMENT_ID", "WF_NEW", "WF_COMMENTS", "IN_SECTIONS", "CODE", "TAGS", "XML_ID", "TMP_ID"));
if (!($ar_element = $db_element->Fetch())) {
return false;
}
$arIBlock = CIBlock::GetArrayByID($ar_element["IBLOCK_ID"]);
$bWorkFlow = $bWorkFlow && is_array($arIBlock) && $arIBlock["WORKFLOW"] != "N" && CModule::IncludeModule("workflow");
$ar_wf_element = $ar_element;
$LAST_ID = 0;
if ($bWorkFlow) {
$LAST_ID = CIBlockElement::WF_GetLast($ID);
if ($LAST_ID != $ID) {
$db_element = CIBlockElement::GetByID($LAST_ID);
if (!($ar_wf_element = $db_element->Fetch())) {
return false;
}
}
$arFields["WF_PARENT_ELEMENT_ID"] = $ID;
if (!array_key_exists("PROPERTY_VALUES", $arFields) || !is_array($arFields["PROPERTY_VALUES"])) {
$arFields["PROPERTY_VALUES"] = array();
}
$bFieldProps = array();
foreach ($arFields["PROPERTY_VALUES"] as $k => $v) {
$bFieldProps[$k] = true;
}
$arFieldProps =& $arFields['PROPERTY_VALUES'];
$props = CIBlockElement::GetProperty($ar_element["IBLOCK_ID"], $ar_wf_element["ID"]);
while ($arProp = $props->Fetch()) {
$pr_val_id = $arProp['PROPERTY_VALUE_ID'];
if ($arProp['PROPERTY_TYPE'] == 'F' && strlen($pr_val_id) > 0) {
if (strlen($arProp["CODE"]) > 0 && is_set($arFieldProps, $arProp["CODE"])) {
$pr_id = $arProp["CODE"];
} else {
$pr_id = $arProp['ID'];
}
if (array_key_exists($pr_id, $arFieldProps) && array_key_exists($pr_val_id, $arFieldProps[$pr_id]) && is_array($arFieldProps[$pr_id][$pr_val_id])) {
$new_value = $arFieldProps[$pr_id][$pr_val_id];
if (strlen($new_value['name']) <= 0 && $new_value['del'] != "Y" && strlen($new_value['VALUE']['name']) <= 0 && $new_value['VALUE']['del'] != "Y") {
if (array_key_exists('DESCRIPTION', $new_value) && $new_value['DESCRIPTION'] != $arProp['DESCRIPTION']) {
$p = array("VALUE" => CFile::MakeFileArray($arProp['VALUE']));
$p["DESCRIPTION"] = $new_value["DESCRIPTION"];
$p["MODULE_ID"] = "iblock";
$arFieldProps[$pr_id][$pr_val_id] = $p;
} elseif ($arProp['VALUE'] > 0) {
$arFieldProps[$pr_id][$pr_val_id] = array("VALUE" => $arProp['VALUE'], "DESCRIPTION" => $arProp["DESCRIPTION"]);
}
}
} else {
$arFieldProps[$pr_id][$pr_val_id] = array("VALUE" => $arProp['VALUE'], "DESCRIPTION" => $arProp["DESCRIPTION"]);
}
continue;
}
if (strlen($pr_val_id) <= 0 || array_key_exists($arProp["ID"], $bFieldProps) || strlen($arProp["CODE"]) > 0 && array_key_exists($arProp["CODE"], $bFieldProps)) {
continue;
}
$arFieldProps[$arProp["ID"]][$pr_val_id] = array("VALUE" => $arProp['VALUE'], "DESCRIPTION" => $arProp["DESCRIPTION"]);
}
if ($ar_wf_element["IN_SECTIONS"] == "Y") {
$ar_wf_element["IBLOCK_SECTION"] = array();
$rsSections = CIBlockElement::GetElementGroups($ar_element["ID"], true, array('ID', 'IBLOCK_ELEMENT_ID'));
while ($arSection = $rsSections->Fetch()) {
$ar_wf_element["IBLOCK_SECTION"][] = $arSection["ID"];
}
}
unset($ar_wf_element["DATE_ACTIVE_FROM"]);
unset($ar_wf_element["DATE_ACTIVE_TO"]);
unset($ar_wf_element["EXTERNAL_ID"]);
unset($ar_wf_element["TIMESTAMP_X"]);
unset($ar_wf_element["ID"]);
$arFields = $arFields + $ar_wf_element;
}
$arFields["WF"] = $bWorkFlow ? "Y" : "N";
$bBizProc = is_array($arIBlock) && $arIBlock["BIZPROC"] == "Y" && IsModuleInstalled("bizproc");
if (array_key_exists("BP_PUBLISHED", $arFields)) {
if ($bBizProc) {
if ($arFields["BP_PUBLISHED"] == "Y") {
$arFields["WF_STATUS_ID"] = 1;
$arFields["WF_NEW"] = false;
} else {
$arFields["WF_STATUS_ID"] = 2;
$arFields["WF_NEW"] = "Y";
$arFields["BP_PUBLISHED"] = "N";
}
} else {
$arFields["WF_NEW"] = false;
unset($arFields["BP_PUBLISHED"]);
}
} else {
$arFields["WF_NEW"] = false;
}
if (is_set($arFields, "ACTIVE") && $arFields["ACTIVE"] != "Y") {
$arFields["ACTIVE"] = "N";
}
if (is_set($arFields, "PREVIEW_TEXT_TYPE") && $arFields["PREVIEW_TEXT_TYPE"] != "html") {
$arFields["PREVIEW_TEXT_TYPE"] = "text";
}
if (is_set($arFields, "DETAIL_TEXT_TYPE") && $arFields["DETAIL_TEXT_TYPE"] != "html") {
//.........这里部分代码省略.........
示例3: array
$arMeasureIDs = array();
$arCatalogRights = array();
// List build
while($arRes = $rsData->NavNext(true, "f_"))
{
$sec_list_url = htmlspecialcharsbx(CIBlock::GetAdminSectionListLink($IBLOCK_ID, array('find_section_section'=>$f_ID)));
$el_edit_url = htmlspecialcharsbx(CIBlock::GetAdminElementEditLink($IBLOCK_ID, $f_ID, array('find_section_section'=>intval($find_section_section), "WF"=>"Y")));;
$sec_edit_url = htmlspecialcharsbx(CIBlock::GetAdminSectionEditLink($IBLOCK_ID, $f_ID, array('find_section_section'=>intval($find_section_section))));
$arRes_orig = $arRes;
if($f_TYPE=="E")
{
if($bWorkFlow)
{
$LAST_ID = CIBlockElement::WF_GetLast($arRes['ID']);
if($LAST_ID!=$arRes['ID'])
{
$rsData2 = CIBlockElement::GetList(
Array(),
Array(
"ID"=>$LAST_ID,
"SHOW_HISTORY"=>"Y"
),
false,
Array("nTopCount"=>1),
$arSelectedFields
);
if(isset($arCatGroup))
{
$arRes_tmp = Array();
示例4: array
//This function returns array with prices description and access rights
//in case catalog module n/a prices get values from element properties
$arResultPrices = CIBlockPriceTools::GetCatalogPrices($arParams["IBLOCK_ID"], $arParams["PRICE_CODE"]);
$arResultPricesAllow = CIBlockPriceTools::GetAllowCatalogPrices($arResultPrices);
if ($bCatalog && $boolNeedCatalogCache && !empty($arResultPricesAllow))
{
$boolNeedCatalogCache = CIBlockPriceTools::SetCatalogDiscountCache($arResultPricesAllow, $USER->GetUserGroupArray());
}
$WF_SHOW_HISTORY = "N";
if ($arParams["SHOW_WORKFLOW"] && CModule::IncludeModule("workflow"))
{
$arResultModules['workflow'] = true;
$WF_ELEMENT_ID = CIBlockElement::WF_GetLast($arParams["ELEMENT_ID"]);
$WF_STATUS_ID = CIBlockElement::WF_GetCurrentStatus($WF_ELEMENT_ID, $WF_STATUS_TITLE);
$WF_STATUS_PERMISSION = CIBlockElement::WF_GetStatusPermission($WF_STATUS_ID);
if ($WF_STATUS_ID == 1 || $WF_STATUS_PERMISSION < 1)
$WF_ELEMENT_ID = $arParams["ELEMENT_ID"];
else
$WF_SHOW_HISTORY = "Y";
$arParams["ELEMENT_ID"] = $WF_ELEMENT_ID;
}
//SELECT
$arSelect = array(
"ID",
"IBLOCK_ID",
示例5: WF_GetCurrentStatus
public static function WF_GetCurrentStatus($ELEMENT_ID, &$STATUS_TITLE)
{
global $DB;
if (CModule::IncludeModule("workflow")) {
$ELEMENT_ID = intval($ELEMENT_ID);
$WF_ID = intval(CIBlockElement::WF_GetLast($ELEMENT_ID));
if ($WF_ID <= 0) {
$WF_ID = $ELEMENT_ID;
}
if ($WF_ID > 0) {
$strSql = "SELECT E.WF_STATUS_ID, S.TITLE " . "FROM b_iblock_element E, b_workflow_status S " . "WHERE E.ID = " . $WF_ID . " " . "\tAND\tS.ID = E.WF_STATUS_ID";
$z = $DB->Query($strSql);
$zr = $z->Fetch();
$STATUS_ID = $zr["WF_STATUS_ID"];
$STATUS_TITLE = $zr["TITLE"];
}
}
return intval($STATUS_ID);
}
示例6: _CIBlockError
if(!($arElement = $rsElement->Fetch()))
{
$error = new _CIBlockError(1, "BAD_ELEMENT", GetMessage("IBLOCK_BAD_ELEMENT"));
$APPLICATION->SetTitle($arIBTYPE["ELEMENT_NAME"].": ".GetMessage("IBLOCK_EDIT_TITLE"));
$errorTriger = true;
}
}
if (!$errorTriger)
{
// workflow mode
$isLocked = false;
if($ID>0 && $WF=="Y")
{
// get ID of the last record in workflow
$WF_ID = CIBlockElement::WF_GetLast($ID);
// check for edit permissions
$STATUS_ID = CIBlockElement::WF_GetCurrentStatus($WF_ID, $STATUS_TITLE);
$STATUS_PERMISSION = CIBlockElement::WF_GetStatusPermission($STATUS_ID);
if($STATUS_ID>1 && $STATUS_PERMISSION<2)
{
$error = new _CIBlockError(1, "ACCESS_DENIED", GetMessage("IBLOCK_ACCESS_DENIED_STATUS"));
$errorTriger = true;
}
elseif($STATUS_ID==1)
{
$WF_ID = $ID;
$STATUS_ID = CIBlockElement::WF_GetCurrentStatus($WF_ID, $STATUS_TITLE);
$STATUS_PERMISSION = CIBlockElement::WF_GetStatusPermission($STATUS_ID);
示例7: CheckWebRights
//.........这里部分代码省略.........
if (!$res) {
$arError[] = array("id" => "", "text" => GetMessage("WD_ACCESS_DENIED"));
}
} else {
$res = $this->GetPermission($type, $arElement['item_id'], 'section_delete', false);
if (!$res) {
$arError[] = array("id" => "", "text" => GetMessage("WD_ACCESS_DENIED"));
}
}
} elseif ($action == 'destroy') {
//arElement
$id = $arElement['item_id'];
$type = $arElement['is_dir'] ? 'SECTION' : 'ELEMENT';
$op = $arElement['is_dir'] ? 'section_delete' : 'element_delete';
if (!$this->GetPermission($type, $id, $op, false)) {
$arError[] = array("id" => "", "text" => GetMessage("WD_ACCESS_DENIED"));
}
} elseif ($action == 'edit' || $action == 'lock' || $action == 'proppatch' || $action == 'delete_dropped') {
//arElement
$id = $arElement['item_id'];
$type = $arElement['is_dir'] ? 'SECTION' : 'ELEMENT';
if ($arElement['is_dir']) {
if (!$this->GetPermission($type, $id, 'section_edit')) {
$arError[] = array("id" => "", "text" => GetMessage("WD_ACCESS_DENIED"));
}
} else {
if ($arElement["LOCK_STATUS_BP"] == "red") {
$arError[] = array("id" => "locked", "text" => GetMessage("WD_FILE_ERROR107"));
} elseif ($this->check_creator && $arElement["CREATED_BY"] != $GLOBALS["USER"]->GetID()) {
$arError[] = array("id" => "bad_author", "text" => GetMessage("WD_FILE_ERROR108"));
} elseif ($this->GetPermission($type, $id, 'element_edit_any_wf_status')) {
true;
} elseif ($this->workflow == "workflow" && $this->GetPermission($type, $id, 'element_edit')) {
$arWorkFlow = array("LAST_ID" => CIBlockElement::WF_GetLast($arElement["item_id"]));
$arWorkFlow["STATUS_ID"] = CIBlockElement::WF_GetCurrentStatus($arWorkFlow["LAST_ID"], $arWorkFlow["STATUS_TITLE"]);
$arWorkFlow["STATUS_PERMISSION"] = CIBlockElement::WF_GetStatusPermission($arWorkFlow["STATUS_ID"]);
if ($arWorkFlow["STATUS_ID"] > 1 && $arWorkFlow["STATUS_PERMISSION"] < 2) {
$arError[] = array("id" => "bad_wf_status_permission", "text" => GetMessage("WD_FILE_ERROR109"));
}
} elseif ($this->workflow == 'bizproc' && $this->GetPermission($type, $id, 'element_edit')) {
$documentId = $this->wfParams['DOCUMENT_TYPE'];
$documentId[2] = $arElement["item_id"];
$arDocumentStates = CBPDocument::GetDocumentStates($this->wfParams['DOCUMENT_TYPE'], $documentId);
$arUserGroups = $this->USER["GROUPS"];
if ($arElement["CREATED_BY"] == $GLOBALS["USER"]->GetID()) {
$arUserGroups[] = "Author";
}
if (!CBPDocument::CanUserOperateDocument(CBPCanUserOperateOperation::WriteDocument, $GLOBALS["USER"]->GetID(), $documentId, array("IBlockPermission" => $this->permission, "AllUserGroups" => $arUserGroups, "DocumentStates" => $arDocumentStates))) {
$arError[] = array("id" => "bad_bizproc_permision", "text" => GetMessage("WD_ACCESS_DENIED"));
}
} else {
$arError[] = array("id" => "bad_permision", "text" => GetMessage("WD_ACCESS_DENIED"));
}
}
} elseif ($action == 'read' || $action == 'propfind') {
//arElement, null
if ($arElement) {
$id = $arElement['item_id'];
$type = $arElement['is_dir'] ? 'SECTION' : 'ELEMENT';
$op = $arElement['is_dir'] ? 'section_read' : 'element_read';
if (!$this->GetPermission($type, $id, $op)) {
$arError[] = array("id" => "bad_permision", "text" => GetMessage("WD_ACCESS_DENIED"));
}
if ($type == 'SECTION' && $id == $this->GetMetaID('TRASH')) {
if (!$this->GetPermission($type, $id, 'section_delete')) {
$arError[] = array("id" => "bad_permision", "text" => GetMessage("WD_ACCESS_DENIED"));
示例8: ShowError
ShowError(GetMessage("WD_ACCESS_DENIED"));
return 0;
}
$res = array("UNLOCK" => "N", "EDIT" => CWebDavIblock::CheckRight($arResult["ELEMENT"]["PERMISSION"], "element_edit") >= "W" ? "Y" : "N", "DELETE" => CWebDavIblock::CheckRight($arResult["ELEMENT"]["PERMISSION"], "element_edit") >= "W" ? "Y" : "N", "HISTORY" => "Y");
if ($arResult["ELEMENT"]["LOCK_STATUS"] == "yellow" || $arResult["ELEMENT"]["LOCK_STATUS"] == "red" && (CWorkflow::IsAdmin() || $USER->CanDoOperation('webdav_change_settings'))) {
$res["UNLOCK"] = "Y";
}
if ($arResult["ELEMENT"]["LOCK_STATUS"] == "red") {
$res["EDIT"] = "N";
} elseif (CWebDavIblock::CheckRight($arResult["ELEMENT"]["PERMISSION"], "element_bizproc_start") == "U") {
$res["EDIT"] = $arResult["ELEMENT"]["WF_STATUS_ID"] > 1 && $arResult["WF_STATUSES_PERMISSION"][$arResult["ELEMENT"]["WF_STATUS_ID"]] < 2 ? "N" : "Y";
}
$arResult["ELEMENT"]["SHOW"] = $res;
/************** Last element ***************************************/
$arResult["ELEMENT"]["LAST"] = $arResult["ELEMENT"];
$LAST_ID = CIBlockElement::WF_GetLast($arResult["ELEMENT"]["ID"]);
if ($LAST_ID != $arResult["ELEMENT"]["ID"]) {
$db_res = CIBlockElement::GetByID($LAST_ID);
if ($db_res && ($res = $db_res->Fetch())) {
$arResult["ELEMENT"]["LAST"] = $res;
}
}
/************** Versions *******************************************/
$db_res = CIBlockElement::WF_GetHistoryList($arParams['ELEMENT_ID'], $by = 's_id', $order = 'desc', array("IBLOCK_ID" => $arParams['IBLOCK_ID']), $is_filtered);
if ($db_res) {
$db_res->NavStart($arParams["PAGE_ELEMENTS"]);
$arResult["NAV_RESULT"] = $db_res;
$arResult["NAV_STRING"] = $db_res->GetPageNavStringEx($navComponentObject, GetMessage("WD_DOCUMENTS"), $arParams["PAGE_NAVIGATION_TEMPLATE"]);
if ($this->__parent) {
$this->__parent->arResult["HISTORY_LENGTH"] = $db_res->NavRecordCount;
}