Example #1
0
 function __bwl1_ParseStringParameterTmp($matches)
 {
     $result = "";
     if ($matches[1] == "user") {
         $user = $matches[2];
         $l = strlen("user_");
         if (substr($user, 0, $l) == "user_") {
             $result = htmlspecialcharsbx(CBPHelper::ConvertUserToPrintableForm(intval(substr($user, $l))));
         } else {
             $result = $GLOBALS["__bwl1_ParseStringParameterTmp_arAllowableUserGroups"][$user];
         }
     } elseif ($matches[1] == "group") {
         $result = $GLOBALS["__bwl1_ParseStringParameterTmp_arAllowableUserGroups"][$matches[2]];
     } else {
         $result = $matches[0];
     }
     return $result;
 }
Example #2
0
 public static function parseStringParameterMatches($matches, $documentType = null)
 {
     $result = "";
     $documentType = is_array($documentType) ? array_filter($documentType) : null;
     if ($matches[1] == "user") {
         $user = $matches[2];
         $l = strlen("user_");
         if (substr($user, 0, $l) == "user_") {
             $result = CBPHelper::ConvertUserToPrintableForm(intval(substr($user, $l)));
         } elseif (strpos($user, 'group_') === 0) {
             $result = htmlspecialcharsbx(CBPHelper::getExtendedGroupName($user));
         } elseif ($documentType) {
             $v = implode(",", $documentType);
             if (!array_key_exists($v, self::$userGroupsCache)) {
                 self::$userGroupsCache[$v] = CBPDocument::GetAllowableUserGroups($documentType);
             }
             $result = self::$userGroupsCache[$v][$user];
         } else {
             $result = $user;
         }
     } elseif ($matches[1] == "group") {
         if (strpos($matches[2], 'group_') === 0) {
             $result = htmlspecialcharsbx(CBPHelper::getExtendedGroupName($matches[2]));
         } elseif ($documentType) {
             $v = implode(",", $documentType);
             if (!array_key_exists($v, self::$userGroupsCache)) {
                 self::$userGroupsCache[$v] = CBPDocument::GetAllowableUserGroups($documentType);
             }
             $result = self::$userGroupsCache[$v][$matches[2]];
         } else {
             $result = $matches[2];
         }
     } else {
         $result = $matches[0];
     }
     return $result;
 }
Example #3
0
 public static function GetFieldValuePrintable($fieldName, $fieldType, $result)
 {
     $newResult = null;
     switch ($fieldType) {
         case "user":
             if (is_array($result)) {
                 $newResult = array();
                 foreach ($result as $r) {
                     $newResult[] = CBPHelper::ConvertUserToPrintableForm($r);
                 }
             } else {
                 $newResult = CBPHelper::ConvertUserToPrintableForm($result);
             }
             break;
         case "file":
             if (is_array($result)) {
                 $newResult = array();
                 foreach ($result as $r) {
                     $r = intval($r);
                     $dbImg = CFile::GetByID($r);
                     if ($arImg = $dbImg->Fetch()) {
                         $newResult[] = "[url=/bitrix/tools/bizproc_show_file.php?f=" . htmlspecialcharsbx($arImg["FILE_NAME"]) . "&i=" . $r . "]" . htmlspecialcharsbx($arImg["ORIGINAL_NAME"]) . "[/url]";
                     }
                 }
             } else {
                 $result = intval($result);
                 $dbImg = CFile::GetByID($result);
                 if ($arImg = $dbImg->Fetch()) {
                     $newResult = "[url=/bitrix/tools/bizproc_show_file.php?f=" . htmlspecialcharsbx($arImg["FILE_NAME"]) . "&i=" . $result . "]" . htmlspecialcharsbx($arImg["ORIGINAL_NAME"]) . "[/url]";
                 }
             }
             break;
         default:
             $newResult = $result;
     }
     return $newResult;
 }
Example #4
0
 function __bwl_ParseStringParameterTmp1($matches, $documentType)
 {
     static $varCache = array();
     $result = "";
     if ($matches[1] == "user") {
         $user = $matches[2];
         $l = strlen("user_");
         if (substr($user, 0, $l) == "user_") {
             $result = htmlspecialcharsbx(CBPHelper::ConvertUserToPrintableForm(intval(substr($user, $l))));
         } else {
             $v = implode(",", $documentType);
             if (!array_key_exists($v, $varCache)) {
                 $varCache[$v] = CBPDocument::GetAllowableUserGroups($documentType);
             }
             $result = $varCache[$v][$user];
         }
     } elseif ($matches[1] == "group") {
         $v = implode(",", $documentType);
         if (!array_key_exists($v, $varCache)) {
             $varCache[$v] = CBPDocument::GetAllowableUserGroups($documentType);
         }
         $result = $varCache[$v][$matches[2]];
     } else {
         $result = $matches[0];
     }
     return $result;
 }
Example #5
0
 /**
  * @param int $userID  - ID пользователя
  * @return string в формате БП - по умолчанию только Фамилия Имя - почта
  */
 public static function getPrintable($userID)
 {
     return CBPHelper::ConvertUserToPrintableForm($userID);
 }