|
@@ 164-172 (lines=9) @@
|
| 161 |
|
echo json_encode(['id' => $media_object->getXref(), 'text' => Select2::mediaObjectValue($media_object)]); |
| 162 |
|
break; |
| 163 |
|
|
| 164 |
|
case 'create-note-object': |
| 165 |
|
// Create a note, and return parameters needed by Select2 |
| 166 |
|
header('Content-type: application/json'); |
| 167 |
|
$note = Filter::post('note'); |
| 168 |
|
$gedcom = "0 @new@ NOTE " . str_replace("\n", "\n1 CONT ", $note); |
| 169 |
|
$note_object = $WT_TREE->createRecord($gedcom); |
| 170 |
|
echo json_encode(['id' => $note_object->getXref(), 'text' => Select2::noteValue($note_object)]); |
| 171 |
|
break; |
| 172 |
|
|
| 173 |
|
case 'create-repository': |
| 174 |
|
// Create a repository, and return parameters needed by Select2 |
| 175 |
|
header('Content-type: application/json'); |
|
@@ 173-181 (lines=9) @@
|
| 170 |
|
echo json_encode(['id' => $note_object->getXref(), 'text' => Select2::noteValue($note_object)]); |
| 171 |
|
break; |
| 172 |
|
|
| 173 |
|
case 'create-repository': |
| 174 |
|
// Create a repository, and return parameters needed by Select2 |
| 175 |
|
header('Content-type: application/json'); |
| 176 |
|
$repository_name = Filter::post('repository_name'); |
| 177 |
|
$gedcom = "0 @new@ REPO\n1 NAME " . $repository_name; |
| 178 |
|
$repository = $WT_TREE->createRecord($gedcom); |
| 179 |
|
echo json_encode(['id' => $repository->getXref(), 'text' => Select2::repositoryValue($repository)]); |
| 180 |
|
break; |
| 181 |
|
|
| 182 |
|
case 'create-source': |
| 183 |
|
// Create a source, and return parameters needed by Select2 |
| 184 |
|
header('Content-type: application/json'); |