static function getFile($id) { $l = new Layout(); $l->getByID($id); if ($l->layout_file != "") { return $l->layout_file; } else { return 0; } }
} } if (!$validLayout || !$cp->canEditPageContents() || !$ap->canAddLayoutToArea()) { $jsonData['msg'] = t('Access Denied.'); } elseif (!is_object($layout)) { $jsonData['msg'] = t('Error: Layout not found'); } else { switch ($_GET['task']) { case 'lock': $layout->locked = intval($_REQUEST['lock']) ? 1 : 0; $saved = $layout->save(); $jsonData['success'] = intval($saved); break; case 'move': $cvalID = intval($_REQUEST['cvalID']); $layout = Layout::getByID($_REQUEST['layoutID']); $db = Loader::db(); $direction = $_REQUEST['direction']; // Get array of layouts for the current (published) page //$oldLayouts = $a->getAreaLayouts($c); // Get array of layouts for the working (unsaved) page $newLayouts = $a->getAreaLayouts($nvc); // Iterate through layouts, looking for the one we need to change for ($i = 0; $i < count($newLayouts); $i++) { $layout = $newLayouts[$i]; // Check if this layout is the one we need to change if ($layout->areaNameNumber == $_REQUEST['areaNameNumber']) { // If so, adjust the position values if ($direction == 'up' && $i > 0) { $prevLayout = $newLayouts[$i - 1]; $layout->position = $prevLayout->position;
function simpan() { // pr($_POST); $succ = 0; $id = tin($_POST['id']); $val = tin($_POST['val']); $l = new Layout(); $l->getByID($id); if ($l->layout_file != "") { $l->layout_file = $val; $l->load = 1; $succ = $l->save(); } else { $l1 = new Layout(); $l1->layout_id = $id; $l1->layout_file = $val; $succ = $l1->save(); } if ($succ) { echo Lang::t("Success"); } else { echo Lang::t("Failed"); } }