예제 #1
0
 function postProcessForm(&$values)
 {
     $model =& $this->getDefaultModel();
     $pk = $model->primaryKey();
     // fix the paths for navigation
     // if (on insert or if changed path on update)
     $this->fixPaths($model->{$pk});
     // move all the old content to the current template
     // into matching template containers
     if (isset($values['mv_content'])) {
         $page_content =& NController::singleton('page_content');
         $page_content->changeTemplate($model->{$pk}, $model->page_template_id);
     }
     // delete general caches
     include_once 'n_cache.php';
     NCache::removeMenu();
     NCache::removeTreeAsSelect();
     NCache::removeJavascript($model->{$pk});
     // REMOVE PAGE CACHE
     $this->deletePageCache($model->{$pk});
     // REMOVE PARENT PAGE CACHE (for child links, etc);
     if ($this->action == 'create') {
         // load a new one
         $new_model =& NModel::factory($this->name);
         $parent_id = $new_model->getParent($model->{$pk});
         unset($new_model);
     } else {
         // user the existing model to find the parent
         $parent_id = $model->getParent($model->{$pk});
     }
     $this->deletePageCache($parent_id);
     // remove the site admin cache
     $site_admin =& NController::singleton('site_admin');
     $site_admin->deleteCache();
     unset($site_admin);
     if ($this->action == 'delete') {
         $this->flash->set('notice', 'Your page has been deleted.');
     } else {
         $this->flash->set('notice', 'Your page has been saved.');
     }
     parent::postProcessForm($values);
 }