From de4b3670d8252fe180f634fe17647226b9a1b2a6 Mon Sep 17 00:00:00 2001
From: Antonio Gallo <tonicucoz@gmail.com>
Date: Sat, 30 Oct 2010 16:53:58 +0000
Subject: improved users history - part 2

---
 .../Application/Controllers/MeetController.php     | 38 ++++++++++++++-
 h-source/Application/Views/Meet/contributions.php  |  7 +++
 h-source/Application/Views/Meet/talk.php           | 56 ++++++++++++++++++++++
 h-source/Application/Views/talk.php                |  1 +
 h-source/Config/Route.php                          |  1 +
 h-source/Public/Css/website.css                    |  4 +-
 6 files changed, 104 insertions(+), 3 deletions(-)
 create mode 100644 h-source/Application/Views/Meet/talk.php

(limited to 'h-source')

diff --git a/h-source/Application/Controllers/MeetController.php b/h-source/Application/Controllers/MeetController.php
index d2ccc27..314f273 100644
--- a/h-source/Application/Controllers/MeetController.php
+++ b/h-source/Application/Controllers/MeetController.php
@@ -34,6 +34,7 @@ class MeetController extends BaseController
 		$this->model('HardwareModel');
 		$this->model('IssuesModel');
 		$this->model('MessagesModel');
+		$this->model('TalkModel');
 		
 		$argKeys = array(
 			'page:forceNat'	=>	1,
@@ -107,9 +108,12 @@ class MeetController extends BaseController
 			
 			$messNumb = $this->m['MessagesModel']->select('id_mes,messages.id_issue,messages.creation_date')->where(array('created_by'=>$clean['id_user'],'deleted'=>'no'))->rowNumber();
 			
+			$talkNumb = $this->m['TalkModel']->select('talk.title')->where(array('created_by'=>$clean['id_user'],'deleted'=>'no'))->rowNumber();
+			
 			$data['hasHardware'] = $hardNumb > 0 ? true : false;
 			$data['hasIssues'] = $issuesNumb > 0 ? true : false;
 			$data['hasMessages'] = $messNumb > 0 ? true : false;
+			$data['hasTalk'] = $talkNumb > 0 ? true : false;
 			
 			$this->append($data);
 			$this->load('contributions');
@@ -208,7 +212,39 @@ class MeetController extends BaseController
 			$this->load('messages');
 			$this->right();
 		}
+	}
+
+	//messages in the talk page
+	public function talk($lang = 'en', $user = '')
+	{
+		$clean['user'] = ctype_alnum($user) ? sanitizeAll($user) : '';
+		$data['title'] = "messages submitted - ".Website::$generalName;
+		
+		$this->shift(2);
+		
+		if ($this->userExists($clean['user']))
+		{
+			//load the Pages helper
+			$this->helper('Pages','meet/talk/'.$this->lang.'/'.$clean['user'],'page');
+			
+			$clean['id_user'] = (int)$this->m['UsersModel']->getUserId($clean['user']);
 
+			$this->m['TalkModel']->from('talk inner join hardware')->using('id_hard')->select('talk.title,talk.creation_date,talk.id_hard,talk.id_talk,hardware.type')->where(array('created_by'=>$clean['id_user'],'deleted'=>'no'))->orderBy('id_talk desc');
+			
+			$recordNumber = $this->m['TalkModel']->rowNumber();
+			$page = $this->viewArgs['page'];
+			
+			$this->m['TalkModel']->limit = $this->h['Pages']->getLimit($page,$recordNumber,20);
+			
+			$data['table'] = $this->m['TalkModel']->send();
+			
+			$data['meet_username'] = $clean['user'];
+
+			$data['pageList'] = $this->h['Pages']->render($page-3,7);
+			
+			$this->append($data);
+			$this->load('talk');
+			$this->right();
+		}
 	}
-	
 }
\ No newline at end of file
diff --git a/h-source/Application/Views/Meet/contributions.php b/h-source/Application/Views/Meet/contributions.php
index f679c71..99ad4d1 100644
--- a/h-source/Application/Views/Meet/contributions.php
+++ b/h-source/Application/Views/Meet/contributions.php
@@ -51,6 +51,13 @@
 			</div>
 			<?php } ?>
 			
