Create awesome courses in Moodle | Course Contents

Поділитися
Вставка
  • Опубліковано 25 лис 2024

КОМЕНТАРІ • 4

  • @saurabhgupta6764
    @saurabhgupta6764 2 роки тому

    Wonderful demonstration, Arjun...!

  • @chandankumar-jp4li
    @chandankumar-jp4li 6 місяців тому

    Please make a video on How to setup Global search in moodle in webserver?

  • @jouhny3061
    @jouhny3061 2 роки тому +1

    Can we make this by creating custom websevice sir

    • @moodlerarjun
      @moodlerarjun  2 роки тому

      Surely Yes. You can take below code sample as a reference:
      $record = new stdClass();
      if ($DB->record_exists('course_categories', array('name' =>$category))) {
      $catupdate = $DB->get_record('course_categories', array('name'=>$category));
      $catidupdate= $catupdate->id;
      $record->category = $catidupdate;
      } else {
      $recordcatgory->name= $category;
      $catlastinsertid = $DB->insert_record('course_categories',$recordcatgory, true);
      $record->category = $catlastinsertid;
      }
      $record->idnumber=$idnumber;
      $record->fullname = $subjectName;
      $record->shortname = $subjectGUID;
      $record->summary = $summary;
      $record->lang = 'en';
      $record->startdate = time();
      $record->timecreated = time();
      $record->timemodified = time();
      $record->cacherev = time();
      $courselastinsertid = $DB->insert_record('course', $record, true);
      remove_dir($CFG->dataroot.'/cache', true);
      if($courselastinsertid) {
      $statusCode = 200;
      $statusMessage = 'OK';
      $errorMessage = null;
      $coursetypelastinsertid = 0;
      }