moodle_local_treestudyplan/classes/coursemoduleinfo.php

37 lines
1.0 KiB
PHP
Raw Normal View History

<?php
namespace local_treestudyplan;
require_once($CFG->libdir.'/externallib.php');
require_once($CFG->libdir.'/modinfolib.php');
require_once($CFG->dirroot.'/course/lib.php');
use core_course\local\repository\caching_content_item_readonly_repository;
use core_course\local\repository\content_item_readonly_repository;
use \grade_item;
class coursemoduleinfo {
private $id;
private $cm;
private $cm_info;
private $db_record;
public function __construct($id){
global $DB;
// Determine the icon for the associated activity
$this->id = $id;
$this->cm = $DB->get_record("course_modules",["id" => $id]);
$this->cm_info = \cm_info::create($this->cm);
// $this->db_record = $DB->get_record($this->cm_info->modname,["id" => $this->cm_info->instance]);
}
public function getTitle(){
return $this->cm_info->name;
}
public function setTitle($value){
$this->cm_info->set_name($value);
// TODO: Actually save this after setting the cminfo
}
}