コード例 #1
0
function saveContract($entity)
{
    $dao = new ContractDao();
    $dao->save($entity);
}
コード例 #2
0
ファイル: driver.php プロジェクト: guycole/choral-smell-php
<?php

print 'contract stub1<br>';
include "pdo/contract_dao.php";
include "pdo/contract_entity.php";
$xx = new ContractEntity(666, "bogus20");
print $xx . "<br>";
$yy = new ContractDao();
$zz = $yy->save($xx);
print $zz;
print 'contract stub2y<br>';
コード例 #3
0
 /**
  * Used to enhance the provided timesheet with data from other tables.
  *
  * @param obj The timesheet object to enhance.
  *
  * @return Returns the enhanced timesheet.
  */
 public function enhanceTimesheet($obj)
 {
     // Set the other timesheet information.
     if (is_numeric($obj->id)) {
         // Set the bills in the timesheet.
         $billDao = new BillDao();
         $obj->bills = $billDao->getForTimesheet($obj->id, $obj->employee_id);
         // Set the employee.
         $employeeDao = new EmployeeDao();
         $obj->employee = $employeeDao->get($obj->employee_id);
         // Set the audit log info.
         $auditLogDao = new AuditLogDao();
         $obj->audit_log = $auditLogDao->getForTimesheet($obj->id);
         // Set the pay period.
         $payPeriodDao = new PayPeriodDao();
         $obj->pay_period = $payPeriodDao->get($obj->pp_start);
         // Set the employee's contracts.
         $contractDao = new ContractDao();
         $obj->contracts = $contractDao->getEmployeeContractsForPayPeriod($obj->employee_id, $obj->pay_period);
         // Set the holidays.
         $holidayDao = new HolidayDao();
         $obj->holidays = $holidayDao->getForPayPeriod($obj->pay_period);
     }
     // Perform post-processing.
     $this->postProcess($obj);
     // Return the enhanced timesheet object.
     return $obj;
 }
コード例 #4
0
 /**
  * Retrieve the JSON for all the contracts assigned to an employee as of a
  * specific day.
  */
 public function employeeAction()
 {
     // Get the id of the employee for which contracts are to be retrieved.
     $id = $this->getInt('id');
     // Get the day for which contract data is to be retrieved.
     $day = $this->getDate('day');
     // Determine whether administrative contracts should be retrieved.
     $regularOnly = $this->getBool('regularOnly');
     // Wrap the whole thing in a try/catch.
     try {
         // Check to see if the provided employee id is valid.
         if (isset($id) && is_numeric($id)) {
             // Used to retrieve the necessary pay period.
             $payPeriodDao = new PayPeriodDao();
             // Used to retrieve the contracts.
             $contractDao = new ContractDao();
             // Get the contracts for the specified employee.
             $contracts = $contractDao->getEmployeeContracts($id, $day, $regularOnly);
             // Create the JSON object to return.
             $json = new stdClass();
             $json->success = true;
             $json->msg = 'The assigned contracts were ' . 'retrieved successfully.';
             $json->contracts = $contracts;
         } else {
             // Create the error JSON object to return.
             $json = new stdClass();
             $json->success = false;
             $json->msg = 'A valid employee id must be specified.';
         }
     } catch (Zend_Exception $ex) {
         // Create the error JSON object to return.
         $json = new stdClass();
         $json->success = false;
         $json->msg = $ex->getMessage();
         $json->employees = array();
     }
     // Return all the contracts as JSON.
     $this->_helper->json($json);
 }