Changeset 451


Ignore:
Timestamp:
05/25/10 14:54:24 (21 months ago)
Author:
aarkerio
Message:

Update Google markers

Location:
trunk
Files:
2 deleted
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/config/core.php

    r449 r451  
    141141 * Actual value depends on 'Security.level' setting. 
    142142 */ 
    143   Configure::write('Session.timeout', '1200000'); 
     143  Configure::write('Session.timeout', '3600'); 
    144144 
    145145/** 
  • trunk/controllers/markers_controller.php

    r450 r451  
    11<?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 
    212class MarkersController extends AppController { 
    313 
    414 public $name = 'Markers'; 
    515 
    6  public function index()  
     16 public function display()  
    717 { 
    8    $this->Marker->recursive = 0; 
    9    $this->set('markers', $this->paginate()); 
     18  $this->layout = Null; 
     19  $this->set('data', $this->Marker->find('all')); 
    1020 } 
    1121 
    12  public function display()  
     22 public function view()  
    1323 { 
    14    $this->set('data', $this->Marker->find('all')); 
     24  $this->layout = 'gmap'; 
    1525 } 
    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         } 
    5626 
    5727/** == ADMIN METHODS == */ 
     
    6232  $this->set('markers', $this->paginate()); 
    6333 } 
    64  
    6534 
    6635 public function admin_edit($marker_id = null)  
     
    7443      if ($this->Marker->save($this->data)): 
    7544          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;     
    7847              elseif ($this->data['Marker']['end'] == 0 && isset($this->data['Marker']['id'])):  # UPDATE  
    7948              $return = '/admin/markers/edit/'.$this->data['Marker']['id']; 
     
    9059 } 
    9160 
    92  public function admin_delete($id = null)  
     61 public function admin_delete($marker_id = null)  
    9362 { 
    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')); 
    9665          $this->redirect(array('action'=>'index')); 
    9766  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')); 
    10069                 $this->redirect(array('action'=>'index')); 
    10170         else: 
    102                  $this->Session->setFlash(sprintf(__('%s was not deleted', true), 'Marker')); 
     71                 $this->Session->setFlash(sprintf(__('%s was not deleted', True), 'Marker')); 
    10372                 $this->redirect(array('action' => 'index')); 
    10473     endif; 
  • trunk/models/marker.php

    r450 r451  
    11<?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 
    212class Marker extends AppModel { 
    313  public $name = 'Marker'; 
    414  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), 
    917                                //'message' => 'Your custom message here', 
    1018                                //'allowEmpty' => false, 
     
    1321                                //'on' => 'create', // Limit validation to 'create' or 'update' operations 
    1422                        ), 
    15                         'notempty' => array( 
    16                                 'rule' => array('notempty'), 
     23                'address' => array('rule'       => array('minLength', 4), 
    1724                                //'message' => 'Your custom message here', 
    1825                                //'allowEmpty' => false, 
     
    2128                                //'on' => 'create', // Limit validation to 'create' or 'update' operations 
    2229                        ), 
    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 rule 
    31                                 //'on' => 'create', // Limit validation to 'create' or 'update' operations 
    32                         ), 
    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 rule 
    41                                 //'on' => 'create', // Limit validation to 'create' or 'update' operations 
    42                         ), 
    43                 ), 
    4430                'lat' => array( 
    4531                        'numeric' => array( 
  • trunk/views/layouts/gmap.ctp

    r449 r451  
    33<html xmlns="http://www.w3.org/1999/xhtml"> 
    44<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" 
    811            type="text/javascript"></script> 
    912 
    1013<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 } 
    1225 
    1326var iconBlue = new GIcon();  
     
    3649        map.addControl(new GSmallMapControl()); 
    3750        map.addControl(new GMapTypeControl()); 
    38         map.setCenter(new GLatLng(47.614495, -122.341861), 13); 
     51        map.setCenter(new GLatLng(19.43430, -99.13264), 10); 
    3952        
    40         GDownloadUrl("phpsqlajax_genxml.php", function(data) { 
     53        GDownloadUrl("/markers/display", function(data) { 
    4154                var xml = GXml.parse(data); 
    4255                var markers = xml.documentElement.getElementsByTagName("marker"); 
     
    6578</script> 
    6679</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> 
    7083 </body> 
    7184</html> 
  • trunk/views/layouts/portal.ctp

    r447 r451  
    77<head> 
    88<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" /> 
    1011<link rel="shortcut icon" href="/img/static/favicon.ico" /> 
    11 <meta name="description" content="Educational Portal" /> 
     12<meta name="description" content="Hacktivismo Portal" /> 
    1213<?php 
    1314if ( isset($this->Js) ): 
  • trunk/views/markers/admin_edit.ctp

    r450 r451  
    2020                echo $this->Form->input('lat'); 
    2121                echo $this->Form->input('lng'); 
    22         $types = array(1=>'Bar', 2=>'Restaurante');  
     22        $types = array('Bar'=>'Bar', 'Restaurante'=>'Restaurante', 'Antro'=>'Antro', 'Congal'=>'Congal'); 
    2323        echo $this->Form->input('type', array('options'=>$types)); 
    2424        echo $this->Form->input('end', array('type'=>'checkbox', 'value'=>'1')); 
  • trunk/views/markers/admin_index.ctp

    r450 r451  
    11<div class="actions"> 
    22        <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?> 
    67</div> 
    78<div class="markers index"> 
     
    3334                <td><?php echo $marker['Marker']['type']; ?>&nbsp;</td> 
    3435                <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'])); ?> 
    3838                </td> 
    3939        </tr> 
Note: See TracChangeset for help on using the changeset viewer.