function perform()
 {
     // don't lose the db!
     $db = $_REQUEST['db'];
     if (isset($_POST['all'])) {
         $location_id = $_POST['all'];
     } else {
         $location_id = $_POST['visible'];
     }
     $short_name = $_POST['library'];
     $lib_f = new LibraryFinder($db);
     $library = $lib_f->getLibraryByName($short_name);
     $library_id = $library['library_id'];
     $lf = new LocationFinder($db);
     $location_name = $lf->getLocation($location_id);
     if (isset($_POST['add'])) {
         $add = $lf->addBridgeItem($location_id, $library_id, $location_name);
     } elseif (isset($_POST['remove'])) {
         $remove = $lf->removeBridgeItem($location_id, $library_id);
     } elseif (isset($_POST['up'])) {
         $location_id = $_POST['visible'];
         $up = $lf->moveBridgeItemUp($location_id, $library_id);
     } elseif (isset($_POST['down'])) {
         $location_id = $_POST['visible'];
         $down = $lf->moveBridgeItemDown($location_id, $library_id);
     }
     $loa = new LibraryAdminFormAction();
     $result = $loa->perform();
     $_REQUEST['library_id'] = $library['library_id'];
     $_REQUEST['library'] = $library['short_name'];
     $_REQUEST['full_name'] = $library['full_name'];
     $_REQUEST['parent_table'] = 'locations';
     $_REQUEST['locationList'] = $lf->findByLibraryID($library['library_id']);
     return $result;
 }
Ejemplo n.º 2
0
 function perform()
 {
     // don't lose the db!
     $db = $_REQUEST['db'];
     // decipher finder function (add or edit)
     //echo($_POST['option_pk']);
     if (isset($_POST['save']) && $_POST['option_pk'] == 0) {
         $function = 'addOption';
     } elseif (isset($_POST['save']) && $_POST['option_pk'] != '') {
         $function = 'editOption';
     }
     // OptionAddAction
     $finder = $_POST['parent_finder'];
     $table = $_POST['parent_table'];
     $option_pk = $_POST['option_pk'];
     $option = $_POST['option'];
     $parent_pk = $_POST['parent_pk'];
     $description = $_POST['description'];
     $examples = $_POST['examples'];
     $finder = new $finder($db);
     $option = $finder->{$function}($option_pk, $option, $parent_pk, $description, $examples);
     $short_name = $_POST['library'];
     $lib_f = new LibraryFinder($db);
     $library = $lib_f->getLibraryByName($short_name);
     header('Location: optionAdminForm.do?table=' . $table);
 }
 function perform()
 {
     // don't lose the db!
     $db = $_REQUEST['db'];
     // PatronTypeAddAction
     $patron_type = $_POST['new_option'];
     $parent_pk = $_POST['parent_pk'];
     $description = $_POST['description'];
     $examples = $_POST['examples'];
     $ptf = new PatronTypeFinder($db);
     $new_option = $ptf->addPatronType($patron_type, $parent_pk, $description, $examples);
     $short_name = $_POST['library'];
     $lib_f = new LibraryFinder($db);
     $library = $lib_f->getLibraryByName($short_name);
     $laa = new LibraryAdminAction();
     $result = $laa->perform();
     $result['library_id'] = $library['library_id'];
     $result['library'] = $library['short_name'];
     $result['full_name'] = $library['full_name'];
     return $result;
 }