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


PHP CCourse::Update方法代码示例

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


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

示例1: CreateCourse

 protected function CreateCourse()
 {
     global $APPLICATION;
     if (strlen($this->LAST_ERROR) > 0) {
         return false;
     }
     if (!($title = $this->objXML->SelectNodes("/manifest/organizations/organization/item/title"))) {
         $this->LAST_ERROR = GetMessage("LEARNING_BAD_NAME");
         return false;
     }
     $arFields = array("NAME" => $title->content, "SITE_ID" => $this->arSITE_ID);
     $course = new CCourse();
     $this->COURSE_ID = $course->Add($arFields);
     $res = $this->COURSE_ID;
     if (!$res) {
         if ($e = $APPLICATION->GetException()) {
             $this->LAST_ERROR = $e->GetString();
         }
         return false;
     }
     $r = new CDataXML();
     if (!$r->Load($this->package_dir . "/res1.xml")) {
         return false;
     }
     if (!($data = $r->SelectNodes("/coursetoc/"))) {
         return false;
     }
     $ar = $data->__toArray();
     $arFields = $this->_MakeFields($ar);
     $res = $course->Update($this->COURSE_ID, $arFields);
     if (!$res) {
         if ($e = $APPLICATION->GetException()) {
             $this->LAST_ERROR = $e->GetString();
         }
         return false;
     }
     CheckDirPath($_SERVER["DOCUMENT_ROOT"] . "/" . COption::GetOptionString("main", "upload_dir", "upload") . "/learning/" . $this->COURSE_ID);
     CLearnHelper::CopyDirFiles($this->package_dir . "/resources/res1", $_SERVER["DOCUMENT_ROOT"] . "/" . COption::GetOptionString("main", "upload_dir", "upload") . "/learning/" . $this->COURSE_ID . "/res1", true);
     return true;
 }
开发者ID:Satariall,项目名称:izurit,代码行数:40,代码来源:import.php

