1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: 104: 105: 106: 107: 108: 109: 110: 111: 112: 113: 114: 115: 116: 117: 118: 119: 120: 121: 122: 123: 124: 125: 126: 127: 128: 129: 130: 131: 132: 133: 134: 135: 136: 137: 138: 139: 140: 141: 142: 143: 144: 145: 146: 147:
<?php
class Notation
{
private $id;
private $module_name;
private $id_in_module;
private $user_id;
private $note;
private $notation_scale;
private $average_notes;
private $number_notes;
private $user_already_noted;
private $infos;
public function set_id($id)
{
$this->id = $id;
}
public function get_id()
{
return $this->id;
}
public function set_module_name($module)
{
$this->module_name = $module;
}
public function get_module_name()
{
return $this->module_name;
}
public function set_id_in_module($id_in_module)
{
$this->id_in_module = $id_in_module;
}
public function get_id_in_module()
{
return $this->id_in_module;
}
public function set_user_id($user_id)
{
$this->user_id = $user_id;
}
public function get_user_id()
{
return !empty($this->user_id) ? $this->user_id : AppContext::get_current_user()->get_id();
}
public function set_note($note)
{
$this->note = $note;
}
public function get_note()
{
return $this->note;
}
public function set_notation_scale($notation_scale)
{
$this->notation_scale = $notation_scale;
}
public function get_notation_scale()
{
if (!empty($this->notation_scale))
{
return $this->notation_scale;
}
return ContentManagementConfig::load()->get_notation_scale();
}
public function set_average_notes($average_notes)
{
$this->average_notes = (float)$average_notes;
}
public function get_average_notes()
{
if ($this->average_notes === null)
{
$this->init_database_infos();
return $this->infos['average_notes'];
}
return $this->average_notes;
}
public function set_number_notes($number_notes)
{
$this->number_notes = (int)$number_notes;
}
public function get_number_notes()
{
if ($this->number_notes === null)
{
$this->init_database_infos();
return $this->infos['number_notes'];
}
return $this->number_notes;
}
public function set_user_already_noted($user_already_noted)
{
$this->user_already_noted = (bool)$user_already_noted;
}
public function user_already_noted()
{
if ($this->user_already_noted === null)
{
$this->init_database_infos();
return $this->infos['user_already_noted'];
}
return $this->user_already_noted;
}
private function init_database_infos()
{
if ($this->infos === null)
{
$this->infos = NotationService::get_informations_note($this);
}
return $this->infos;
}
}
?>