CMS  Version 3.9
link_form.inc
Go to the documentation of this file.
1 <?php
2 Fakoli::using("link_library", "taxonomy");
3 
4 $link_library_id = checkNumeric($_GET["link_library_id"]);
5 $link_id = checkNumeric($_GET["link_id"]);
6 
8 {
9  Fakoli::end("No link or library specified");
10 }
11 
12 if ($link_id)
13 {
14  $link = new LinkRecord($link_id);
15  $library = $link->LinkLibrary();
16 }
17 else
18 {
19  $link = new LinkRecord();
21  $link->link_library_id = $link_library_id;
22 }
23 
24 if (!$library->allowWriteAccess())
25 {
26  Fakoli::end("Access Denied");
27 }
28 
29 $form = new AutoForm($link, "POST", "/action/link_library/link_form?link_id={$link_id}&link_library_id={$link_library_id}");
30 $form->hide("link_library_id", "owner_id", "last_modified", "sort_order");
31 $form->ajaxSubmit("function(result) {LinkLibraryManager.linkEdited(result);}", "function() {document.id('{$form->id}_error').set('text','Failed to communicate with server'); }");
32 $form->allowDelete = true;
33 
35 
36 if ($method == "POST")
37 {
38  if ($form->save())
39  {
40  Fakoli::end("OK");
41  }
42  else
43  {
44  Fakoli::end($form->msg);
45  }
46 }
47 
48 $script .= $form->writeScript();
49 
50 $form->drawForm();
static using()
Import the datamodels, views and manifest for the specified component(s).
Definition: core.inc:116
static end($message="")
Use this method to terminate execution of a script instead of using the php keywords exit() or die().
Definition: core.inc:1149
static addTaxonomyFieldRenderers($form, $showSelectAll=true, $group=null, $limitTo=null)
$method
Pull out a simple reference to the request method.
Definition: core.inc:1573