summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorFelix Rabinovich <virshu@users.sourceforge.net>2008-11-08 07:18:56 +0000
committerFelix Rabinovich <virshu@users.sourceforge.net>2008-11-08 07:18:56 +0000
commit28b739a2105cba83f877d4fc4022d710b920b5a7 (patch)
treee814afda14126e1ae3160d07040f90042c42a8cd /modules
parent3bb9b9185cb9445157ab20df9178f9a892a0bbe0 (diff)
Adding user (owner) to items; info module
Diffstat (limited to 'modules')
-rw-r--r--modules/info/views/info_block.html.php12
-rw-r--r--modules/user/helpers/user_installer.php7
2 files changed, 13 insertions, 6 deletions
diff --git a/modules/info/views/info_block.html.php b/modules/info/views/info_block.html.php
index eac76b40..543ce3db 100644
--- a/modules/info/views/info_block.html.php
+++ b/modules/info/views/info_block.html.php
@@ -3,19 +3,19 @@
<tbody>
<tr>
<th>Title:</th>
- <td>Christmas 2007</td>
+ <td><?= $item->title; ?></td>
</tr>
<tr>
- <th>Taken:</th>
- <td>January 21, 2008</td>
+ <th>Description:</th>
+ <td><?= $item->description; ?></td>
</tr>
<tr>
- <th>Uploaded:</th>
- <td>January 27, 2008</td>
+ <th>Name:</th>
+ <td><?= $item->name; ?></td>
</tr>
<tr>
<th>Owner:</th>
- <td><a href="#">username</a></td>
+ <td><a href="#"><?= isset($item->user_id) ? $item->user->name : "anonymous"?></a></td>
</tr>
<tr>
<td colspan="2" class="toggle">
diff --git a/modules/user/helpers/user_installer.php b/modules/user/helpers/user_installer.php
index c69781e5..82221f10 100644
--- a/modules/user/helpers/user_installer.php
+++ b/modules/user/helpers/user_installer.php
@@ -18,6 +18,8 @@
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/
class user_installer {
+ protected $has_many = array('items');
+
public static function install() {
Kohana::log("debug", "user_installer::install");
$db = Database::instance();
@@ -56,6 +58,8 @@ class user_installer {
PRIMARY KEY (`group_id`, `user_id`),
UNIQUE KEY(`user_id`, `group_id`))
ENGINE=InnoDB DEFAULT CHARSET=utf8;");
+
+ $db->query("ALTER TABLE `items` ADD `user_id` INT(9) NULL");
$user_module = ORM::factory("module")->where("name", "user")->find();
$user_module->name = "user";
@@ -66,6 +70,8 @@ class user_installer {
$user->name = "admin";
$user->display_name = "Gallery Administrator";
$user->save();
+ $id = $user->id;
+ $db->query("UPDATE `items` SET `user_id` = $id ");
foreach (array("administrator", "registered") as $group_name) {
$group = ORM::factory("group")->where("name", $group_name)->find();
@@ -81,6 +87,7 @@ class user_installer {
public static function uninstall() {
$db = Database::instance();
+ $db->query("ALTER TABLE `items` DROP `user_id`");
$db->query("DROP TABLE IF EXISTS `users`;");
$db->query("DROP TABLE IF EXISTS `groups`;");
$db->query("DROP TABLE IF EXISTS `groups_users`;");