本文整理汇总了PHP中CommonFunctions::isValidId方法的典型用法代码示例。如果您正苦于以下问题:PHP CommonFunctions::isValidId方法的具体用法?PHP CommonFunctions::isValidId怎么用?PHP CommonFunctions::isValidId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CommonFunctions
的用法示例。
在下文中一共展示了CommonFunctions::isValidId方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: parseEditData
public function parseEditData($postArr)
{
$tmpArr = null;
$duplicateArr = array();
$durationArr = array();
for ($i = 0; $i < count($postArr['cmbActivity']); $i++) {
$tmpObj = new TimeEvent();
$projectId = $postArr['cmbProject'][$i];
if (!CommonFunctions::isValidId($projectId)) {
continue;
}
$tmpObj->setActivityId($postArr['cmbActivity'][$i]);
$tmpObj->setProjectId($projectId);
$txtReportedDate = trim($postArr['txtReportedDate'][$i]);
$tmpObj->setReportedDate(LocaleUtil::getInstance()->convertToStandardDateFormat($txtReportedDate));
if (isset($postArr['txtDuration'][$i])) {
$txtDuration = trim($postArr['txtDuration'][$i]);
if (!empty($txtDuration) || $txtDuration == 0) {
$tmpObj->setDuration($txtDuration * 3600);
}
}
$tmpObj->setDescription(stripslashes($postArr['txtDescription'][$i]));
if (isset($postArr['txtTimeEventId'][$i])) {
$tmpObj->setTimeEventId(trim($postArr['txtTimeEventId'][$i]));
}
$tmpObj->setEmployeeId(trim($postArr['txtEmployeeId']));
$tmpObj->setTimesheetId(trim($postArr['txtTimesheetId']));
$tmpArr[] = $tmpObj;
/* Checking duplicate rows: Begins */
$row = $postArr['cmbProject'][$i] . '-' . $postArr['cmbActivity'][$i] . '-' . $postArr['txtReportedDate'][$i];
if (!in_array($row, $duplicateArr) && !$this->detailedDuplicate) {
$duplicateArr[] = $row;
} else {
$this->detailedDuplicate = true;
}
/* Checking duplicate rows: Ends */
/* Checking for invalid durations: Begins */
if (!$this->detailedInvalidDuration) {
$key = trim($postArr['txtReportedDate'][$i]);
$value = (double) $postArr['txtDuration'][$i];
if (array_key_exists($key, $durationArr)) {
if ($durationArr[$key] + $value > 24) {
$this->detailedInvalidDuration = true;
} else {
$durationArr[$key] = $durationArr[$key] + $value;
}
} else {
$durationArr[$key] = $value;
}
}
/* Checking for invalid durations: Ends */
}
return $tmpArr;
}
示例2: _parseCommonData
/**
* Parse common data for edit and update
* @return JobTitle object
*/
private function _parseCommonData($postArr)
{
$jobTitle = new JobTitle();
$jobTitle->setJobName(CommonFunctions::escapeHtml(trim($postArr['txtJobTitleName'])));
$jobTitle->setJobDesc(CommonFunctions::escapeHtml(trim($postArr['txtJobTitleDesc'])));
$jobTitle->setJobComm(CommonFunctions::escapeHtml(trim($postArr['txtJobTitleComments'])));
$jobTitle->setJobSalGrd(trim($postArr['cmbPayGrade']));
$jobSpecId = trim($postArr['cmbJobSpecId']);
if (CommonFunctions::isValidId($jobSpecId)) {
$jobTitle->setJobSpecId($jobSpecId);
}
return $jobTitle;
}
示例3: parseEditData
public function parseEditData($postArr)
{
$tmpArr = null;
for ($i = 0; $i < count($postArr['cmbActivity']); $i++) {
$tmpObj = new TimeEvent();
$projectId = $postArr['cmbProject'][$i];
if (!CommonFunctions::isValidId($projectId)) {
continue;
}
$tmpObj->setActivityId($postArr['cmbActivity'][$i]);
$tmpObj->setProjectId($projectId);
$txtStartTime = trim($postArr['txtStartTime'][$i]);
if (!empty($txtStartTime)) {
$tmpObj->setStartTime(LocaleUtil::getInstance()->convertToStandardDateTimeFormat($txtStartTime));
}
$txtEndTime = trim($postArr['txtEndTime'][$i]);
if (!empty($txtEndTime)) {
$tmpObj->setEndTime(LocaleUtil::getInstance()->convertToStandardDateTimeFormat($txtEndTime));
}
$txtReportedDate = trim($postArr['txtReportedDate'][$i]);
$tmpObj->setReportedDate(LocaleUtil::getInstance()->convertToStandardDateFormat($txtReportedDate));
if (isset($postArr['txtDuration'][$i])) {
$txtDuration = trim($postArr['txtDuration'][$i]);
if (!empty($txtDuration)) {
$tmpObj->setDuration($txtDuration * 3600);
}
}
$tmpObj->setDescription(stripslashes($postArr['txtDescription'][$i]));
if (isset($postArr['txtTimeEventId'][$i])) {
$tmpObj->setTimeEventId(trim($postArr['txtTimeEventId'][$i]));
}
$tmpObj->setEmployeeId(trim($postArr['txtEmployeeId']));
$tmpObj->setTimesheetId(trim($postArr['txtTimesheetId']));
$tmpArr[] = $tmpObj;
}
return $tmpArr;
}
示例4: getJobSpecForJob
/**
* Get the job spec for the given job title
* @param String $jobTitleCode The job title code
* @return JobSpec JobSpec object or null if no job spec assigned for given job title
*/
public function getJobSpecForJob($jobTitleCode)
{
$jobSpec = null;
if (CommonFunctions::isValidId($jobTitleCode, 'JOB')) {
$jobTitle = new JobTitle();
$jobTitles = $jobTitle->filterJobTitles($jobTitleCode);
if (is_array($jobTitles) && count($jobTitles) == 1) {
$jobSpecId = $jobTitles[0][5];
try {
$jobSpec = JobSpec::getJobSpec($jobSpecId);
} catch (JobSpecException $ex) {
// ignore, we will be returning null
}
}
}
return $jobSpec;
}
示例5: reDirect
//.........这里部分代码省略.........
$form_creator->popArr['ppcntlist'] = $countrylist;
$form_creator->popArr['customFieldList'] = CustomFields::getCustomFieldList();
if ($getArr['capturemode'] == 'addmode') {
$form_creator->popArr['newID'] = $empinfo->getLastId();
if ($object != null) {
$form_creator->popArr['ctlist'] = $corptit->getCorpTitlesEmpInfo($object->cmbSalGrd);
$form_creator->popArr['deslist'] = $des->getDesEmpInfo($object->cmbCorpTit);
$form_creator->popArr['plist'] = $porinfo->getProvinceCodes($object->cmbTaxCountry);
$form_creator->popArr['resplist'] = $porinfo->getProvinceCodes($object->cmbPermCountry);
$form_creator->popArr['resdlist'] = $distric->getDistrictCodes($object->cmbPermProvince);
if (isset($postArr['cmbJobTitle'])) {
$form_creator->popArr['empstatlist'] = $view_controller->xajaxObjCall($postArr['cmbJobTitle'], 'JOB', 'allEmpStat');
}
$form_creator->popArr['ethRace'] = $ethnicrace->getEthnicRaceCodes($object->cmbEthnicRace);
}
} elseif ($getArr['capturemode'] == 'updatemode') {
$form_creator->popArr['editTaxInfo'] = $empTax->getEmployeeTaxInfo($getArr['id']);
$form_creator->popArr['usStateList'] = $porinfo->getProvinceCodes('US');
$form_creator->popArr['empDDAss'] = $ddebit->getEmployeeDirectDebit($getArr['id']);
if (isset($getArr['DDSEQ'])) {
$form_creator->popArr['editDDForm'] = $ddebit->getDirectDebit($getArr['id'], $getArr['DDSEQ']);
}
$form_creator->popArr['editMainArr'] = $empinfo->filterEmpMain($getArr['id']);
$form_creator->popArr['editPersArr'] = $empinfo->filterEmpPers($getArr['id']);
$form_creator->popArr['editJobInfoArr'] = $empJobInfo = $empinfo->filterEmpJobInfo($getArr['id']);
$form_creator->popArr['editCustomInfoArr'] = $empCustomInfo = $empinfo->filterEmpCustomInfo($getArr['id']);
$view_controller = new ViewController();
$form_creator->popArr['empstatlist'] = $view_controller->xajaxObjCall($empJobInfo[0][2], 'JOB', 'allEmpStat');
$empJobTitle = $empJobInfo[0][2];
if (isset($postArr['cmbJobTitle'])) {
$form_creator->popArr['empstatlist'] = $view_controller->xajaxObjCall($postArr['cmbJobTitle'], 'JOB', 'allEmpStat');
$empJobTitle = $postArr['cmbJobTitle'];
}
if (CommonFunctions::isValidId($empJobTitle, 'JOB')) {
$empJobSpec = $view_controller->getJobSpecForJob($empJobTitle);
} else {
$empJobSpec = null;
}
$form_creator->popArr['jobSpec'] = $empJobSpec;
$jobTitleHistory = new JobTitleHistory();
$form_creator->popArr['jobTitleHistory'] = $jobTitleHistory->getHistory($getArr['id']);
$empDivisionHistory = new SubDivisionHistory();
$form_creator->popArr['subDivisionHistory'] = $empDivisionHistory->getHistory($getArr['id']);
$locationHistory = new LocationHistory();
$form_creator->popArr['locationHistory'] = $locationHistory->getHistory($getArr['id']);
$form_creator->popArr['assignedlocationList'] = EmpLocation::getEmpLocations($getArr['id']);
$form_creator->popArr['availablelocationList'] = EmpLocation::getUnassignedLocations($getArr['id']);
$form_creator->popArr['editPermResArr'] = $edit = $editPermRes = $empinfo->filterEmpContact($getArr['id']);
$form_creator->popArr['provlist'] = $porinfo->getProvinceCodes($edit[0][4]);
$form_creator->popArr['citylist'] = $distric->getDistrictCodes($edit[0][5]);
$form_creator->popArr['empPPAss'] = $pport->getAssEmpPP($getArr['id']);
$form_creator->popArr['empDepAss'] = $dep->getAssEmpDep($getArr['id']);
$form_creator->popArr['empECAss'] = $econ->getAssEmpEC($getArr['id']);
$form_creator->popArr['empChiAss'] = $chi->getAssEmpChi($getArr['id']);
$form_creator->popArr['empAttAss'] = $attachment->getAssEmpAtt($getArr['id']);
$form_creator->popArr['empDpAss'] = $depen->getAssEmpDep($getArr['id']);
$form_creator->popArr['newPPID'] = $pport->getLastRecord($getArr['id']);
if (isset($getArr['PPSEQ'])) {
$arr[0] = $getArr['id'];
$arr[1] = $getArr['PPSEQ'];
$form_creator->popArr['editPPForm'] = $pport->filterEmpPP($arr);
}
$form_creator->popArr['newECID'] = $econ->getLastRecord($getArr['id']);
if (isset($getArr['ECSEQ'])) {
$arr[0] = $getArr['id'];
$arr[1] = $getArr['ECSEQ'];
示例6: deleteWorkshifts
/**
* Delete workshifts
* @param array $workShiftIds array of work sheet id's to delete
*/
public static function deleteWorkshifts($workshiftIds)
{
if (!is_array($workshiftIds) || empty($workshiftIds)) {
throw new WorkshiftException("Invalid Parameter", WorkshiftException::INVALID_PARAMETER);
}
foreach ($workshiftIds as $id) {
if (!CommonFunctions::isValidId($id)) {
throw new WorkshiftException("Invalid ID in array", WorkshiftException::INVALID_ID);
}
}
self::_deleteWorkshifts($workshiftIds);
}
示例7: getList
/**
* Get list of job applications.
* If optional emp number is given, only job applications associated with given manager
* are returned.
*
* @param int $managerEmpNum Employee number of manager.
* @return Array Array of JobApplication objects.
*/
public static function getList($managerEmpNum = null)
{
if (!empty($managerEmpNum) && !CommonFunctions::isValidId($managerEmpNum)) {
throw new JobApplicationException("Invalid id", JobApplicationException::INVALID_PARAMETER);
}
return self::_getList(null, $managerEmpNum);
}
示例8: deleteFields
/**
* Deletes the given custom fields
*
* @param array $fieldNumbers The list of custom fields to delete
*
* @return int Number of custom fields deleted.
*/
public static function deleteFields($fieldNumbers)
{
$count = 0;
if (!is_array($fieldNumbers)) {
throw new CustomFieldsException("Invalid parameter to deleteFields(): activityIds should be an array");
}
foreach ($fieldNumbers as $num) {
if (!CommonFunctions::isValidId($num)) {
throw new CustomFieldsException("Invalid parameter to deleteFields(): field num = {$num}");
}
}
if (!empty($fieldNumbers)) {
$sql = sprintf("DELETE FROM %s WHERE `%s` IN (%s)", self::TABLE_NAME, self::DB_FIELDS_NUM, implode(",", $fieldNumbers));
$conn = new DMLFunctions();
$result = $conn->executeQuery($sql);
if ($result) {
$count = mysql_affected_rows();
}
}
return $count;
}
示例9: getJobApplicationEvent
/**
* Get job application Event with given id
*
* @param int $id Job Application Event ID
* @return JobApplicationEvent JobApplicationEvent object
*/
public static function getJobApplicationEvent($id)
{
if (!CommonFunctions::isValidId($id)) {
throw new JobApplicationEventException("Invalid id", JobApplicationEventException::INVALID_PARAMETER);
}
$conditions[] = self::DB_FIELD_ID . ' = ' . $id;
$list = self::_getList($conditions);
$application = count($list) == 1 ? $list[0] : null;
return $application;
}
示例10: validateCode
/**
* Validate the code
*
* @param mixed $code Code
* @return boolean true if code valid, false otherwise
*/
protected function validateCode($code)
{
return CommonFunctions::isValidId($code, 'JOB');
}
示例11: getJobSpec
/**
* Get job spec with given ID
* @param int $id The job spec ID
* @return JobSpec Job Spec object with given id or null if not found
*/
public static function getJobSpec($id)
{
if (!CommonFunctions::isValidId($id)) {
throw new JobSpecException("Invalid parameters to getJobSpec(): id = {$id}", JobSpecException::INVALID_PARAMETER);
}
$selectCondition[] = self::DB_FIELD_ID . " = {$id}";
$actList = self::_getList($selectCondition);
$obj = count($actList) == 0 ? null : $actList[0];
return $obj;
}
示例12: _validateParams
/**
* Validates that the member variables are valid
*
* @throws EmpHistoryException if not valid
*/
private function _validateParams()
{
if (!CommonFunctions::isValidId($this->empNumber)) {
throw new EmpHistoryException("Invalid emp number", EmpHistoryException::INVALID_PARAMETER);
}
if (!$this->validateCode($this->code)) {
throw new EmpHistoryException("Code invalid", EmpHistoryException::INVALID_PARAMETER);
}
if (!empty($this->id) && !CommonFunctions::isValidId($this->empNumber)) {
throw new EmpHistoryException("Invalid ID", EmpHistoryException::INVALID_PARAMETER);
}
if (empty($this->startDate)) {
throw new EmpHistoryException("Missing start date", EmpHistoryException::INVALID_PARAMETER);
} else {
$start = strtotime($this->startDate);
if (!empty($this->endDate)) {
$end = strtotime($this->endDate);
if ($end < $start) {
throw new EmpHistoryException("Missing start date", EmpHistoryException::END_BEFORE_START);
}
}
}
}
示例13: getPayPeriod
public static function getPayPeriod($id)
{
if (!CommonFunctions::isValidId($id)) {
throw new HspException("Invalid id", HspException::INVALID_ID);
}
$sqlBuilder = new SQLQBuilder();
$selectTable = "`" . self::PAY_PERIOD_DB_TABLE . "`";
$selectFields[] = "`" . self::PAY_PERIOD_DB_FIELD_ID . "`";
$selectFields[] = "`" . self::PAY_PERIOD_DB_FIELD_START_DATE . "`";
$selectFields[] = "`" . self::PAY_PERIOD_DB_FIELD_END_DATE . "`";
$selectFields[] = "`" . self::PAY_PERIOD_DB_FIELD_CLOSE_DATE . "`";
$selectFields[] = "`" . self::PAY_PERIOD_DB_FIELD_CHECK_DATE . "`";
$selectFields[] = "`" . self::PAY_PERIOD_DB_FIELD_TIMESHEET_APROVAL_DUE_DATE . "`";
$selectConditions[] = "`" . self::PAY_PERIOD_DB_FIELD_ID . "` = {$id}";
$selectOrder = "ASC";
$selectOrderBy = "`" . self::PAY_PERIOD_DB_FIELD_CHECK_DATE . "`";
$query = $sqlBuilder->simpleSelect($selectTable, $selectFields, $selectConditions, $selectOrderBy, $selectOrder);
$dbConnection = new DMLFunctions();
$result = $dbConnection->executeQuery($query);
$numResults = mysql_num_rows($result);
if ($numResults == 1) {
$objs = self::_buildObjArr($result);
return $objs[0];
} else {
if ($numResults == 0) {
throw new HspPayPeriodException("Invalid number of results returned.", HspPayPeriodException::HSP_NOT_FOUND);
} else {
throw new HspPayPeriodException("Invalid number of results returned.", HspPayPeriodException::INVALID_ROW_COUNT);
}
}
}
示例14: _update
private function _update()
{
if (!CommonFunctions::isValidId($this->id)) {
throw new HspPaymentRequest("Invalid id", HspPaymentRequest::INVALID_ID);
}
$arrTable = '`' . self::HSP_PAYMENT_REQUEST_DB_TABLE . '`';
if ($this->dateIncurred != null) {
$updateFields[] = '`' . self::DB_FIELD_DATE_INCURRED . '`';
$arrRecordsList[] = "'" . $this->dateIncurred . "'";
}
if ($this->providerName != null) {
$updateFields[] = '`' . self::DB_FIELD_PROVIDER_NAME . '`';
$arrRecordsList[] = "'" . $this->providerName . "'";
}
if ($this->personIncurringExpense != null) {
$updateFields[] = '`' . self::DB_FIELD_PERSON_INCURRING_EXPENSE . '`';
$arrRecordsList[] = "'" . $this->personIncurringExpense . "'";
}
if ($this->expenseDescription != null) {
$updateFields[] = '`' . self::DB_FIELD_EXPENSE_DESCRIPTION . '`';
$arrRecordsList[] = "'" . $this->expenseDescription . "'";
}
if ($this->expenseAmount != null) {
$updateFields[] = '`' . self::DB_FIELD_EXPENSE_AMOUNT . '`';
$arrRecordsList[] = "'" . $this->expenseAmount . "'";
}
if ($this->paymentMadeTo != null) {
$updateFields[] = '`' . self::DB_FIELD_PAYMENT_MADE_TO . '`';
$arrRecordsList[] = "'" . $this->paymentMadeTo . "'";
}
if ($this->thirdPartyAccountNumber != null) {
$updateFields[] = '`' . self::DB_FIELD_THIRD_PARTY_ACCOUNT_NUMBER . '`';
$arrRecordsList[] = "'" . $this->thirdPartyAccountNumber . "'";
}
if ($this->mailAddress != null) {
$updateFields[] = '`' . self::DB_FIELD_MAIL_ADDRESS . '`';
$arrRecordsList[] = "'" . $this->mailAddress . "'";
}
if ($this->comments != null) {
$updateFields[] = '`' . self::DB_FIELD_COMMENTS . '`';
$arrRecordsList[] = "'" . $this->comments . "'";
}
if ($this->status != null) {
$updateFields[] = '`' . self::DB_FIELD_STATUS . '`';
$arrRecordsList[] = "'" . $this->status . "'";
}
if ($this->datePaid != null) {
$updateFields[] = '`' . self::DB_FIELD_DATE_PAID . '`';
$arrRecordsList[] = "'" . $this->datePaid . "'";
}
if ($this->checkNumber != null) {
$updateFields[] = '`' . self::DB_FIELD_CHECK_NUMBER . '`';
$arrRecordsList[] = "'" . $this->checkNumber . "'";
}
if ($this->hrNotes != null) {
$updateFields[] = '`' . self::DB_FIELD_HR_NOTES . '`';
$arrRecordsList[] = "'" . $this->hrNotes . "'";
}
$updateConditions[0] = "`" . self::DB_FIELD_ID . "` = '" . $this->id . "'";
$sqlBuilder = new SQLQBuilder();
$query = $sqlBuilder->simpleUpdate($arrTable, $updateFields, $arrRecordsList, $updateConditions);
$dbConnection = new DMLFunctions();
$result = $dbConnection->executeQuery($query);
if ($result === false) {
throw new HspPaymentRequestException("Error in update", HspPaymentRequestException::ERROR_IN_DB_QUERY);
}
return mysql_affected_rows();
}
示例15: deleteExports
/**
* Delete custom exports with the given ids
*
* @param array $ids Array of export id's
* @return int the number of CustomExport's actually deleted
*/
public static function deleteExports($ids)
{
$count = 0;
if (!is_array($ids)) {
throw new CustomExportException("Invalid parameter to deleteExports(): ids should be an array", CustomExportException::INVALID_PARAMETERS);
}
foreach ($ids as $id) {
if (!CommonFunctions::isValidId($id)) {
throw new CustomExportException("Invalid parameter to deleteExports(): id = {$id}", CustomExportException::INVALID_PARAMETERS);
}
}
if (!empty($ids)) {
$sql = sprintf("DELETE FROM %s WHERE `%s` IN (%s)", self::TABLE_NAME, self::DB_FIELDS_ID, implode(",", $ids));
$conn = new DMLFunctions();
$result = $conn->executeQuery($sql);
if ($result) {
$count = mysql_affected_rows();
}
}
return $count;
}