/** * Generate box output * Assign box_pages template * Sets local language * * @param array $params */ function generate_output($params) { $this->set_template($params); require_once VIVVO_FS_PLUGIN_ROOT . 'plugins/pages/Pages.class.php'; $pg_list = new Pages_list(); if (isset($params['search_id'])) { $pg_list->search(array('search_id' => intval($params['search_id'])), 'order_number', 'descending'); } else { $pg_list->search(array(), 'order_number', 'descending'); } $this->_template->assign('page_list', $pg_list->list); }
function page_content_handler(&$sm) { $um = $sm->get_url_manager(); $sm->set_theme(); if ($um->get_param('search_page')) { require_once dirname(__FILE__) . '/Pages.class.php'; $page_list = new Pages_list($sm); $page = $page_list->get_pages_by_id($um->get_param('search_page')); if ($page) { $sm->_template->assign('PAGE_TITLE', strval($page->title)); if ($um->isset_param('force_template') && $sm->user && $sm->user->is_admin() && file_exists(VIVVO_FS_TEMPLATE_ROOT . VIVVO_TEMPLATE_DIR . 'frame/' . $um->get_param('force_template'))) { $sm->_template->set_template_file(VIVVO_FS_TEMPLATE_ROOT . VIVVO_TEMPLATE_DIR . 'frame/' . $um->get_param('force_template')); } elseif ($page->template && file_exists(VIVVO_FS_TEMPLATE_ROOT . VIVVO_TEMPLATE_DIR . 'frame/' . $page->template)) { $sm->_template->set_template_file(VIVVO_FS_TEMPLATE_ROOT . VIVVO_TEMPLATE_DIR . 'frame/' . $page->template); } else { $sm->_template->set_template_file(VIVVO_FS_TEMPLATE_ROOT . VIVVO_TEMPLATE_DIR . 'frame/default.tpl'); } $sm->_template->assign('PAGE_CONTENT', $page->body); $sm->_template->assign('PAGE_OBJECT', $page); } } }
/** * Reorder pages * * @param array $pages_ids * @return boolean true on success or false on fail */ function reorder_pages($pages_ids) { $sm = vivvo_lite_site::get_instance(); if ($sm->user) { if ($sm->user->can('MANAGE_PLUGIN', 'pages')) { $pages_list_ids = $pages_ids; $pages_list = new Pages_list(); $pages_list->search(array('search_id' => $pages_ids), 'order_number', 'descending'); $order_nums = $pages_list->get_property_list('order_number'); foreach ($pages_list_ids as $k) { $new_order = array_shift($order_nums); $pages_list->list[$k]->set_order_number($new_order); $this->_post_master->set_data_object($pages_list->list[$k]); if (!$this->_post_master->sql_update()) { $this->set_error_code(2613); return false; } } return true; } else { $this->set_error_code(2614); return false; } } else { $this->set_error_code(2615); return false; } }
function _default_assignments() { $sm = vivvo_lite_site::get_instance(); $template = $sm->get_template(); $um = $sm->get_url_manager(); $pm = $sm->get_plugin_manager(); $dm = $sm->get_dump_manager(); $template->assign('PLUGIN_ROOT', $pm->plugins['pages']['root_dir']); $action = $sm->action_status; $url = $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; if ($action && !$um->isset_param('list_output')) { $dm->store_dump(md5($url)); header('Location: http://' . $url); exit; } require_once VIVVO_FS_PLUGIN_ROOT . 'plugins/pages/Pages.class.php'; if ($um->isset_param('action') && $action === false) { $in_page = $um->get_param_regexp('/^PAGE_/'); $page = new Pages($sm, $in_page); $template->assign('page', $page); } elseif ($um->get_param('search_pid')) { $pl = new Pages_list(); $page = $pl->get_pages_by_id($um->get_param('search_pid')); if ($page) { $template->assign('page', $page); } } }