Changeset 461 for trunk/app/models/topic.php
- Timestamp:
- 05/08/08 11:43:23 (8 months ago)
- Files:
-
- 1 modified
-
trunk/app/models/topic.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/app/models/topic.php
r333 r461 2 2 /** 3 3 * Karamelo eLearning Platform 4 * Chipotle Software 2002-2008 4 * Chipotle Software 2002-2008 5 * @author: Manuel Montoya 5 6 * GPLv3 manuel<arroba>mononeurona<punto>org 6 7 **/ 8 // file: app/models/topic.php 7 9 8 10 class Topic extends AppModel … … 46 48 ); */ 47 49 48 public function addVisitor($users = array(), $user_id, $topic_id) 49 { // this is just to set a flag to indicate user is visiting topic for first time 50 51 $ids = array(); 52 //die(var_dump( $users )); 53 foreach ($users as $v) 54 { 55 array_push($ids, $v['id']); 56 } 57 58 if ( in_array($user_id, $ids) ) 59 { 60 return false; 61 } 62 else 63 { 64 $this->data['Visitor']['topic_id'] = $topic_id; 65 $this->data['Visitor']['user_id'] = $user_id; 66 $this->Visitor->create(); 67 68 if ( $this->Visitor->save( $this->data['Visitor'] ) ) 69 { 70 return true; 71 } 72 else 73 { 74 die('Error on addVisitor function'); 75 } 76 } 77 return true; 78 } 79 80 public $validate = array( 50 public $validate = array( 81 51 'subject' => VALID_NOT_EMPTY, 82 52 'message' => VALID_NOT_EMPTY, … … 84 54 'forum_id' => VALID_NOT_EMPTY 85 55 ); 56 57 public function addVisitor($topic_id, $user_id) 58 { 59 $this->data['Visitor']['topic_id'] = $topic_id; 60 $this->data['Visitor']['user_id'] = $user_id; 61 62 $this->Visitor->create(); 63 64 if ( $this->Visitor->save( $this->data['Visitor'] ) ): 65 return true; 66 else: 67 die('Error on addVisitor function'); 68 endif; 69 70 return true; 71 } 86 72 } 87 73 ?>
