CLesson::Add
int CLesson::Add( array arFields );
The Add method adds a new lesson.
Parameters
Parameter | Description |
---|---|
arFields | The array Array("field"=>"value", ...). Contains values of all lesson fields. Required fields must be present. |
Return Values
The method returns the ID of the added lesson on success, or false otherwise. If an error occurs, the exception will contain the error description.
See Also
Example
<? if (CModule::IncludeModule("learning")) { $COURSE_ID = 97; $arFields = Array( "ACTIVE" => "Y", "COURSE_ID" => $COURSE_ID, "NAME" => "Lesson 1", "SORT" => "1", "DETAIL_TEXT" => "It my first lesson ...", ); $lesson = new CLesson; $ID = $lesson->Add($arFields); $success = ($ID>0); if($success) { echo "Ok!"; } else { if($e = $APPLICATION->GetException()) echo "Error: ".$e->GetString(); } } ?>
© «Bitrix24», 2001-2024