当前位置: 首页>>代码示例>>PHP>>正文


PHP CIBlockElement::Add方法代码示例

本文整理汇总了PHP中CIBlockElement::Add方法的典型用法代码示例。如果您正苦于以下问题:PHP CIBlockElement::Add方法的具体用法?PHP CIBlockElement::Add怎么用?PHP CIBlockElement::Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CIBlockElement的用法示例。


在下文中一共展示了CIBlockElement::Add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: addPropsBlock

 /**
  * Добавляем инфоблок дополнительных свойств пользователя
  * @param $name
  */
 function addPropsBlock($name)
 {
     global $USER;
     $PROP['PROPERTY_USER'] = $this->getUserId();
     $arLoadProductArray = array("MODIFIED_BY" => $USER->GetID(), "IBLOCK_ID" => IB_USER_PROPS, "PROPERTY_VALUES" => $PROP, "NAME" => $name, "ACTIVE" => "Y");
     return CIBlockElement::Add($arLoadProductArray);
 }
开发者ID:nProfessor,项目名称:Mytb,代码行数:11,代码来源:User.php

示例2: Execute

 public function Execute()
 {
     if (!CModule::IncludeModule("intranet")) {
         return CBPActivityExecutionStatus::Closed;
     }
     $absenceIblockId = COption::GetOptionInt("intranet", 'iblock_absence', 0);
     if ($absenceIblockId <= 0) {
         return CBPActivityExecutionStatus::Closed;
     }
     $rootActivity = $this->GetRootActivity();
     $documentId = $rootActivity->GetDocumentId();
     $documentService = $this->workflow->GetService("DocumentService");
     $arAbsenceUserTmp = $this->AbsenceUser;
     $arAbsenceUser = CBPHelper::ExtractUsers($arAbsenceUserTmp, $documentId, false);
     $arAbsenceTypes = array();
     $dbTypeRes = CIBlockPropertyEnum::GetList(array("SORT" => "ASC", "VALUE" => "ASC"), array('IBLOCK_ID' => $absenceIblockId, 'PROPERTY_ID' => 'ABSENCE_TYPE'));
     while ($arTypeValue = $dbTypeRes->GetNext()) {
         $arAbsenceTypes[$arTypeValue['XML_ID']] = $arTypeValue['ID'];
     }
     foreach ($arAbsenceUser as $absenceUser) {
         $arFields = array("ACTIVE" => "Y", "IBLOCK_ID" => $absenceIblockId, 'ACTIVE_FROM' => $this->AbsenceFrom, 'ACTIVE_TO' => $this->AbsenceTo, "NAME" => $this->AbsenceName, "PREVIEW_TEXT" => $this->AbsenceDesrc, "PREVIEW_TEXT_TYPE" => "text", "PROPERTY_VALUES" => array("USER" => $absenceUser, "STATE" => $this->AbsenceState, "FINISH_STATE" => $this->AbsenceFinishState, "ABSENCE_TYPE" => $arAbsenceTypes[$this->AbsenceType]));
         $el = new CIBlockElement();
         $el->Add($arFields);
     }
     return CBPActivityExecutionStatus::Closed;
 }
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:26,代码来源:absenceactivity.php

示例3: AddProduct

 function AddProduct($NAME)
 {
     $iblock_permission = CIBlock::GetPermission(IBLOCK_ID);
     if ($iblock_permission < "W") {
         $GLOBALS["USER"]->RequiredHTTPAuthBasic();
         return new CSOAPFault('Server Error', 'Unable to authorize user.');
     }
     $code = self::translit($NAME);
     $i = 1;
     while (true) {
         $res = CIBlockElement::Getlist(array(), array("CODE" => $code), false, array("CODE"));
         if ($res->Fetch()) {
             $code = self::translit($NAME) . $i;
         } else {
             break;
         }
         $i++;
     }
     $arFields = array("IBLOCK_ID" => IBLOCK_ID, "NAME" => $NAME);
     $ib_element = new CIBlockElement();
     $result = $ib_element->Add($arFields);
     if ($result > 0) {
         return $result;
     }
     return new CSOAPFault('Server Error', 'Error: ' . $ib_element->LAST_ERROR);
 }
开发者ID:doppler324,项目名称:componentforworkingwithbitrix,代码行数:26,代码来源:HelperProduct.php

示例4: trackStartedTask

