/** * OrangeHRM is a comprehensive Human Resource Management (HRM) System that captures * all the essential functionalities required for any enterprise. * Copyright (C) 2006 OrangeHRM Inc., http://www.orangehrm.com * * OrangeHRM is free software; you can redistribute it and/or modify it under the terms of * the GNU General Public License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * OrangeHRM is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along with this program; * if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA * */ function populateActivities($projectId) { ob_clean(); require ROOT_PATH . '/language/default/lang_default_full.php'; $timeController = new TimeController(); $projectActivities = $timeController->fetchProjectActivities($projectId); $objResponse = new xajaxResponse(); $xajaxFiller = new xajaxElementFiller(); $element = "cmbActivity"; $objResponse = $xajaxFiller->cmbFillerById($objResponse, $projectActivities, 0, 'frmTimesheet', $element, 1); $objResponse->addScript('document.getElementById("' . $element . '").focus();'); $objResponse->addAssign('status', 'innerHTML', ''); return $objResponse->getXML(); }
function populateActivities($projectId, $row, $activityId = null, $activityName = null) { ob_clean(); require ROOT_PATH . '/language/default/lang_default_full.php'; $timeController = new TimeController(); $projectActivities = $timeController->fetchProjectActivities($projectId); $objResponse = new xajaxResponse(); $xajaxFiller = new xajaxElementFiller(); $xajaxFiller->setDefaultOptionName($GLOBALS['lang_Common_Select']); $element = "cmbActivity[{$row}]"; if (count($projectActivities) == 0) { $projectActivities[0][0] = -1; $projectActivities[0][1] = "- {$lang_Time_Timesheet_SelectProject} -"; $objResponse = $xajaxFiller->cmbFillerById($objResponse, $projectActivities, 0, 'frmTimesheet', $element, 0); } else { if ($activityId != null) { $projectActivityObject = new ProjectActivity(); if ($projectId == $projectActivityObject->retrieveActivityProjectId($activityId)) { $activityExists = false; $i = 0; foreach ($projectActivities as $activity) { if ($activity[$i][0] == $activityId) { $activityExists = true; } $i++; } if (!$activityExists) { $count = count($projectActivities); $projectActivities[$count][0] = $activityId; $projectActivities[$count][1] = $activityName; } } } $objResponse->addScript("document.getElementById('" . $element . "').options.length = 0;"); $objResponse->addScript("document.getElementById('" . $element . "').options[0] = new Option('- {$lang_Common_Select} -','-1');"); $objResponse = $xajaxFiller->cmbFillerById($objResponse, $projectActivities, 0, 'frmTimesheet', $element, 1); } $objResponse->addScript('document.getElementById("' . $element . '").focus();'); $objResponse->addAssign('status', 'innerHTML', ''); return $objResponse->getXML(); }