initial commit

This commit is contained in:
Chris Sewell
2012-11-28 03:55:08 -05:00
parent 7adb399b2e
commit cf140a2e97
3247 changed files with 492437 additions and 0 deletions

View File

@ -0,0 +1,180 @@
<?php
/**
* maps actions.
*
* @package atlbiomed
* @subpackage maps
* @author Your name here
* @version SVN: $Id: actions.class.php 2692 2006-11-15 21:03:55Z fabien $
*/
class mapsActions extends sfActions
{
/**
* Executes index action
*
*/
public function executeIndex()
{
// default view values
$this->bogusWorkOrder = new Workorder();
$this->bogusWorkOrder->setJobStatusId('');
$this->bogusWorkOrder->setJobTypeId('');
$this->bogusWorkOrder->setTech('');
$this->technicians = array();
foreach(UserPeer::getUserByType(1) as $tech)
{
$this->technicians[$tech->getId()] = $tech->getDisplayName();
}
$this->dateFilter = date('Y-m-d');
$this->dateFilterType = 'day';
$this->markers = array();
if ($this->getRequestParameter('viewMode', 0) == 1)
{
// show all clients
foreach(ClientPeer::doSelect(new Criteria()) as $client)
{
$title = $client->getClientIdentification() . ' - ' . $client->getClientName();
$address = $client->getAddress() . ' ' .
$client->getCity() . ' ' .
$client->getState() . ' ' .
$client->getZip();
$content = $address . '<br />' .
'ATTN: ' . $client->getAttn() . '<br />' .
'Phone: ' . $client->getPhone();
if(!$client->getLocation())
$this->markers[] = new GMapMarker($address, '', '',$title, $content, 'green');
else
$this->markers[] = new GMapMarker($address,
$client->getLocation()->getLatitude(),
$client->getLocation()->getLongitude(), $title, $content, 'green');
}
}
else
{
// show jobs
$jobDate = date('Ymd');
$usersWithWork = new Criteria();
$workorders = new Criteria();
if($this->getRequest()->getMethod() == sfRequest::POST)
{
$this->dateFilter = $this->getRequestParameter('jobDate');
$this->dateFilterType = $this->getRequestParameter('dateFilterType');
if($this->getRequestParameter('technicianId') != '')
{
$usersWithWork->add(UserPeer::ID, $this->getRequestParameter('technicianId'));
$workorders->add(WorkorderTechPeer::USER_ID, $this->getRequestParameter('technicianId'));
$workorders->addJoin(WorkorderPeer::ID, WorkorderTechPeer::WORKORDER_ID, Criteria::INNER_JOIN);
$this->bogusWorkOrder->setTech($this->getRequestParameter('technicianId'));
}
if($this->getRequestParameter('job_status_id') != '')
{
$usersWithWork->add(WorkorderPeer::JOB_STATUS_ID, $this->getRequestParameter('job_status_id'));
$workorders->add(WorkorderPeer::JOB_STATUS_ID, $this->getRequestParameter('job_status_id'));
$this->bogusWorkOrder->setJobStatusId($this->getRequestParameter('job_status_id'));
}
if($this->getRequestParameter('job_type_id') != '')
{
$workorders->add(WorkorderPeer::JOB_TYPE_ID, $this->getRequestParameter('job_type_id'));
$this->bogusWorkOrder->setJobTypeId($this->getRequestParameter('job_type_id'));
}
}
$usersWithWork->addJoin(UserPeer::ID, WorkorderPeer::TECH);
$usersWithWork->setDistinct(true);
if ($this->dateFilterType == 'day')
{
$usersWithWork->add(WorkorderPeer::JOB_DATE, $this->getRequestParameter('jobDate'));
$workorders->add(WorkorderPeer::JOB_DATE, $this->getRequestParameter('jobDate'));
}
else if ($this->dateFilterType == 'month')
{
$year = substr($this->getRequestParameter('jobDate'), 0, 4);
$month = substr($this->getRequestParameter('jobDate'), 5, 2);
$start = $year . '-' . $month . '-01';
$end = $year . '-' . $month . '-31'; // easy check, even for months without 31 days since all dates are
// strings in our database
$usersWithWork->add(WorkorderPeer::JOB_DATE, $start, Criteria::GREATER_EQUAL);
$usersWithWork->addAnd($usersWithWork->getNewCriterion(WorkorderPeer::JOB_DATE, $end, Criteria::LESS_EQUAL)); // inclusive
$workorders->add(WorkorderPeer::JOB_DATE, $start, Criteria::GREATER_EQUAL);
$workorders->addAnd($workorders->getNewCriterion(WorkorderPeer::JOB_DATE, $end, Criteria::LESS_EQUAL)); // inclusive
}
else
{
// week from the selected date
$start = date('Y-m-d', strtotime($this->getRequestParameter('jobDate')));
$end = date('Y-m-d', strtotime('+7 days', strtotime($this->getRequestParameter('jobDate'))));
//$this->renderText($start . $end); return sfView::NONE;
$usersWithWork->add(WorkorderPeer::JOB_DATE, $end, Criteria::LESS_THAN); // exclusive
$usersWithWork->addAnd($usersWithWork->getNewCriterion(WorkorderPeer::JOB_DATE, $start, Criteria::GREATER_EQUAL));
$workorders->add(WorkorderPeer::JOB_DATE, $end, Criteria::LESS_THAN); // exclusive
$workorders->addAnd($workorders->getNewCriterion(WorkorderPeer::JOB_DATE, $start, Criteria::GREATER_EQUAL));
}
$techs = UserPeer::doSelect($usersWithWork);
$orders = WorkorderPeer::doSelect($workorders);
foreach($orders as $order)
{
$findTech = create_function('$tech', 'return $tech->getId() ==' . $order->getTech() . ';');
$theTech = array_filter($techs, $findTech);
if(isset($theTech) && count($theTech) == 1)
{
$address = $order->getClient()->getAddress() . ' ' .
$order->getClient()->getCity() . ' ' .
$order->getClient()->getState() . ' ' .
$order->getClient()->getZip();
$jobDate = $order->getJobDate();
$tech = array_pop($theTech);
$content = 'Contact: ' . $order->getClient()->getAttn() . '<br />' .
'Phone: ' . $order->getClient()->getPhone() . '<br />' .
'City: ' . $order->getClient()->getCity() . ', ' . $order->getClient()->getState() . '<br/><span class="red">';
if($order->getClient()->getAnesthesia() != null){
$content .= $order->getClient()->getAnesthesia();
}
if($order->getClient()->getAnesthesia() != null && $order->getClient()->getMedgas() != null){
$content .= '&nbsp;&frasl;&nbsp;';
}
if($order->getClient()->getMedgas() != null){
$content .= $order->getClient()->getMedgas();
}
$content .= '</span><br/><br/>' .
'<a href="/index.php/scheduler/index/mode/edit/ticket/' .$order->getId().'" >Schedule</a>';
if(!$order->getClient()->getLocation())
$this->markers[] = new GMapMarker($address, '', '',$order->getClient()->getClientName(), $content, 'green');
else
$this->markers[] = new GMapMarker($address,
$order->getClient()->getLocation()->getLatitude(),
$order->getClient()->getLocation()->getLongitude(),
$order->getClient()->getClientName(), $content, 'green');
}
unset($theTech);
}
}
}
}