function trackStartedTask($stopStartedTask = true)
{
    CModule::IncludeModule('iblock');
    $res = CIBlockElement::GetList(array(), array("IBLOCK_ID" => TASKS_IBLOCK_ID, 'ACTIVE' => 'Y', "PROPERTY_PROGRAMMER" => CUser::GetID(), "PROPERTY_STATUS" => STATUS_LIST_WORK), false, false, array('ID', 'NAME', 'PROPERTY_PROJECT', 'PROPERTY_STATUS_DATE'));
    if ($taskArr = $res->Fetch()) {
        if ($stopStartedTask) {
            CIBlockElement::SetPropertyValuesEx($taskArr['ID'], TASKS_IBLOCK_ID, array('STATUS' => STATUS_LIST_PAUSE));
        }
        $link = TASKS_LIST_URL . $taskArr["PROPERTY_PROJECT_VALUE"] . '/' . $taskArr['ID'] . '/';
        $date = new DateTime($taskArr["PROPERTY_STATUS_DATE_VALUE"]);
        $curdate = new DateTime();
        $diff = $date->diff($curdate);
        $h = $diff->format('%h');
        $i = $diff->format('%i');
        if ($h || $i) {
            $timingText = '';
            if ($h) {
                $timingText = "{$h} ч, ";
            }
            if ($i) {
                $timingText = $timingText . "{$i} мин. ";
            }
            $decTime = $h + $i / 60;
            $decTime = round($decTime, 2);
            $el = new CIBlockElement();
            if ($el->Add(array("DATE_ACTIVE_FROM" => ConvertTimeStamp(time(), "SHORT"), "MODIFIED_BY" => CUser::GetID(), "IBLOCK_SECTION_ID" => false, "IBLOCK_ID" => TRACKING_IBLOCK_ID, "NAME" => 'Без названия' . ' (' . $decTime . 'ч.)', "ACTIVE" => "Y", "PROPERTY_VALUES" => array("HOURS" => $decTime, "TASK" => $taskArr['ID'])))) {
                crmEntitiesHelper::recalcTaskTracking($taskArr['ID']);
                ToolTip::Add("+ {$timingText} в трекер задачи \"<a target=\"_blank\" href=\"{$link}\">{$taskArr['ID']} {$taskArr['NAME']}</a>\"");
            } else {
                ToolTip::AddError($el->LAST_ERROR);
            }
        }
    }
}
开发者ID:kudin,项目名称:crm,代码行数:34,代码来源:functions.php

示例5: add

 function add($data)
 {
     global $USER;
     $el = new CIBlockElement();
     $arLoadProductArray = array("MODIFIED_BY" => $USER->GetID(), "IBLOCK_ID" => IB_SUB_STOCK_ID, "PROPERTY_VALUES" => array('CLUB_ID' => $this->clubID), "ACTIVE_TO" => date("d.m.Y", strtotime($data['ACTIVE_TO'])), "ACTIVE_FROM" => date("d.m.Y", strtotime($data['ACTIVE_FROM'])), "NAME" => trim(strip_tags($data['NAME'])), "ACTIVE" => "Y", "DETAIL_TEXT" => trim($data['DETAIL_TEXT']));
     return $el->Add($arLoadProductArray);
 }
开发者ID:nProfessor,项目名称:Mytb,代码行数:7,代码来源:Stocks.php

示例6: addResult

function addResult($STEP, $PARAMS){
	if (!CModule::IncludeModule("iblock")):
		return false;
	endif;
	global $USER;
	$actionStr = getActionStr($STEP);
	$el = new CIBlockElement;
	$PROP = array();
	$PROP = array(
		"TIME" => mktime(),
		"ACTION" => $actionStr,
		"STATUS" => "wait",
		"TYPE" => $STEP,
		"PARAMS" => $PARAMS,
		"MESSAGE" => "Ожидает"
		);
	$arLoadProductArray = Array(
	  "MODIFIED_BY"    => $USER->GetID(), // элемент изменен текущим пользователем
	  "IBLOCK_ID"      => 23,
	  "PROPERTY_VALUES"=> $PROP,
	  "NAME"           => $actionStr,
	  "ACTIVE"         => "Y",// активен
	  );
	if($ID = $el->Add($arLoadProductArray)):
		return $ID;
	endif;
}
开发者ID:akniyev,项目名称:arteva.ru,代码行数:27,代码来源:addProcess.php

示例7: storeResult

function storeResult($arResult, $arParams) {
    $iblock = CIBlock::GetList(
        array(),
        array(
            'TYPE' => $arParams['IBLOCK_TYPE'],
            'CODE' => $arParams['IBLOCK_CODE'],
        )
    );
    $iblock = $iblock->Fetch();
    
    $el = new CIBlockElement;

    $props = array();
    foreach ($arResult['FIELDS_LIST'] as $arField) {
        if ($arField['FIELD_TYPE'] == 'TEXT' || $arField['FIELD_TYPE'] == 'NUMBER') {
            $props[$arField['CODE']] = array(
                'VALUE' => $arResult['POST_DATA']['~'.$arField['CODE']],
            );
        } elseif ($arField['FIELD_TYPE'] == 'TEXTAREA') {
            $props[$arField['CODE']] = array(
                'VALUE' => array(
                    'TYPE' => 'text',
                    'TEXT' => $arResult['POST_DATA']['~'.$arField['CODE']],
                ),
            );
        } elseif ($arField['FIELD_TYPE'] == 'LIST') {
            $propEnum = CIBlockPropertyEnum::GetList(
                array(),
                array(
                    'XML_ID' => $arResult['POST_DATA']['~'.$arField['CODE']],
                    'CODE' => $arField['CODE'],
                    'IBLOCK_ID' => $iblock['ID'],
                )
            );
            $propEnum = $propEnum->Fetch();
            if ( ! $propEnum) return false;

            $props[$arField['CODE']] = array(
                'VALUE' => $propEnum['ID'],
            );
        }
    }

    $res = $el->Add(array(
        'IBLOCK_TYPE' => $arParams['IBLOCK_TYPE'],
        'IBLOCK_ID' => $iblock['ID'],
        'ACTIVE' => 'Y',
        'PROPERTY_VALUES' => $props,
        'ACTIVE_FROM' => ConvertTimeStamp(time()+CTimeZone::GetOffset(), 'FULL'),
        'NAME' => 'Form result', # !!! NEED TO REPLACE TO DEFAULT VALUE
    ));

    if (!$res) {
        return array(
            'MESSAGE' => $el->LAST_ERROR,
        );
    }

    return true;
}
开发者ID:ASDAFF,项目名称:bitrix-advanced-form,代码行数:60,代码来源:store_result.php

示例8: Add

 /**
  * <p>Метод добавляет новую Wiki-страницу. Динамичный метод.</p>
  *
  *
  * @param array $arFields  <a href="http://dev.1c-bitrix.ru/api_help/iblock/classes/ciblock/add.php">CIBlock::Add</a>
  *
  * @return int 
  *
  * <h4>Example</h4> 
  * <pre>
  * &lt;?<br>
  * // Добавим Wiki-страницу в инфо.блок с идентификатором 2
  * 
  * $arFields = array(
  * 	'ACTIVE' =&gt; 'Y',
  * 	'IBLOCK_ID' =&gt; 2,
  * 	'DETAIL_TEXT_TYPE' =&gt; 'html',
  * 	'DETAIL_TEXT' =&gt; '&lt;br/&gt;&lt;h2&gt;Тестовая страница&lt;/h2&gt;&lt;br/&gt;',
  * 	'NAME' =&gt; 'Тестовая страница'
  * );
  * $CWiki = new CWiki();
  * if (!($ID = $CWiki-&gt;Add($arFields)))
  * 	echo 'Ошибка. Страница не создана.';
  * ?&gt;
  * </pre>
  *
  *
  * <h4>See Also</h4> 
  * <ul> <li> <a href="http://dev.1c-bitrix.ru/api_help/wiki/classes/cwiki/Update.php">CWiki::Update</a> </li> </ul><a
  * name="examples"></a>
  *
  *
  * @static
  * @link http://dev.1c-bitrix.ru/api_help/wiki/classes/cwiki/Add.php
  * @author Bitrix
  */
 public function Add($arFields)
 {
     $arFields['XML_ID'] = $arFields['NAME'];
     $arCats = array();
     $CWikiParser = new CWikiParser();
     $arFields['DETAIL_TEXT'] = $CWikiParser->parseBeforeSave($arFields['DETAIL_TEXT'], $arCats, $arFields['NAME_TEMPLATE']);
     if (CWikiSocnet::IsSocNet()) {
         $arFields['IBLOCK_SECTION_ID'] = CWikiSocnet::$iCatId;
     }
     //add item
     $ID = $this->cIB_E->Add($arFields);
     $this->CleanCache($ID, $arFields['NAME'], $arFields['IBLOCK_ID']);
     //serve category / bindings
     $this->UpdateCategory($ID, $arFields['IBLOCK_ID'], $arCats);
     //$this->UpdateHistory($ID, $arFields['IBLOCK_ID']);
     return $ID;
 }
