本文整理汇总了PHP中block_manager::get_active方法的典型用法代码示例。如果您正苦于以下问题:PHP block_manager::get_active方法的具体用法?PHP block_manager::get_active怎么用?PHP block_manager::get_active使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类block_manager
的用法示例。
在下文中一共展示了block_manager::get_active方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _get_blocks
private function _get_blocks()
{
$active_blocks = array();
$available_blocks = block_manager::get_available_site_blocks();
foreach (block_manager::get_active("site.sidebar") as $block) {
$id = "{$block[0]}:{$block[1]}";
if (!empty($available_blocks[$id])) {
$active_blocks[$id] = $available_blocks[$id];
unset($available_blocks[$id]);
}
}
return array($available_blocks, $active_blocks);
}
示例2: reorder
public function reorder()
{
access::verify_csrf();
$active_set = array();
foreach (array("dashboard_sidebar", "dashboard_center") as $location) {
foreach (block_manager::get_active($location) as $id => $info) {
$active_set[$id] = $info;
}
}
foreach (array("dashboard_sidebar", "dashboard_center") as $location) {
$new_blocks = array();
foreach (Input::instance()->get($location, array()) as $id) {
$new_blocks[$id] = $active_set[$id];
}
block_manager::set_active($location, $new_blocks);
}
}
示例3: upgrade
static function upgrade($version)
{
$db = Database::instance();
if ($version == 1) {
module::set_var("gallery", "date_format", "Y-M-d");
module::set_var("gallery", "date_time_format", "Y-M-d H:i:s");
module::set_var("gallery", "time_format", "H:i:s");
module::set_version("gallery", $version = 2);
}
if ($version == 2) {
module::set_var("gallery", "show_credits", 1);
module::set_version("gallery", $version = 3);
}
if ($version == 3) {
$db->query("CREATE TABLE {caches} (\n `id` varchar(255) NOT NULL,\n `tags` varchar(255),\n `expiration` int(9) NOT NULL,\n `cache` text,\n PRIMARY KEY (`id`),\n KEY (`tags`))\n DEFAULT CHARSET=utf8;");
module::set_version("gallery", $version = 4);
}
if ($version == 4) {
Cache::instance()->delete_all();
$db->query("ALTER TABLE {caches} MODIFY COLUMN `cache` LONGBLOB");
module::set_version("gallery", $version = 5);
}
if ($version == 5) {
Cache::instance()->delete_all();
$db->query("ALTER TABLE {caches} DROP COLUMN `id`");
$db->query("ALTER TABLE {caches} ADD COLUMN `key` varchar(255) NOT NULL");
$db->query("ALTER TABLE {caches} ADD COLUMN `id` int(9) NOT NULL auto_increment PRIMARY KEY");
module::set_version("gallery", $version = 6);
}
if ($version == 6) {
module::clear_var("gallery", "version");
module::set_version("gallery", $version = 7);
}
if ($version == 7) {
$groups = identity::groups();
$permissions = ORM::factory("permission")->find_all();
foreach ($groups as $group) {
foreach ($permissions as $permission) {
// Update access intents
$db->query("ALTER TABLE {access_intents} MODIFY COLUMN {$permission->name}_{$group->id} BINARY(1) DEFAULT NULL");
// Update access cache
if ($permission->name === "view") {
$db->query("ALTER TABLE {items} MODIFY COLUMN {$permission->name}_{$group->id} BINARY(1) DEFAULT FALSE");
} else {
$db->query("ALTER TABLE {access_caches} MODIFY COLUMN {$permission->name}_{$group->id} BINARY(1) NOT NULL DEFAULT FALSE");
}
}
}
module::set_version("gallery", $version = 8);
}
if ($version == 8) {
$db->query("ALTER TABLE {items} CHANGE COLUMN `left` `left_ptr` INT(9) NOT NULL;");
$db->query("ALTER TABLE {items} CHANGE COLUMN `right` `right_ptr` INT(9) NOT NULL;");
module::set_version("gallery", $version = 9);
}
if ($version == 9) {
$db->query("ALTER TABLE {items} ADD KEY `weight` (`weight` DESC);");
module::set_version("gallery", $version = 10);
}
if ($version == 10) {
module::set_var("gallery", "image_sharpen", 15);
module::set_version("gallery", $version = 11);
}
if ($version == 11) {
$db->query("ALTER TABLE {items} ADD COLUMN `relative_url_cache` varchar(255) DEFAULT NULL");
$db->query("ALTER TABLE {items} ADD COLUMN `slug` varchar(255) DEFAULT NULL");
// This is imperfect since some of the slugs may contain invalid characters, but it'll do
// for now because we don't want a lengthy operation here.
$db->query("UPDATE {items} SET `slug` = `name`");
// Flush all path caches becuase we're going to start urlencoding them.
$db->query("UPDATE {items} SET `relative_url_cache` = NULL, `relative_path_cache` = NULL");
module::set_version("gallery", $version = 12);
}
if ($version == 12) {
if (module::get_var("gallery", "active_site_theme") == "default") {
module::set_var("gallery", "active_site_theme", "wind");
}
if (module::get_var("gallery", "active_admin_theme") == "admin_default") {
module::set_var("gallery", "active_admin_theme", "admin_wind");
}
module::set_version("gallery", $version = 13);
}
if ($version == 13) {
// Add rules for generating our thumbnails and resizes
Database::instance()->query("UPDATE {graphics_rules} SET `operation` = CONCAT('gallery_graphics::', `operation`);");
module::set_version("gallery", $version = 14);
}
if ($version == 14) {
$sidebar_blocks = block_manager::get_active("site_sidebar");
if (empty($sidebar_blocks)) {
$available_blocks = block_manager::get_available_site_blocks();
foreach (array_keys(block_manager::get_available_site_blocks()) as $id) {
$sidebar_blocks[] = explode(":", $id);
}
block_manager::set_active("site_sidebar", $sidebar_blocks);
}
module::set_version("gallery", $version = 15);
}
if ($version == 15) {
module::set_var("gallery", "identity_provider", "user");
//.........这里部分代码省略.........
示例4: upgrade
static function upgrade($version)
{
$db = Database::instance();
if ($version == 1) {
module::set_var("gallery", "date_format", "Y-M-d");
module::set_var("gallery", "date_time_format", "Y-M-d H:i:s");
module::set_var("gallery", "time_format", "H:i:s");
module::set_version("gallery", $version = 2);
}
if ($version == 2) {
module::set_var("gallery", "show_credits", 1);
module::set_version("gallery", $version = 3);
}
if ($version == 3) {
$db->query("CREATE TABLE {caches} (\n `id` varchar(255) NOT NULL,\n `tags` varchar(255),\n `expiration` int(9) NOT NULL,\n `cache` text,\n PRIMARY KEY (`id`),\n KEY (`tags`))\n DEFAULT CHARSET=utf8;");
module::set_version("gallery", $version = 4);
}
if ($version == 4) {
Cache::instance()->delete_all();
$db->query("ALTER TABLE {caches} MODIFY COLUMN `cache` LONGBLOB");
module::set_version("gallery", $version = 5);
}
if ($version == 5) {
Cache::instance()->delete_all();
$db->query("ALTER TABLE {caches} DROP COLUMN `id`");
$db->query("ALTER TABLE {caches} ADD COLUMN `key` varchar(255) NOT NULL");
$db->query("ALTER TABLE {caches} ADD COLUMN `id` int(9) NOT NULL auto_increment PRIMARY KEY");
module::set_version("gallery", $version = 6);
}
if ($version == 6) {
module::clear_var("gallery", "version");
module::set_version("gallery", $version = 7);
}
if ($version == 7) {
$groups = identity::groups();
$permissions = ORM::factory("permission")->find_all();
foreach ($groups as $group) {
foreach ($permissions as $permission) {
// Update access intents
$db->query("ALTER TABLE {access_intents} MODIFY COLUMN {$permission->name}_{$group->id} BINARY(1) DEFAULT NULL");
// Update access cache
if ($permission->name === "view") {
$db->query("ALTER TABLE {items} MODIFY COLUMN {$permission->name}_{$group->id} BINARY(1) DEFAULT FALSE");
} else {
$db->query("ALTER TABLE {access_caches} MODIFY COLUMN {$permission->name}_{$group->id} BINARY(1) NOT NULL DEFAULT FALSE");
}
}
}
module::set_version("gallery", $version = 8);
}
if ($version == 8) {
$db->query("ALTER TABLE {items} CHANGE COLUMN `left` `left_ptr` INT(9) NOT NULL;");
$db->query("ALTER TABLE {items} CHANGE COLUMN `right` `right_ptr` INT(9) NOT NULL;");
module::set_version("gallery", $version = 9);
}
if ($version == 9) {
$db->query("ALTER TABLE {items} ADD KEY `weight` (`weight` DESC);");
module::set_version("gallery", $version = 10);
}
if ($version == 10) {
module::set_var("gallery", "image_sharpen", 15);
module::set_version("gallery", $version = 11);
}
if ($version == 11) {
$db->query("ALTER TABLE {items} ADD COLUMN `relative_url_cache` varchar(255) DEFAULT NULL");
$db->query("ALTER TABLE {items} ADD COLUMN `slug` varchar(255) DEFAULT NULL");
// This is imperfect since some of the slugs may contain invalid characters, but it'll do
// for now because we don't want a lengthy operation here.
$db->query("UPDATE {items} SET `slug` = `name`");
// Flush all path caches because we're going to start urlencoding them.
$db->query("UPDATE {items} SET `relative_url_cache` = NULL, `relative_path_cache` = NULL");
module::set_version("gallery", $version = 12);
}
if ($version == 12) {
if (module::get_var("gallery", "active_site_theme") == "default") {
module::set_var("gallery", "active_site_theme", "wind");
}
if (module::get_var("gallery", "active_admin_theme") == "admin_default") {
module::set_var("gallery", "active_admin_theme", "admin_wind");
}
module::set_version("gallery", $version = 13);
}
if ($version == 13) {
// Add rules for generating our thumbnails and resizes
Database::instance()->query("UPDATE {graphics_rules} SET `operation` = CONCAT('gallery_graphics::', `operation`);");
module::set_version("gallery", $version = 14);
}
if ($version == 14) {
$sidebar_blocks = block_manager::get_active("site_sidebar");
if (empty($sidebar_blocks)) {
$available_blocks = block_manager::get_available_site_blocks();
foreach (array_keys(block_manager::get_available_site_blocks()) as $id) {
$sidebar_blocks[] = explode(":", $id);
}
block_manager::set_active("site_sidebar", $sidebar_blocks);
}
module::set_version("gallery", $version = 15);
}
if ($version == 15) {
module::set_var("gallery", "identity_provider", "user");
//.........这里部分代码省略.........
示例5: upgrade
static function upgrade($version)
{
$db = Database::instance();
if ($version == 1) {
module::set_var("gallery", "date_format", "Y-M-d");
module::set_var("gallery", "date_time_format", "Y-M-d H:i:s");
module::set_var("gallery", "time_format", "H:i:s");
module::set_version("gallery", $version = 2);
}
if ($version == 2) {
module::set_var("gallery", "show_credits", 1);
module::set_version("gallery", $version = 3);
}
if ($version == 3) {
$db->query("CREATE TABLE {caches} (\n `id` varchar(255) NOT NULL,\n `tags` varchar(255),\n `expiration` int(9) NOT NULL,\n `cache` text,\n PRIMARY KEY (`id`),\n KEY (`tags`))\n DEFAULT CHARSET=utf8;");
module::set_version("gallery", $version = 4);
}
if ($version == 4) {
Cache::instance()->delete_all();
$db->query("ALTER TABLE {caches} MODIFY COLUMN `cache` LONGBLOB");
module::set_version("gallery", $version = 5);
}
if ($version == 5) {
Cache::instance()->delete_all();
$db->query("ALTER TABLE {caches} DROP COLUMN `id`");
$db->query("ALTER TABLE {caches} ADD COLUMN `key` varchar(255) NOT NULL");
$db->query("ALTER TABLE {caches} ADD COLUMN `id` int(9) NOT NULL auto_increment PRIMARY KEY");
module::set_version("gallery", $version = 6);
}
if ($version == 6) {
module::clear_var("gallery", "version");
module::set_version("gallery", $version = 7);
}
if ($version == 7) {
$groups = identity::groups();
$permissions = ORM::factory("permission")->find_all();
foreach ($groups as $group) {
foreach ($permissions as $permission) {
// Update access intents
$db->query("ALTER TABLE {access_intents} MODIFY COLUMN {$permission->name}_{$group->id} BINARY(1) DEFAULT NULL");
// Update access cache
if ($permission->name === "view") {
$db->query("ALTER TABLE {items} MODIFY COLUMN {$permission->name}_{$group->id} BINARY(1) DEFAULT FALSE");
} else {
$db->query("ALTER TABLE {access_caches} MODIFY COLUMN {$permission->name}_{$group->id} BINARY(1) NOT NULL DEFAULT FALSE");
}
}
}
module::set_version("gallery", $version = 8);
}
if ($version == 8) {
$db->query("ALTER TABLE {items} CHANGE COLUMN `left` `left_ptr` INT(9) NOT NULL;");
$db->query("ALTER TABLE {items} CHANGE COLUMN `right` `right_ptr` INT(9) NOT NULL;");
module::set_version("gallery", $version = 9);
}
if ($version == 9) {
$db->query("ALTER TABLE {items} ADD KEY `weight` (`weight` DESC);");
module::set_version("gallery", $version = 10);
}
if ($version == 10) {
module::set_var("gallery", "image_sharpen", 15);
module::set_version("gallery", $version = 11);
}
if ($version == 11) {
$db->query("ALTER TABLE {items} ADD COLUMN `relative_url_cache` varchar(255) DEFAULT NULL");
$db->query("ALTER TABLE {items} ADD COLUMN `slug` varchar(255) DEFAULT NULL");
// This is imperfect since some of the slugs may contain invalid characters, but it'll do
// for now because we don't want a lengthy operation here.
$db->query("UPDATE {items} SET `slug` = `name`");
// Flush all path caches becuase we're going to start urlencoding them.
$db->query("UPDATE {items} SET `relative_url_cache` = NULL, `relative_path_cache` = NULL");
module::set_version("gallery", $version = 12);
}
if ($version == 12) {
if (module::get_var("gallery", "active_site_theme") == "default") {
module::set_var("gallery", "active_site_theme", "wind");
}
if (module::get_var("gallery", "active_admin_theme") == "admin_default") {
module::set_var("gallery", "active_admin_theme", "admin_wind");
}
module::set_version("gallery", $version = 13);
}
if ($version == 13) {
// Add rules for generating our thumbnails and resizes
Database::instance()->query("UPDATE {graphics_rules} SET `operation` = CONCAT('gallery_graphics::', `operation`);");
module::set_version("gallery", $version = 14);
}
if ($version == 14) {
$sidebar_blocks = block_manager::get_active("site_sidebar");
if (empty($sidebar_blocks)) {
$available_blocks = block_manager::get_available_site_blocks();
foreach (array_keys(block_manager::get_available_site_blocks()) as $id) {
$sidebar_blocks[] = explode(":", $id);
}
block_manager::set_active("site_sidebar", $sidebar_blocks);
}
module::set_version("gallery", $version = 15);
}
if ($version == 15) {
module::set_var("gallery", "identity_provider", "user");
//.........这里部分代码省略.........
示例6: get_html
static function get_html($location, $theme = null)
{
$active = block_manager::get_active($location);
$result = "";
foreach ($active as $id => $desc) {
if (class_exists("{$desc['0']}_block") && method_exists("{$desc['0']}_block", "get")) {
$block = call_user_func(array("{$desc['0']}_block", "get"), $desc[1], $theme);
if (!empty($block)) {
$block->id = $id;
$result .= $block;
}
}
}
return $result;
}
示例7: upgrade
static function upgrade($version)
{
$db = Database::instance();
if ($version == 1) {
module::set_var("gallery", "date_format", "Y-M-d");
module::set_var("gallery", "date_time_format", "Y-M-d H:i:s");
module::set_var("gallery", "time_format", "H:i:s");
module::set_version("gallery", $version = 2);
}
if ($version == 2) {
module::set_var("gallery", "show_credits", 1);
module::set_version("gallery", $version = 3);
}
if ($version == 3) {
$db->query("CREATE TABLE {caches} (\n `id` varchar(255) NOT NULL,\n `tags` varchar(255),\n `expiration` int(9) NOT NULL,\n `cache` text,\n PRIMARY KEY (`id`),\n KEY (`tags`))\n DEFAULT CHARSET=utf8;");
module::set_version("gallery", $version = 4);
}
if ($version == 4) {
Cache::instance()->delete_all();
$db->query("ALTER TABLE {caches} MODIFY COLUMN `cache` LONGBLOB");
module::set_version("gallery", $version = 5);
}
if ($version == 5) {
Cache::instance()->delete_all();
$db->query("ALTER TABLE {caches} DROP COLUMN `id`");
$db->query("ALTER TABLE {caches} ADD COLUMN `key` varchar(255) NOT NULL");
$db->query("ALTER TABLE {caches} ADD COLUMN `id` int(9) NOT NULL auto_increment PRIMARY KEY");
module::set_version("gallery", $version = 6);
}
if ($version == 6) {
module::clear_var("gallery", "version");
module::set_version("gallery", $version = 7);
}
if ($version == 7) {
$groups = identity::groups();
$permissions = ORM::factory("permission")->find_all();
foreach ($groups as $group) {
foreach ($permissions as $permission) {
// Update access intents
$db->query("ALTER TABLE {access_intents} MODIFY COLUMN {$permission->name}_{$group->id} BINARY(1) DEFAULT NULL");
// Update access cache
if ($permission->name === "view") {
$db->query("ALTER TABLE {items} MODIFY COLUMN {$permission->name}_{$group->id} BINARY(1) DEFAULT FALSE");
} else {
$db->query("ALTER TABLE {access_caches} MODIFY COLUMN {$permission->name}_{$group->id} BINARY(1) NOT NULL DEFAULT FALSE");
}
}
}
module::set_version("gallery", $version = 8);
}
if ($version == 8) {
$db->query("ALTER TABLE {items} CHANGE COLUMN `left` `left_ptr` INT(9) NOT NULL;");
$db->query("ALTER TABLE {items} CHANGE COLUMN `right` `right_ptr` INT(9) NOT NULL;");
module::set_version("gallery", $version = 9);
}
if ($version == 9) {
$db->query("ALTER TABLE {items} ADD KEY `weight` (`weight` DESC);");
module::set_version("gallery", $version = 10);
}
if ($version == 10) {
module::set_var("gallery", "image_sharpen", 15);
module::set_version("gallery", $version = 11);
}
if ($version == 11) {
$db->query("ALTER TABLE {items} ADD COLUMN `relative_url_cache` varchar(255) DEFAULT NULL");
$db->query("ALTER TABLE {items} ADD COLUMN `slug` varchar(255) DEFAULT NULL");
// This is imperfect since some of the slugs may contain invalid characters, but it'll do
// for now because we don't want a lengthy operation here.
$db->query("UPDATE {items} SET `slug` = `name`");
// Flush all path caches becuase we're going to start urlencoding them.
$db->query("UPDATE {items} SET `relative_url_cache` = NULL, `relative_path_cache` = NULL");
module::set_version("gallery", $version = 12);
}
if ($version == 12) {
if (module::get_var("gallery", "active_site_theme") == "default") {
module::set_var("gallery", "active_site_theme", "wind");
}
if (module::get_var("gallery", "active_admin_theme") == "admin_default") {
module::set_var("gallery", "active_admin_theme", "admin_wind");
}
module::set_version("gallery", $version = 13);
}
if ($version == 13) {
// Add rules for generating our thumbnails and resizes
Database::instance()->query("UPDATE {graphics_rules} SET `operation` = CONCAT('gallery_graphics::', `operation`);");
module::set_version("gallery", $version = 14);
}
if ($version == 14) {
$sidebar_blocks = block_manager::get_active("site_sidebar");
if (empty($sidebar_blocks)) {
$available_blocks = block_manager::get_available_site_blocks();
foreach (array_keys(block_manager::get_available_site_blocks()) as $id) {
$sidebar_blocks[] = explode(":", $id);
}
block_manager::set_active("site_sidebar", $sidebar_blocks);
}
module::set_version("gallery", $version = 15);
}
if ($version == 15) {
module::set_var("gallery", "identity_provider", "user");
//.........这里部分代码省略.........
示例8: upgrade
static function upgrade($version)
{
$db = Database::instance();
if ($version == 1) {
module::set_var("gallery", "date_format", "Y-M-d");
module::set_var("gallery", "date_time_format", "Y-M-d H:i:s");
module::set_var("gallery", "time_format", "H:i:s");
module::set_version("gallery", $version = 2);
}
if ($version == 2) {
module::set_var("gallery", "show_credits", 1);
module::set_version("gallery", $version = 3);
}
if ($version == 3) {
$db->query("CREATE TABLE {caches} (\n `id` varchar(255) NOT NULL,\n `tags` varchar(255),\n `expiration` int(9) NOT NULL,\n `cache` text,\n PRIMARY KEY (`id`),\n KEY (`tags`))\n DEFAULT CHARSET=utf8;");
module::set_version("gallery", $version = 4);
}
if ($version == 4) {
Cache::instance()->delete_all();
$db->query("ALTER TABLE {caches} MODIFY COLUMN `cache` LONGBLOB");
module::set_version("gallery", $version = 5);
}
if ($version == 5) {
Cache::instance()->delete_all();
$db->query("ALTER TABLE {caches} DROP COLUMN `id`");
$db->query("ALTER TABLE {caches} ADD COLUMN `key` varchar(255) NOT NULL");
$db->query("ALTER TABLE {caches} ADD COLUMN `id` int(9) NOT NULL auto_increment PRIMARY KEY");
module::set_version("gallery", $version = 6);
}
if ($version == 6) {
module::clear_var("gallery", "version");
module::set_version("gallery", $version = 7);
}
if ($version == 7) {
$groups = ORM::factory("group")->find_all();
$permissions = ORM::factory("permission")->find_all();
foreach ($groups as $group) {
foreach ($permissions as $permission) {
// Update access intents
$db->query("ALTER TABLE {access_intents} MODIFY COLUMN {$permission->name}_{$group->id} BINARY(1) DEFAULT NULL");
// Update access cache
if ($permission->name === "view") {
$db->query("ALTER TABLE {items} MODIFY COLUMN {$permission->name}_{$group->id} BINARY(1) DEFAULT FALSE");
} else {
$db->query("ALTER TABLE {access_caches} MODIFY COLUMN {$permission->name}_{$group->id} BINARY(1) NOT NULL DEFAULT FALSE");
}
}
}
module::set_version("gallery", $version = 8);
}
if ($version == 8) {
$db->query("ALTER TABLE {items} CHANGE COLUMN `left` `left_ptr` INT(9) NOT NULL;");
$db->query("ALTER TABLE {items} CHANGE COLUMN `right` `right_ptr` INT(9) NOT NULL;");
module::set_version("gallery", $version = 9);
}
if ($version == 9) {
$db->query("ALTER TABLE {items} ADD KEY `weight` (`weight` DESC);");
module::set_version("gallery", $version = 10);
}
if ($version == 10) {
module::set_var("gallery", "image_sharpen", 15);
module::set_version("gallery", $version = 11);
}
if ($version == 11) {
$db->query("ALTER TABLE {items} ADD COLUMN `relative_url_cache` varchar(255) DEFAULT NULL");
$db->query("ALTER TABLE {items} ADD COLUMN `slug` varchar(255) DEFAULT NULL");
// This is imperfect since some of the slugs may contain invalid characters, but it'll do
// for now because we don't want a lengthy operation here.
$db->query("UPDATE {items} SET `slug` = `name`");
// Flush all path caches becuase we're going to start urlencoding them.
$db->query("UPDATE {items} SET `relative_url_cache` = NULL, `relative_path_cache` = NULL");
module::set_version("gallery", $version = 12);
}
if ($version == 12) {
if (module::get_var("gallery", "active_site_theme") == "default") {
module::set_var("gallery", "active_site_theme", "wind");
}
if (module::get_var("gallery", "active_admin_theme") == "admin_default") {
module::set_var("gallery", "active_admin_theme", "admin_wind");
}
module::set_version("gallery", $version = 13);
}
if ($version == 13) {
// Add rules for generating our thumbnails and resizes
Database::instance()->query("UPDATE {graphics_rules} SET `operation` = CONCAT('gallery_graphics::', `operation`);");
module::set_version("gallery", $version = 14);
}
if ($version == 14) {
$sidebar_blocks = block_manager::get_active("site.sidebar");
if (empty($sidebar_blocks)) {
$available_blocks = block_manager::get_available_site_blocks();
foreach (array_keys(block_manager::get_available_site_blocks()) as $id) {
$sidebar_blocks[] = explode(":", $id);
}
block_manager::set_active("site.sidebar", $sidebar_blocks);
}
module::set_version("gallery", $version = 15);
}
}
示例9: get_add_block_form
static function get_add_block_form()
{
$available_blocks = block_manager::get_available_admin_blocks();
$active = array();
foreach (array_merge(block_manager::get_active("dashboard_sidebar"), block_manager::get_active("dashboard_center")) as $b) {
unset($available_blocks[implode(":", $b)]);
}
if (!$available_blocks) {
return;
}
$form = new Forge("admin/dashboard/add_block", "", "post", array("id" => "g-add-dashboard-block-form"));
$group = $form->group("add_block")->label(t("Add Block"));
$group->dropdown("id")->label(t("Available blocks"))->options($available_blocks);
$group->submit("center")->value(t("Add to center"));
$group->submit("sidebar")->value(t("Add to sidebar"));
return $form;
}
示例10: defined
<?php
defined("SYSPATH") or die("No direct script access.");
?>
<ul class="g-message-block">
<li class="g-warning">
<?php
if (block_manager::get_active("site_sidebar")) {
?>
<?php
echo t("Active sidebar blocks have no content.");
?>
<?php
} else {
?>
<?php
echo t("No active sidebar blocks.");
?>
<?php
}
?>
<a href="<?php
echo url::site("admin/sidebar");
?>
"><?php
echo t("configure blocks");
?>
</a>
</li>
</ul>
示例11: get_block_html
public function get_block_html($module)
{
$active = block_manager::get_active("site_sidebar");
$result = "";
foreach ($active as $id => $desc) {
if ($desc[0] == $module and method_exists("{$desc['0']}_block", "get")) {
$block = call_user_func(array("{$desc['0']}_block", "get"), $desc[1], $this);
if (!empty($block)) {
$block->id = $id;
$block->css_id = $block->css_id . "-inline";
$result .= $block;
}
}
}
return $result;
}