Example #1
0
 /**
  * This function get a database resource as the input and creates a HSP objects array
  * containing the data of the resource.
  */
 private static function _buildSummaryObjects($result)
 {
     $dbConnection = new DMLFunctions();
     $hspObjArr = null;
     while ($row = $dbConnection->dbObject->getArray($result)) {
         $hspObj = new Hsp();
         $empName = EmpInfo::getFullName($row[1]);
         if (isset($empName)) {
             // For excluding deleted employees
             $hspObj->setSummaryId($row[0]);
             $hspObj->setEmployeeId($row[1]);
             $hspObj->setHspPlanId($row[2]);
             $hspObj->setHspPlanName(DefineHsp::getHspPlanName($row[2]));
             $hspObj->setEmployeeName($empName);
             $hspObj->setHspPlanYear($row[3]);
             $hspObj->setHspPlanStatus($row[4]);
             $hspObj->setAnnualLimit($row[5]);
             $hspObj->setEmployerAmount($row[6]);
             $hspObj->setEmployeeAmount($row[7]);
             $hspObj->setTotalAccrued($row[8]);
             $hspObj->setTotalUsed($row[9]);
             $currentHspPlan = Config::getHspCurrentPlan();
             if ($currentHspPlan == 3 || $currentHspPlan == 4 || $currentHspPlan == 5) {
                 // If FSA is avaialbe in current plan
                 if ($row[2] == 3) {
                     $hspObj->setFsaBalance(self::_fetchLastYearFsaBalance($row[1], $row[3] - 1));
                 } else {
                     $hspObj->setFsaBalance("NA");
                 }
             }
             $hspObjArr[] = $hspObj;
         }
     }
     return $hspObjArr;
 }
 /**
  * Builds leave cancellation notice
  *
  */
 private function _cancelMail()
 {
     $this->notificationTypeId = EmailNotificationConfiguration::EMAILNOTIFICATIONCONFIGURATION_NOTIFICATION_TYPE_LEAVE_CANCELLED;
     if ($this->action == self::MAILNOTIFICATIONS_ACTION_SUPERVISOR_CANCEL) {
         $this->templateFile = file_get_contents(ROOT_PATH . "/templates/leave/mails/" . self::MAILNOTIFICATIONS_TEMPLATE_SUPERVISOR_CANCEL);
     } else {
         $this->templateFile = file_get_contents(ROOT_PATH . "/templates/leave/mails/" . self::MAILNOTIFICATIONS_TEMPLATE_CANCEL);
     }
     $txt = $this->templateFile;
     $leaveObjs = $this->getLeaveObjs();
     $txtArr = preg_split('/#\\{(.*)\\}/', $txt, null, PREG_SPLIT_DELIM_CAPTURE);
     $recordTxt = $txtArr[1];
     $recordArr = null;
     $fulldays = 0;
     foreach ($leaveObjs as $leaveObj) {
         if ($leaveObj->getLeaveStatus() == Leave::LEAVE_STATUS_LEAVE_CANCELLED) {
             $leaveLength = $leaveObj->getLeaveLengthHours();
             $fulldays += $leaveObj->getLeaveLengthDays();
             $duration = $leaveObj->getLeaveLengthHours();
             $date = $leaveObj->getLeaveDate();
             $type = $leaveObj->getLeaveTypeName();
             $comments = $leaveObj->getLeaveComments();
             $recordArr[] = preg_replace(array('/#date/', '/#type/', '/#duration/', '/#comments/'), array($date, $type, $duration, $comments), $recordTxt);
         }
     }
     $recordTxt = "";
     if (isset($recordArr)) {
         $recordTxt = join("\r\n", $recordArr);
     }
     $txt = $txtArr[0] . $recordTxt . $txtArr[2];
     if (isset($leaveObjs[0])) {
         $employeeId = $leaveObjs[0]->getEmployeeId();
         $empInfoObj = new EmpInfo();
         $employeeName = $empInfoObj->getFullName($employeeId);
         $this->_getAddresses($employeeId);
         $txt = preg_replace('/#' . self::MAILNOTIFICATIONS_VARIABLE_SUBORDINATE . '/', $employeeName, $txt);
         if ($this->action == self::MAILNOTIFICATIONS_ACTION_SUPERVISOR_CANCEL) {
             $subjectTemplate = self::MAILNOTIFICATIONS_TEMPLATE_SUPERVISOR_CANCEL_SUBJECT;
             $this->to = $this->subordinateMail;
         } else {
             $subjectTemplate = self::MAILNOTIFICATIONS_TEMPLATE_CANCEL_SUBJECT;
             $this->to = $this->supervisorMail;
         }
         $this->subject = $this->_getMailSubject($subjectTemplate, $employeeName, $fulldays);
     }
     $this->mail = $txt;
 }
					</tr>
					<tr>
						<td valign="top"><?php 
        echo $lang_empview_employeename;
        ?>
</td>
<?php 
        $empsupid = $this->getArr['editIDSup'];
        ?>
						<td align="left" valign="top"><input type="hidden" name="txtRepEmpID" value="<?php 
        echo $this->getArr['editIDSup'];
        ?>
"/><strong>
						<?php 
        echo $empInfoObj->getFullName($this->getArr['editIDSup']);
        ?>
					</strong></td>
					  </tr>
					  <tr>
						<td valign="top"><?php 
        echo $lang_hrEmpMain_reportingmethod;
        ?>
</td>
						<td align="left" valign="top"><select disabled="disabled" name='cmbRepMethod'><strong>
<?php 
        $keys = array_keys($arrRepMethod);
        $values = array_values($arrRepMethod);
        for ($c = 0; count($arrRepMethod) > $c; $c++) {
            if ($this->getArr['RepMethod'] == $values[$c]) {
                echo "<option selected=\"selected\" value='" . $values[$c] . "'>" . $keys[$c] . "</option>";
        ?>
	    name='chkcriteria[]' id='EMPNO' value='EMPNO' onclick="chkboxCriteriaEnable()"
	    <?php 
        echo isset($this->postArr['chkcriteria']) && in_array('EMPNO', $this->postArr['chkcriteria']) ? 'checked' : '';
        ?>
	    class="formCheckbox"/>

	<label for="EMPNO"><?php 
        echo $lang_rep_Employee;
        ?>
</label>
	<?php 
        $empId = isset($criteriaData['EMPNO'][0]) ? $criteriaData['EMPNO'][0] : false;
        if ($empId) {
            $empId = $empInfoObj->fetchEmployeeId($empId);
            $employeeName = $empInfoObj->getFullName($empId, true);
            if (!$empId) {
                $empId = $criteriaData['EMPNO'][0];
            }
        } else {
            $empId = "";
            $employeeName = "";
        }
        ?>
	  <select name="cmbId" onchange="disableEmployeeId();" disabled="disabled" class="formSelect">
	  	<option value="0"><?php 
        echo $lang_Leave_Common_AllEmployees;
        ?>
</option>
		<option value="1" <?php 
        echo $empId == "" ? "" : "selected='selected'";