registryAction('getBlockBy'); } /** * put your comment there... * * @deprecated this is just a redirect to the CJTBlockContoller::getAction(). */ protected function getBlockByAction() { // Pass to CJTBlockController! $this->redirect('block'); } /** * put your comment there... * * @deprecated All will be moved to other controllers in the future versions. */ public function getInfoViewAction() { $model = $this->getModel('blocks'); // Set content type as HTML. $this->httpContentType = "text/html"; // Get block info. $id = filter_input(INPUT_GET, 'id', FILTER_SANITIZE_NUMBER_INT); $Info = $model->getInfo($id); // Create info view object. $view = CJTController::getView('blocks/info'); // Get view info content. $view->info = $Info; $this->response = $view->getTemplate('default'); } /** * put your comment there... * * @deprecated All will be moved to other controllers in the future versions. */ public function getRevisionAction() { $model = $this->getModel('blocks'); // Get request parameters. $revision['id'] = filter_input(INPUT_GET, 'id', FILTER_SANITIZE_NUMBER_INT); $revision['fields'] = array('id', 'code', 'pinPoint', 'links', 'expressions'); $revision = $model->getBlock($revision['id'], array(), $revision['fields']); $this->response = $revision; } /** * put your comment there... * * @deprecated All will be moved to other controllers in the future versions. */ public function getRevisionsAction() { $model = $this->getModel('blocks'); // Get request parameters. $blockId = filter_input(INPUT_GET, 'id', FILTER_SANITIZE_NUMBER_INT); // Get block revisions. $revisions['filter']['parent'] = $blockId; $revisions['filter']['type'] = 'revision'; // Its mandatory to select fields instead of using just .*. // This is because id field must be first to be used as the array key $revisions['fields'] = array('id', 'name', 'created', 'lastModified', 'owner'); // Query getBlocks without ids filter or backup. $revisions = $model->getBlocks(null, $revisions['filter'], $revisions['fields']); // Create view. $view = $this->getView('blocks/revisions'); // Push view vars. $view->blockId = $blockId; $view->revisions = $revisions; // Set output header. $this->httpContentType = 'text/html'; // Return view content. $this->response = $view->getTemplate('default'); } /** * Update exists block property value. * * * Call this method using POST method with the following parameters. * - id integer Block id. * - property string Property Name to change. * - value mixed Property value to change. * * Response body is array with the following elements. * - string oldValue Old property value. * - string value New value. * * @deprecated * @return void */ public function setPropertyAction() { // Initialize. $response = array(); $blocks = $this->getModel('blocks'); // Prepare parameters. $blockId = filter_input(INPUT_POST, 'id', FILTER_SANITIZE_NUMBER_INT); $property = filter_input(INPUT_POST, 'property', FILTER_SANITIZE_STRING); $newValue = filter_input(INPUT_POST, 'value', FILTER_UNSAFE_RAW); // Get old value. $block = $blocks->getBlock($blockId); $oldValue = $block->$property; // Update only if there is a change. if ($oldValue != $newValue) { // Update block property. $block->$property = $newValue; $blocks->setBlock($block); $blocks->save(); // Set response object. $response['oldValue'] = $oldValue; $response['value'] = $newValue; } $this->response = $response; } } // End class.