当前位置: 首页>>代码示例>>PHP>>正文


PHP block_manager类代码示例

本文整理汇总了PHP中block_manager的典型用法代码示例。如果您正苦于以下问题:PHP block_manager类的具体用法?PHP block_manager怎么用?PHP block_manager使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了block_manager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: upgrade

 static function upgrade($version)
 {
     if ($version == 1) {
         block_manager::add("site.sidebar", "image_block", "random_image");
         module::set_version("image_block", 2);
     }
 }
开发者ID:brocki,项目名称:gallery3,代码行数:7,代码来源:image_block_installer.php

示例2: install

 static function install()
 {
     $db = Database::instance();
     $db->query("CREATE TABLE IF NOT EXISTS {comments} (\n                 `author_id` int(9) default NULL,\n                 `created` int(9) NOT NULL,\n                 `guest_email` varchar(128) default NULL,\n                 `guest_name` varchar(128) default NULL,\n                 `guest_url` varchar(255) default NULL,\n                 `id` int(9) NOT NULL auto_increment,\n                 `item_id` int(9) NOT NULL,\n                 `server_http_accept_charset` varchar(64) default NULL,\n                 `server_http_accept_encoding` varchar(64) default NULL,\n                 `server_http_accept_language` varchar(64) default NULL,\n                 `server_http_accept` varchar(128) default NULL,\n                 `server_http_connection` varchar(64) default NULL,\n                 `server_http_host` varchar(64) default NULL,\n                 `server_http_referer` varchar(255) default NULL,\n                 `server_http_user_agent` varchar(128) default NULL,\n                 `server_query_string` varchar(64) default NULL,\n                 `server_remote_addr` varchar(32) default NULL,\n                 `server_remote_host` varchar(64) default NULL,\n                 `server_remote_port` varchar(16) default NULL,\n                 `state` varchar(15) default 'unpublished',\n                 `text` text,\n                 `updated` int(9) NOT NULL,\n               PRIMARY KEY (`id`))\n               DEFAULT CHARSET=utf8;");
     block_manager::add("dashboard_center", "comment", "recent_comments");
     module::set_var("comment", "spam_caught", 0);
     module::set_version("comment", 2);
 }
开发者ID:Okat,项目名称:gallery3,代码行数:8,代码来源:comment_installer.php

示例3: get_add_block_form

 static function get_add_block_form()
 {
     $form = new Forge("admin/dashboard/add_block", "", "post", array("id" => "gAddDashboardBlockForm"));
     $group = $form->group("add_block")->label(t("Add Block"));
     $group->dropdown("id")->label(t("Available Blocks"))->options(block_manager::get_available());
     $group->submit("center")->value(t("Add to center"));
     $group->submit("sidebar")->value(t("Add to sidebar"));
     return $form;
 }
开发者ID:kstyrvoll,项目名称:gallery3,代码行数:9,代码来源:gallery_block.php

示例4: _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);
 }
开发者ID:ChrisRut,项目名称:gallery3,代码行数:13,代码来源:admin_sidebar.php

示例5: 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);
     }
 }
开发者ID:andyst,项目名称:gallery3,代码行数:17,代码来源:admin_dashboard.php

示例6: install

 static function install()
 {
     $db = Database::instance();
     $db->query("CREATE TABLE {access_caches} (\n                 `id` int(9) NOT NULL auto_increment,\n                 `item_id` int(9),\n                 PRIMARY KEY (`id`))\n               ENGINE=InnoDB DEFAULT CHARSET=utf8;");
     $db->query("CREATE TABLE {access_intents} (\n                 `id` int(9) NOT NULL auto_increment,\n                 `item_id` int(9),\n                 PRIMARY KEY (`id`))\n               ENGINE=InnoDB DEFAULT CHARSET=utf8;");
     $db->query("CREATE TABLE {caches} (\n                `id` int(9) NOT NULL auto_increment,\n                `key` varchar(255) NOT NULL,\n                `tags` varchar(255),\n                `expiration` int(9) NOT NULL,\n                `cache` longblob,\n                PRIMARY KEY (`id`),\n                KEY (`tags`))\n                ENGINE=InnoDB DEFAULT CHARSET=utf8;");
     $db->query("CREATE TABLE {graphics_rules} (\n                 `id` int(9) NOT NULL auto_increment,\n                 `active` BOOLEAN default 0,\n                 `args` varchar(255) default NULL,\n                 `module_name` varchar(64) NOT NULL,\n                 `operation` varchar(64) NOT NULL,\n                 `priority` int(9) NOT NULL,\n                 `target`  varchar(32) NOT NULL,\n                 PRIMARY KEY (`id`))\n               ENGINE=InnoDB DEFAULT CHARSET=utf8;");
     $db->query("CREATE TABLE {incoming_translations} (\n                 `id` int(9) NOT NULL auto_increment,\n                 `key` char(32) NOT NULL,\n                 `locale` char(10) NOT NULL,\n                 `message` text NOT NULL,\n                 `revision` int(9) DEFAULT NULL,\n                 `translation` text,\n                 PRIMARY KEY (`id`),\n                 UNIQUE KEY(`key`, `locale`),\n                 KEY `locale_key` (`locale`, `key`))\n               ENGINE=InnoDB DEFAULT CHARSET=utf8;");
     $db->query("CREATE TABLE {items} (\n                 `id` int(9) NOT NULL auto_increment,\n                 `album_cover_item_id` int(9) default NULL,\n                 `captured` int(9) default NULL,\n                 `created` int(9) default NULL,\n                 `description` varchar(2048) default NULL,\n                 `height` int(9) default NULL,\n                 `left` int(9) NOT NULL,\n                 `level` int(9) NOT NULL,\n                 `mime_type` varchar(64) default NULL,\n                 `name` varchar(255) default NULL,\n                 `owner_id` int(9) default NULL,\n                 `parent_id` int(9) NOT NULL,\n                 `rand_key` float default NULL,\n                 `relative_path_cache` varchar(255) default NULL,\n                 `resize_dirty` boolean default 1,\n                 `resize_height` int(9) default NULL,\n                 `resize_width` int(9) default NULL,\n                 `right` int(9) NOT NULL,\n                 `sort_column` varchar(64) default NULL,\n                 `sort_order` char(4) default 'ASC',\n                 `thumb_dirty` boolean default 1,\n                 `thumb_height` int(9) default NULL,\n                 `thumb_width` int(9) default NULL,\n                 `title` varchar(255) default NULL,\n                 `type` varchar(32) NOT NULL,\n                 `updated` int(9) default NULL,\n                 `view_count` int(9) default 0,\n                 `weight` int(9) NOT NULL default 0,\n                 `width` int(9) default NULL,\n                 PRIMARY KEY (`id`),\n                 KEY `parent_id` (`parent_id`),\n                 KEY `type` (`type`),\n                 KEY `random` (`rand_key`))\n               ENGINE=InnoDB DEFAULT CHARSET=utf8;");
     $db->query("CREATE TABLE {logs} (\n                 `id` int(9) NOT NULL auto_increment,\n                 `category` varchar(64) default NULL,\n                 `html` varchar(255) default NULL,\n                 `message` text default NULL,\n                 `referer` varchar(255) default NULL,\n                 `severity` int(9) default 0,\n                 `timestamp` int(9) default 0,\n                 `url` varchar(255) default NULL,\n                 `user_id` int(9) default 0,\n                 PRIMARY KEY (`id`))\n               ENGINE=InnoDB DEFAULT CHARSET=utf8;");
     $db->query("CREATE TABLE {messages} (\n                 `id` int(9) NOT NULL auto_increment,\n                 `key` varchar(255) default NULL,\n                 `severity` varchar(32) default NULL,\n                 `value` varchar(255) default NULL,\n                 PRIMARY KEY (`id`),\n                 UNIQUE KEY(`key`))\n               ENGINE=InnoDB DEFAULT CHARSET=utf8;");
     $db->query("CREATE TABLE {modules} (\n                 `id` int(9) NOT NULL auto_increment,\n                 `active` BOOLEAN default 0,\n                 `name` varchar(64) default NULL,\n                 `version` int(9) default NULL,\n                 PRIMARY KEY (`id`),\n                 UNIQUE KEY(`name`))\n               ENGINE=InnoDB DEFAULT CHARSET=utf8;");
     $db->query("CREATE TABLE {outgoing_translations} (\n                 `id` int(9) NOT NULL auto_increment,\n                 `base_revision` int(9) DEFAULT NULL,\n                 `key` char(32) NOT NULL,\n                 `locale` char(10) NOT NULL,\n                 `message` text NOT NULL,\n                 `translation` text,\n                 PRIMARY KEY (`id`),\n                 UNIQUE KEY(`key`, `locale`),\n                 KEY `locale_key` (`locale`, `key`))\n               ENGINE=InnoDB DEFAULT CHARSET=utf8;");
     $db->query("CREATE TABLE {permissions} (\n                 `id` int(9) NOT NULL auto_increment,\n                 `display_name` varchar(64) default NULL,\n                 `name` varchar(64) default NULL,\n                 PRIMARY KEY (`id`),\n                 UNIQUE KEY(`name`))\n               ENGINE=InnoDB DEFAULT CHARSET=utf8;");
     $db->query("CREATE TABLE {sessions} (\n                `session_id` varchar(127) NOT NULL,\n                `data` text NOT NULL,\n                `last_activity` int(10) UNSIGNED NOT NULL,\n                PRIMARY KEY (`session_id`))\n               ENGINE=InnoDB DEFAULT CHARSET=utf8;");
     $db->query("CREATE TABLE {tasks} (\n                `id` int(9) NOT NULL auto_increment,\n                `callback` varchar(128) default NULL,\n                `context` text NOT NULL,\n                `done` boolean default 0,\n                `name` varchar(128) default NULL,\n                `owner_id` int(9) default NULL,\n                `percent_complete` int(9) default 0,\n                `state` varchar(32) default NULL,\n                `status` varchar(255) default NULL,\n                `updated` int(9) default NULL,\n                PRIMARY KEY (`id`),\n                KEY (`owner_id`))\n               ENGINE=InnoDB DEFAULT CHARSET=utf8;");
     $db->query("CREATE TABLE {themes} (\n                 `id` int(9) NOT NULL auto_increment,\n                 `name` varchar(64) default NULL,\n                 `version` int(9) default NULL,\n                 PRIMARY KEY (`id`),\n                 UNIQUE KEY(`name`))\n               ENGINE=InnoDB DEFAULT CHARSET=utf8;");
     $db->query("CREATE TABLE {vars} (\n                `id` int(9) NOT NULL auto_increment,\n                `module_name` varchar(64) NOT NULL,\n                `name` varchar(64) NOT NULL,\n                `value` text,\n                PRIMARY KEY (`id`),\n                UNIQUE KEY(`module_name`, `name`))\n               ENGINE=InnoDB DEFAULT CHARSET=utf8;");
     foreach (array("albums", "logs", "modules", "resizes", "thumbs", "tmp", "uploads") as $dir) {
         @mkdir(VARPATH . $dir);
     }
     access::register_permission("view", "View");
     access::register_permission("view_full", "View Full Size");
     access::register_permission("edit", "Edit");
     access::register_permission("add", "Add");
     $root = ORM::factory("item");
     $root->type = "album";
     $root->title = "Gallery";
     $root->description = "";
     $root->left = 1;
     $root->right = 2;
     $root->parent_id = 0;
     $root->level = 1;
     $root->thumb_dirty = 1;
     $root->resize_dirty = 1;
     $root->sort_column = "weight";
     $root->sort_order = "ASC";
     $root->save();
     access::add_item($root);
     module::set_var("gallery", "active_site_theme", "default");
     module::set_var("gallery", "active_admin_theme", "admin_default");
     module::set_var("gallery", "page_size", 9);
     module::set_var("gallery", "thumb_size", 200);
     module::set_var("gallery", "resize_size", 640);
     module::set_var("gallery", "default_locale", "en_US");
     module::set_var("gallery", "image_quality", 75);
     // Add rules for generating our thumbnails and resizes
     graphics::add_rule("gallery", "thumb", "resize", array("width" => 200, "height" => 200, "master" => Image::AUTO), 100);
     graphics::add_rule("gallery", "resize", "resize", array("width" => 640, "height" => 480, "master" => Image::AUTO), 100);
     // Instantiate default themes (site and admin)
     foreach (array("default", "admin_default") as $theme_name) {
         $theme_info = new ArrayObject(parse_ini_file(THEMEPATH . $theme_name . "/theme.info"), ArrayObject::ARRAY_AS_PROPS);
         $theme = ORM::factory("theme");
         $theme->name = $theme_name;
         $theme->version = $theme_info->version;
         $theme->save();
     }
     block_manager::add("dashboard_sidebar", "gallery", "block_adder");
     block_manager::add("dashboard_sidebar", "gallery", "stats");
     block_manager::add("dashboard_sidebar", "gallery", "platform_info");
     block_manager::add("dashboard_sidebar", "gallery", "project_news");
     block_manager::add("dashboard_center", "gallery", "welcome");
     block_manager::add("dashboard_center", "gallery", "photo_stream");
     block_manager::add("dashboard_center", "gallery", "log_entries");
     module::set_var("gallery", "choose_default_tookit", 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_var("gallery", "show_credits", 1);
     // @todo this string needs to be picked up by l10n_scanner
     module::set_var("gallery", "credits", "Powered by <a href=\"%url\">Gallery %version</a>");
     module::set_version("gallery", 7);
 }
开发者ID:hiwilson,项目名称:gallery3,代码行数:73,代码来源:gallery_installer.php

示例7: setup_blocks

 /**
  * Inform a block_manager about the block regions this theme wants on this
  * type of page.
  * @param string $generaltype the general type of the page.
  * @param block_manager $blockmanager the block_manger to set up.
  * @return void
  */
 public function setup_blocks($generaltype, $blockmanager)
 {
     // Legacy fallback.
     if (empty($this->layouts)) {
         if (!in_array($generaltype, array('form', 'popup', 'maintenance'))) {
             $blockmanager->add_regions(array(BLOCK_POS_LEFT, BLOCK_POS_RIGHT));
             $blockmanager->set_default_region(BLOCK_POS_RIGHT);
         }
         return;
     }
     $layoutinfo = $this->layout_info_for_page($generaltype);
     if (!empty($layoutinfo['regions'])) {
         $blockmanager->add_regions($layoutinfo['regions']);
         $blockmanager->set_default_region($layoutinfo['defaultregion']);
     }
 }
开发者ID:ajv,项目名称:Offline-Caching,代码行数:23,代码来源:outputlib.php

示例8: test_create_all_block_instances

 public function test_create_all_block_instances()
 {
     global $CFG, $PAGE, $DB;
     $this->resetAfterTest();
     $regionname = 'side-pre';
     $context = context_system::instance();
     $PAGE->reset_theme_and_output();
     $CFG->theme = 'boost';
     list($page, $blockmanager) = $this->get_a_page_and_block_manager(array($regionname), $context, 'page-type');
     $blockmanager->load_blocks();
     $blockmanager->create_all_block_instances();
     $blocks = $blockmanager->get_blocks_for_region($regionname);
     $this->assertEmpty($blocks);
     // There should be no blocks in the DB.
     $PAGE->reset_theme_and_output();
     // Change to a theme with undeletable blocks.
     $CFG->theme = 'clean';
     list($page, $blockmanager) = $this->get_a_page_and_block_manager(array($regionname), $context, 'page-type');
     $blockmanager->show_only_fake_blocks(true);
     $blockmanager->load_blocks();
     $blockmanager->create_all_block_instances();
     $blocks = $blockmanager->get_blocks_for_region($regionname);
     $this->assertEmpty($blocks);
     $PAGE->reset_theme_and_output();
     list($page, $blockmanager) = $this->get_a_page_and_block_manager(array($regionname), $context, 'page-type');
     $blockmanager->show_only_fake_blocks(false);
     $blockmanager->load_blocks();
     $blockmanager->create_all_block_instances();
     $blocks = $blockmanager->get_blocks_for_region($regionname);
     $this->assertCount(2, $blocks);
     $undeletable = block_manager::get_undeletable_block_types();
     foreach ($undeletable as $blockname) {
         $instance = $DB->get_record('block_instances', array('blockname' => $blockname));
         $this->assertEquals(1, $instance->requiredbytheme);
     }
     // Switch back and those auto blocks should not be returned.
     $PAGE->reset_theme_and_output();
     $CFG->theme = 'boost';
     list($page, $blockmanager) = $this->get_a_page_and_block_manager(array($regionname), $context, 'page-type');
     $blockmanager->load_blocks();
     $blockmanager->create_all_block_instances();
     $blocks = $blockmanager->get_blocks_for_region($regionname);
     $this->assertEmpty($blocks);
     // But they should exist in the DB.
     foreach ($undeletable as $blockname) {
         $count = $DB->count_records('block_instances', array('blockname' => $blockname));
         $this->assertEquals(1, $count);
     }
 }
开发者ID:EsdrasCaleb,项目名称:moodle,代码行数:49,代码来源:blocklib_test.php

示例9: install

 static function install()
 {
     $db = Database::instance();
     $version = 0;
     try {
         $version = module::get_version("core");
     } catch (Exception $e) {
         if ($e->getCode() != E_DATABASE_ERROR) {
             Kohana::log("error", $e);
             throw $e;
         }
     }
     if ($version == 0) {
         $db->query("CREATE TABLE `access_caches` (\n                   `id` int(9) NOT NULL auto_increment,\n                   `item_id` int(9),\n                   PRIMARY KEY (`id`))\n                 ENGINE=InnoDB DEFAULT CHARSET=utf8;");
         $db->query("CREATE TABLE `access_intents` (\n                   `id` int(9) NOT NULL auto_increment,\n                   `item_id` int(9),\n                   PRIMARY KEY (`id`))\n                 ENGINE=InnoDB DEFAULT CHARSET=utf8;");
         $db->query("CREATE TABLE `graphics_rules` (\n                   `id` int(9) NOT NULL auto_increment,\n                   `priority` int(9) NOT NULL,\n                   `module_name` varchar(64) NOT NULL,\n                   `target`  varchar(32) NOT NULL,\n                   `operation` varchar(64) NOT NULL,\n                   `args` varchar(255) default NULL,\n                   PRIMARY KEY (`id`))\n                 ENGINE=InnoDB DEFAULT CHARSET=utf8;");
         $db->query("CREATE TABLE `items` (\n                   `album_cover_item_id` int(9) default NULL,\n                   `created` int(9) default NULL,\n                   `description` varchar(255) default NULL,\n                   `height` int(9) default NULL,\n                   `id` int(9) NOT NULL auto_increment,\n                   `left` int(9) NOT NULL,\n                   `level` int(9) NOT NULL,\n                   `mime_type` varchar(64) default NULL,\n                   `name` varchar(255) default NULL,\n                   `owner_id` int(9) default NULL,\n                   `parent_id` int(9) NOT NULL,\n                   `resize_height` int(9) default NULL,\n                   `resize_width` int(9) default NULL,\n                   `resize_dirty` boolean default 1,\n                   `right` int(9) NOT NULL,\n                   `thumb_height` int(9) default NULL,\n                   `thumb_width` int(9) default NULL,\n                   `thumb_dirty` boolean default 1,\n                   `title` varchar(255) default NULL,\n                   `type` varchar(32) NOT NULL,\n                   `updated` int(9) default NULL,\n                   `view_count` int(9) default 0,\n                   `width` int(9) default NULL,\n                   PRIMARY KEY (`id`),\n                   KEY `parent_id` (`parent_id`),\n                   KEY `type` (`type`))\n                 ENGINE=InnoDB DEFAULT CHARSET=utf8;");
         $db->query("CREATE TABLE `logs` (\n                   `id` int(9) NOT NULL auto_increment,\n                   `category` varchar(64) default NULL,\n                   `html` varchar(255) default NULL,\n                   `message` text default NULL,\n                   `referer` varchar(255) default NULL,\n                   `severity` int(9) default 0,\n                   `timestamp` int(9) default 0,\n                   `url` varchar(255) default NULL,\n                   `user_id` int(9) default 0,\n                   PRIMARY KEY (`id`))\n                 ENGINE=InnoDB DEFAULT CHARSET=utf8;");
         $db->query("CREATE TABLE `messages` (\n                   `id` int(9) NOT NULL auto_increment,\n                   `key` varchar(255) default NULL,\n                   `value` varchar(255) default NULL,\n                   `severity` varchar(32) default NULL,\n                   PRIMARY KEY (`id`),\n                   UNIQUE KEY(`key`))\n                 ENGINE=InnoDB DEFAULT CHARSET=utf8;");
         $db->query("CREATE TABLE `modules` (\n                   `id` int(9) NOT NULL auto_increment,\n                   `name` varchar(64) default NULL,\n                   `version` int(9) default NULL,\n                   PRIMARY KEY (`id`),\n                   UNIQUE KEY(`name`))\n                 ENGINE=InnoDB DEFAULT CHARSET=utf8;");
         $db->query("CREATE TABLE `themes` (\n                   `id` int(9) NOT NULL auto_increment,\n                   `name` varchar(64) default NULL,\n                   `version` int(9) default NULL,\n                   PRIMARY KEY (`id`),\n                   UNIQUE KEY(`name`))\n                 ENGINE=InnoDB DEFAULT CHARSET=utf8;");
         $db->query("CREATE TABLE `permissions` (\n                   `id` int(9) NOT NULL auto_increment,\n                   `name` varchar(64) default NULL,\n                   `display_name` varchar(64) default NULL,\n                   PRIMARY KEY (`id`),\n                   UNIQUE KEY(`name`))\n                 ENGINE=InnoDB DEFAULT CHARSET=utf8;");
         $db->query("CREATE TABLE `incoming_translations` (\n                   `id` int(9) NOT NULL auto_increment,\n                   `key` binary(16) NOT NULL,\n                   `locale` char(10) NOT NULL,\n                   `message` text NOT NULL,\n                   `translation` text,\n                   `revision` int(9) DEFAULT NULL,\n                   PRIMARY KEY (`id`),\n                   UNIQUE KEY(`key`, `locale`),\n                   KEY `locale_key` (`locale`, `key`))\n                 ENGINE=InnoDB DEFAULT CHARSET=utf8;");
         $db->query("CREATE TABLE `sessions` (\n                  `session_id` varchar(127) NOT NULL,\n                  `last_activity` int(10) UNSIGNED NOT NULL,\n                  `data` text NOT NULL,\n                  PRIMARY KEY (`session_id`))\n                 ENGINE=InnoDB DEFAULT CHARSET=utf8;");
         $db->query("CREATE TABLE `tasks` (\n                  `callback` varchar(128) default NULL,\n                  `context` text NOT NULL,\n                  `done` boolean default 0,\n                  `id` int(9) NOT NULL auto_increment,\n                  `updated` int(9) default NULL,\n                  `name` varchar(128) default NULL,\n                  `percent_complete` int(9) default 0,\n                  `state` varchar(32) default NULL,\n                  `status` varchar(255) default NULL,\n                  PRIMARY KEY (`id`))\n                 ENGINE=InnoDB DEFAULT CHARSET=utf8;");
         $db->query("CREATE TABLE `vars` (\n                   `id` int(9) NOT NULL auto_increment,\n                   `module_name` varchar(64) NOT NULL,\n                   `name` varchar(64) NOT NULL,\n                   `value` text,\n                   PRIMARY KEY (`id`),\n                   UNIQUE KEY(`module_name`, `name`))\n                 ENGINE=InnoDB DEFAULT CHARSET=utf8;");
         foreach (array("albums", "resizes", "thumbs", "uploads", "modules") as $dir) {
             @mkdir(VARPATH . $dir);
         }
         access::register_permission("view", "View");
         access::register_permission("view_full", "View Full Size");
         access::register_permission("edit", "Edit");
         $root = ORM::factory("item");
         $root->type = 'album';
         $root->title = "Gallery";
         $root->description = "Welcome to your Gallery3";
         $root->left = 1;
         $root->right = 2;
         $root->parent_id = 0;
         $root->level = 1;
         $root->thumb_dirty = 1;
         $root->resize_dirty = 1;
         $root->save();
         access::add_item($root);
         module::set_var("core", "active_site_theme", "default");
         module::set_var("core", "active_admin_theme", "admin_default");
         module::set_var("core", "page_size", 9);
         module::set_var("core", "thumb_size", 200);
         module::set_var("core", "resize_size", 640);
         // Add rules for generating our thumbnails and resizes
         graphics::add_rule("core", "thumb", "resize", array("width" => 200, "height" => 200, "master" => Image::AUTO), 100);
         graphics::add_rule("core", "resize", "resize", array("width" => 640, "height" => 480, "master" => Image::AUTO), 100);
         // Detect a graphics toolkit
         $toolkits = graphics::detect_toolkits();
         foreach (array("imagemagick", "graphicsmagick", "gd") as $tk) {
             if ($toolkits[$tk]) {
                 module::set_var("core", "graphics_toolkit", $tk);
                 if ($tk != "gd") {
                     module::set_var("core", "graphics_toolkit_path", $toolkits[$tk]);
                 }
                 break;
             }
         }
         if (!module::get_var("core", "graphics_toolkit")) {
             site_status::warning(t("Graphics toolkit missing!  Please <a href=\"%url\">choose a toolkit</a>", array("url" => url::site("admin/graphics"))), "missing_graphics_toolkit");
         }
         // Instantiate default themes (site and admin)
         foreach (array("default", "admin_default") as $theme_name) {
             $theme_info = new ArrayObject(parse_ini_file(THEMEPATH . $theme_name . "/theme.info"), ArrayObject::ARRAY_AS_PROPS);
             $theme = ORM::factory("theme");
             $theme->name = $theme_name;
             $theme->version = $theme_info->version;
             $theme->save();
         }
         block_manager::add("dashboard_sidebar", "core", "block_adder");
         block_manager::add("dashboard_sidebar", "core", "stats");
         block_manager::add("dashboard_sidebar", "core", "platform_info");
         block_manager::add("dashboard_sidebar", "core", "project_news");
         block_manager::add("dashboard_center", "core", "welcome");
         block_manager::add("dashboard_center", "core", "photo_stream");
         block_manager::add("dashboard_center", "core", "log_entries");
         module::set_version("core", 1);
         module::set_var("core", "version", "3.0");
     }
 }
开发者ID:Juuro,项目名称:Dreamapp-Website,代码行数:85,代码来源:core_installer.php

示例10: 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");
//.........这里部分代码省略.........
开发者ID:HarriLu,项目名称:gallery3,代码行数:101,代码来源:gallery_installer.php

示例11: add_to_config_log

    add_to_config_log('block_visibility', $block->visible, '1', $block->name);
    core_plugin_manager::reset_caches();
    admin_get_root(true, false);
    // settings not required - only pages
}
if (!empty($protect) && confirm_sesskey()) {
    block_manager::protect_block((int) $protect);
    admin_get_root(true, false);
    // settings not required - only pages
}
if (!empty($unprotect) && confirm_sesskey()) {
    block_manager::unprotect_block((int) $unprotect);
    admin_get_root(true, false);
    // settings not required - only pages
}
$undeletableblocktypes = block_manager::get_undeletable_block_types();
echo $OUTPUT->header();
echo $OUTPUT->heading($strmanageblocks);
/// Main display starts here
/// Get and sort the existing blocks
if (!($blocks = $DB->get_records('block', array(), 'name ASC'))) {
    print_error('noblocks', 'error');
    // Should never happen
}
$incompatible = array();
/// Print the table of all blocks
$table = new flexible_table('admin-blocks-compatible');
$table->define_columns(array('name', 'instances', 'version', 'hideshow', 'undeletable', 'settings', 'uninstall'));
$table->define_headers(array($strname, $strcourses, $strversion, $strhide . '/' . $strshow, $strprotecthdr, $strsettings, $struninstall));
$table->define_baseurl($CFG->wwwroot . '/' . $CFG->admin . '/blocks.php');
$table->set_attribute('class', 'admintable blockstable generaltable');
开发者ID:Chocolate-lightning,项目名称:moodle,代码行数:31,代码来源:blocks.php

示例12: setup_blocks

 /**
  * Inform a block_manager about the block regions this theme wants on this
  * page layout.
  *
  * @param string $pagelayout the general type of the page.
  * @param block_manager $blockmanager the block_manger to set up.
  */
 public function setup_blocks($pagelayout, $blockmanager)
 {
     $layoutinfo = $this->layout_info_for_page($pagelayout);
     if (!empty($layoutinfo['regions'])) {
         $blockmanager->add_regions($layoutinfo['regions'], false);
         $blockmanager->set_default_region($layoutinfo['defaultregion']);
     }
 }
开发者ID:MoodleMetaData,项目名称:MoodleMetaData,代码行数:15,代码来源:outputlib.php

示例13: 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);
     }
 }
开发者ID:brocki,项目名称:gallery3,代码行数:99,代码来源:gallery_installer.php

示例14: 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;
 }
开发者ID:JasonWiki,项目名称:docs,代码行数:17,代码来源:gallery_block.php

示例15: 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>
开发者ID:JasonWiki,项目名称:docs,代码行数:30,代码来源:no_sidebar.html.php


注:本文中的block_manager类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。