本文整理汇总了PHP中CCourse::GetGroupPermissions方法的典型用法代码示例。如果您正苦于以下问题:PHP CCourse::GetGroupPermissions方法的具体用法?PHP CCourse::GetGroupPermissions怎么用?PHP CCourse::GetGroupPermissions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCourse
的用法示例。
在下文中一共展示了CCourse::GetGroupPermissions方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Update
//.........这里部分代码省略.........
* <h4>See Also</h4>
* <ul> <li> <a href="http://dev.1c-bitrix.ru/api_help/learning/fields.php#course">Поля курса</a> </li> <li> <a
* href="http://dev.1c-bitrix.ru/api_help/learning/classes/ccourse/index.php">CCourse</a>::<a
* href="http://dev.1c-bitrix.ru/api_help/learning/classes/ccourse/add.php">Add</a> </li> </ul> <a name="examples"></a>
*
*
* @static
* @link http://dev.1c-bitrix.ru/api_help/learning/classes/ccourse/update.php
* @author Bitrix
*/
public function Update($ID, $arFields)
{
global $DB;
$ID = intval($ID);
if ($ID < 1) {
return false;
}
if (is_set($arFields, "ACTIVE") && $arFields["ACTIVE"] != "Y") {
$arFields["ACTIVE"] = "N";
}
if (is_set($arFields, "DESCRIPTION_TYPE") && $arFields["DESCRIPTION_TYPE"] != "html") {
$arFields["DESCRIPTION_TYPE"] = "text";
}
if (is_set($arFields, "DETAIL_TEXT_TYPE") && $arFields["DETAIL_TEXT_TYPE"] != "html") {
$arFields["DETAIL_TEXT_TYPE"] = "text";
}
if (is_set($arFields, "PREVIEW_TEXT_TYPE") && $arFields["PREVIEW_TEXT_TYPE"] != "html") {
$arFields["PREVIEW_TEXT_TYPE"] = "text";
}
if (is_set($arFields, "RATING") && !in_array($arFields["RATING"], array("Y", "N"))) {
$arFields["RATING"] = NULL;
}
if (is_set($arFields, "RATING_TYPE") && !in_array($arFields["RATING_TYPE"], array("like", "standart_text", "like_graphic", "standart"))) {
$arFields["RATING_TYPE"] = NULL;
}
$lessonId = self::CourseGetLinkedLesson($ID);
if ($this->CheckFields($arFields, $ID) && $lessonId !== false) {
if (array_key_exists('ID', $arFields)) {
unset($arFields["ID"]);
}
$arFieldsLesson = $arFields;
$arFieldsToUnset = array('GROUP_ID', 'SITE_ID');
foreach ($arFieldsToUnset as $key => $value) {
if (array_key_exists($value, $arFieldsLesson)) {
unset($arFieldsLesson[$value]);
}
}
//Sites
if (is_set($arFields, "SITE_ID")) {
$str_LID = "''";
foreach ($arFields["SITE_ID"] as $lang) {
$str_LID .= ", '" . $DB->ForSql($lang) . "'";
}
$strSql = "DELETE FROM b_learn_course_site WHERE COURSE_ID=" . $ID;
$DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
$strSql = "INSERT INTO b_learn_course_site(COURSE_ID, SITE_ID) " . "SELECT " . $ID . ", LID " . "FROM b_lang " . "WHERE LID IN (" . $str_LID . ") ";
$DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
}
CLearnLesson::Update($lessonId, $arFieldsLesson);
if ($ID && (is_set($arFields, "NAME") || is_set($arFields, "DESCRIPTION") || is_set($arFields, 'DETAIL_TEXT'))) {
if (CModule::IncludeModule("search")) {
$rsCourse = CCourse::GetByID($ID);
if ($arCourse = $rsCourse->Fetch()) {
$arGroupPermissions = CCourse::GetGroupPermissions($arCourse["ID"]);
if (is_set($arFields, "SITE_ID")) {
$arSiteIds = array();
foreach ($arFields["SITE_ID"] as $lang) {
$rsSitePaths = CSitePath::GetList(array(), array("SITE_ID" => $lang, "TYPE" => "C"));
if ($arSitePaths = $rsSitePaths->Fetch()) {
$strPath = $arSitePaths["PATH"];
} else {
$strPath = "";
}
$arSiteIds[$lang] = str_replace("#COURSE_ID#", $ID, $strPath);
}
$detailText = '';
if ($arCourse["DETAIL_TEXT_TYPE"] !== 'text') {
$detailText = CSearch::KillTags($arCourse['DETAIL_TEXT']);
} else {
$detailText = strip_tags($arCourse['DETAIL_TEXT']);
}
$dataBody = '';
if (strlen($detailText) > 0) {
$dataBody = $detailText;
} else {
$dataBody = $arCourse['NAME'];
}
$arSearchIndex = array("LAST_MODIFIED" => $arCourse["TIMESTAMP_X"], "TITLE" => $arCourse["NAME"], "BODY" => $dataBody, "SITE_ID" => $arSiteIds, "PERMISSIONS" => $arGroupPermissions);
CSearch::Index("learning", "C" . $ID, $arSearchIndex);
}
CSearch::ChangePermission("learning", $arGroupPermissions, false, "C" . $arCourse["ID"]);
}
}
}
global $CACHE_MANAGER;
$CACHE_MANAGER->ClearByTag('LEARN_COURSE_' . $ID);
return true;
}
return false;
}