Example #1
0
function get_pages_rows()
{
    $L = Language::instance();
    $Static_pages = Static_pages::instance();
    $categories = array_slice(Config::instance()->route, 2);
    $structure = $Static_pages->get_structure();
    $path = [];
    if (!empty($categories)) {
        foreach ($categories as $category) {
            $category = $Static_pages->get_category($category)['path'];
            if (isset($structure['categories'][$category])) {
                $structure = $structure['categories'][$category];
                $path[] = $structure['path'];
            }
        }
        unset($category);
    }
    Page::instance()->title($structure['id'] == 0 ? $L->root_category : $structure['title']);
    $path = !empty($path) ? implode('/', $path) . '/' : '';
    $content = [];
    if (!empty($structure['pages'])) {
        foreach ($structure['pages'] as &$page) {
            $page = $Static_pages->get($page);
            $content[] = [[h::a($page['title'], ['href' => $path . $page['path']]), ['class' => 'cs-static-pages-padding-left-0']], h::{'a.cs-button-compact'}([h::icon('file-text'), ['href' => "admin/Static_pages/edit_page/{$page['id']}", 'data-title' => $L->edit]], [h::icon('trash-o'), ['href' => "admin/Static_pages/delete_page/{$page['id']}", 'data-title' => $L->delete]])];
        }
    }
    return [$content];
}
Example #2
0
/**
 * @package		Static Pages
 * @category	modules
 * @author		Nazar Mokrynskyi <*****@*****.**>
 * @copyright	Copyright (c) 2011-2014, Nazar Mokrynskyi
 * @license		MIT License, see license.txt
 */
namespace cs\modules\Static_pages;

use cs\Cache, cs\User, cs\Trigger;
Trigger::instance()->register('admin/System/components/modules/uninstall/process', function ($data) {
    if ($data['name'] != 'Static_pages' || !User::instance()->admin()) {
        return true;
    }
    time_limit_pause();
    $Static_pages = Static_pages::instance();
    $structure = $Static_pages->get_structure();
    while (!empty($structure['categories'])) {
        foreach ($structure['categories'] as $category) {
            $Static_pages->del_category($category['id']);
        }
        $structure = $Static_pages->get_structure();
    }
    unset($category);
    if (!empty($structure['pages'])) {
        foreach ($structure['pages'] as $page) {
            $Static_pages->del($page);
        }
        unset($page);
    }
    unset($structure, Cache::instance()->Static_pages);
Example #3
0
<?php

/**
 * @package		Static Pages
 * @category	modules
 * @author		Nazar Mokrynskyi <*****@*****.**>
 * @copyright	Copyright (c) 2011-2014, Nazar Mokrynskyi
 * @license		MIT License, see license.txt
 */
namespace cs\modules\Static_pages;

use h, cs\Config, cs\Index, cs\Language, cs\Page;
$Index = Index::instance();
$L = Language::instance();
$id = (int) Config::instance()->route[1];
$data = Static_pages::instance()->get_category($id);
Page::instance()->title($L->editing_of_page_category($data['title']));
$Index->apply_button = false;
$Index->cancel_button_back = true;
$Index->action = 'admin/Static_pages';
$Index->content(h::{'p.lead.cs-center'}($L->editing_of_page_category($data['title'])) . h::{'table.cs-table-borderless.cs-center-all'}(h::{'thead tr th'}($L->parent_category, $L->category_title, h::info('category_path')), h::{'tbody tr td'}(h::{'select[name=parent][size=5]'}(get_categories_list($id), ['selected' => $data['parent']]), h::{'input[name=title]'}(['value' => $data['title']]), h::{'input[name=path]'}(['value' => $data['path']]))) . h::{'input[type=hidden][name=id]'}(['value' => $id]) . h::{'input[type=hidden][name=mode][value=edit_category]'}());
Example #4
0
<?php

/**
 * @package		Static Pages
 * @category	modules
 * @author		Nazar Mokrynskyi <*****@*****.**>
 * @copyright	Copyright (c) 2011-2014, Nazar Mokrynskyi
 * @license		MIT License, see license.txt
 */
namespace cs\modules\Static_pages;

use h, cs\Config, cs\Index, cs\Language, cs\Page;
$Index = Index::instance();
$L = Language::instance();
$id = (int) Config::instance()->route[1];
$title = Static_pages::instance()->get($id)['title'];
Page::instance()->title($L->deletion_of_page($title));
$Index->buttons = false;
$Index->cancel_button_back = true;
$Index->action = 'admin/Static_pages';
$Index->content(h::{'p.lead.cs-center'}($L->sure_to_delete_page($title)) . h::{'button[type=submit]'}($L->yes) . h::{'input[type=hidden][name=id]'}(['value' => $id]) . h::{'input[type=hidden][name=mode][value=delete_page]'}());
Example #5
0
<?php

/**
 * @package		Static Pages
 * @category	modules
 * @author		Nazar Mokrynskyi <*****@*****.**>
 * @copyright	Copyright (c) 2011-2014, Nazar Mokrynskyi
 * @license		MIT License, see license.txt
 */
namespace cs\modules\Static_pages;

use h, cs\Config, cs\Index, cs\Language, cs\Page;
$Index = Index::instance();
$L = Language::instance();
$id = (int) Config::instance()->route[1];
$data = Static_pages::instance()->get($id);
Page::instance()->title($L->editing_of_page($data['title']));
$Index->apply_button = false;
$Index->cancel_button_back = true;
$Index->action = 'admin/Static_pages';
$Index->content(h::{'p.lead.cs-center'}($L->editing_of_page($data['title'])) . h::{'table.cs-table-borderless.cs-center-all'}(h::{'thead tr th'}($L->category, $L->page_title, h::info('page_path'), h::info('page_interface')), h::{'tbody tr td'}(h::{'select[name=category][size=5]'}(get_categories_list(), ['selected' => $data['category']]), h::{'input[name=title]'}(['value' => $data['title']]), h::{'input[name=path]'}(['value' => $data['path']]), h::{'div input[type=radio][name=interface]'}(['checked' => $data['interface'], 'value' => [0, 1], 'in' => [$L->off, $L->on]]))) . h::{'table.cs-table-borderless.cs-center-all'}(h::{'thead tr th'}($L->content), h::{'tbody tr td textarea[name=content]'}($data['content'], ['class' => $data['interface'] ? 'EDITOR' : ''])) . h::{'input[type=hidden][name=id]'}(['value' => $id]) . h::{'input[type=hidden][name=mode][value=edit_page]'}());
Example #6
0
<?php

/**
 * @package		Static Pages
 * @category	modules
 * @author		Nazar Mokrynskyi <*****@*****.**>
 * @copyright	Copyright (c) 2011-2014, Nazar Mokrynskyi
 * @license		MIT License, see license.txt
 */
namespace cs\modules\Static_pages;

use h, cs\Config, cs\Index, cs\Language, cs\Page;
$Index = Index::instance();
$L = Language::instance();
$id = (int) Config::instance()->route[1];
$title = Static_pages::instance()->get_category($id)['title'];
Page::instance()->title($L->deletion_of_page_category($title));
$Index->buttons = false;
$Index->cancel_button_back = true;
$Index->action = 'admin/Static_pages';
$Index->content(h::{'p.lead.cs-center'}($L->sure_to_delete_page_category($title)) . h::{'button[type=submit]'}($L->yes) . h::{'input[type=hidden][name=id]'}(['value' => $id]) . h::{'input[type=hidden][name=mode][value=delete_category]'}());