本文整理汇总了PHP中CIBlockProperty::getUserType方法的典型用法代码示例。如果您正苦于以下问题:PHP CIBlockProperty::getUserType方法的具体用法?PHP CIBlockProperty::getUserType怎么用?PHP CIBlockProperty::getUserType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CIBlockProperty
的用法示例。
在下文中一共展示了CIBlockProperty::getUserType方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: GetFieldInputValuePrintable
public function GetFieldInputValuePrintable($documentType, $fieldType, $fieldValue)
{
$result = $fieldValue;
switch ($fieldType['Type']) {
case "user":
if (!is_array($fieldValue)) {
$fieldValue = array($fieldValue);
}
$result = CBPHelper::usersArrayToString($fieldValue, null, array("lists", get_called_class(), $documentType));
break;
case "bool":
if (is_array($fieldValue)) {
$result = array();
foreach ($fieldValue as $r) {
$result[] = strtoupper($r) != "N" && !empty($r) ? GetMessage("BPVDX_YES") : GetMessage("BPVDX_NO");
}
} else {
$result = strtoupper($fieldValue) != "N" && !empty($fieldValue) ? GetMessage("BPVDX_YES") : GetMessage("BPVDX_NO");
}
break;
case "file":
if (is_array($fieldValue)) {
$result = array();
foreach ($fieldValue as $r) {
$r = intval($r);
$imgQuery = CFile::getByID($r);
if ($img = $imgQuery->fetch()) {
$result[] = "[url=/bitrix/tools/bizproc_show_file.php?f=" . htmlspecialcharsbx($img["FILE_NAME"]) . "&i=" . $r . "&h=" . md5($img["SUBDIR"]) . "]" . htmlspecialcharsbx($img["ORIGINAL_NAME"]) . "[/url]";
}
}
} else {
$fieldValue = intval($fieldValue);
$imgQuery = CFile::getByID($fieldValue);
if ($img = $imgQuery->fetch()) {
$result = "[url=/bitrix/tools/bizproc_show_file.php?f=" . htmlspecialcharsbx($img["FILE_NAME"]) . "&i=" . $fieldValue . "&h=" . md5($img["SUBDIR"]) . "]" . htmlspecialcharsbx($img["ORIGINAL_NAME"]) . "[/url]";
}
}
break;
case "select":
if (is_array($fieldType["Options"])) {
if (is_array($fieldValue)) {
$result = array();
foreach ($fieldValue as $r) {
if (array_key_exists($r, $fieldType["Options"])) {
$result[] = $fieldType["Options"][$r];
}
}
} else {
if (array_key_exists($fieldValue, $fieldType["Options"])) {
$result = $fieldType["Options"][$fieldValue];
}
}
}
break;
}
if (strpos($fieldType['Type'], ":") !== false) {
if ($fieldType["Type"] == "S:employee") {
$fieldValue = CBPHelper::stripUserPrefix($fieldValue);
}
$customType = CIBlockProperty::getUserType(substr($fieldType['Type'], 2));
if (array_key_exists("GetPublicViewHTML", $customType)) {
if (is_array($fieldValue) && !CBPHelper::isAssociativeArray($fieldValue)) {
$result = array();
foreach ($fieldValue as $value) {
$r = call_user_func_array($customType["GetPublicViewHTML"], array(array("LINK_IBLOCK_ID" => $fieldType["Options"]), array("VALUE" => $value), ""));
$result[] = HTMLToTxt($r);
}
} else {
$result = call_user_func_array($customType["GetPublicViewHTML"], array(array("LINK_IBLOCK_ID" => $fieldType["Options"]), array("VALUE" => $fieldValue), ""));
$result = HTMLToTxt($result);
}
}
}
return $result;
}
示例2: getPropsList
protected function getPropsList($iblockId, $skuPropertyId = 0)
{
$arResult = array();
$dbrFProps = \CIBlockProperty::getList(array("SORT" => "ASC", "NAME" => "ASC"), array("IBLOCK_ID" => $iblockId, "ACTIVE" => "Y", "!XML_ID" => "CML2_LINK", "CHECK_PERMISSIONS" => "N"));
while ($arProp = $dbrFProps->getNext()) {
if ($skuPropertyId == $arProp['ID']) {
continue;
}
$arProp["PROPERTY_USER_TYPE"] = !empty($arProp["USER_TYPE"]) ? \CIBlockProperty::getUserType($arProp["USER_TYPE"]) : array();
$arResult[] = $arProp;
}
return $arResult;
}
示例3: getFieldInputControl
public static function getFieldInputControl($documentType, $fieldType, $fieldName, $fieldValue, $allowSelection = false, $publicMode = false)
{
global $USER_FIELD_MANAGER, $APPLICATION;
$storageId = self::getStorageIdByType($documentType);
if (!$storageId) {
throw new CBPArgumentNullException('documentType');
}
if (!$publicMode) {
$APPLICATION->showAjaxHead();
}
static $documentFieldTypes = array();
if (!array_key_exists($documentType, $documentFieldTypes)) {
$documentFieldTypes[$documentType] = self::getDocumentFieldTypes($documentType);
}
$fieldType["BaseType"] = "string";
$fieldType["Complex"] = false;
if (array_key_exists($fieldType["Type"], $documentFieldTypes[$documentType])) {
$fieldType["BaseType"] = $documentFieldTypes[$documentType][$fieldType["Type"]]["BaseType"];
$fieldType["Complex"] = $documentFieldTypes[$documentType][$fieldType["Type"]]["Complex"];
}
if (!is_array($fieldValue) || is_array($fieldValue) && CBPHelper::isAssociativeArray($fieldValue)) {
$fieldValue = array($fieldValue);
}
$customMethodName = "";
$customMethodNameMulty = "";
if (strpos($fieldType["Type"], ":") !== false) {
$ar = \CIBlockProperty::getUserType(substr($fieldType["Type"], 2));
if (array_key_exists("GetPublicEditHTML", $ar)) {
$customMethodName = $ar["GetPublicEditHTML"];
}
if (array_key_exists("GetPublicEditHTMLMulty", $ar)) {
$customMethodNameMulty = $ar["GetPublicEditHTMLMulty"];
}
}
ob_start();
if ($fieldType['Type'] == 'select') {
$fieldValueTmp = $fieldValue;
?>
<select id="id_<?php
echo htmlspecialcharsbx($fieldName["Field"]);
?>
" style="width:280px" name="<?php
echo htmlspecialcharsbx($fieldName["Field"]) . ($fieldType["Multiple"] ? "[]" : "");
?>
"<?php
echo $fieldType["Multiple"] ? ' size="5" multiple' : '';
?>
>
<?php
if (!$fieldType['Required']) {
echo '<option value="">[' . Loc::getMessage('DISK_FILED_NOT_SET') . ']</option>';
}
foreach ($fieldType['Options'] as $k => $v) {
$ind = array_search($k, $fieldValueTmp);
echo '<option value="' . htmlspecialcharsbx($k) . '"' . ($ind !== false ? ' selected' : '') . '>' . htmlspecialcharsbx($v) . '</option>';
if ($ind !== false) {
unset($fieldValueTmp[$ind]);
}
}
?>
</select>
<?php
if ($allowSelection) {
?>
<br /><input type="text" id="id_<?php
echo htmlspecialcharsbx($fieldName['Field']);
?>
_text" name="<?php
echo htmlspecialcharsbx($fieldName['Field']);
?>
_text" value="<?php
if (count($fieldValueTmp) > 0) {
$a = array_values($fieldValueTmp);
echo htmlspecialcharsbx($a[0]);
}
?>
">
<input type="button" value="..." onclick="BPAShowSelector('id_<?php
echo htmlspecialcharsbx($fieldName['Field']);
?>
_text', 'select');">
<?php
}
} elseif ($fieldType['Type'] == 'user' || $fieldType['Type'] == static::getPrefixForCustomType() . 'employee') {
$fieldValue = CBPHelper::usersArrayToString($fieldValue, null, self::generateDocumentComplexType($storageId));
?>
<input type="text" size="40" id="id_<?php
echo htmlspecialcharsbx($fieldName['Field']);
?>
" name="<?php
echo htmlspecialcharsbx($fieldName['Field']);
?>
" value="<?php
echo htmlspecialcharsbx($fieldValue);
?>
">
<input type="button" value="..." onclick="BPAShowSelector('id_<?php
echo htmlspecialcharsbx($fieldName['Field']);
?>
', 'user');"><?php
//.........这里部分代码省略.........
示例4: getFormatFunction
/**
* Retruns GetPublicViewHTML handler function for $this->property.
* Returns false if no handler defined.
*
* @return callable|false
*/
protected function getFormatFunction()
{
static $propertyFormatFunction = null;
if (!isset($propertyFormatFunction)) {
$propertyFormatFunction = false;
if ($this->property && strlen($this->property["USER_TYPE"])) {
$propertyUserType = \CIBlockProperty::getUserType($this->property["USER_TYPE"]);
if (array_key_exists("GetPublicViewHTML", $propertyUserType) && is_callable($propertyUserType["GetPublicViewHTML"])) {
$propertyFormatFunction = $propertyUserType["GetPublicViewHTML"];
}
}
}
return $propertyFormatFunction;
}
示例5: getUserType
protected static function getUserType(FieldType $fieldType)
{
return \CIBlockProperty::getUserType(substr($fieldType->getType(), 2));
}
示例6: __construct
/**
* @param integer $key Iblock element identifier.
* @param array|mixed $property Iblock property array.
*/
function __construct($key, $property)
{
parent::__construct($key);
if (is_array($property)) {
$this->property = $property;
if (strlen($property["USER_TYPE"])) {
$propertyUserType = \CIBlockProperty::getUserType($property["USER_TYPE"]);
if (array_key_exists("GetPublicViewHTML", $propertyUserType) && is_callable($propertyUserType["GetPublicViewHTML"])) {
$this->propertyFormatFunction = $propertyUserType["GetPublicViewHTML"];
}
}
}
}
示例7: OnAfterIBlockElementDelete
public function OnAfterIBlockElementDelete($fields)
{
if (CModule::includeModule('bizproc')) {
$errors = array();
$iblockType = COption::getOptionString("lists", "livefeed_iblock_type_id");
$iblockQuery = CIBlock::getList(array(), array('ID' => $fields['IBLOCK_ID']));
if ($iblock = $iblockQuery->fetch()) {
$iblockType = $iblock["IBLOCK_TYPE_ID"];
}
$states = CBPStateService::getDocumentStates(BizprocDocument::getDocumentComplexId($iblockType, $fields['ID']));
$listWorkflowId = array();
foreach ($states as $workflowId => $state) {
$listWorkflowId[] = $workflowId;
}
self::deleteSocnetLog($listWorkflowId);
CBPDocument::onDocumentDelete(BizprocDocument::getDocumentComplexId($iblockType, $fields['ID']), $errors);
}
$propertyQuery = CIBlockElement::getProperty($fields['IBLOCK_ID'], $fields['ID'], 'sort', 'asc', array('ACTIVE' => 'Y'));
while ($property = $propertyQuery->fetch()) {
$userType = \CIBlockProperty::getUserType($property['USER_TYPE']);
if (array_key_exists('DeleteAllAttachedFiles', $userType)) {
call_user_func_array($userType['DeleteAllAttachedFiles'], array($fields['ID']));
}
}
}
示例8: GetDocument
/**
* @param string $documentId - document id.
* @return array - document fields array.
*/
public function GetDocument($documentId)
{
$documentId = intval($documentId);
if ($documentId <= 0) {
throw new CBPArgumentNullException("documentId");
}
$arResult = null;
$dbDocumentList = CIBlockElement::GetList(array(), array("ID" => $documentId, "SHOW_NEW" => "Y", "SHOW_HISTORY" => "Y"));
if ($objDocument = $dbDocumentList->GetNextElement(false, true)) {
$arDocumentFields = $objDocument->GetFields();
$arDocumentProperties = $objDocument->GetProperties();
foreach ($arDocumentFields as $fieldKey => $fieldValue) {
if (substr($fieldKey, 0, 1) == "~") {
continue;
}
$arResult[$fieldKey] = $fieldValue;
if (in_array($fieldKey, array("MODIFIED_BY", "CREATED_BY"))) {
$arResult[$fieldKey] = "user_" . $fieldValue;
$arResult[$fieldKey . "_PRINTABLE"] = $arDocumentFields[$fieldKey == "MODIFIED_BY" ? "USER_NAME" : "CREATED_USER_NAME"];
} elseif (in_array($fieldKey, array("PREVIEW_TEXT", "DETAIL_TEXT"))) {
if ($arDocumentFields[$fieldKey . "_TYPE"] == "html") {
$arResult[$fieldKey] = HTMLToTxt($arDocumentFields["~" . $fieldKey]);
}
}
}
foreach ($arDocumentProperties as $propertyKey => $propertyValue) {
if (strlen($propertyValue["USER_TYPE"]) > 0) {
if ($propertyValue["USER_TYPE"] == "UserID" || $propertyValue["USER_TYPE"] == "employee" && COption::GetOptionString("bizproc", "employee_compatible_mode", "N") != "Y") {
if (!is_array($propertyValue["VALUE"])) {
$propertyValue["VALUE"] = array($propertyValue["VALUE"]);
}
$listUsers = implode(' | ', $propertyValue["VALUE"]);
$userQuery = CUser::getList($by = 'ID', $order = 'ASC', array('ID' => $listUsers), array('FIELDS' => array('ID', 'LOGIN', 'NAME', 'LAST_NAME')));
while ($user = $userQuery->fetch()) {
$arResult["PROPERTY_" . $propertyKey][$user['ID']] = "user_" . intval($user['ID']);
$arResult["PROPERTY_" . $propertyKey . "_PRINTABLE"][$user['ID']] = "(" . $user["LOGIN"] . ")" . (strlen($user["NAME"]) > 0 || strlen($user["LAST_NAME"]) > 0 ? " " : "") . $user["NAME"] . (strlen($user["NAME"]) > 0 && strlen($user["LAST_NAME"]) > 0 ? " " : "") . $user["LAST_NAME"];
}
} elseif ($propertyValue["USER_TYPE"] == "DiskFile") {
if (is_array($propertyValue["VALUE"])) {
if ($propertyValue["MULTIPLE"] == "Y") {
$propertyValue["VALUE"] = current($propertyValue["VALUE"]);
}
if (!is_array($propertyValue["VALUE"])) {
continue;
}
foreach ($propertyValue["VALUE"] as $attachedId) {
$userType = \CIBlockProperty::getUserType($propertyValue['USER_TYPE']);
$fileId = null;
if (array_key_exists('GetObjectId', $userType)) {
$fileId = call_user_func_array($userType['GetObjectId'], array($attachedId));
}
if (!$fileId) {
continue;
}
$printableUrl = '';
if (array_key_exists('GetUrlAttachedFileElement', $userType)) {
$printableUrl = call_user_func_array($userType['GetUrlAttachedFileElement'], array($documentId, $fileId));
}
$arResult["PROPERTY_" . $propertyKey][$attachedId] = $fileId;
$arResult["PROPERTY_" . $propertyKey . "_PRINTABLE"][$attachedId] = $printableUrl;
}
} else {
continue;
}
} else {
$arResult["PROPERTY_" . $propertyKey] = $propertyValue["VALUE"];
}
} elseif ($propertyValue["PROPERTY_TYPE"] == "L") {
$arPropertyValue = $propertyValue["VALUE"];
$arPropertyKey = self::GetVersion() > 1 ? $propertyValue["VALUE_XML_ID"] : $propertyValue["VALUE_ENUM_ID"];
if (!is_array($arPropertyValue)) {
$arPropertyValue = array($arPropertyValue);
$arPropertyKey = array($arPropertyKey);
}
for ($i = 0, $cnt = count($arPropertyValue); $i < $cnt; $i++) {
$arResult["PROPERTY_" . $propertyKey][$arPropertyKey[$i]] = $arPropertyValue[$i];
}
} elseif ($propertyValue["PROPERTY_TYPE"] == "F") {
$arPropertyValue = $propertyValue["VALUE"];
if (!is_array($arPropertyValue)) {
$arPropertyValue = array($arPropertyValue);
}
foreach ($arPropertyValue as $v) {
$ar = CFile::GetFileArray($v);
if ($ar) {
$arResult["PROPERTY_" . $propertyKey][intval($v)] = $ar["SRC"];
$arResult["PROPERTY_" . $propertyKey . "_printable"][intval($v)] = "[url=/bitrix/tools/bizproc_show_file.php?f=" . urlencode($ar["FILE_NAME"]) . "&i=" . $v . "&h=" . md5($ar["SUBDIR"]) . "]" . htmlspecialcharsbx($ar["ORIGINAL_NAME"]) . "[/url]";
}
}
} else {
$arResult["PROPERTY_" . $propertyKey] = $propertyValue["VALUE"];
}
}
$documentFields = static::GetDocumentFields(static::GetDocumentType($documentId));
foreach ($documentFields as $fieldKey => $field) {
if (!array_key_exists($fieldKey, $arResult)) {
//.........这里部分代码省略.........