Assembla home | Assembla project page
 

Changeset 87

Show
Ignore:
Timestamp:
07/13/07 17:08:55 (1 year ago)
Author:
digitalspaghetti
Message:

Improved views for Venues and some JQ. New DB saved.

Files:

Legend:

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

    r85 r87  
    2929                        } 
    3030                } 
    31                 $tags = $this->Event->Tag->generateList(); 
    32                 $venues = $this->Event->Venue->generateList(); 
     31                $venues = $this->Event->Venue->generateList(null, 'name ASC'); 
    3332                $eventTypes = $this->Event->EventType->generateList(); 
    3433                $users = $this->Event->User->generateList(); 
     
    9897                        } 
    9998                } 
    100                 $tags = $this->Event->Tag->generateList(); 
    101                 $venues = $this->Event->Venue->generateList(); 
     99                $venues = $this->Event->Venue->generateList(null, 'name ASC'); 
    102100                $eventTypes = $this->Event->EventType->generateList(); 
    103101                $users = $this->Event->User->generateList(); 
    104102                $subjects = $this->Event->Subject->generateList(); 
    105                 $this->set(compact('tags', 'venues', 'eventTypes', 'users', 'subjects')); 
     103                $this->set(compact('venues', 'eventTypes', 'users', 'subjects')); 
    106104        } 
    107105 
  • branch/controllers/venues_controller.php

    r84 r87  
    11<?php 
    2 class VenuesController extends AppController 
    3 
    4         //var $scaffold; 
     2class VenuesController extends AppController { 
     3 
    54        var $name = 'Venues'; 
    6         var $helpers = array('Html', 'Form', 'Ajax', 'Javascript','GoogleMap' ); 
     5        var $helpers = array('Html', 'Form' ); 
     6 
     7        function index() { 
     8                $this->Venue->recursive = 0; 
     9                $this->set('venues', $this->paginate()); 
     10        } 
     11 
     12        function view($id = null) { 
     13                if (!$id) { 
     14                        $this->Session->setFlash('Invalid Venue.'); 
     15                        $this->redirect(array('action'=>'index'), null, true); 
     16                } 
     17                $this->set('venue', $this->Venue->read(null, $id)); 
     18        } 
     19 
     20        function add() { 
     21                if (!empty($this->data)) { 
     22                        $this->cleanUpFields(); 
     23                        $this->Venue->create(); 
     24                        if ($this->Venue->save($this->data)) { 
     25                                $this->Session->setFlash('The Venue has been saved'); 
     26                                $this->redirect(array('action'=>'index'), null, true); 
     27                        } else { 
     28                                $this->Session->setFlash('The Venue could not be saved. Please, try again.'); 
     29                        } 
     30                } 
     31        } 
     32 
     33        function edit($id = null) { 
     34                if (!$id && empty($this->data)) { 
     35                        $this->Session->setFlash('Invalid Venue'); 
     36                        $this->redirect(array('action'=>'index'), null, true); 
     37                } 
     38                if (!empty($this->data)) { 
     39                        $this->cleanUpFields(); 
     40                        if ($this->Venue->save($this->data)) { 
     41                                $this->Session->setFlash('The Venue saved'); 
     42                                $this->redirect(array('action'=>'index'), null, true); 
     43                        } else { 
     44                                $this->Session->setFlash('The Venue could not be saved. Please, try again.'); 
     45                        } 
     46                } 
     47                if (empty($this->data)) { 
     48                        $this->data = $this->Venue->read(null, $id); 
     49                } 
     50        } 
     51 
     52        function delete($id = null) { 
     53                if (!$id) { 
     54                        $this->Session->setFlash('Invalid id for Venue'); 
     55                        $this->redirect(array('action'=>'index'), null, true); 
     56                } 
     57                if ($this->Venue->del($id)) { 
     58                        $this->Session->setFlash('Venue #'.$id.' deleted'); 
     59                        $this->redirect(array('action'=>'index'), null, true); 
     60                } 
     61        } 
     62 
    763 
    864        function admin_index() { 
     
    2480                $avg_lon = $avg_lon/$count; 
    2581                $this->set('default', $avg_lat . "," . $avg_lon); 
    26                 $this->set('points', $points); 
     82                $this->set('venues', $this->paginate()); 
     83        } 
     84 
     85        function admin_view($id = null) { 
     86                if (!$id) { 
     87                        $this->Session->setFlash('Invalid Venue.'); 
     88                        $this->redirect(array('action'=>'index'), null, true); 
     89                } 
     90                $this->set('venue', $this->Venue->read(null, $id)); 
    2791        } 
    2892 
    2993        function admin_add() { 
    30                 if(empty($this->data)) { 
    31                         $this->render(); 
    32                 } else { 
    33                         $this->cleanUpFields();                  
    34                         if($this->Venue->save($this->data)) { 
     94                if (!empty($this->data)) { 
     95                        $this->cleanUpFields(); 
     96                        $this->Venue->create(); 
     97                        if ($this->Venue->save($this->data)) { 
    3598                                $this->Session->setFlash('The Venue has been saved'); 
    36                                 $this->redirect('/venues/index'); 
     99                                $this->redirect(array('action'=>'index'), null, true); 
    37100                        } else { 
    38                                 $this->Session->setFlash('Please correct errors below.'); 
     101                                $this->Session->setFlash('The Venue could not be saved. Please, try again.'); 
    39102                        } 
    40103                } 
    41104        } 
    42105 
    43         function admin_edit($id) { 
    44                 if(empty($this->data)) { 
     106        function admin_edit($id = null) { 
     107                if (!$id && empty($this->data)) { 
     108                        $this->Session->setFlash('Invalid Venue'); 
     109                        $this->redirect(array('action'=>'index'), null, true); 
     110                } 
     111                if (!empty($this->data)) { 
     112                        $this->cleanUpFields(); 
     113                        if ($this->Venue->save($this->data)) { 
     114                                $this->Session->setFlash('The Venue saved'); 
     115                                $this->redirect(array('action'=>'index'), null, true); 
     116                        } else { 
     117                                $this->Session->setFlash('The Venue could not be saved. Please, try again.'); 
     118                        } 
     119                } 
     120                if (empty($this->data)) { 
    45121                        $this->data = $this->Venue->read(null, $id); 
    46                 } else { 
    47                         $this->cleanUpFields(); 
    48                          
    49                         $address = $this->data; 
    50                         unset( 
    51                                 $this->data['name'],$this->data['description'], 
    52                                 $this->data['latitude'], $this->data['longitude'], 
    53                                 $this->data['zoom'] 
    54                                 ); 
    55                         vendor('googlegeo'); 
    56                         $googleGeo = new GoogleGeo($address); 
    57                         $geo = $googleGeo->geo(); 
    58                         $this->data = array_merge($this->data,$geo); 
    59                          
    60                         if($this->Venue->save($this->data)) { 
    61                                 $this->Session->setFlash('The Venue has been saved'); 
    62                                 $this->redirect('/venues/index'); 
    63                         } else { 
    64                                 $this->Session->setFlash('Please correct errors below.'); 
    65                         } 
    66122                } 
    67123        } 
    68124 
    69         function admin_view($id) { 
    70                 $this->layout = "map"; 
    71                 $this->set('point', $this->Venue->read(null, $id)); 
    72         } 
    73  
    74         function admin_delete($id) { 
    75                 if($this->Venue->del($id)) { 
    76                         $this->Session->setFlash('The Venue deleted: id '.$id.''); 
    77                         $this->redirect('/venues/index'); 
     125        function admin_delete($id = null) { 
     126                if (!$id) { 
     127                        $this->Session->setFlash('Invalid id for Venue'); 
     128                        $this->redirect(array('action'=>'index'), null, true); 
    78129                } 
    79         } 
    80          
    81         function venuesjson() 
    82         { 
    83                 $this->layout = "ajax"; 
    84                 $this->Venue->recursive = 0; 
    85                 $this->set('points', $this->Venue->findAll());   
     130                if ($this->Venue->del($id)) { 
     131                        $this->Session->setFlash('Venue #'.$id.' deleted'); 
     132                        $this->redirect(array('action'=>'index'), null, true); 
     133                } 
    86134        } 
    87135 
  • branch/db.sql

    r79 r87  
    44--  
    55-- Host: localhost 
    6 -- Generation Time: Jul 06, 2007 at 03:29 PM 
     6-- Generation Time: Jul 13, 2007 at 06:06 PM 
    77-- Server version: 5.0.38 
    88-- PHP Version: 5.2.1 
     
    436436  `event_time` time default NULL, 
    437437  `event_url` varchar(255) default NULL, 
     438  `event_ticket1` varchar(255) default NULL, 
     439  `event_ticket2` varchar(255) default NULL, 
     440  `event_price` varchar(255) NOT NULL, 
    438441  `body` text, 
    439442  `tags` varchar(255) NOT NULL, 
     
    444447  `modified` datetime NOT NULL, 
    445448  PRIMARY KEY  (`id`) 
    446 ) ENGINE=MyISAM  DEFAULT CHARSET=utf8
     449) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=4
    447450 
    448451--  
    449452-- Dumping data for table `events` 
    450453--  
     454 
     455INSERT INTO `events` (`id`, `venue_id`, `event_type_id`, `event_date`, `event_time`, `event_url`, `event_ticket1`, `event_ticket2`, `event_price`, `body`, `tags`, `user_id`, `subject_id`, `published`, `created`, `modified`) VALUES  
     456(1, 3, 3, '2007-07-08', '11:55:00', 'http://www.tinthepark.com', NULL, NULL, '', 'The Hedrons will be on the King Tut''s Stage', 'The Hedrons, T In The Park, Summer Festivals, Festival, King Tuts', 0, 2, 1, '2007-07-06 16:21:10', '2007-07-06 16:21:10'), 
     457(2, 1, 1, '2007-07-20', '20:00:00', 'http://www.kingtuts.com', NULL, NULL, '', 'King Tuts', 'The Hedrons', 0, 2, 1, '2007-07-12 14:05:45', '2007-07-12 14:05:45'), 
     458(3, 8, 1, '2007-07-31', '20:00:00', 'http://www.metro.com', NULL, NULL, '', NULL, 'The Hedrons, London', 0, 2, 1, '2007-07-12 14:48:18', '2007-07-12 14:48:18'); 
    451459 
    452460-- -------------------------------------------------------- 
     
    467475--  
    468476 
     477INSERT INTO `events_tags` (`event_id`, `tag_id`) VALUES  
     478(1, 1), 
     479(1, 2), 
     480(1, 3), 
     481(1, 4), 
     482(1, 5), 
     483(2, 1), 
     484(3, 1), 
     485(3, 6); 
     486 
    469487-- -------------------------------------------------------- 
    470488 
     
    483501  `modified` datetime NOT NULL, 
    484502  PRIMARY KEY  (`id`) 
    485 ) ENGINE=MyISAM DEFAULT CHARSET=utf8
     503) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1
    486504 
    487505--  
     
    508526  `modified` datetime NOT NULL, 
    509527  PRIMARY KEY  (`id`) 
    510 ) ENGINE=MyISAM DEFAULT CHARSET=utf8
     528) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1
    511529 
    512530--  
     
    628646  `modified` datetime default NULL, 
    629647  PRIMARY KEY  (`id`) 
    630 ) ENGINE=MyISAM DEFAULT CHARSET=utf8
     648) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1
    631649 
    632650--  
     
    693711  `modified` datetime NOT NULL, 
    694712  PRIMARY KEY  (`id`) 
    695 ) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=42
     713) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=44
    696714 
    697715--  
     
    740758(39, 'Manage Playlists', '/admin/playlists/', 31, NULL, 29, 1, 900, 1, '2007-06-04 22:55:27', '2007-06-04 22:55:27'), 
    741759(40, 'Add Playlist', '/admin/playlists/add', 32, NULL, 39, 1, 900, 1, '2007-06-04 22:56:09', '2007-06-04 22:56:09'), 
    742 (41, 'Manage Tags', '/admin/tags', 1, NULL, 35, 1, 900, 1, '2007-06-20 16:02:08', '2007-06-20 16:02:08'); 
     760(41, 'Manage Tags', '/admin/tags', 1, NULL, 35, 1, 900, 1, '2007-06-20 16:02:08', '2007-06-20 16:02:08'), 
     761(42, 'Manage Venues', '/admin/venues/', 3, NULL, 30, 1, 900, 1, '2007-07-06 15:48:34', '2007-07-06 15:48:34'), 
     762(43, 'Add Venue', '/admin/venues/add', 0, NULL, 42, 1, 900, 1, '2007-07-06 15:49:05', '2007-07-06 15:49:05'); 
    743763 
    744764-- -------------------------------------------------------- 
     
    763783  `modified` datetime NOT NULL, 
    764784  PRIMARY KEY  (`id`) 
    765 ) ENGINE=MyISAM DEFAULT CHARSET=utf8
     785) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1
    766786 
    767787--  
     
    832852  `comments` varchar(255) collate utf8_unicode_ci NOT NULL, 
    833853  PRIMARY KEY  (`id`) 
    834 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci
     854) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1
    835855 
    836856--  
     
    881901  `modified` datetime default NULL, 
    882902  PRIMARY KEY  (`id`) 
    883 ) ENGINE=MyISAM DEFAULT CHARSET=utf8
     903) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1
    884904 
    885905--  
    886906-- Dumping data for table `posts` 
    887907--  
     908 
    888909 
    889910-- -------------------------------------------------------- 
     
    903924-- Dumping data for table `posts_tags` 
    904925--  
     926 
    905927 
    906928-- -------------------------------------------------------- 
     
    921943  `modified` datetime NOT NULL, 
    922944  PRIMARY KEY  (`id`) 
    923 ) ENGINE=MyISAM DEFAULT CHARSET=utf8
     945) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1
    924946 
    925947--  
     
    10631085INSERT INTO `subjects` (`id`, `title`, `posts_count`, `pages_count`, `events_count`, `feeds_count`, `images_count`, `galleries_count`, `videos_count`, `created`, `modified`) VALUES  
    10641086(1, 'Uncatagorised', 1, 0, 2, 0, 0, 0, 0, '2007-05-01 17:05:55', '2007-05-01 17:05:55'), 
    1065 (2, 'The Hedrons', NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2007-07-06 14:33:59', '2007-07-06 14:33:59'), 
     1087(2, 'The Hedrons', NULL, NULL, 3, NULL, NULL, NULL, NULL, '2007-07-06 14:33:59', '2007-07-06 14:33:59'), 
    10661088(3, 'Wet Wet Wet', NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2007-07-06 14:34:09', '2007-07-06 14:34:09'); 
    10671089 
     
    10771099  `tag` varchar(255) collate utf8_unicode_ci NOT NULL, 
    10781100  PRIMARY KEY  (`id`) 
    1079 ) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci
     1101) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=7
    10801102 
    10811103--  
    10821104-- Dumping data for table `tags` 
    10831105--  
     1106 
     1107INSERT INTO `tags` (`id`, `tag`) VALUES  
     1108(1, 'The Hedrons'), 
     1109(2, 'T In The Park'), 
     1110(3, 'Summer Festivals'), 
     1111(4, 'Festival'), 
     1112(5, 'King Tuts'), 
     1113(6, 'London'); 
    10841114 
    10851115-- -------------------------------------------------------- 
     
    12341264  `id` int(8) NOT NULL auto_increment, 
    12351265  `name` varchar(255) collate utf8_unicode_ci NOT NULL, 
    1236   `description` text collate utf8_unicode_ci NOT NULL
    1237   `street` varchar(255) collate utf8_unicode_ci NOT NULL, 
    1238   `city` varchar(255) collate utf8_unicode_ci NOT NULL, 
     1266  `description` text collate utf8_unicode_ci
     1267  `street` varchar(255) collate utf8_unicode_ci default NULL, 
     1268  `city` varchar(255) collate utf8_unicode_ci default NULL, 
    12391269  `state` varchar(255) collate utf8_unicode_ci default NULL, 
    1240   `postcode` varchar(255) collate utf8_unicode_ci NOT NULL, 
    1241   `latitude` float NOT NULL, 
    1242   `longitude` float NOT NULL, 
    1243   `zoom` int(11) NOT NULL
     1270  `postcode` varchar(255) collate utf8_unicode_ci default NULL, 
     1271  `latitude` decimal(20,15) NOT NULL, 
     1272  `longitude` decimal(20,15) NOT NULL, 
     1273  `zoom` int(11) NOT NULL default '12'
    12441274  `created` datetime default NULL, 
    12451275  `modified` datetime default NULL, 
    12461276  PRIMARY KEY  (`id`) 
    1247 ) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci
     1277) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=24
    12481278 
    12491279--  
    12501280-- Dumping data for table `venues` 
    12511281--  
     1282 
     1283INSERT INTO `venues` (`id`, `name`, `description`, `street`, `city`, `state`, `postcode`, `latitude`, `longitude`, `zoom`, `created`, `modified`) VALUES  
     1284(1, 'King Tuts', 'King Tuts club in Glasgow', '272a St Vincent St', 'Glasgow', 'Glasgow', 'G2 5RL', 55.862529754638670, -4.265317916870117, 12, '2007-07-06 16:13:18', '2007-07-13 14:09:16'), 
     1285(3, 'T In The Park', 'T In The park', 'Balado', 'Kinross', 'Fife', 'KY13', 56.207641601562500, -3.467989921569824, 12, '2007-07-06 16:18:55', '2007-07-13 14:09:31'), 
     1286(9, 'Water Street Music Hall', 'Water Street Music Hall', '204 N. Water Street', 'Rochester', 'NY', '14604', 43.160435004700986, -77.611788511276250, 12, '2007-07-13 14:06:08', '2007-07-13 14:09:00'), 
     1287(10, 'Nectar''s', 'Nectar''s', '188 Main St.', 'Burlington', 'VT', '05401', 44.475900338720756, -73.212525844573970, 12, '2007-07-13 14:23:07', '2007-07-13 14:23:07'), 
     1288(11, 'Quebec City International Summer Fest', 'Quebec City International Summer Fest', NULL, 'Quebec', 'Quebec', NULL, 46.812984012678640, -71.228141784667970, 12, '2007-07-13 14:48:57', '2007-07-13 14:48:57'), 
     1289(12, 'The Boat', 'The Boat', '158 Augusta Avenue', 'Toronto', 'ON', NULL, 43.653248574034730, -79.401519298553470, 12, '2007-07-13 14:51:50', '2007-07-13 14:51:50'), 
     1290(13, 'The Legendary Horseshoe Tavern', 'The Legendary Horseshoe Tavern', '370 Queen Street West', 'Toronto', 'Ontario', 'M5V 2A2', 43.648823705297730, -79.395875930786130, 12, '2007-07-13 14:53:36', '2007-07-13 14:53:36'), 
     1291(14, 'The Annex', 'The Annex on The Lower East Side', '150 Orchard St', 'New York', 'NY', NULL, 40.720591366423290, -73.988950252532960, 12, '2007-07-13 14:58:18', '2007-07-13 14:58:18'), 
     1292(15, 'Great Scott', 'Great Scott', '1222 Commonwealth Ave', 'Allston, Boston', 'MA', '02134', 42.350226896549096, -71.130638122558600, 12, '2007-07-13 15:01:52', '2007-07-13 15:01:52'), 
     1293(16, 'The State Theatre', 'The State Theatre', '220 N. Washington', 'Falls Church', 'VA', '22046-4517', 38.883224495209410, -77.169739007949830, 12, '2007-07-13 15:05:13', '2007-07-13 15:05:13'), 
     1294(17, 'North Star Bar', 'North Star Bar', '2639 Poplar Street', 'Philadelphia', 'PA', '19130', 39.972811886948640, -75.180366039276120, 12, '2007-07-13 15:15:48', '2007-07-13 15:15:48'), 
     1295(18, 'The Dame', 'The Dame', '156 West Main Street', 'Lexington', 'Kentucky', '40507', 38.046914549925850, -84.497625231742860, 12, '2007-07-13 15:43:18', '2007-07-13 15:48:17'), 
     1296(19, 'Radio Radio', 'Radio Radio', '1119 E. Prospect Street', ' Indianapolis', 'IN', '46203', 39.752320727309480, -86.139442920684810, 12, '2007-07-13 15:58:48', '2007-07-13 15:58:48'), 
     1297(20, 'Wicker Park Festival', 'Wicker Park Festival', 'N. Wicker Park Ave', 'Chicago', 'Il', NULL, 41.907658914284650, -87.676724195480350, 12, '2007-07-13 16:04:35', '2007-07-13 16:04:35'), 
     1298(21, 'Metro', 'Metro', '3730 N. Clark St.', 'Chicago', 'IL', '60613', 41.949771967936680, -87.658581733703610, 12, '2007-07-13 16:08:32', '2007-07-13 16:08:32'), 
     1299(22, 'Caird Hall', 'Caird Hall', 'City Square', 'Dundee', 'Angus', 'DD1 3BB', 56.465033295055020, -2.969806194305420, 12, '2007-07-13 16:18:12', '2007-07-13 16:18:12'), 
     1300(23, 'Darvel Town Hall', 'Darvel Town Hall', NULL, 'Darvel', NULL, NULL, 55.609731000000000, -4.281818000000000, 12, '2007-07-13 16:32:58', '2007-07-13 16:32:58'); 
    12521301 
    12531302-- -------------------------------------------------------- 
     
    12731322  `modified` datetime NOT NULL, 
    12741323  PRIMARY KEY  (`id`) 
    1275 ) ENGINE=MyISAM DEFAULT CHARSET=utf8
     1324) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1
    12761325 
    12771326--  
    12781327-- Dumping data for table `videos` 
    12791328--  
     1329 
  • branch/views/events/admin_edit.ctp

    r79 r87  
    11<div class="event"> 
    2 <?php echo $form->create('Event');?> 
     2       <?php echo $form->create('Event');?> 
    33        <fieldset> 
    44                <legend><?php __('Event Details');?></legend> 
  • branch/views/layouts/default.ctp

    r85 r87  
    1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" 
    2  "http://www.w3.org/TR/html4/strict.dtd"> 
    3 <html
     1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
     2    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 
     3<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml"
    44<head> 
    55        <title><?php echo $title_for_layout;?></title> 
     6         
    67        <?php echo $html->charset();?> 
    78    
     
    1617        <?php echo $html->css('../js/wymeditor/skins/default/screen');?> 
    1718        <?php e($this->element('js_include'));?> 
     19         
    1820</head> 
    1921<body class="jamal"> 
  • branch/views/venues/admin_add.ctp

    r83 r87  
    1 <h2>New Point</h2> 
    21<?php e($javascript->codeBlock('$j().ready(function(){$j("#gmap").gmapp();});'));?> 
    3 <div id="gmap" style="float:left;width:800px;height:400px;"></div> 
    42 
    5 <div style="float:left;width:15%"> 
    6 <p> 
    7 Please enter the postcode or address of the point you want to add. 
    8 </p> 
    9  
     3<div class="venue"> 
     4         
     5<div id="gmap" style="width:99%; height: 400px;"></div> 
    106<?php e($form->input('address'));?> 
    11 <?php e($form->submit('findaddress', array('id'=>'findaddress')));?> 
    12  
    13 <div id="gmapp-info"></div> 
    14  
    15 <?php e($form->create('Venue'));?> 
    16  
    17 <?php e($form->input('name'));?> 
    18 <?php e($form->input('description'));?> 
    19 <?php e($form->input('street'));?> 
    20 <?php e($form->input('city'));?> 
    21 <?php e($form->input('state'));?> 
    22 <?php e($form->input('postcode'));?> 
    23 <?php e($form->input('latitude'));?> 
    24 <?php e($form->input('longitude'));?> 
    25 <?php e($form->input('zoom'));?> 
    26 <?php e($form->submit());?> 
    27  
    28 <ul class="actions"> 
    29 <li><?php echo $html->link('List points', '/points/index')?></li> 
    30 </ul> 
     7<?php e($form->submit('Find Address', array('id'=>'findaddress')));?> 
     8         
     9<?php echo $form->create('Venue');?> 
     10        <fieldset> 
     11                <legend><?php __('Add');?> <?php __('Venue');?></legend> 
     12        <?php 
     13                echo $form->input('name'); 
     14                echo $form->input('description'); 
     15                echo $form->input('street'); 
     16                echo $form->input('city'); 
     17                echo $form->input('state'); 
     18                echo $form->input('postcode'); 
     19                echo $form->input('latitude'); 
     20                echo $form->input('longitude'); 
     21                echo $form->input('zoom'); 
     22        ?> 
     23        </fieldset> 
     24<?php echo $form->end('Submit');?> 
    3125</div> 
     26<div class="actions"> 
     27        <ul> 
     28                <li><?php echo $html->link(__('List', true).' '.__('Venues', true), array('action'=>'index'));?></li> 
     29                <li><?php echo $html->link(__('List', true).' '.__('Events', true), array('controller'=> 'events', 'action'=>'index')); ?> </li> 
     30                <li><?php echo $html->link(__('New', true).' '.__('Event', true), array('controller'=> 'events', 'action'=>'add')); ?> </li> 
     31        </ul> 
     32</div> 
  • branch/views/venues/admin_edit.ctp

    r79 r87  
    1 <h2>New Point</h2
     1<?php e($javascript->codeBlock('$j().ready(function(){$j("#gmap").gmapp();});'));?
    22 
    3 <div style="float:left;width:800px;"> 
    4 <?php 
    5 $default = array('type'=>'2','zoom'=>13,'lat'=>'55.868272','long'=>'-4.271121'); 
    6 echo $googleMap->map($default, $style = 'width:100%; height: 600px' ); 
    7 //if(isset($points)){ 
    8         echo $googleMap->addMarkers($points); 
    9 //      } 
     3<div class="venue"> 
    104 
     5<div id="gmap" style="width:99%; height: 400px;"></div> 
     6<?php e($form->input('address'));?> 
     7<?php e($form->submit('Find Address', array('id'=>'findaddress')));?> 
    118 
    12 ?> 
     9<?php echo $form->create('Venue');?> 
     10        <fieldset> 
     11                <legend><?php __('Edit');?> <?php __('Venue');?></legend> 
     12        <?php 
     13                echo $form->input('id'); 
     14                echo $form->input('name'); 
     15                echo $form->input('description'); 
     16                echo $form->input('street'); 
     17                echo $form->input('city'); 
     18                echo $form->input('state'); 
     19                echo $form->input('postcode'); 
     20                echo $form->input('latitude'); 
     21                echo $form->input('longitude'); 
     22                echo $form->input('zoom'); 
     23        ?> 
     24        </fieldset> 
     25<?php echo $form->end('Submit');?> 
    1326</div> 
    14  
    15 <div style="float:left;width:15%"> 
    16 <p> 
    17 Please enter the postcode or address of the point you want to add. 
    18 </p> 
    19  
    20  
    21  
    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"/> 
    24 <br /> 
    25 <input id="lat" /><input id="lng" /> 
    26  
    27 <?php e($form->create('Venue'));?> 
    28 <?php e($form->input('id'));?> 
    29 <?php e($form->input('name'));?> 
    30 <?php e($form->input('description'));?> 
    31 <?php e($form->input('street'));?> 
    32 <?php e($form->input('city'));?> 
    33 <?php e($form->input('state'));?> 
    34 <?php e($form->input('postcode'));?> 
    35 <?php e($form->input('zoom'));?> 
    36 <?php e($form->submit());?> 
    37  
    38 <ul class="actions"> 
    39 <li><?php echo $html->link('List points', '/points/index')?></li> 
    40 </ul> 
     27<div class="actions"> 
     28        <ul> 
     29                <li><?php echo $html->link(__('Delete', true), array('action'=>'delete', $form->value('Venue.id')), null, __('Are you sure you want to delete', true).' #' . $form->value('Venue.id')); ?></li> 
     30                <li><?php echo $html->link(__('List', true).' '.__('Venues', true), array('action'=>'index'));?></li> 
     31                <li><?php echo $html->link(__('List', true).' '.__('Events', true), array('controller'=> 'events', 'action'=>'index')); ?> </li> 
     32                <li><?php echo $html->link(__('New', true).' '.__('Event', true), array('controller'=> 'events', 'action'=>'add')); ?> </li> 
     33        </ul> 
    4134</div> 
  • branch/views/venues/admin_index.ctp

    r84 r87  
    1 <h2>List Venues</h2
     1<?php e($javascript->codeBlock('$j().ready(function(){$j("#gmap").gmapp({center: ['. $default .'], zoom: 2});});'));?
    22 
    3 <?php e($javascript->codeBlock('$j().ready(function(){$j("#gmap").gmapp(); $j("#gmap")[0].GMap2.setCenter(new GLatLng(' . $default . '), 2)});'));?> 
     3<div class="venues"> 
     4<h2><?php __('Venues');?></h2> 
    45 
    5 <div id="gmap" style="float:left;width:800px;height:400px;"></div> 
     6<div id="gmap" style="width:99%; height: 400px;"></div> 
    67 
    7 <div style="float:left;width:15%"> 
    8         <span style="font-size:12pt;font-weight:bold;background:#239855;"><?php echo $html->link('Create A New Venue', '/points/add'); ?></span> 
    98<table cellpadding="0" cellspacing="0"> 
    109<tr> 
    11         <th>Name</th> 
    12         <th>City</th> 
    13         <th>State</th> 
     10        <th><?php echo $paginator->sort('id');?></th> 
     11        <th><?php echo $paginator->sort('name');?></th> 
     12        <th><?php echo $paginator->sort('description');?></th> 
     13        <th><?php echo $paginator->sort('street');?></th> 
     14        <th><?php echo $paginator->sort('city');?></th> 
     15        <th><?php echo $paginator->sort('state');?></th> 
     16        <th><?php echo $paginator->sort('postcode');?></th> 
     17        <th><?php echo $paginator->sort('latitude');?></th> 
     18        <th><?php echo $paginator->sort('longitude');?></th> 
     19        <th><?php echo $paginator->sort('zoom');?></th> 
     20        <th><?php echo $paginator->sort('created');?></th> 
     21        <th><?php echo $paginator->sort('modified');?></th> 
     22        <th class="actions"><?php __('Actions');?></th> 
    1423</tr> 
    15 <?php foreach ($points as $point): ?> 
    16 <tr> 
    17         <td><?php echo $point['Venue']['name'] ?></td> 
    18         <td><?php echo $point['Venue']['city'] ?></td> 
    19         <td><?php echo $point['Venue']['state'] ?></td> 
    20 </tr> 
     24<?php 
     25$i = 0; 
     26foreach ($venues as $venue): 
     27 
     28        e($javascript->codeBlock('$j().ready(function(){$("#gmap").addPoint("' . $venue['Venue']['latitude'] . '","' . $venue['Venue']['longitude'] . '","' . $venue['Venue']['name'] . '<br />' . $venue['Venue']['street'] . '<br />' . $venue['Venue']['city'] . ',' . $venue['Venue']['postcode'] . '");});')); 
     29 
     30        $class = null; 
     31        if ($i++ % 2 == 0) { 
     32                $class = ' class="altrow"'; 
     33        } 
     34?> 
     35        <tr<?php echo $class;?>> 
     36                <td> 
     37                        <?php echo $venue['Venue']['id']?> 
     38                </td> 
     39                <td> 
     40                        <?php echo $venue['Venue']['name']?> 
     41                </td> 
     42                <td> 
     43                        <?php echo $venue['Venue']['description']?> 
     44                </td> 
     45                <td> 
     46                        <?php echo $venue['Venue']['street']?> 
     47                </td> 
     48                <td> 
     49                        <?php echo $venue['Venue']['city']?> 
     50                </td> 
     51                <td> 
     52                        <?php echo $venue['Venue']['state']?> 
     53                </td> 
     54                <td> 
     55                        <?php echo $venue['Venue']['postcode']?> 
     56                </td> 
     57                <td> 
     58                        <?php echo $venue['Venue']['latitude']?> 
     59                </td> 
     60                <td> 
     61                        <?php echo $venue['Venue']['longitude']?> 
     62                </td> 
     63                <td> 
     64                        <?php echo $venue['Venue']['zoom']?> 
     65                </td> 
     66                <td> 
     67                        <?php echo $venue['Venue']['created']?> 
     68                </td> 
     69                <td> 
     70                        <?php echo $venue['Venue']['modified']?> 
     71                </td> 
     72                <td class="actions"> 
     73                        <?php echo $html->link(__('View', true), array('action'=>'view', $venue['Venue']['id'])); ?> 
     74                        <?php echo $html->link(__('Edit', true), array('action'=>'edit', $venue['Venue']['id'])); ?> 
     75                        <?php echo $html->link(__('Delete', true), array('action'=>'delete', $venue['Venue']['id']), null, __('Are you sure you want to delete', true).' #' . $venue['Venue']['id']); ?> 
     76                </td> 
     77        </tr> 
    2178<?php endforeach; ?> 
    2279</table> 
    2380</div> 
     81<div class="paging"> 
     82        <?php echo $paginator->prev('<< '.__('previous', true), array(), null, array('class'=>'disabled'));?> 
     83 |      <?php echo $paginator->numbers();?> 
     84        <?php echo $paginator->next(__('next', true).' >>', array(), null, array('class'=>'disabled'));?> 
     85</div> 
     86<div class="actions"> 
     87        <ul> 
     88                <li><?php echo $html->link(__('New', true).' '.__('Venue', true), array('action'=>'add')); ?></li> 
     89                <li><?php echo $html->link(__('List', true).' '.__('Events', true), array('controller'=> 'events', 'action'=>'index')); ?> </li> 
     90                <li><?php echo $html->link(__('New', true).' '.__('Event', true), array('controller'=> 'events', 'action'=>'add')); ?> </li> 
     91        </ul> 
     92</div> 
  • branch/views/venues/admin_view.ctp

    r79 r87  
    1 <h2>View Venues</h2> 
    2 <div style="float:left;width:80%;"> 
    3 <?php 
    4 $default = array('type'=>'2','zoom'=>$point['Venue']['zoom'],'lat'=>$point['Venue']['latitude'],'long'=>$point['Venue']['longitude']); 
    5 $draw[0]['Venue']['latitude'] = $point['Venue']['latitude']; 
    6 $draw[0]['Venue']['longitude'] = $point['Venue']['longitude']; 
    7 $draw[0]['Venue']['title'] = $point['Venue']['name']; 
    8 $draw[0]['Venue']['html'] = $point['Venue']['street'] . ",<br />" . $point['Venue']['city'] . ",<br />" . $point['Venue']['postcode']; 
     1<?php e($javascript->codeBlock('$j().ready(function(){$j("#gmap").gmapp({center: ['. $venue['Venue']['latitude'] .','. $venue['Venue']['longitude'] .']});});'));?> 
     2<?php e($javascript->codeBlock('$j().ready(function(){$("#gmap").addPoint("' . $venue['Venue']['latitude'] . '","' . $venue['Venue']['longitude'] . '","' . $venue['Venue']['name'] . '<br />' . $venue['Venue']['street'] . '<br />' . $venue['Venue']['city'] . ',' . $venue['Venue']['postcode'] . '");});'));?> 
    93 
     4<div id="gmap" style="width:50%; height: 400px;float:left;"></div> 
    105 
    11 echo $googleMap->map($default, $style = 'width:100%; height: 800px' ); 
    12 //if(isset($points)){ 
    13         echo $googleMap->addMarkers($draw); 
    14 //      } 
    15 ?> 
     6<div class="venue" style="float:left;width:50%"> 
     7<h2><?php  __('Venue');?></h2> 
     8        <dl> 
     9                <dt class="altrow">Id</dt> 
     10                <dd class="altrow"> 
     11                        <?php echo $venue['Venue']['id']?> 
     12                        &nbsp; 
     13                </dd> 
     14                <dt>Name</dt> 
     15                <dd> 
     16                        <?php echo $venue['Venue']['name']?> 
     17                        &nbsp; 
     18                </dd> 
     19                <dt class="altrow">Description</dt> 
     20                <dd class="altrow"> 
     21                        <?php echo $venue['Venue']['description']?> 
     22                        &nbsp; 
     23                </dd> 
     24                <dt>Street</dt> 
     25                <dd> 
     26                        <?php echo $venue['Venue']['street']?> 
     27                        &nbsp; 
     28                </dd> 
     29                <dt class="altrow">City</dt> 
     30                <dd class="altrow"> 
     31                        <?php echo $venue['Venue']['city']?> 
     32                        &nbsp; 
     33                </dd> 
     34                <dt>State</dt> 
     35                <dd> 
     36                        <?php echo $venue['Venue']['state']?> 
     37                        &nbsp; 
     38                </dd> 
     39                <dt class="altrow">Postcode</dt> 
     40                <dd class="altrow"> 
     41                        <?php echo $venue['Venue']['postcode']?> 
     42                        &nbsp; 
     43                </dd> 
     44                <dt>Latitude</dt> 
     45                <dd> 
     46                        <?php echo $venue['Venue']['latitude']?> 
     47                        &nbsp; 
     48                </dd> 
     49                <dt class="altrow">Longitude</dt> 
     50                <dd class="altrow"> 
     51                        <?php echo $venue['Venue']['longitude']?> 
     52                        &nbsp; 
     53                </dd> 
     54                <dt>Zoom</dt> 
     55                <dd> 
     56                        <?php echo $venue['Venue']['zoom']?> 
     57                        &nbsp; 
     58                </dd> 
     59                <dt class="altrow">Created</dt> 
     60                <dd class="altrow"> 
     61                        <?php echo $venue['Venue']['created']?> 
     62                        &nbsp; 
     63                </dd> 
     64                <dt>Modified</dt> 
     65                <dd> 
     66                        <?php echo $venue['Venue']['modified']?> 
     67                        &nbsp; 
     68                </dd> 
     69        </dl> 
    1670</div> 
     71<div class="actions"> 
     72        <ul> 
     73                <li><?php echo $html->link(__('Edit', true).' '.__('Venue', true),   array('action'=>'edit', $venue['Venue']['id'])); ?> </li> 
     74                <li><?php echo $html->link(__('Delete', true).' '.__('Venue', true), array('action'=>'delete', $venue['Venue']['id']), null, __('Are you sure you want to delete', true).' #' . $venue['Venue']['id'] . '?'); ?> </li> 
     75                <li><?php echo $html->link(__('List', true).' '.__('Venues', true), array('action'=>'index')); ?> </li> 
     76                <li><?php echo $html->link(__('New', true).' '.__('Venue', true), array('action'=>'add')); ?> </li> 
     77                <li><?php echo $html->link(__('List', true).' '.__('Events', true), array('controller'=> 'events', 'action'=>'index')); ?> </li> 
     78                <li><?php echo $html->link(__('New', true).' '.__('Event', true), array('controller'=> 'events', 'action'=>'add')); ?> </li> 
     79        </ul> 
     80</div> 
     81<div class="related"> 
     82        <h3><?php  __('Related');?> <?php __('Events');?></h3> 
     83        <?php if (!empty($venue['Event'])):?> 
     84        <table cellpadding = "0" cellspacing = "0"> 
     85        <tr> 
     86                <th>Id</th> 
     87                <th>Venue Id</th> 
     88                <th>Event Type Id</th> 
     89                <th>Event Date</th> 
     90                <th>Event Time</th> 
     91                <th>Event Url</th> 
     92                <th>Event Ticket1</th> 
     93                <th>Event Ticket2</th> 
     94                <th>Event Price</th> 
     95                <th>Body</th> 
     96                <th>Tags</th> 
     97                <th>User Id</th> 
     98                <th>Subject Id</th> 
     99                <th>Published</th> 
     100                <th>Created</th> 
     101                <th>Modified</th> 
     102                <th class="actions"><?php __('Actions');?></th> 
     103        </tr> 
     104        <?php 
     105                $i = 0; 
     106                foreach ($venue['Event'] as $event): 
     107                        $class = null; 
     108                        if ($i++ % 2 == 0) { 
     109                                $class = ' class="altrow"'; 
     110                        } 
     111                ?> 
     112                <tr<?php echo $class;?>> 
     113                        <td><?php echo $event['id'];?></td> 
     114                        <td><?php echo $event['venue_id'];?></td> 
     115                        <td><?php echo $event['event_type_id'];?></td> 
     116                        <td><?php echo $event['event_date'];?></td> 
     117                        <td><?php echo $event['event_time'];?></td> 
     118                        <td><?php echo $event['event_url'];?></td> 
     119                        <td><?php echo $event['event_ticket1'];?></td> 
     120                        <td><?php echo $event['event_ticket2'];?></td> 
     121                        <td><?php echo $event['event_price'];?></td> 
     122                        <td><?php echo $event['body'];?></td> 
     123