View File

@ -0,0 +1,25 @@
<?php
/**
* Defines components for the map actions, namely the ability to easily print a technician
* map.
*
* @author Ciphent
**/
class mapsComponents extends sfComponents
{
/**
* Displays the google map for all technicians. You can only have one instance of this component on a page.
*
* Call it as so: include_component('maps', 'displayTechnicianMap', array('markers' => array(elements of type GMapMarer))
*
**/
public function executeDisplayTechnicianMap()
{
$map = new GoogleMap('map');
$map->includeDefaultLocation()->setWidth($this->mapwidth)->addMarkers($this->markers);
$map->setHeight($this->mapheight);
$this->map = $map;
}
}

View File

@ -0,0 +1,3 @@
all:
is_secure: off
credentials: Office

View File

@ -0,0 +1,2 @@
all:
javascripts: [%SF_PROTOTYPE_WEB_DIR%/js/prototype]

View File

@ -0,0 +1,19 @@
<?php use_helper('Javascript') ?>
<div><h2>Mon:<img src='/images/pins/pin_red1.png' /> Tue:<img src='/images/pins/pin_blue1.png' /> Wed: <img src='/images/pins/pin_orange1.png' /> Thu:<img src='/images/pins/pin_green1.png' /> Fri: <img src='/images/pins/pin_grey1.png' /> </h2></div>
<?php
echo $map->getMapJS();
echo javascript_tag("
Event.observe(window, 'load', showMap, false);
function showMap(evt)
{
onLoad();
}
");
echo $map->getMapHtml();
?>

View File

@ -0,0 +1,6 @@
<?php echo radiobutton_tag('dateFilterType', 'month', $dateFilterType == 'month') ?>By Selected Month<br />
<?php echo radiobutton_tag('dateFilterType', 'week', $dateFilterType == 'week') ?>By Selected Week (selected day plus seven days)<br />
<?php echo radiobutton_tag('dateFilterType', 'day', $dateFilterType == 'day') ?>By Selected Day<br />
<?php echo input_date_tag('jobDate', $initialDate, 'rich=true'); ?>

View File

@ -0,0 +1,50 @@
<?php use_helper('Javascript') ?>
<?php use_helper('Object') ?>
<div class="content" style="padding: 5px;">
<div class="mapsCollapsingPanelContainer">
<?php echo form_tag('maps/index'); ?>
<?php include_partial('global/collapsingDivContainer',
array('title' => 'Filter by Status',
'uniqueId' => 'filterByStatus',
'content' => object_select_tag($bogusWorkOrder, 'getJobStatusId', 'include_custom=All', ''))); ?>
<?php include_partial('global/collapsingDivContainer',
array('title' => 'Filter by Job Type',
'uniqueId' => 'filterByJType',
'content' => object_select_tag($bogusWorkOrder, 'getJobTypeId', 'include_custom=All', ''))); ?>
<?php include_partial('global/collapsingDivContainer',
array('title' => 'Filter by Technician',
'uniqueId' => 'filterByTechnician',
'content' => select_tag('technicianId',
options_for_select($technicians,
$bogusWorkOrder->getTech(),
'include_custom=All')))); ?>
<?php include_partial('global/collapsingDivContainer',
array('title' => 'Filter by Date',
'uniqueId' => 'filterByDate',
'content' => get_partial('mapDateFilterControl',
array('initialDate' => $dateFilter,
'dateFilterType' => $dateFilterType)))); ?>
<div class="mapsCollapsingPanelContainerControl">
<?php echo submit_tag('Filter'); ?>
</div>
<div class="mapsCollapsingPanelContainerControl">
<hr />
</div>
<div class="mapsCollapsingPanelContainerControl">
<h3><?php echo link_to('View all Client Locations', 'maps/index?viewMode=1'); ?></h3>
</div>
</form>
</div>
<div style="float: left; display: inline; border: 1px solid black;">
<?php include_component('maps', 'displayTechnicianMap', array('markers' => $markers, 'mapwidth' => '800px')); ?>
</div>
</div>