本文整理汇总了PHP中Floxim\Floxim\System\Fx::page方法的典型用法代码示例。如果您正苦于以下问题:PHP Fx::page方法的具体用法?PHP Fx::page怎么用?PHP Fx::page使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Floxim\Floxim\System\Fx
的用法示例。
在下文中一共展示了Fx::page方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getBlocks
public function getBlocks()
{
$area_id = $this->getAreaId();
$blocks = fx::page()->getAreaInfoblocks($area_id);
if (count($blocks) === 0) {
return null;
}
return $blocks;
}
示例2: route
public function route($url = null, $context = null)
{
if (!fx::isAdmin()) {
return null;
}
if (!preg_match("~^/\\~ib/(\\d+|fake(?:\\-\\d+)?)@(\\d+)~", $url, $ib_info)) {
return null;
}
$c_url = fx::input()->fetchGetPost('_ajax_base_url');
if ($c_url) {
$_SERVER['REQUEST_URI'] = $c_url;
$path = fx::router()->getPath(fx::path()->removeBase($c_url));
if ($path) {
fx::env('page', $path->last());
} else {
fx::env('page', fx::router('error')->getErrorPage());
}
$c_url = parse_url($c_url);
if (isset($c_url['query'])) {
parse_str($c_url['query'], $_GET);
}
}
$ib_id = $ib_info[1];
$page_id = $ib_info[2];
if (!fx::env('page') && $page_id) {
$page = fx::data('floxim.main.content', $page_id);
fx::env('page', $page);
}
fx::env('ajax', true);
$page_infoblocks = fx::router('front')->getPageInfoblocks($page_id, fx::env('layout'));
fx::page()->setInfoblocks($page_infoblocks);
// import layout template to recreate real env
fx::router('front')->importLayoutTemplate();
// front end can try to reload the layout which is out of date
// when updating from "layout settings" panel
$infoblock = fx::data('infoblock', $ib_id);
if (!$infoblock && isset($_POST['infoblock_is_layout']) || $infoblock->isLayout()) {
//$infoblock = $layout_infoblock;
$infoblock = fx::router('front')->getLayoutInfoblock(fx::env('page'));
}
fx::http()->status('200');
$infoblock_overs = null;
if (fx::isAdmin() && isset($_POST['override_infoblock'])) {
$infoblock_overs = fx::input('post', 'override_infoblock');
if (is_string($infoblock_overs)) {
parse_str($infoblock_overs, $infoblock_overs);
$infoblock_overs = fx::input()->prepareSuperglobal($infoblock_overs);
}
$infoblock->override($infoblock_overs);
}
$infoblock->overrideParam('ajax_mode', true);
$res = $infoblock->render();
return $res;
}
示例3: showAdminPanel
protected function showAdminPanel()
{
if (!fx::isAdmin()) {
return;
}
// initialize the admin panel
$p = fx::page();
$js_config = new Admin\Configjs();
$p->addJsText("\$fx.init(" . $js_config->getConfig() . ");");
$p->setAfterBody(Admin\Controller\Adminpanel::panelHtml());
}
示例4: show
public function show($input)
{
$this->response->breadcrumb->addItem(fx::alang('Console'), '#admin.console.show');
$this->response->submenu->setMenu('console');
$fields = array('console_text' => array('name' => 'console_text', 'type' => 'text', 'code' => 'htmlmixed', 'value' => isset($input['console_text']) ? $input['console_text'] : '<?php' . "\n"));
$fields[] = $this->ui->hidden('entity', 'console');
$fields[] = $this->ui->hidden('action', 'execute');
$this->response->addFormButton(array('label' => fx::alang('Execute') . ' (Ctrl+Enter)', 'is_submit' => false, 'class' => 'execute'));
$this->response->addFields($fields);
fx::page()->addJsFile(fx::path('@floxim') . '/Admin/js/console.js');
return array('show_result' => 1);
}
示例5: route
public function route($url = null, $context = null)
{
$adm_path = '/' . fx::config('path.admin_dir_name') . '/';
if (trim($url, '/') === trim($adm_path, '/') && $url !== $adm_path) {
fx::http()->redirect(fx::config('paht.admin'), 301);
}
if ($url !== $adm_path) {
return null;
}
$input = fx::input()->makeInput();
$entity = fx::input()->fetchPost('entity');
$action = fx::input()->fetchPost('action');
if (!$entity || !$action) {
fx::page()->setBaseUrl(FX_BASE_URL . '/' . trim($adm_path, '/'));
return new Controller\Admin();
}
$base_url = fx::input()->fetchPost('_base_url');
if ($base_url) {
$base_path = fx::router()->getPath(fx::path()->removeBase($base_url));
if ($base_path) {
fx::env('page', $base_path->last());
}
}
fx::env('ajax', true);
$posting = fx::input()->fetchPost('posting');
if (!preg_match("~^module_~", $entity) || fx::input()->fetchPost('fx_admin')) {
$entity = 'admin_' . $entity;
}
if ($posting && $posting !== 'false') {
$action .= "_save";
}
$path = explode('_', $entity, 2);
if ($path[0] == 'admin') {
$classname = 'Floxim\\Floxim\\Admin\\Controller\\' . fx::util()->underscoreToCamel($path[1]);
} else {
// todo: psr0 what?
}
try {
$controller = new $classname($input, $action);
} catch (\Exception $e) {
die("Error! Entity: " . htmlspecialchars($entity));
}
//header("Content-type: application/json; charset=utf-8");
return $controller;
}
示例6: doShow
public function doShow()
{
$area_name = 'blockset_' . $this->input['infoblock_id'];
$blocks = fx::page()->getAreaInfoblocks($area_name);
if ($this->getParam('is_fake')) {
foreach (range(1, 3) as $n) {
$blocks[] = $this->getFakeIb();
}
} else {
if ($this->getParam('add_new_infoblock')) {
$blocks[] = $this->getFakeIb();
}
}
$res = parent::doShow();
$res += array('items' => $blocks, 'area' => $area_name);
if (count($blocks) == 0 && !fx::isAdmin()) {
$this->_meta['disabled'] = true;
}
return $res;
}
示例7: process
public function process()
{
$res = parent::process();
$is_new = $this->isNewBlock();
$this->assign('is_overriden', $this->getParam('is_overriden'));
if (isset($res['areas'])) {
foreach ($res['areas'] as $i => &$area) {
if (!isset($area['id'])) {
$area['id'] = 'grid_' . (isset($area['keyword']) ? $area['keyword'] : $i) . '_' . $this->getParam('infoblock_id');
}
$area['blocks'] = !$is_new ? fx::page()->getAreaInfoblocks($area['id']) : array();
if (!$area['name']) {
$area['name'] = fx::alang('Column %s', null, $i + 1);
}
if (fx::isAdmin()) {
if ($is_new || $this->getParam('is_overriden') && count($area['blocks']) === 0) {
$area['placeholder'] = fx::alang('%s is empty, you can add blocks here', null, $area['name']);
}
}
}
}
return $res;
}
示例8:
<?php
use Floxim\Floxim\System\Fx as fx;
// if request directs right to /floxim/index.php
// e.g. admin interface
// current dir /vendor/floxim/floxim/
//require_once(dirname(__FILE__) . '/../../../boot.php');
$boot = $_SERVER['DOCUMENT_ROOT'] . '/boot.php';
require_once $boot;
register_shutdown_function(function () {
if (!fx::env()->get('complete_ok')) {
$ob_level = ob_get_level();
$res = '';
for ($i = 0; $i < $ob_level; $i++) {
$res .= ob_get_clean();
}
if (fx::config('dev.on')) {
echo fx::page()->postProcess($res);
}
fx::log('down', $res, $_SERVER, $_POST);
}
});
$result = fx::router()->route();
if ($result) {
$result = $result instanceof \Floxim\Floxim\System\Controller ? $result->process() : $result;
if (fx::env('ajax')) {
fx::page()->addAssetsAjax();
}
echo $result;
fx::complete();
}
示例9: adminOffice
/**
* @return string
*/
public function adminOffice()
{
self::addAdminFiles();
if (fx::isAdmin()) {
$panel = Adminpanel::panelHtml();
$res = fx::template('@admin:back_office')->render(array('panel' => $panel));
$js_config = new FxAdmin\Configjs();
fx::page()->addJsText("\$fx.init(" . $js_config->getConfig() . ");");
} else {
$auth_form = fx::controller('user:auth_form')->render('user:auth_form');
$recover_form = fx::controller('user:recover_form', array('email' => isset($_POST['email']) ? $_POST['email'] : null))->render('user:recover_form');
$res = fx::template('@admin:authorize')->render(array('auth_form' => $auth_form, 'recover_form' => $recover_form));
}
return fx::page()->postProcess($res);
}
示例10: addAdminAssets
public static function addAdminAssets()
{
$path = fx::path('@module/Floxim/Ui/Box');
fx::page()->addJsFile($path . '/box-builder.js');
fx::page()->addCssBundle(array($path . '/box-builder.less'));
}
示例11: route
public function route($url = null, $context = null)
{
$action_info = null;
if (!preg_match("~^/\\~ajax/([a-z0-9_\\.\\:\\@-]+)?~", $url, $action_info)) {
return null;
}
fx::env('ajax', true);
$c_url = fx::input()->fetchGetPost('_ajax_base_url');
if ($c_url) {
$c_url = preg_replace("~^https?://[^/]+~", '', $c_url);
$_SERVER['REQUEST_URI'] = $c_url;
$base_path = fx::router()->getPath($c_url);
if ($base_path) {
$page = $base_path->last();
fx::env('page', $page);
} else {
fx::env('page', fx::router('error')->getErrorPage());
}
$c_url = parse_url($c_url);
if (isset($c_url['query'])) {
parse_str($c_url['query'], $_GET);
}
}
// import layout template to recreate real env
fx::router('front')->importLayoutTemplate();
$page_infoblocks = fx::router('front')->getPageInfoblocks($page_id, $layout_id);
fx::page()->setInfoblocks($page_infoblocks);
$controller_params = fx::input()->fetchGetPost('_ajax_controller_params');
$c_infoblock_id = fx::input()->fetchGetPost('_ajax_infoblock_id');
if ($c_infoblock_id) {
$infoblock = fx::data('infoblock', $c_infoblock_id);
if ($infoblock) {
if ($controller_params) {
$infoblock->override(array('params' => $controller_params));
}
$res = $infoblock->render();
return $res;
}
}
$template = null;
if ($action_info && !empty($action_info[1])) {
$action = $action_info[1];
$action = explode("@", $action);
if (count($action) == 2) {
$template = $action[1];
$action = $action[0];
} else {
$action = $action[0];
}
} elseif (isset($_POST['_ajax_controller'])) {
$action = $_POST['_ajax_controller'];
} else {
return null;
}
$action = explode(":", $action);
$controller_name = $action[0];
if (preg_match("~^widget_~", $controller_name) && !isset($action[1])) {
$action[1] = 'show';
}
$action_name = $action[1];
$controller = fx::controller($controller_name . ':' . $action_name, $controller_params);
if (!$template) {
$template = fx::input()->fetchGetPost('_ajax_template');
}
if (!$template) {
$tpls = $controller->getAvailableTemplates();
if (count($tpls) > 0) {
$template = $tpls[0]['full_id'];
}
}
$res = $controller->process();
if ($template) {
$tpl = fx::template($template);
if ($tpl) {
$res = $tpl->render($res);
}
}
return $res ? $res : true;
}
示例12: renderArea
public static function renderArea($area, $context, $mode = 'both')
{
if (isset($area['size'])) {
$area['size'] = preg_replace("~[^a-z0-9]+~i", ',', $area['size']);
}
$is_admin = fx::isAdmin();
if ($mode != 'marker') {
fx::trigger('render_area', array('area' => $area));
if ($is_admin && $context->isIdle()) {
return;
}
}
if ($is_admin) {
ob_start();
}
if ($mode != 'marker' && (!isset($area['render']) || $area['render'] != 'manual')) {
$area_blocks = fx::page()->getAreaInfoblocks($area['id']);
$pos = 1;
foreach ($area_blocks as $ib) {
$ib->addParams(array('infoblock_area_position' => $pos));
$result = $ib->render();
echo $result;
$pos++;
}
}
if ($is_admin) {
$area_result = ob_get_clean();
self::$area_replacements[] = array($area, $area_result);
$marker = '###fxa' . (count(self::$area_replacements) - 1);
if ($mode != 'both') {
$marker .= '|' . $mode;
}
$marker .= '###';
echo $marker;
}
}