开发者ID:andy-profi,项目名称:bxApiDocs,代码行数:53,代码来源:wiki.php

示例9: agent_kingcoupon_pars

/**
 * Created by JetBrains PhpStorm.
 * User: oleg
 * Date: 01.10.12
 * Time: 21:06
 * To change this template use File | Settings | File Templates.
 */
function agent_kingcoupon_pars()
{
    require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_before.php";
    CModule::IncludeModule("iblock");
    CModule::IncludeModule("mytb");
    $content = file_get_contents("http://kingcoupon.ru/offer/category/Food/");
    preg_match_all("#kingcoupon\\.ru/offer/([0-9]+)/#is", $content, $arr);
    $xml = file_get_contents("http://kingcoupon.ru/offer/export/?refId=100132540459877345");
    $svg = new SimpleXMLElement($xml);
    $clubListID = array();
    foreach ($arr[1] as $var) {
        $clubListID[$var] = $var;
    }
    foreach ($svg->offers->offer as $var) {
        $R = array();
        if (in_array($var->id, $arr[1])) {
            $R['clubName'] = (string) $var->supplier->name;
            foreach ((array) $var->supplier->addresses as $address) {
                if (is_array($address)) {
                    foreach ((array) $address as $var1) {
                        $R['clubAdress'][] = (string) $var1->name;
                    }
                } else {
                    $R['clubAdress'][] = $address->name;
                }
            }
            foreach ((array) $var->supplier->tel as $tel) {
                $R['clubPhone'][] = $tel;
            }
            $id = $var->id;
            $url = preg_replace("#http://#i", "", $var->supplier->url);
            $url = preg_replace("#^([^/]+)/.*#i", "\\1", $url);
            $url = str_replace("www.", "", $url);
            $R['url'] = $url;
            $arSelect = array("ID", "NAME");
            $arFilter = array("IBLOCK_ID" => IB_CLUB_ID, "PROPERTY_SITE" => "%" . $url . "%");
            $res = CIBlockElement::GetList(array("SORT" => "DESC"), $arFilter, FALSE, FALSE, $arSelect);
            if (!$res->Fetch()) {
                $PROP = array();
                //                $PROP["PHONE"]   = $R['clubPhone'];
                //                $PROP["ADDRESS"] = $R['clubAdress'];
                $PROP["SITE"] = $R['url'];
                $PROP["LIST"] = array(54);
                $el = new CIBlockElement();
                $arLoadProductArray = array("IBLOCK_ID" => IB_CLUB_ID, "PROPERTY_VALUES" => $PROP, "NAME" => $R['clubName'], "TAGS" => "kingcoupon", "ACTIVE" => "Y", "SORT" => "0");
                if ($PRODUCT_ID = $el->Add($arLoadProductArray)) {
                    foreach ($R['clubAdress'] as $addressItem) {
                        MyTbCore::Add(array("CLUB_ID" => $PRODUCT_ID, "SITY_ID" => 1, "ADDRESS" => $addressItem, "PHONE" => serialize($R['clubPhone'])), "address");
                        printAr($addressItem);
                    }
                } else {
                    echo "Error: " . $el->LAST_ERROR;
                }
            }
        }
    }
    return "agent_kingcoupon_pars();";
}
开发者ID:nProfessor,项目名称:Mytb,代码行数:65,代码来源:kingcoupon_pars.php

示例10: executeUp

 function executeUp()
 {
     CModule::IncludeModule('iblock');
     $obj_ib_element = new CIBlockElement();
     $r = $obj_ib_element->Add(array('NAME' => 'sone new name here', 'IBLOCK_ID' => self::IBLOCK_ID, 'ACTIVE' => 'Y'));
     if (!$r) {
         throw new \Exception('Fail do add new element!!!');
     }
     return true;
 }
开发者ID:u-mulder,项目名称:bixmigs,代码行数:10,代码来源:Mgr_20150101_102030_task_2001.php

