~agasti-rhok-02/sahana-agasti/mayon-rhok-02

« back to all changes in this revision

Viewing changes to plugins/agGisPlugin/modules/agGis/templates/liststaffSuccess.php

  • Committer: charles wisniewski
  • Date: 2010-12-08 22:06:31 UTC
  • mfrom: (1.1.3 cuny-sps-trunk)
  • Revision ID: charles.wisniewski@mail.cuny.edu-20101208220631-63o0t8b9vi7nbbu6
all up to date

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<h3>Staff GIS List</h3>
 
2
 
 
3
<table class="staffTable">
 
4
  <thead>
 
5
    <tr>
 
6
      <th>Staff Member</th>
 
7
      <th>Home Address</th>
 
8
      <th>Work Address</th>
 
9
      <th>Updated at</th>
 
10
    </tr>
 
11
  </thead>
 
12
  <tbody>
 
13
    <?php foreach ($ag_staff_geos as $ag_staff_geo): ?>
 
14
    <tr>
 
15
      <td><a href="<?php echo url_for('staff/edit?id='.$ag_staff_geo->getId()) ?>"><?php echo $ag_staff_geo->getId() ?></a></td>
 
16
      <td><?php
 
17
 
 
18
    $siteContacts = $ag_staff_geo;
 
19
 
 
20
    $siteContacts = $siteContacts->getAgEntity()->getAgEntityAddressContact();
 
21
      foreach ($siteContacts as $siteContact) {
 
22
        $address = $siteContact->getAgAddress();
 
23
        $formats = $siteContact->getAgAddress()->getAgAddressStandard()->getAgAddressFormat();
 
24
        foreach ($formats as $format) {
 
25
          $string = '';
 
26
          $addressValues = $address->getAgAddressMjAgAddressValue();
 
27
          foreach ($addressValues as $addressValue) {
 
28
            if ($addressValue->getAgAddressValue()->getAddressElementId() == $format->getAddressElementId()) {
 
29
              if ($format->getLineSequence() <> 1 && $format->getInlineSequence() == 1) {
 
30
                $string .= ' ';
 
31
              }
 
32
              $string .= $format->getPreDelimiter() . $addressValue->getAgAddressValue() . $format->getPostDelimiter();
 
33
            }
 
34
          }
 
35
          $order[$format->getLineSequence()][$format->getInlineSequence()] = $string;
 
36
        }
 
37
 
 
38
        $formatted_address = '';
 
39
        $address_id = $siteContact->getAddressId();
 
40
        foreach ($order as $key => $line) {
 
41
          foreach ($line as $key2 => $inLine) {
 
42
            $formatted_address .= $order[$key][$key2];
 
43
          }
 
44
        }
 
45
 
 
46
        $fooaddress[] =  $formatted_address;
 
47
        //making a second array with the same indices as the above (hackish, needs redo)
 
48
        $fooaddressid[] = $address_id;
 
49
      }
 
50
      if(isset($fooaddress[0]))
 
51
      {
 
52
        echo $fooaddress[0];
 
53
 
 
54
        $addressfull = new agGis();
 
55
        $addressparts = $addressfull->parse_address($fooaddress[0]);
 
56
 
 
57
        echo '<a href="' . url_for('gis/geocode') . '?number=' . $addressparts['number'] . '&street=' . $addressparts['street']  . '&zip=' . $addressparts['zip'] . '&address_id=' . $fooaddressid[0] . '">geo</a>';
 
58
      }       ?></td>
 
59
      <td><?php 
 
60
      if(isset($fooaddress[1]))
 
61
      {
 
62
        echo $fooaddress[1];
 
63
 
 
64
        //take the address, parse it into the pieces needed for geocoding
 
65
        $addressfull = new agGis();
 
66
        $addressparts = $addressfull->parse_address($fooaddress[1]);
 
67
 
 
68
        echo '<a href="' . url_for('gis/geocode') . '?number=' . $addressparts['number'] . '&street=' . $addressparts['street']  . '&zip=' . $addressparts['zip'] . '&address_id=' . $fooaddressid[1] . '">geo</a>';
 
69
      }?></td>
 
70
      <td><?php echo $ag_staff_geo->getUpdatedAt() ?></td>
 
71
    </tr>
 
72
 
 
73
    <?php
 
74
    $fooaddress = "";
 
75
    endforeach;
 
76
    ?>
 
77
  </tbody>
 
78
</table>
 
79
 
 
80
  <a href="<?php echo url_for('gis/new') ?>">New</a>
 
 
b'\\ No newline at end of file'