Assembla home | Assembla project page
 

Changeset 78

Show
Ignore:
Timestamp:
07/06/07 10:39:49 (1 year ago)
Author:
digitalspaghetti
Message:

Changes to point/venues for events

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branch/controllers/venues_controller.php

    r77 r78  
    11<?php 
    2 class PointsController extends AppController 
     2class VenuesController extends AppController 
    33{ 
    44        //var $scaffold; 
    5         var $name = 'Points'; 
     5        var $name = 'Venues'; 
    66        var $helpers = array('Html', 'Form', 'Ajax', 'Javascript','GoogleMap' ); 
    77 
    8         function index() { 
     8        function admin_index() { 
    99                $this->layout = "map"; 
    10                 $this->Point->recursive = 0; 
    11                 $this->set('points', $this->Point->findAll()); 
     10                $this->Venue->recursive = 0; 
     11                $this->set('points', $this->Venue->findAll()); 
    1212        } 
    1313 
    14         function add() { 
     14        function admin_add() { 
    1515                $this->layout = "map"; 
    1616                if(empty($this->data)) { 
     
    1919                        $this->cleanUpFields(); 
    2020                         
    21                         $address = $this->data['Point']; 
     21                        $address = $this->data['Venue']; 
    2222                        unset( 
    2323                                $address['id'], 
     
    3232                        $geo = $googleGeo->geo(); 
    3333                        var_dump($geo); 
    34                         $this->data = array_merge($this->data['Point'],$geo); 
     34                        $this->data = array_merge($this->data['Venue'],$geo); 
    3535                         
    36                         if($this->Point->save($this->data)) { 
    37                                 $this->Session->setFlash('The Point has been saved'); 
     36                        if($this->Venue->save($this->data)) { 
     37                                $this->Session->setFlash('The Venue has been saved'); 
    3838                                //$this->redirect('/points/index'); 
    3939                        } else { 
     
    4242                } 
    4343        } 
    44 /* 
    45         function edit($id) { 
     44 
     45        function admin_edit($id) { 
    4646                if(empty($this->data)) { 
    47                         $this->data = $this->Point->read(null, $id); 
     47                        $this->data = $this->Venue->read(null, $id); 
    4848                } else { 
    4949                        $this->cleanUpFields(); 
     
    6060                        $this->data = array_merge($this->data,$geo); 
    6161                         
    62                         if($this->Point->save($this->data)) { 
    63                                 $this->Session->setFlash('The Point has been saved'); 
     62                        if($this->Venue->save($this->data)) { 
     63                                $this->Session->setFlash('The Venue has been saved'); 
    6464                                $this->redirect('/points/index'); 
    6565                        } else { 
     
    6969        } 
    7070 
    71         function view($id) { 
     71        function admin_view($id) { 
    7272                $this->layout = "map"; 
    73                 $this->set('point', $this->Point->read(null, $id)); 
     73                $this->set('point', $this->Venue->read(null, $id)); 
    7474        } 
    7575 
    76         function delete($id) { 
    77                 if($this->Point->del($id)) { 
    78                         $this->Session->setFlash('The Point deleted: id '.$id.''); 
     76        function admin_delete($id) { 
     77                if($this->Venue->del($id)) { 
     78                        $this->Session->setFlash('The Venue deleted: id '.$id.''); 
    7979                        $this->redirect('/points/index'); 
    8080                } 
    8181        } 
    82 */ 
     82 
    8383} 
    8484?> 
  • branch/models/venue.php

    r76 r78  
    11<?php 
    2 class Point extends AppModel { 
     2class Venue extends AppModel { 
    33 
    4         var $name = 'Point'; 
     4        var $name = 'Venue'; 
     5 
     6        //The Associations below have been created with all possible keys, those that are not needed can be removed 
     7        var $hasMany = array( 
     8                        'Event' => array('className' => 'Event', 
     9                                                                'foreignKey' => 'venue_id', 
     10                                                                'conditions' => '', 
     11                                                                'fields' => '', 
     12                                                                'order' => '', 
     13                                                                'limit' => '', 
     14                                                                'offset' => '', 
     15                                                                'dependent' => '', 
     16                                                                'exclusive' => '', 
     17                                                                'finderQuery' => '', 
     18                                                                'counterQuery' => ''), 
     19        ); 
    520 
    621} 
  • branch/views/venues/add.ctp

    r77 r78  
    33<div style="float:left;width:800px;"> 
    44<?php 
    5 $default = array('type'=>'0','zoom'=>13,'lat'=>'55.868272','long'=>'-4.271121'); 
     5$default = array('type'=>'2','zoom'=>13,'lat'=>'55.868272','long'=>'-4.271121'); 
    66echo $googleMap->map($default, $style = 'width:100%; height: 600px' ); 
    77//if(isset($points)){ 
     
    1818</p> 
    1919 
    20 <?php e($form->create('Point'));?> 
    2120 
    22 <?php e($form->input('postcode'));?> 
    2321 
    24 <input type="text" id="postcode" size="25" /><br /> 
    25 <input type="submit" onclick="javascript:usePointFromPostcode(document.getElementById('postcode').value, setCenterToPoint)" value="Center Map"/> 
    26 <input type="submit" value="Place Marker" onclick="javascript:usePointFromPostcode(document.getElementById('postcode').value, placeMarkerAtPoint)" /> 
    27 <input type="submit" value="Do whatever" onclick="javascript:usePointFromPostcode(document.getElementById('postcode').value, function (point) { alert('Latitude: ' + point.lat() + '\nLongitude: ' + point.lng());})" /> 
     22<?php e($form->input('findaddress', array('label'=>'Enter Address or Postcode')));?> 
     23<input type="submit" onclick="javascript:usePointFromPostcode(document.getElementById('Findaddress').value, setCenterToPoint)" value="Locate on Map"/> 
    2824<br /> 
    2925<input id="lat" /><input id="lng" /> 
    3026 
    31  
     27<?php e($form->create('Venue'));?> 
    3228 
    3329<?php e($form->input('name'));?> 
  • branch/views/venues/index.ctp

    r77 r78  
    1 <h2>List Points</h2> 
     1<h2>List Venues</h2> 
    22<div style="float:left;width:80%;"> 
    33<?php 
     
    77 
    88foreach($points as $n=>$point){ 
    9         $points[$n]['Point']['title'] = "<b>".$point['Point']['name']."</b>"; 
    10         $points[$n]['Point']['html'] = $point['Point']['description']; 
    11         $avg_lat += $point['Point']['latitude']; 
    12         $avg_lon += $point['Point']['longitude']; 
     9        $points[$n]['Venue']['title'] = "<b>".$point['Venue']['name']."</b>"; 
     10        $points[$n]['Venue']['html'] = $point['Venue']['description']; 
     11        $avg_lat += $point['Venue']['latitude']; 
     12        $avg_lon += $point['Venue']['longitude']; 
    1313        $count++; 
    1414        } 
     
    3232</style> 
    3333<div style="float:left;width:15%"> 
    34         <span style="font-size:12pt;font-weight:bold;background:#239855;"><?php echo $html->link('Create A New Point', '/points/add'); ?></span> 
     34        <span style="font-size:12pt;font-weight:bold;background:#239855;"><?php echo $html->link('Create A New Venue', '/points/add'); ?></span> 
    3535<table cellpadding="0" cellspacing="0"> 
    3636<tr> 
     
    4040</tr> 
    4141<?php foreach ($points as $point): ?> 
    42 <tr onclick="<?php echo $point['Point']['js'] ?>"  > 
    43         <td><?php echo $point['Point']['name'] ?></td> 
    44         <td><?php echo $point['Point']['city'] ?></td> 
    45         <td><?php echo $point['Point']['state'] ?></td> 
     42<tr onclick="<?php echo $point['Venue']['js'] ?>"  > 
     43        <td><?php echo $point['Venue']['name'] ?></td> 
     44        <td><?php echo $point['Venue']['city'] ?></td> 
     45        <td><?php echo $point['Venue']['state'] ?></td> 
    4646</tr> 
    4747<?php endforeach; ?>