本文整理汇总了PHP中CIBlockElement::SetPropertyValueCode方法的典型用法代码示例。如果您正苦于以下问题:PHP CIBlockElement::SetPropertyValueCode方法的具体用法?PHP CIBlockElement::SetPropertyValueCode怎么用?PHP CIBlockElement::SetPropertyValueCode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CIBlockElement
的用法示例。
在下文中一共展示了CIBlockElement::SetPropertyValueCode方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: published
function published($stockID)
{
global $USER;
$el = new CIBlockElement();
$arLoadProductArray = array("MODIFIED_BY" => $USER->GetID(), "IBLOCK_ID" => IB_SUB_STOCK_ID, "ACTIVE" => "Y");
// CIBlockElement::SetPropertyValuesEx($stockID, IB_SUB_STOCK_ID, array("PUBLIC"=>array('VALUE' => PROP_STOCK_PUBLIC)),array("DoNotValidateLists"));
CIBlockElement::SetPropertyValueCode($stockID, "PUBLIC", array('VALUE' => PROP_STOCK_PUBLIC));
return $el->update($stockID, $arLoadProductArray);
}
示例2: fill
/**
* @inheritdoc
*
* @throws FillDataException
*/
public function fill($propCodePublicId = null, $propCodeLang = null, $defaultLang = null, $force = false)
{
$elementModel = new \CIBlockElement();
$rsElements = $elementModel->GetList([], ['IBLOCK_ID' => $this->getIblockId()], false, false, ['ID', 'IBLOCK_ID', 'PROPERTY_' . $propCodePublicId, 'PROPERTY_' . $propCodeLang]);
while ($element = $rsElements->Fetch()) {
if ($propCodePublicId) {
if ($force === false && !empty($element['PROPERTY_' . $propCodePublicId . '_VALUE'])) {
continue;
}
if (!$elementModel->SetPropertyValueCode($element['ID'], $propCodePublicId, $element['ID'])) {
throw new FillDataException($element['ID'], $this->getIblockId());
}
}
if ($propCodeLang && $defaultLang) {
if ($force === false && !empty($element['PROPERTY_' . $propCodeLang . '_VALUE'])) {
continue;
}
if (!$elementModel->SetPropertyValueCode($element['ID'], $propCodeLang, $defaultLang)) {
throw new FillDataException($element['ID'], $this->getIblockId());
}
}
}
}
示例3: SendEmailCounterR
public static function SendEmailCounterR($ELEMENT_ID, $name, $Files_Send, $type_post_template = "ATTACH_FILES_BP", $emails_to, $arEx = array())
{
/* запуск з бп кодом:
$rootActivity = $this->GetRootActivity();
$Files_Send = $rootActivity->GetVariable("Files_Send");
SendEmailCounter("{=Document:ID}", "{=Document:NAME}", $Files_Send);
*/
/*
Файлы для отправки: Files_Send
Файлы расчета: Files_Count
*/
require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_before.php";
require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/iblock/include.php";
if (is_array($Files_Send)) {
$arCopyFiles = array();
foreach ($Files_Send as $key => $file) {
$arFile = CFile::MakeFileArray($file);
$arCopyFiles[] = $arFile;
}
CIBlockElement::SetPropertyValueCode($ELEMENT_ID, "Files_Count", $arCopyFiles);
$rsElements = CIBlockElement::GetList(array("sort" => "asc"), array("ID" => $ELEMENT_ID), false, false, array('ID', 'IBLOCK_ID'));
$arCopyFilesID = array();
while ($obElement = $rsElements->GetNextElement()) {
$arElement = $obElement->GetFields();
$arProp_Files_Count = $obElement->GetProperty("Files_Count");
foreach ($arProp_Files_Count['VALUE'] as $file) {
$arCopyFilesID[] = $file;
}
}
$arFieldmail = array("NAME" => $name, "EMAIL_TO" => $emails_to);
// добавить дополнительные поля в массив
/*
foreach($arEx as $kk => $vv){
$arFieldmail[$kk] = $vv;
}
*/
$itt = 1;
foreach ($arCopyFilesID as $file) {
$arFile = CFile::GetFileArray($file);
foreach ($arCopyFiles as $fl) {
if ($fl['size'] == $arFile['FILE_SIZE'] && $fl['name'] == $arFile['ORIGINAL_NAME']) {
$arFieldmail['FILE' . $itt] = $arFile['SRC'];
$itt++;
}
}
}
error_log("almost end", 3, "_test1.log");
$event = new CEvent();
$event->Send($type_post_template, SITE_ID, $arFieldmail);
} else {
}
}
示例4: __InTaskTaskComplete
function __InTaskTaskComplete($taskCompleteId, $iblockId, $taskType, $ownerId, $arTaskStatus, $arParams)
{
$errorMessage = "";
$taskCompleteId = IntVal($taskCompleteId);
if ($taskCompleteId <= 0) {
return "";
}
$arTask = __InTaskGetTask($taskCompleteId, $iblockId, $taskType, $ownerId);
if (!$arTask) {
$errorMessage .= GetMessage("INTL_TASK_NOT_FOUND") . ".";
}
if (StrLen($errorMessage) <= 0) {
if ($arTask["PROPS"]["TASKASSIGNEDTO"]["VALUE"] != $GLOBALS["USER"]->GetID()) {
$errorMessage .= GetMessage("INTL_CAN_NOT_FINISH") . ".";
}
}
if (StrLen($arResult["ErrorMessage"]) <= 0) {
$obIB = new CIBlockElement();
$obIB->SetPropertyValueCode($taskCompleteId, $arTask["PROPS"]["TASKSTATUS"]["ID"], $arTaskStatus["COMPLETED"]["ID"]);
$obIB->SetPropertyValueCode($taskCompleteId, $arTask["PROPS"]["TASKCOMPLETE"]["ID"], array(100));
$obIB->SetPropertyValueCode($taskCompleteId, $arTask["PROPS"]["TASKFINISH"]["ID"], array(Date($GLOBALS["DB"]->DateFormatToPHP(FORMAT_DATETIME))));
// added by sigurd
CIntranetUtils::UpdateOWSVersion($iblockId, $taskCompleteId);
$obIB->Update($taskCompleteId, array('TIMESTAMP_X' => Date($GLOBALS["DB"]->DateFormatToPHP(FORMAT_DATETIME))));
$arMessageFields = array("=DATE_CREATE" => $GLOBALS["DB"]->CurrentTimeFunction(), "MESSAGE_TYPE" => SONET_MESSAGE_SYSTEM, "FROM_USER_ID" => $GLOBALS["USER"]->GetID(), "TO_USER_ID" => $arTask["FIELDS"]["CREATED_BY"]);
if ($arMessageFields["FROM_USER_ID"] != $arMessageFields["TO_USER_ID"]) {
$path2view = ($GLOBALS["APPLICATION"]->IsHTTPS() ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST'] . CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_TASKS_TASK"], array("owner_id" => $arTask["PROPS"]["TASKASSIGNEDTO"]["VALUE"], "task_id" => $taskCompleteId, "action" => "view"));
$arMessageFields["MESSAGE"] = str_replace(array("#URL_VIEW#", "#NAME#"), array($path2view, $arTask["FIELDS"]["NAME"]), GetMessage("INTL_FINISH_MESSAGE"));
CSocNetMessages::Add($arMessageFields);
}
}
return $errorMessage;
}
示例5: array
// Получим заново свойство
$arrAdvert['PARENTS'][$intParentId][$arrFieldProp[$strNameField]] = array();
//$arrFileNew = array();
$res = CIBlockElement::GetProperty($intParentBlockID, $intParentId, 'sort', 'asc', array('ACTIVE' => 'Y', 'CODE' => $arrFieldProp[$strNameField]));
while ($ob = $res->GetNext()) {
if (intval($ob['VALUE'])) $arrAdvert['PARENTS'][$intParentId][$ob['CODE']][] = intval($ob['VALUE']);
}//\\ while
$intFileID = $arrAdvert['PARENTS'][$intParentId][$arrFieldProp[$strNameField]];
$rsFile = CFile::GetByID($intFileID[0]);
if ($arFile = $rsFile->Fetch())
$arrResult['original_name'] = $arFile['ORIGINAL_NAME'];
}//\\ if
}//\\if
}//\\ if
}//\\ if
CIBlockElement::SetPropertyValueCode($intAdvertID, 'MODERATION', array('VALUE' => 984));
}//\\ if
//$arrResult['percent'] = rand(0, 100);
}//\\ if
$arrResult['advert_id'] = $intAdvertID;
// Проверим валидацию
// Получим заново поля и свойства
$objE = CIBlockElement::GetList(array(), array('IBLOCK_ID' => $intBlockID, 'ID' => $intAdvertID, 'SECTION_ID' => $intRootSection, 'INCLUDE_SUBSECTIONS' => 'Y', 'ACTIVE' => 'Y'));
if ($arrAdvert = $objE->GetNext()) {
// Получим свойства
$res = CIBlockElement::GetProperty($intBlockID, $intAdvertID, 'sort', 'asc', array('ACTIVE' => 'Y'));
while ($ob = $res->GetNext())
$arrAdvert[$ob['CODE']] = $ob['VALUE'];
示例6: delFile
private function delFile($itemID, $iblock_id)
{
$image_prop = $this->iblockProps[$iblock_id]['PROP_IMAGE'];
if ($image_prop) {
$ob = \CIBlockElement::GetProperty($iblock_id, $itemID, array(), array('CODE' => 'photo', 'EMPTY' => 'N'));
while ($res = $ob->Fetch()) {
$arFile[] = $res['PROPERTY_VALUE_ID'];
}
foreach ($arFile as $arVal) {
$arValue[$arVal] = array("VALUE" => array("del" => 'Y'));
}
\CIBlockElement::SetPropertyValueCode($itemID, $image_prop, $arValue);
}
}
示例7: setNewRating
/**
* Записываем новое значение рейтинга клуба
* @param $socset
*/
function setNewRating($count, $socset = "VK")
{
CIBlockElement::SetPropertyValueCode($this->clubID, "RATING", intval($count));
}
示例8: published
function published($eventID)
{
global $USER;
$el = new CIBlockElement();
$arLoadProductArray = array("MODIFIED_BY" => $USER->GetID(), "IBLOCK_ID" => IB_SUB_EVENT_ID, "ACTIVE" => "Y");
CIBlockElement::SetPropertyValueCode($eventID, "PUBLIC", array('VALUE' => PROP_EVENT_PUBLIC));
return $el->update($eventID, $arLoadProductArray);
}
示例9: RatingProduct
function RatingProduct(&$arFields)
{
//id инфоблока отзывов 8
if($arFields['IBLOCK_ID'] == 8)
{
$section_id = 0;
$arSelect = Array("IBLOCK_SECTION_ID");
$arFilter = Array("ID"=>$arFields['ID'], "ACTIVE"=>"Y");
$res = CIBlockElement::GetList(Array(), $arFilter, false, false, $arSelect);
while($ob = $res->GetNextElement())
{
$arResult = $ob->GetFields();
$section_id= $arResult['IBLOCK_SECTION_ID'];
}
/*Получаем рейтинги*/
$ratings = self::listElementReviewsRating($arFields['IBLOCK_ID'],$section_id);
$sum_rating = 0;
/*Считаем рейтинг*/
foreach($ratings as $rat)
{
$sum_rating += $rat;
}
$rating = $sum_rating/count($ratings);
/*получаем символьный код раздела для связи его с товаром*/
$res = CIBlockSection::GetByID($section_id);
if($ar_res = $res->GetNext())
$code = $ar_res['CODE'];
/*Получаем id нужного товара для установки его рейтинга*/
$arSelect = Array("ID", "NAME", "CODE");
$arFilter = Array("IBLOCK_ID"=>7, "ACTIVE"=>"Y", "CODE"=>$code);
$res = CIBlockElement::GetList(Array(), $arFilter, false, false, $arSelect);
while($ob = $res->GetNextElement())
{
$arResult = $ob->GetFields();
$PRODUCT_ID = $arResult['ID'];
}
/*Устаналиваем рейтинг*/
CIBlockElement::SetPropertyValueCode($PRODUCT_ID, "rating", $rating);
CIBlockElement::SetPropertyValueCode($PRODUCT_ID, "vote_count", count($ratings));
}
}
示例10: array
<?php
require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_before.php";
CModule::IncludeModule("iblock");
CModule::IncludeModule("highloadblock");
for ($group = 1; $group <= 9; $group++) {
$filter = array("UF_GROUPS" => $group);
$rsUsers = CUser::GetList($by = "LAST_NAME", $order = "asc", $filter, array('NAV_PARAMS' => array("nTopCount" => 0)));
CIBlockElement::SetPropertyValueCode($group, "USERS", $rsUsers->NavRecordCount);
echo "count = " . $rsUsers->NavRecordCount;
}
示例11: removeImages
/**
* [removeImages description]
* @param int $id
* @return true
*/
protected function removeImages($id){
if (!CModule::IncludeModule("iblock")):
return false;
endif;
$db_props = CIBlockElement::GetProperty($this->getIblockId(), $id, array("sort" => "asc"), Array("CODE"=>"IMAGES"));
while($ar_props = $db_props->Fetch()):
if ($ar_props["PROPERTY_VALUE_ID"]):
$arFile["MODULE_ID"] = "iblock";
$arFile["del"] = "Y";
CIBlockElement::SetPropertyValueCode($id, "IMAGES", Array ($ar_props["PROPERTY_VALUE_ID"] => Array("VALUE"=>$arFile)));
CFile::Delete($ar_props["PROPERTY_VALUE_ID"]);
endif;
endwhile;
return true;
}
示例12: send_message_event
/**
* Отправляем уведомления пользователям об акциях
* User: Tabota Oleg (sForge.ru)
* Date: 18.11.12 16:20
* File name: send_message_event.php
*/
function send_message_event()
{
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_before.php";
CModule::IncludeModule("iblock");
global $DB;
$clubListID = array();
$userListID = array();
$stokAll = array();
$stokAllUser = array();
// Выбираем все акции по кторым нужно разослать уведомления
$resStoskListNoSend = $DB->Query("SELECT * FROM a_send_notice");
/**
* Собираем список событий по которым отправляем уведомления
* И список пользователей
*/
while ($row = $resStoskListNoSend->Fetch()) {
$stokAll = array_merge((array) $stokAll, (array) explode("|", $row['EVENT_ID']));
$stokAllUser[$row['USER_ID']] = $row['USER_ID'];
}
if (!count($stokAll)) {
return "send_message_event();";
}
// собираем все акции всех клубов которые активны на данный момент и которые нужно разослать
// TODO нужно еще и события рассылать
$resStock = CIBlockElement::GetList(array("SORT" => "DESC"), array("IBLOCK_ID" => IB_SUB_STOCK_ID, ">=DATE_ACTIVE_TO" => date("d.m.Y"), "ID" => $stokAll), false, false, array("ID", "PROPERTY_CLUB_ID"));
$idl = array();
while ($obj = $resStock->Fetch()) {
$clubID = intval($obj['PROPERTY_CLUB_ID_VALUE']);
$clubListID[$clubID] = $clubID;
$idl[] = $obj['ID'];
}
// Собираем всех пользователей которые подписанны на действующие акции и которым нужно разослать сегодня
$res = CIBlockElement::GetList(array("SORT" => "DESC"), array("IBLOCK_ID" => IB_USER_PROPS, "PROPERTY_LINK_STOK" => $clubListID, "PROPERTY_USER" => $stokAllUser), false, false, array("ID", "PROPERTY_USER", "PROPERTY_LINK_STOK", "PROPERTY_LINK_NEWS", "PROPERTY_LINK_EVENT", "PROPERTY_NOTICE", "PROPERTY_DATE_SEND"));
$day_now = date('w');
$day_now = $day_now == 0 ? 7 : $day_now;
while ($obj = $res->Fetch()) {
$PROPERTY_NOTICE_VALUE = unserialize($obj['PROPERTY_NOTICE_VALUE']);
$day_send = $PROPERTY_NOTICE_VALUE['day'];
$metod = intval($PROPERTY_NOTICE_VALUE['stock']["count"]);
if (in_array($day_now, $day_send)) {
// если должны отправить сегодня, то отправляем уведомления
$usersProps[] = array("MEOD" => $metod, "USER_ID" => $obj['PROPERTY_USER_VALUE'], "PROPS_ID" => $obj['ID']);
$userListID[] = intval($obj['PROPERTY_USER_VALUE']);
}
}
if (count($userListID)) {
$arUser = User::getList($userListID);
$sms = new Smsc();
foreach ($usersProps as $var) {
//отсылаем всем уведомления
$send = false;
if (in_array("sms", $var["MEOD"])) {
$user = $arUser[$var['USER_ID']];
$sms->send_sms($user["PERSONAL_PHONE"], "Новые акции в заведениях, на которые вы подписаны!\nС уважением MyTb.ru");
$send = true;
}
if (in_array("email", $var["MEOD"])) {
$user = $arUser[$var['USER_ID']];
$arEventFields = array("NAME" => $user["NAME"] . " " . $user["LAST_NAME"], "EMAIL" => $user["EMAIL"]);
CEvent::Send("SEND_MESSGE_EVENT", "s1", $arEventFields);
$send = true;
}
if ($send) {
CIBlockElement::SetPropertyValueCode(intval($var["PROPS_ID"]), "DATE_SEND", date("d.m.Y H:i:s"));
$DB->Query("DELETE FROM a_send_notice WHERE USER_ID='{$var['USER_ID']}'");
}
}
}
return "send_message_event();";
}
示例13: setCodePhoneConfirm
/**
* Устанавливаем код для подтверждения телефона
*
* @param $code
*
* @return array|bool|mixed
*/
function setCodePhoneConfirm($code)
{
$ob = CIBlockElement::GetList(array("SORT" => "ASC"), array("PROPERTY_USER" => $this->user["ID"]), FALSE, FALSE, array("ID"));
$PropsUser = $ob->Fetch();
if (!$PropsUser) {
return FALSE;
}
CIBlockElement::SetPropertyValueCode(intval($PropsUser["ID"]), "CODE_PHONE", $code);
return $ob->Fetch();
}