+			<!--talk messages submitted-->
+			<?php if ($hasTalk) { ?>
+			<div class="user_hardware_pages">
+				<a href="<?php echo $this->baseUrl."/meet/talk/$lang/$meet_username".$this->viewStatus;?>">talk messages submitted by <b><?php echo $meet_username;?></b></a>
+			</div>
+			<?php } ?>
+			
 		</div>
 	
 	</div>
\ No newline at end of file
diff --git a/h-source/Application/Views/Meet/talk.php b/h-source/Application/Views/Meet/talk.php
new file mode 100644
index 0000000..7ad80f0
--- /dev/null
+++ b/h-source/Application/Views/Meet/talk.php
@@ -0,0 +1,56 @@
+<?php if (!defined('EG')) die('Direct access not allowed!'); ?>
+
+<?php
+// h-source, a web software to build a community of people that want to share their hardware information.
+// Copyright (C) 2010  Antonio Gallo (h-source-copyright.txt)
+// 
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+// 
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+// 
+// You should have received a copy of the GNU General Public License
+// along with this program.  If not, see <http://www.gnu.org/licenses/>.
+?>
+
+	<div id="left">
+	
+		<div class="position_tree_box">
+			<a href="<?php echo $this->baseUrl."/home/index/$lang";?>">Home</a> &raquo; <a href="<?php echo $this->baseUrl."/meet/user/$lang/$meet_username";?>">meet <b><?php echo $meet_username;?></b></a> &raquo; <a href="<?php echo $this->baseUrl."/meet/contributions/$lang/$meet_username";?>">contributions</a> &raquo; talk messages
+		</div>
+		
+		<div class="contrib_explain_box">
+			talk messages submitted by <?php echo $meet_username;?>
+		</div>
+		
+		<div class="external_users_contrib">
+			<?php foreach ($table as $item) {?>
+			<div class="users_contrib_item">
+
+				<div class="contribution_item">
+					<?php 
+					
+					$t_date = $item['talk']['creation_date'];
+					$t_title = $item['talk']['title'];
+					$t_id = $item['talk']['id_hard'];
+					$t_id_talk = $item['talk']['id_talk'];
+					$controller = MyStrings::$reverse[$item['hardware']['type']];
+					?>
+					
+					<?php echo "<a href='".$this->baseUrl."/$controller/talk/$lang/$t_id#talk-$t_id_talk'>".$t_title."</a> at ".smartDate($t_date);?>
+				</div>
+				
+			</div>
+			<?php } ?>
+		</div>
+		
+		<div class="history_page_list">
+			<?php echo gtext("page list");?>: <?php echo $pageList;?>
+		</div>
+	
+	</div>
\ No newline at end of file
diff --git a/h-source/Application/Views/talk.php b/h-source/Application/Views/talk.php
index d0872f4..5975c54 100644
--- a/h-source/Application/Views/talk.php
+++ b/h-source/Application/Views/talk.php
@@ -34,6 +34,7 @@
 		
 			<?php if (strcmp($message['talk']['deleted'],'no') === 0) { ?>
 			
+				<a name="talk-<?php echo $message['talk']['id_talk'];?>"></a>
 				<div class="talk_message_item">
 				
 					<div class="talk_message_item_title_date">
diff --git a/h-source/Config/Route.php b/h-source/Config/Route.php
index b26caab..3cde053 100644
--- a/h-source/Config/Route.php
+++ b/h-source/Config/Route.php
@@ -46,6 +46,7 @@ class Route
 		'meet,hardware',
 		'meet,issues',
 		'meet,messages',
+		'meet,talk',
 		'wifi,catalogue',
 		'wifi,view',
 		'wifi,history',
diff --git a/h-source/Public/Css/website.css b/h-source/Public/Css/website.css
index 9809448..01e35c9 100755
--- a/h-source/Public/Css/website.css
+++ b/h-source/Public/Css/website.css
@@ -1443,6 +1443,6 @@ ins
 	margin:10px 5px;
 	padding:10px;
 	background:#F1D8D8;
-/* 	border-bottom:1px solid #D26262; */
-/* 	border-top:1px solid #D26262; */
+	border-bottom:1px solid #DC143C;
+	border-top:1px solid #DC143C;
 }
\ No newline at end of file
-- 
cgit v1.2.3