[Isocial-svn] SF.net SVN: isocial: [242] app
Status: Pre-Alpha
Brought to you by:
aguidrevitch
From: <fsn...@us...> - 2008-06-20 07:54:27
|
Revision: 242 http://isocial.svn.sourceforge.net/isocial/?rev=242&view=rev Author: fsnobody Date: 2008-06-20 00:54:35 -0700 (Fri, 20 Jun 2008) Log Message: ----------- hot kakoj nit da camit Modified Paths: -------------- app/controllers/blogapp/post_controller.php app/installers/blogapp/blog_installer.php app/models/blogapp_attachment.php app/models/blogapp_post.php app/views/blogapp/post/index.tpl Modified: app/controllers/blogapp/post_controller.php =================================================================== --- app/controllers/blogapp/post_controller.php 2008-06-17 09:22:52 UTC (rev 241) +++ app/controllers/blogapp/post_controller.php 2008-06-20 07:54:35 UTC (rev 242) @@ -5,11 +5,23 @@ var $models = array('blogapp', 'blogapp_post', 'blogapp_attachment'); function index () { + $this->posts = $this->BlogappPost->find('all', array('conditions' => array('user_id = ' . $this->current_user->getId()))); + //$this->debug($this->posts); + for ($i = 0 ; $i < count($this->posts) ; $i++) { + $this->posts[$i]->media_item->load(); + $this->posts[$i]->attachments = $this->posts[$i]->attachment->load(); + foreach ($this->posts[$i]->attachments as $k => $attach) { + $attach->stored_file->load(); + } + //$this->debug( count($this->posts[$i]->attachment->load())); + //$this->debug($this->posts[$i]->media_item->find()); + } } function create () { if (!empty($this->params['post']) && $this->Request->isPost() ){ $post = $this->BlogappPost; + $post->user_id = $this->current_user->getId(); $post->media_item->build(); $post->media_item->user_id = $this->current_user->getId(); $post->media_item->setAttributes($this->params['post']); Modified: app/installers/blogapp/blog_installer.php =================================================================== --- app/installers/blogapp/blog_installer.php 2008-06-17 09:22:52 UTC (rev 241) +++ app/installers/blogapp/blog_installer.php 2008-06-20 07:54:35 UTC (rev 242) @@ -9,6 +9,7 @@ "CREATE TABLE `blogapp_posts` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `media_item_id` int(11) NOT NULL, + `user_id` int(11) NOT NULL, FOREIGN KEY (media_item_id) REFERENCES media_items(id) ) ENGINE=InnoDB"); Modified: app/models/blogapp_attachment.php =================================================================== --- app/models/blogapp_attachment.php 2008-06-17 09:22:52 UTC (rev 241) +++ app/models/blogapp_attachment.php 2008-06-20 07:54:35 UTC (rev 242) @@ -3,12 +3,13 @@ class BlogappAttachment extends ActiveRecord { - var $belongs_to = array('post' => array('class_name' => 'BlogappPost', - 'primary_key_name' => 'post_id') + var $belongs_to = array( + 'post' => array('class_name' => 'BlogappPost', 'primary_key_name' => 'post_id'), + 'stored_file' => array('class_name' => 'StoredFile', 'primary_key_name' => 'base_file_id') ); - var $has_many = array( 'stored_files' => array('class_name' => 'StoredFile', 'foreign_key' => 'base_file_id') ); +// var $has_many = array( 'stored_files' => array('class_name' => 'StoredFile', 'foreign_key' => 'base_file_id') ); } ?> Modified: app/models/blogapp_post.php =================================================================== --- app/models/blogapp_post.php 2008-06-17 09:22:52 UTC (rev 241) +++ app/models/blogapp_post.php 2008-06-20 07:54:35 UTC (rev 242) @@ -2,15 +2,21 @@ class BlogappPost extends ActiveRecord { - +/* var $has_one = array('media_item' => array('class_name' => 'MediaItem', 'foreign_key' => 'media_item_id') ); +*/ + var $belongs_to = array('media_item' => array('class_name' => 'MediaItem', + 'primary_key_name' => 'media_item_id') + ); + var $has_many = array( 'attachments' => array('class_name' => 'BlogappAttachment', 'foreign_key' => 'post_id') ); + function validateOnCreate () { } Modified: app/views/blogapp/post/index.tpl =================================================================== --- app/views/blogapp/post/index.tpl 2008-06-17 09:22:52 UTC (rev 241) +++ app/views/blogapp/post/index.tpl 2008-06-20 07:54:35 UTC (rev 242) @@ -16,4 +16,14 @@ <div class="clearfix"></div> </div> +<div class="container"> + {loop posts} + <div><?= $post->getId();?></div> + <div><?= $post->media_item->get('title');?></div> + <div><?= $post->attachments[0]->get('base_file_id');?></div> + <div><?= $post->attachments[0]->stored_file->get('name');?></div> + + {end} +</div> + <div class="clearfix"></div> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |