function launch() { global $interface; global $configArray; $interface->assign('id', $_REQUEST['id']); $epubFile = new EContentItem(); $epubFile->id = $_REQUEST['id']; $epubFile->find(); if ($epubFile->N > 0) { $epubFile->fetch(); $interface->assign('epubFile', $epubFile); } //Load the pillar to display $structure = EContentItem::getObjectStructure(); $interface->setTemplate('view.tpl'); $interface->display('layout.tpl'); }
function launch() { global $interface; global $timer; global $configArray; global $user; $id = $_REQUEST['id']; $structure = EContentItem::getObjectStructure(); $ret = DataObjectUtil::saveObject($structure, 'EContentItem'); if (!$ret['validatedOk']) { echo "Item failed validation."; } elseif (!$ret['saveOk']) { echo "Could not save the new item"; } else { $object = $ret['object']; header("Location: " . $configArray['Site']['path'] . "/EcontentRecord/{$object->recordId}/Home"); } }
function launch() { global $interface; global $configArray; $isNew = true; if (isset($_REQUEST['id']) && strlen($_REQUEST['id']) > 0) { $epubFile = new EContentItem(); $epubFile->id = $_REQUEST['id']; $epubFile->find(); if ($epubFile->N > 0) { $epubFile->fetch(); $interface->assign('object', $epubFile); $interface->setPageTitle('Edit EPUB File'); $isNew = false; } } $structure = EContentItem::getObjectStructure(); if (isset($_REQUEST['submit'])) { //Save the object $results = DataObjectUtil::saveObject($structure, 'EContentItem'); $epubFile = $results['object']; //redirect to the view of the competency if we saved ok. if (!$results['validatedOk'] || !$results['saveOk']) { //Display the errors for the user. $interface->assign('errors', $results['errors']); $interface->assign('object', $epubFile); $_REQUEST['id'] = $epubFile->id; } else { //Show the new tip that was created header('Location:' . $configArray['Site']['path'] . "/EContent/{$epubFile->id}/View"); exit; } } //Manipulate the structure as needed if ($isNew) { } else { } $interface->assign('isNew', $isNew); $interface->assign('submitUrl', $configArray['Site']['path'] . '/EContent/Edit'); $interface->assign('editForm', DataObjectUtil::getEditForm($structure)); $interface->setTemplate('edit.tpl'); $interface->display('layout.tpl'); }
function EditItem() { require_once ROOT_DIR . '/sys/eContent/EContentItem.php'; require_once ROOT_DIR . '/sys/DataObjectUtil.php'; global $user; global $interface; global $configArray; $structure = EContentItem::getObjectStructure(); $object = new EContentItem(); $recordId = strip_tags($_REQUEST['id']); $itemId = strip_tags($_REQUEST['itemId']); $object->id = $itemId; if ($object->find(true)) { $interface->assign('object', $object); $interface->assign('title', 'Edit eContent Item'); $interface->assign('submitUrl', $configArray['Site']['path'] . "/EcontentRecord/SaveItem"); $interface->assign('editForm', DataObjectUtil::getEditForm($structure)); return $interface->fetch('EcontentRecord/ajax-editItem.tpl'); } else { return "Could not find a record for item {$itemId}"; } }
function getObjectStructure() { return EContentItem::getObjectStructure(); }