Ejemplo n.º 1
0
 public static function edit_display($row)
 {
     //$row['data'] = unserialize($row['data']);
     self::$row = $row;
     i18n::set('admin');
     if ($_POST['cc_form'] == 'edit_page') {
         plugin('admin_edit_post_pre_processing');
         $id = $_GET['id'];
         $title = filter('admin_edit_post_title', self::get('title'));
         $content = filter('admin_edit_post_content', self::get('content_area'));
         $last_modified = filter('admin_edit_post_last_modified', time());
         $settings = filter('admin_edit_post_settings', self::get('settings'));
         $weight = filter('admin_edit_post_weight', self::get('weight'));
         $menutitle = filter('admin_edit_post_menutitle', self::get('menutitle'));
         $parent_id = filter('admin_edit_post_parent_id', self::get('parent_id'));
         $type = filter('admin_edit_post_type', self::get('content_type'));
         $slug = filter('admin_edit_post_slug', self::get('slug'));
         $values = array('title' => $title, 'content' => $content, 'settings' => unserialize($settings), 'weight' => $weight, 'menutitle' => $menutitle, 'parent_id' => $parent_id, 'slug' => $slug);
         plugin('admin_edit_post_post_processing');
         $values = filter('admin_edit_post_posted_values', $values);
         $values['settings'] = serialize($values['settings']);
         $res = Content::editNode($id, $type, $values);
         if ($res) {
             $message = Message::success('Page updated successfully!');
         } else {
             $message = Message::success('Page update failed (DB Error)!');
         }
         //Hooks::bind('post_edit_page', 'EditPage::handlePost');
     }
     $r = $message;
     $tl = $themeList = array_subkeys(Themes::getThemeList(), 'name');
     $tl['-1'] = 'Default Theme';
     ksort($tl);
     $form = new Form('self', 'post', 'edit_page');
     $form->addHidden('settings', serialize(self::get('settings')));
     $form->startFieldset(__('page-info'), array('id' => 'page_info_f'));
     $form->addInput(__('page-title'), 'text', 'title', self::get('title'), array('class' => 'large'));
     $form->addHidden('content_type', self::get('type'));
     $form->addSelectList(__('theme-override'), 'theme', $tl, true, self::get('theme'));
     $form->addSelectList(__('parent'), 'parent_id', self::buildParentOptions(), true, self::get('parent_id'));
     $form->endFieldset();
     plugin('admin_edit_custom_fields', array(&$form));
     $form->startFieldset(__('menu-settings'), array('id' => 'menu_settings_f'));
     $form->addInput(__('menu-title'), 'text', 'menutitle', self::get('menutitle'));
     $form->addInput(__('slug'), 'text', 'slug', self::get('slug'));
     $form->addInput(__('weight'), 'text', 'weight', self::get('weight'));
     $form->endFieldset();
     plugin('admin_edit_custom_fields2', array(&$form));
     $form->startFieldset(__('content'));
     $form->addEditor('', 'content_area', self::get('content_area'));
     $form->endFieldset();
     plugin('admin_edit_custom_fields3', array(&$form));
     $form->addSubmit('', 'save', __('save'));
     $page_title = __('edit-page');
     i18n::restore();
     return array($page_title, $r . $form->endAndGetHTML());
 }