示例2: SaveInlineEditedItems

 public function SaveInlineEditedItems()
 {
     if (!$this->IsNeedSaveInlineEditedItems()) {
         return $this;
     }
     if (check_bitrix_sessid() !== true) {
         throw new CLearnRenderAdminUnilessonListException('', CLearnRenderAdminUnilessonListException::C_ACCESS_DENIED);
     }
     foreach ($_POST['FIELDS'] as $lessonId => $arFields) {
         $arEdgeProperties = array();
         $wasError = false;
         try {
             // skip not changed items
             if (!$this->oList->IsUpdated($lessonId)) {
                 continue;
             }
             // throws exception if access denied
             $this->EnsureLessonUpdateAccess($lessonId);
             $courseId = CLearnLesson::GetLinkedCourse($lessonId);
             // Depends on current list mode, we must update sort index
             // of element (only for course) or sort index of relation between
             // child and parent lessons.
             // So, we must rename SORT to COURSE_SORT or EDGE_SORT
             if (array_key_exists('SORT', $arFields)) {
                 if ($this->IsListAnyCoursesMode() && $courseId !== false) {
                     $arFields['COURSE_SORT'] = $arFields['SORT'];
                 } elseif ($this->IsListChildLessonsMode()) {
                     $arFields['EDGE_SORT'] = $arFields['SORT'];
                 } else {
                     throw new CLearnRenderAdminUnilessonListException('', CLearnRenderAdminUnilessonListException::C_LOGIC | CLearnRenderAdminUnilessonListException::C_ACTION_UPDATE_FAIL);
                 }
                 unset($arFields['SORT']);
             }
             if (isset($arFields['EDGE_SORT'])) {
                 if (isset($_GET['PARENT_LESSON_ID'])) {
                     $arEdgeProperties['SORT'] = $arFields['EDGE_SORT'];
                 }
                 unset($arFields['EDGE_SORT']);
             }
             // PUBLISH_PROHIBITED
             if (array_key_exists('PUBLISH_PROHIBITED', $arFields)) {
                 // PUBLISH_PROHIBITED available in context of most parent course only
                 if ($this->contextCourseLessonId !== false && in_array($arFields['PUBLISH_PROHIBITED'], array('N', 'Y'), true)) {
                     $isProhibited = true;
                     if ($arFields['PUBLISH_PROHIBITED'] === 'N') {
                         $isProhibited = false;
                     }
                     CLearnLesson::PublishProhibitionSetTo($lessonId, $this->contextCourseLessonId, $isProhibited);
                 }
                 unset($arFields['PUBLISH_PROHIBITED']);
             }
             // Courses must be updated throws CCourse::Update();
             if ($courseId === false) {
                 CLearnLesson::Update($lessonId, $arFields);
             } else {
                 $ob = new CCourse();
                 if (!$ob->Update($courseId, $arFields)) {
                     throw new CLearnRenderAdminUnilessonListException('', CLearnRenderAdminUnilessonListException::C_ACTION_UPDATE_FAIL);
                 }
                 unset($ob);
             }
             if (isset($_GET['PARENT_LESSON_ID']) && count($arEdgeProperties) > 0) {
                 CLearnLesson::RelationUpdate($_GET['PARENT_LESSON_ID'], $lessonId, $arEdgeProperties);
             }
         } catch (CLearnRenderAdminUnilessonListException $e) {
             $wasError = true;
             $errorText = $e->getMessage();
             $errorCode = $e->getCode();
         } catch (Exception $e) {
             $wasError = true;
             $errorText = $e->getMessage();
             $errorCode = 0;
             // Because we checks below only CLearnRenderAdminUnilessonListException codes
         }
         if ($wasError) {
             if ($errorCode & CLearnRenderAdminUnilessonListException::C_ACCESS_DENIED) {
                 // Access denied
                 $errmsg = GetMessage('LEARNING_SAVE_ERROR') . ': ' . GetMessage('LEARNING_ACCESS_D');
                 if (strlen($errorText) > 0) {
                     $errmsg .= ': ' . $errorText;
                 }
             } else {
                 // Some error occured during update operation
                 $errmsg = GetMessage('LEARNING_SAVE_ERROR') . $lessonId;
                 if (strlen($errorText) > 0) {
                     $errmsg .= ' (' . $errorText . ')';
                 }
             }
             $this->oList->AddUpdateError($errmsg, $lessonId);
         }
     }
     return $this;
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:93,代码来源:learn_unilesson_admin.php

示例3: CAdminForm

$aTabs[] = $USER_FIELD_MANAGER->EditFormTab('LEARNING_LESSONS');
$tabControl = new CAdminForm("courseTabControl", $aTabs, true, $bDenyAutosave);
if ($_SERVER["REQUEST_METHOD"] == "POST" && $Perm >= "X" && strlen($_POST["Update"]) > 0 && check_bitrix_sessid()) {
    $course = new CCourse();
    $arPREVIEW_PICTURE = $_FILES["PREVIEW_PICTURE"];
    $arPREVIEW_PICTURE["del"] = $PREVIEW_PICTURE_del;
    $arPREVIEW_PICTURE["MODULE_ID"] = "learning";
    $arPREVIEW_PICTURE["description"] = $PREVIEW_PICTURE_descr;
    $arFields = array("ACTIVE" => $ACTIVE, "NAME" => $NAME, "CODE" => $CODE, "SITE_ID" => $SITE_ID, "GROUP_ID" => $GROUP, "SORT" => $SORT, "DETAIL_TEXT" => $DETAIL_TEXT, "DETAIL_TEXT_TYPE" => $DETAIL_TEXT_TYPE, "PREVIEW_PICTURE" => $arPREVIEW_PICTURE, "PREVIEW_TEXT" => $PREVIEW_TEXT, "PREVIEW_TEXT_TYPE" => $PREVIEW_TEXT_TYPE, "ACTIVE_FROM" => $ACTIVE_FROM, "ACTIVE_TO" => $ACTIVE_TO, "RATING" => $RATING, "RATING_TYPE" => $RATING_TYPE);
    $USER_FIELD_MANAGER->EditFormAddFields('LEARNING_LESSONS', $arFields);
    $res = false;
    if ($COURSE_ID > 0) {
        $linkedLessonId = CCourse::CourseGetLinkedLesson($COURSE_ID);
        if ($linkedLessonId !== false) {
            if ($oAccess->IsLessonAccessible($linkedLessonId, CLearnAccess::OP_LESSON_WRITE)) {
                $res = $course->Update($COURSE_ID, $arFields);
            }
            // Process relations, data submitted from CLearnRelationHelper::RenderForm()
            CLearnRelationHelper::ProccessPOST($oAccess, $linkedLessonId);
        }
    } else {
        if ($oAccess->IsBaseAccess(CLearnAccess::OP_LESSON_CREATE)) {
            $COURSE_ID = $course->Add($arFields);
            $res = $COURSE_ID > 0;
        }
    }
    try {
        // Work with permissions
        if (isset($_POST['LESSON_RIGHTS_marker']) && $COURSE_ID > 0) {
            $linkedLessonId = CCourse::CourseGetLinkedLesson($COURSE_ID);
            if ($linkedLessonId !== false && $oAccess->IsLessonAccessible($linkedLessonId, CLearnAccess::OP_LESSON_MANAGE_RIGHTS)) {
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:31,代码来源:learn_course_edit.php

示例4: array

foreach ($arCourses as $key => $courseCode) {
    try {
        $dbResult = CCourse::GetList(array(), array("CODE" => $arCoursesSite[$key]));
        $pathToService = WIZARD_SERVICE_ABSOLUTE_PATH;
        if (!($arCourse = $dbResult->Fetch())) {
            $pathToCourse = WIZARD_SERVICE_RELATIVE_PATH . "/" . LANGUAGE_ID . "/" . $courseCode . "/";
            $package = new CCourseImport($pathToCourse, array(WIZARD_SITE_ID));
            if (strlen($package->LAST_ERROR) > 0) {
                return;
            }
            $success = $package->ImportPackage();
            if ($success) {
                $dbResult = CCourse::GetList(array(), array("CODE" => $courseCode));
                $arCourse = $dbResult->Fetch();
                $obCCourse = new CCourse();
                $obCCourse->Update($arCourse["ID"], array("CODE" => $arCoursesSite[$key]));
            }
        }
        /*
        it's new rights model now, rights mudt be set for every lesson and/or for module at all
        if (isset($arCourse["ID"])){
        	CCourse::SetPermission($arCourse["ID"], Array("2"=>"R"));
        
        }
        */
        CopyDirFiles($pathToService . "/" . LANGUAGE_ID . "/images/" . $courseCode . "/", WIZARD_SITE_PATH, $rewrite = false, $recursive = true);
    } catch (LearnException $e) {
    }
}
if (!WIZARD_IS_RERUN || WIZARD_FIRST_INSTAL !== "Y") {
    $obSite = CSite::GetByID(WIZARD_SITE_ID);
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:index.php


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