本文整理汇总了PHP中CCourse::Add方法的典型用法代码示例。如果您正苦于以下问题:PHP CCourse::Add方法的具体用法?PHP CCourse::Add怎么用?PHP CCourse::Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCourse
的用法示例。
在下文中一共展示了CCourse::Add方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: CreateCourse
protected function CreateCourse()
{
global $APPLICATION;
if (strlen($this->LAST_ERROR) > 0) {
return false;
}
if (!($title = $this->objXML->SelectNodes("/manifest/organizations/organization/title"))) {
$this->LAST_ERROR = GetMessage("LEARNING_BAD_NAME");
return false;
}
$arFields = array("NAME" => $title->content, "SITE_ID" => $this->arSITE_ID, "SCORM" => "Y");
$course = new CCourse();
$this->COURSE_ID = $course->Add($arFields);
if ($this->COURSE_ID === false) {
if ($err = $APPLICATION->GetException()) {
$this->LAST_ERROR = $err->GetString();
}
return false;
}
return true;
}
示例2: 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;
}
示例3: array
$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)) {
// Process permissions
$arPostedRights = array();
if (is_array($_POST['LESSON_RIGHTS'])) {
$arPostedRights = $_POST['LESSON_RIGHTS'];
}
$arAccessSymbols = array();
$arTaskIds = array();