Changeset 451
- Timestamp:
- 05/25/10 14:54:24 (21 months ago)
- Location:
- trunk
- Files:
-
- 2 deleted
- 7 edited
-
config/core.php (modified) (1 diff)
-
controllers/markers_controller.php (modified) (4 diffs)
-
models/marker.php (modified) (3 diffs)
-
views/layouts/gmap.ctp (modified) (3 diffs)
-
views/layouts/portal.ctp (modified) (1 diff)
-
views/markers/add.ctp (deleted)
-
views/markers/admin_edit.ctp (modified) (1 diff)
-
views/markers/admin_index.ctp (modified) (2 diffs)
-
views/markers/edit.ctp (deleted)
Legend:
- Unmodified
- Added
- Removed
-
trunk/config/core.php
r449 r451 141 141 * Actual value depends on 'Security.level' setting. 142 142 */ 143 Configure::write('Session.timeout', ' 1200000');143 Configure::write('Session.timeout', '3600'); 144 144 145 145 /** -
trunk/controllers/markers_controller.php
r450 r451 1 1 <?php 2 /** 3 * Centauro Intranet Portal 4 * GPLv3 5 * @copyright Copyright 2006-2010, Chipotle Software, Inc. (http://www.chipotle-software.com) 6 * @version 0.8 7 * @package links 8 * @license http://www.gnu.org/licenses/gpl-3.0.html 9 */ 10 #file: controllers/markers_controller.php 11 2 12 class MarkersController extends AppController { 3 13 4 14 public $name = 'Markers'; 5 15 6 public function index()16 public function display() 7 17 { 8 $this->Marker->recursive = 0;9 $this->set('markers', $this->paginate());18 $this->layout = Null; 19 $this->set('data', $this->Marker->find('all')); 10 20 } 11 21 12 public function display()22 public function view() 13 23 { 14 $this->set('data', $this->Marker->find('all'));24 $this->layout = 'gmap'; 15 25 } 16 17 public function view($id = null)18 {19 if ( !$id ):20 $this->Session->setFlash(sprintf(__('Invalid %s', true), 'marker'));21 $this->redirect(array('action' => 'index'));22 endif;23 $this->set('marker', $this->Marker->read(null, $id));24 }25 26 public function add()27 {28 if (!empty($this->data)):29 if ($this->Marker->save($this->data)):30 $this->Session->setFlash(sprintf(__('The %s has been saved', true), 'marker'));31 $this->redirect(array('action' => 'index'));32 else:33 $this->Session->setFlash(sprintf(__('The %s could not be saved. Please, try again.', true), 'marker'));34 endif;35 endif;36 }37 38 public function edit($id = null)39 {40 if (!$id && empty($this->data)) {41 $this->Session->setFlash(sprintf(__('Invalid %s', true), 'marker'));42 $this->redirect(array('action' => 'index'));43 }44 if (!empty($this->data)) {45 if ($this->Marker->save($this->data)) {46 $this->Session->setFlash(sprintf(__('The %s has been saved', true), 'marker'));47 $this->redirect(array('action' => 'index'));48 } else {49 $this->Session->setFlash(sprintf(__('The %s could not be saved. Please, try again.', true), 'marker'));50 }51 }52 if (empty($this->data)) {53 $this->data = $this->Marker->read(null, $id);54 }55 }56 26 57 27 /** == ADMIN METHODS == */ … … 62 32 $this->set('markers', $this->paginate()); 63 33 } 64 65 34 66 35 public function admin_edit($marker_id = null) … … 74 43 if ($this->Marker->save($this->data)): 75 44 if ($this->data['Marker']['end'] == 0 && !isset($this->data['Marker']['id'])): # INSERT INTO 76 $ id = $this->Marker->getLastInsertID();77 $return = '/admin/markers/edit/'.$ id;45 $marker_id = $this->Marker->getLastInsertID(); 46 $return = '/admin/markers/edit/'.$marker_id; 78 47 elseif ($this->data['Marker']['end'] == 0 && isset($this->data['Marker']['id'])): # UPDATE 79 48 $return = '/admin/markers/edit/'.$this->data['Marker']['id']; … … 90 59 } 91 60 92 public function admin_delete($ id = null)61 public function admin_delete($marker_id = null) 93 62 { 94 if (!$ id):95 $this->Session->setFlash(sprintf(__('Invalid id for %s', true), 'marker'));63 if (!$marker_id): 64 $this->Session->setFlash(sprintf(__('Invalid id for %s', True), 'marker')); 96 65 $this->redirect(array('action'=>'index')); 97 66 else: 98 if ($this->Marker->delete($ id)):99 $this->Session->setFlash(sprintf(__('%s deleted', true), 'Marker'));67 if ($this->Marker->delete($marker_id)): 68 $this->Session->setFlash(sprintf(__('%s deleted', True), 'Marker')); 100 69 $this->redirect(array('action'=>'index')); 101 70 else: 102 $this->Session->setFlash(sprintf(__('%s was not deleted', true), 'Marker'));71 $this->Session->setFlash(sprintf(__('%s was not deleted', True), 'Marker')); 103 72 $this->redirect(array('action' => 'index')); 104 73 endif; -
trunk/models/marker.php
r450 r451 1 1 <?php 2 /** 3 * Centauro Intranet Portal 4 * GPLv3 5 * @copyright Copyright 2006-2010, Chipotle Software, Inc. (http://www.chipotle-software.com) 6 * @version 0.8 7 * @package links 8 * @license http://www.gnu.org/licenses/gpl-3.0.html 9 */ 10 #file: models/marker.php 11 2 12 class Marker extends AppModel { 3 13 public $name = 'Marker'; 4 14 public $displayField = 'name'; 5 public$validate = array( 6 'id' => array( 7 'numeric' => array( 8 'rule' => array('numeric'), 15 public $validate = array( 16 'name' => array('rule' => array('minLength', 4), 9 17 //'message' => 'Your custom message here', 10 18 //'allowEmpty' => false, … … 13 21 //'on' => 'create', // Limit validation to 'create' or 'update' operations 14 22 ), 15 'notempty' => array( 16 'rule' => array('notempty'), 23 'address' => array('rule' => array('minLength', 4), 17 24 //'message' => 'Your custom message here', 18 25 //'allowEmpty' => false, … … 21 28 //'on' => 'create', // Limit validation to 'create' or 'update' operations 22 29 ), 23 ),24 'name' => array(25 'alphanumeric' => array(26 'rule' => array('alphanumeric'),27 //'message' => 'Your custom message here',28 //'allowEmpty' => false,29 //'required' => false,30 //'last' => false, // Stop validation after this rule31 //'on' => 'create', // Limit validation to 'create' or 'update' operations32 ),33 ),34 'address' => array(35 'alphanumeric' => array(36 'rule' => array('alphanumeric'),37 //'message' => 'Your custom message here',38 //'allowEmpty' => false,39 //'required' => false,40 //'last' => false, // Stop validation after this rule41 //'on' => 'create', // Limit validation to 'create' or 'update' operations42 ),43 ),44 30 'lat' => array( 45 31 'numeric' => array( -
trunk/views/layouts/gmap.ctp
r449 r451 3 3 <html xmlns="http://www.w3.org/1999/xhtml"> 4 4 <head> 5 <meta http-equiv="content-type" content="text/html; charset=utf-8"/> 6 <title>Google Maps AJAX + MySQL/PHP Example</title> 7 <script src="http://maps.google.com/maps?file=api&v=2&key=ABQIAAAAjPKkDYTVDZGDWlW2yrngQRS683khtCNerCX0A8OGSN-Hv50GHRRSNxYQrB8Gx4ciUuqyy6DNkow08g" 5 <meta http-equiv="content-type" content="text/html; charset=utf-8"/> 6 <title>Google Maps</title> 7 <meta name="viewport" content="initial-scale=1.0, user-scalable=no" /> 8 <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=true"></script> 9 10 <script src="http://maps.google.com/maps?file=api&v=2&key=ABQIAAAAjPKkDYTVDZGDWlW2yrngQRS683khtCNerCX0A8OGSN-Hv50GHRRSNxYQrB8Gx4ciUuqyy6DNkow08g" 8 11 type="text/javascript"></script> 9 12 10 13 <script type="text/javascript"> 11 //<![CDATA[ 14 //<![CDATA[ 15 16 function initialize() { 17 var latlng = new google.maps.LatLng(19.43430, -99.13264); 18 var myOptions = { 19 zoom: 8, 20 center: latlng, 21 mapTypeId: google.maps.MapTypeId.ROADMAP 22 }; 23 var map = new google.maps.Map(document.getElementById("map"), myOptions); 24 } 12 25 13 26 var iconBlue = new GIcon(); … … 36 49 map.addControl(new GSmallMapControl()); 37 50 map.addControl(new GMapTypeControl()); 38 map.setCenter(new GLatLng( 47.614495, -122.341861), 13);51 map.setCenter(new GLatLng(19.43430, -99.13264), 10); 39 52 40 GDownloadUrl(" phpsqlajax_genxml.php", function(data) {53 GDownloadUrl("/markers/display", function(data) { 41 54 var xml = GXml.parse(data); 42 55 var markers = xml.documentElement.getElementsByTagName("marker"); … … 65 78 </script> 66 79 </head> 67 68 <body onload="load()" onunload="GUnload()">69 <div id="map" style="width: 500px; height: 300px"></div>80 <body onload="initialize()" onunload="GUnload()"> 81 <div>Mononeurona::My Places::Google maps API</div> 82 <div id="map" style="width: 900px; height: 800px;margin:auto;"></div> 70 83 </body> 71 84 </html> -
trunk/views/layouts/portal.ctp
r447 r451 7 7 <head> 8 8 <title>Despabilando la.. :: <?php echo $title_for_layout; ?> </title> 9 <meta name="keywords" content="education, school, elearning" /> 9 <meta name="google-site-verification" content="5PeM5GACl_SgMW-cBD6lCelwSwRtGOg_Gx8vBqhi6z0" /> 10 <meta name="keywords" content="linux, openbsd, programming, cakephp, Django, ruby, python" /> 10 11 <link rel="shortcut icon" href="/img/static/favicon.ico" /> 11 <meta name="description" content=" EducationalPortal" />12 <meta name="description" content="Hacktivismo Portal" /> 12 13 <?php 13 14 if ( isset($this->Js) ): -
trunk/views/markers/admin_edit.ctp
r450 r451 20 20 echo $this->Form->input('lat'); 21 21 echo $this->Form->input('lng'); 22 $types = array( 1=>'Bar', 2=>'Restaurante');22 $types = array('Bar'=>'Bar', 'Restaurante'=>'Restaurante', 'Antro'=>'Antro', 'Congal'=>'Congal'); 23 23 echo $this->Form->input('type', array('options'=>$types)); 24 24 echo $this->Form->input('end', array('type'=>'checkbox', 'value'=>'1')); -
trunk/views/markers/admin_index.ctp
r450 r451 1 1 <div class="actions"> 2 2 <h3><?php __('Actions'); ?></h3> 3 <ul> 4 <li><?php echo $this->Html->link(sprintf(__('New %s', true), __('Marker', true)), array('action' => 'edit')); ?></li> 5 </ul> 3 <?php 4 echo $this->Html->link(sprintf(__('New %s', true), __('Marker', true)), array('action' => 'edit')); 5 echo $this->Html->link('View all markers', array('action' => 'view')); 6 ?> 6 7 </div> 7 8 <div class="markers index"> … … 33 34 <td><?php echo $marker['Marker']['type']; ?> </td> 34 35 <td class="actions"> 35 <?php echo $this->Html->link(__('View', true), array('action' => 'view', $marker['Marker']['id'])); ?> 36 <?php echo $this->Html->link(__('Edit', true), array('action' => 'edit', $marker['Marker']['id'])); ?> 37 <?php echo $this->Html->link(__('Delete', true), array('action' => 'delete', $marker['Marker']['id']), null, sprintf(__('Are you sure you want to delete # %s?', true), $marker['Marker']['id'])); ?> 36 <?php echo $this->Html->link(__('Edit', True), array('action' => 'edit', $marker['Marker']['id'])); ?> 37 <?php echo $this->Html->link(__('Delete', True), array('action' => 'delete', $marker['Marker']['id']), null, sprintf(__('Are you sure you want to delete # %s?', true), $marker['Marker']['id'])); ?> 38 38 </td> 39 39 </tr>
Note: See TracChangeset
for help on using the changeset viewer.