示例11: addElement

 private function addElement($arFields)
 {
     $el = new \CIBlockElement();
     if ($elID = $el->Add($arFields)) {
         $this->message .= \Helper::boldColorText("Елемент - <{$arFields['XML_ID']}> успешно добавлен", 'green');
     } else {
         $err = "Добавление элемента <{$arFields['XML_ID']}> не удалось((( - {$el->LAST_ERROR}";
         $this->errors .= \Helper::boldColorText($err, "red");
     }
 }
开发者ID:HannibalLecktor,项目名称:alfa74,代码行数:10,代码来源:parser.php

示例12: add

 /**
  * Добавляет элемент
  *
  * @param array $fields
  * @param array $properties
  *
  * @return int|null
  */
 public function add(array $fields, array $properties = array())
 {
     if ($id = $this->iBEGateway->Add($fields)) {
         if (!empty($properties)) {
             \CIBlockElement::SetPropertyValuesEx($id, $fields['IBLOCK_ID'], $properties);
         }
         return $id;
     }
     return null;
 }
开发者ID:rocko61rus,项目名称:QuetzalTools,代码行数:18,代码来源:IBlockElementManager.php

示例13: connectToUser

 public static function connectToUser($userID, $providerName, $userProfile)
 {
     CModule::IncludeModule("iblock");
     $el = new \CIBlockElement();
     $PROP = array();
     $PROP["USER_ID"] = $userID;
     $PROP["SOCIAL_PROVIDER"] = $providerName;
     $PROP["SOCIAL_ID"] = $userProfile["identifier"];
     $arLoadProductArray = array("IBLOCK_SECTION_ID" => false, "IBLOCK_ID" => USER_SOCIAL_IB, "PROPERTY_VALUES" => $PROP, "NAME" => trim("Пользователь №" . $userID), "ACTIVE" => "Y");
     $el->Add($arLoadProductArray);
     \CUserEx::capacityAdd($userID, 1);
 }
开发者ID:Hawkart,项目名称:megatv,代码行数:12,代码来源:CSocialAuth.php

示例14: save

 public function save()
 {
     \Bitrix\Main\Loader::includeModule("iblock");
     $errors =& $this->arResult["forms"][$this->request->getPost("id")]["errors"];
     $el = new CIBlockElement();
     $this->element_id = $el->Add(array("IBLOCK_ID" => 4, "NAME" => "({$this->arResult["forms"][$this->request->getPost("id")]["title"]})Обращение от {$this->request->getPost("first_name")} {$this->request->getPost("last_name")}", "PREVIEW_TEXT" => $this->request->getPost("comment"), "PROPERTY_VALUES" => array("TREATMENT_REASON" => $this->request->getPost("reason_for_treatment"), "PHONE" => $this->request->getPost("phone"), "EMAIL" => $this->request->getPost("email"), "FILE" => $this->request->getFile("file"))));
     if ($this->element_id !== false) {
         return true;
     }
     $errors[] = $res->LAST_ERROR;
     return false;
 }
开发者ID:dimabresky,项目名称:new-channel-site-project-source-code,代码行数:12,代码来源:class.php

示例15: addElementReview

function addElementReview($arResult, $ID_SECTION, $IBLOCK_ID)
{
    CModule::IncludeModule('iblock');
    $property_enums = CIBlockPropertyEnum::GetList(array("DEF" => "DESC", "SORT" => "ASC"), array("IBLOCK_ID" => $IBLOCK_ID, "CODE" => "RATING", "VALUE" => $arResult['RATING']));
    while ($rating = $property_enums->GetNext()) {
        $arRating = $rating["ID"];
    }
    $current_date = dateActiveFrom(date('d.m.Y'));
    $NAME = $current_date . ' ' . $arResult['NAME'];
    $arFields = array("ACTIVE" => "N", "IBLOCK_ID" => $IBLOCK_ID, "IBLOCK_SECTION_ID" => $ID_SECTION, "NAME" => $NAME, "DETAIL_TEXT" => "Описание элемента", "PROPERTY_VALUES" => array("NAME" => $arResult['NAME'], "EMAIL" => $arResult['EMAIL'], "RATING" => array('VALUE' => $arRating), "BENEFITS" => $arResult['BENEFITS'], "DISADVANTAGES" => $arResult['DISADVANTAGES'], "COMMENT" => $arResult['COMMENT']));
    $oElement = new CIBlockElement();
    $idElement = $oElement->Add($arFields, false, false, true);
    return $idElement;
}
开发者ID:CheBurashka334,项目名称:zakrepi,代码行数:14,代码来源:add_comment.php


注:本文中的CIBlockElement::Add方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。