本文整理汇总了PHP中UniqueIDGenerator::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP UniqueIDGenerator::getInstance方法的具体用法?PHP UniqueIDGenerator::getInstance怎么用?PHP UniqueIDGenerator::getInstance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UniqueIDGenerator
的用法示例。
在下文中一共展示了UniqueIDGenerator::getInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: tearDown
/**
* Tears down the fixture, for example, close a network connection.
* This method is called after a test is executed.
*
* @access protected
*/
protected function tearDown()
{
$this->assertTrue(mysql_query("TRUNCATE TABLE `hs_hr_employee_workshift`", $this->connection));
$this->assertTrue(mysql_query("TRUNCATE TABLE `hs_hr_workshift`", $this->connection));
$this->assertTrue(mysql_query("TRUNCATE TABLE `hs_hr_employee`", $this->connection));
UniqueIDGenerator::getInstance()->resetIDs();
}
示例2: tearDown
/**
* Tears down the fixture, removed database entries created during test.
*
* @access protected
*/
protected function tearDown()
{
$this->_deleteTables();
// Insert default geninfo, and compstructtree values
$this->_runQuery("INSERT INTO `hs_hr_geninfo` VALUES ('001','','')");
$this->_runQuery("INSERT INTO `hs_hr_compstructtree`(`title`, `description`, `loc_code`, `lft`, `rgt`, `id`, `parnt`, `dept_id`) VALUES ('', 'Parent Company', null , 1, 2, 1, 0, null)");
UniqueIDGenerator::getInstance()->resetIDs();
}
示例3: tearDown
/**
* Tears down the fixture, for example, closes a network connection.
* This method is called after a test is executed.
*
* @access protected
*/
protected function tearDown()
{
$this->assertTrue(mysql_query("TRUNCATE `hs_hr_config`;", $this->connection), mysql_error());
foreach ($this->oldValues as $row) {
$query = "INSERT INTO `hs_hr_config` VALUES ('" . implode("', '", $row) . "')";
$this->assertTrue(mysql_query($query));
}
UniqueIDGenerator::getInstance()->resetIDs();
}
示例4: setUp
/**
* Sets up the fixture, for example, open a network connection.
* This method is called before a test is executed.
*
* @access protected
*/
protected function setUp()
{
$this->classHoliday = new Holidays();
$conf = new Conf();
$this->connection = mysql_connect($conf->dbhost . ":" . $conf->dbport, $conf->dbuser, $conf->dbpass);
mysql_select_db($conf->dbname);
mysql_query("TRUNCATE TABLE `hs_hr_holidays`", $this->connection);
mysql_query("INSERT INTO `hs_hr_holidays` (`holiday_id`, `description`, `date`, `recurring`, `length`) VALUES (10, 'Independence', '" . date('Y') . "-07-04', " . Holidays::HOLIDAYS_RECURRING . ", 8)");
mysql_query("INSERT INTO `hs_hr_holidays` (`holiday_id`, `description`, `date`, `recurring`, `length`) VALUES (11, 'Poya', '" . date('Y') . "-01-04', " . Holidays::HOLIDAYS_NOT_RECURRING . ", 4)");
UniqueIDGenerator::getInstance()->initTable();
}
示例5: setUp
/**
* Sets up the fixture, for example, open a network connection.
* This method is called before a test is executed.
*
* @access protected
*/
protected function setUp()
{
$this->classLeaveType = new LeaveType();
$conf = new Conf();
$this->connection = mysql_connect($conf->dbhost . ":" . $conf->dbport, $conf->dbuser, $conf->dbpass);
mysql_select_db($conf->dbname);
mysql_query("TRUNCATE TABLE `hs_hr_leavetype`");
mysql_query("INSERT INTO `hs_hr_leavetype` VALUES ('LTY011', 'Medical', 1)");
mysql_query("INSERT INTO `hs_hr_leavetype` VALUES ('LTY012', 'Medicals', 1)");
mysql_query("INSERT INTO `hs_hr_leavetype` VALUES ('LTY013', 'Medicalx', 1)");
UniqueIDGenerator::getInstance()->initTable();
}
示例6: setUp
/**
* Sets up the fixture, for example, open a network connection.
* This method is called before a test is executed.
*
* @access protected
*/
protected function setUp()
{
$this->classHoliday = new Holidays();
$conf = new Conf();
$this->connection = mysql_connect($conf->dbhost . ":" . $conf->dbport, $conf->dbuser, $conf->dbpass);
mysql_select_db($conf->dbname);
mysql_query("TRUNCATE TABLE `hs_hr_holidays`", $this->connection);
mysql_query("INSERT INTO `hs_hr_holidays` (`holiday_id`, `description`, `date`, `recurring`, `length`) VALUES (10, 'Independence', '" . date('Y') . "-07-04', " . Holidays::HOLIDAYS_RECURRING . ", 8)");
mysql_query("INSERT INTO `hs_hr_holidays` (`holiday_id`, `description`, `date`, `recurring`, `length`) VALUES (11, 'Poya', '" . date('Y') . "-01-04', " . Holidays::HOLIDAYS_NOT_RECURRING . ", 4)");
UniqueIDGenerator::getInstance()->initTable();
mysql_query("INSERT INTO `hs_hr_employee`(emp_number, employee_id, emp_lastname, emp_firstname, emp_middle_name, emp_nick_name) " . "VALUES (18, NULL, 'Nadeeth', 'H', 'Lansakara', 'rc')");
mysql_query("INSERT INTO `hs_hr_leavetype` VALUES ('LTY010', 'Medical', 1)");
mysql_query("INSERT INTO `hs_hr_leave_requests` (`leave_request_id`, `leave_type_id`, `leave_type_name`, `date_applied`, `employee_id`) VALUES (11, 'LTY010', 'Medical', '" . date('Y-m-d', time() + 3600 * 24) . "', '18')");
mysql_query("INSERT INTO `hs_hr_leave` (`leave_id`, `employee_id`, `leave_type_id`, `leave_date`, `leave_length_hours`, `leave_length_days`, `leave_status`, `leave_comments`, `leave_request_id`) VALUES (10, '18', 'LTY010', '" . date('Y-m-d', time() - 3600 * 24 * 2) . "', 4, 0.5, 3, '', 11)");
mysql_query("INSERT INTO `hs_hr_leave` (`leave_id`, `employee_id`, `leave_type_id`, `leave_date`, `leave_length_hours`, `leave_length_days`, `leave_status`, `leave_comments`, `leave_request_id`) VALUES (11, '18', 'LTY010', '" . date('Y-m-d', time() - 3600 * 24 * 1) . "', 8, 1, 5, '', 11)");
mysql_query("INSERT INTO `hs_hr_leave` (`leave_id`, `employee_id`, `leave_type_id`, `leave_date`, `leave_length_hours`, `leave_length_days`, `leave_status`, `leave_comments`, `leave_request_id`) VALUES (12, '18', 'LTY010', '" . date('Y-m-d', time() + 3600 * 24 * 2) . "', 8, 1, 2, '', 11)");
mysql_query("INSERT INTO `hs_hr_leave` (`leave_id`, `employee_id`, `leave_type_id`, `leave_date`, `leave_length_hours`, `leave_length_days`, `leave_status`, `leave_comments`, `leave_request_id`) VALUES (13, '18', 'LTY010', '" . date('Y-m-d', time() + 3600 * 24 * 3) . "', 8, 1, 5, '', 11)");
}
示例7: initUniqueIDs
/**
* Initialize unique ID's
*/
public static function initUniqueIDs()
{
self::connectDB();
if (!mysql_select_db($_SESSION['dbInfo']['dbName'])) {
$_SESSION['error'] = 'Unable to connect to Database!';
error_log(date("r") . " Initializing unique id's. Error - Unable to connect to Database\n", 3, "installer/log.txt");
return false;
}
/* Initialize the hs_hr_unique_id table */
try {
UniqueIDGenerator::getInstance()->initTable();
} catch (IDGeneratorException $e) {
$errMsg = $e->getMessage() . ". Trace = " . $e->getTraceAsString();
$_SESSION['error'] = $errMsg;
error_log(date("r") . " Initializing hs_hr_unique_id table failed with: {$errMsg}\n", 3, "log.txt");
return false;
}
return true;
}
示例8: addLeaveType
/**
* Add the Leave Type
*
*/
public function addLeaveType()
{
$this->leaveTypeId = UniqueIDGenerator::getInstance()->getNextID('hs_hr_leavetype', 'leave_type_id', 'LTY');
$arrRecordsList[0] = "'" . $this->getLeaveTypeId() . "'";
$arrRecordsList[1] = "'" . $this->getLeaveTypeName() . "'";
$arrRecordsList[2] = $this->availableStatusFlag;
$sqlBuilder = new SQLQBuilder();
$arrTable = "`hs_hr_leavetype`";
$query = $sqlBuilder->simpleInsert($arrTable, $arrRecordsList);
$dbConnection = new DMLFunctions();
$result = $dbConnection->executeQuery($query);
return $result;
}
示例9: _createActivites
/**
* Saves the given Project Activity objects in the databas
*
* @param ProjectActivity $activities ProjectActivity objects to save.
*/
private function _createActivites($activities)
{
foreach ($activities as $activity) {
$sql = sprintf("INSERT INTO ohrm_project_activity(activity_id, project_id, name, is_deleted) " . "VALUES(%d, %d, '%s', %d)", $activity->getId(), $activity->getProjectId(), $activity->getName(), $activity->isDeleted() ? 1 : 0);
mysql_query($sql);
UniqueIDGenerator::getInstance()->initTable();
}
}
示例10: _insert
private function _insert()
{
$fields[0] = self::DB_FIELD_WORKSHIFT_ID;
$fields[1] = self::DB_FIELD_NAME;
$fields[2] = self::DB_FIELD_HOURS;
$this->workshiftId = UniqueIDGenerator::getInstance()->getNextID(self::WORKSHIFT_TABLE, self::DB_FIELD_WORKSHIFT_ID);
$values[0] = $this->workshiftId;
$values[1] = "'{$this->name}'";
$values[2] = "'{$this->hoursPerDay}'";
$sqlBuilder = new SQLQBuilder();
$sqlBuilder->table_name = self::WORKSHIFT_TABLE;
$sqlBuilder->flg_insert = 'true';
$sqlBuilder->arr_insert = $values;
$sqlBuilder->arr_insertfield = $fields;
$sql = $sqlBuilder->addNewRecordFeature2();
$dbConnection = new DMLFunctions();
$result = $dbConnection->executeQuery($sql);
if (!$result) {
throw new WorkshiftException("Workshift not inserted", WorkshiftException::ERROR_IN_DB_QUERY);
}
if (mysql_affected_rows() != 1) {
throw new WorkshiftException("Workshift not inserted", WorkshiftException::INVALID_ROW_COUNT);
}
return mysql_affected_rows();
}
示例11: _createEvent
/**
* Create job application event with the passed parameters
*
* @param int $id
* @param int $applicationId
* @param String $createdTime
* @param String $createdBy
* @param int $ownerId
* @param String $eventTime
* @param int $eventType
* @param int $eventStatus
* @param String $notes
*/
private function _createEvent($id, $applicationId, $createdTime, $createdBy, $ownerId, $eventTime, $eventType, $eventStatus, $notes)
{
$sql = sprintf("INSERT INTO `hs_hr_job_application_events`(`id`,`application_id`,`created_time`," . "`created_by`, `owner`, `event_time`, `event_type`, `status`, `notes`) " . "VALUES (%d, %d, '%s', '%s', %d, '%s', %d, %d, '%s')", $id, $applicationId, $createdTime, $createdBy, $ownerId, $eventTime, $eventType, $eventStatus, $notes);
$this->assertTrue(mysql_query($sql), mysql_error());
UniqueIDGenerator::getInstance()->initTable();
}
示例12: addJobTitles
function addJobTitles()
{
$tableName = 'HS_HR_JOB_TITLE';
$this->jobId = UniqueIDGenerator::getInstance()->getNextID($tableName, 'JOBTIT_CODE', 'JOB');
$arrRecordsList[0] = "'" . $this->getJobId() . "'";
$arrRecordsList[1] = "'" . $this->getJobName() . "'";
$arrRecordsList[2] = "'" . $this->getJobDesc() . "'";
$arrRecordsList[3] = "'" . $this->getJobComm() . "'";
$arrRecordsList[4] = "'" . $this->getJobSalGrd() . "'";
$arrRecordsList[5] = isset($this->jobSpecId) ? $this->jobSpecId : 'null';
$arrFieldList[0] = 'JOBTIT_CODE';
$arrFieldList[1] = 'JOBTIT_NAME';
$arrFieldList[2] = 'JOBTIT_DESC';
$arrFieldList[3] = 'JOBTIT_COMM';
$arrFieldList[4] = 'SAL_GRD_CODE';
$arrFieldList[5] = self::DB_FIELD_JOBSPEC_ID;
$sql_builder = new SQLQBuilder();
$sql_builder->table_name = $tableName;
$sql_builder->flg_insert = 'true';
$sql_builder->arr_insert = $arrRecordsList;
$sql_builder->arr_insertfield = $arrFieldList;
$sqlQString = $sql_builder->addNewRecordFeature2();
$dbConnection = new DMLFunctions();
$message2 = $dbConnection->executeQuery($sqlQString);
$jobTitleEmpStat = new JobTitEmpStat();
$jobTitleEmpStat->setEmpStatId(EmploymentStatus::EMPLOYMENT_STATUS_ID_TERMINATED);
$jobTitleEmpStat->setJobTitId($this->getJobId());
$jobTitleEmpStat->addJobTitEmpStat();
return $message2;
}
示例13: _createJobApplications
/**
* Saves the given JobApplication objects in the database
*
* @param array $applications Array of JobApplication objects to save.
*/
private function _createJobApplications($applications)
{
foreach ($applications as $application) {
$sql = sprintf("INSERT INTO hs_hr_job_application(application_id, vacancy_id, firstname, middlename, " . "lastname, street1, street2, city, country_code, province, zip, " . "phone, mobile, email, qualifications) " . "VALUES(%d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s')", $application->getId(), $application->getVacancyId(), $application->getFirstName(), $application->getMiddleName(), $application->getLastName(), $application->getStreet1(), $application->getStreet2(), $application->getCity(), $application->getCountry(), $application->getProvince(), $application->getZip(), $application->getPhone(), $application->getMobile(), $application->getEmail(), $application->getQualifications());
$this->assertTrue(mysql_query($sql), mysql_error());
}
UniqueIDGenerator::getInstance()->initTable();
}
示例14: addSalaryGrades
function addSalaryGrades()
{
$tableName = 'HS_PR_SALARY_GRADE';
$this->salgrdId = UniqueIDGenerator::getInstance()->getNextID($tableName, 'SAL_GRD_CODE', 'SAL');
$arrFieldList[0] = "'" . $this->getSalGrdId() . "'";
$arrFieldList[1] = "'" . $this->getSalGrdDesc() . "'";
$sql_builder = new SQLQBuilder();
$sql_builder->table_name = $tableName;
$sql_builder->flg_insert = 'true';
$sql_builder->arr_insert = $arrFieldList;
$sqlQString = $sql_builder->addNewRecordFeature1();
$dbConnection = new DMLFunctions();
$message = $dbConnection->executeQuery($sqlQString);
//Calling the addData() function
if ($message) {
return $message;
} else {
$errCode = mysql_errno();
switch ($errCode) {
case 1062:
$e = new SalaryGradesException('Pay Grades cannot have duplicate names', SalaryGradesException::DUPLICATE_SALARY_GRADE);
break;
default:
$e = new SalaryGradesException('Unknown error in when adding Pay Grades', SalaryGradesException::UNKNOWN_EXCEPTION);
break;
}
throw $e;
}
}
示例15: testListUnPaidHspRequests
public function testListUnPaidHspRequests()
{
$expected[] = array(11, 10, 11, date('Y-m-d', time() - 3600 * 24), 'Test provider 1', 'Tester 1', 'Just testing 1', '100', 'TestX 1', '12345GD', '1231, Test Grove, Test City 1', 'Test 1', null, null, 0);
$paymentRequests = HspPaymentRequest::listUnPaidHspRequests();
$this->assertNotNull($paymentRequests);
for ($i = 0; $i < count($paymentRequests); $i++) {
$this->assertNotNull($paymentRequests[$i]);
$this->assertEquals($expected[$i][0], $paymentRequests[$i]->getId());
$this->assertEquals($expected[$i][1], $paymentRequests[$i]->getHspId());
$this->assertEquals($expected[$i][2], $paymentRequests[$i]->getEmployeeId());
$this->assertEquals($expected[$i][3], $paymentRequests[$i]->getDateIncurred());
$this->assertEquals($expected[$i][4], $paymentRequests[$i]->getProviderName());
$this->assertEquals($expected[$i][5], $paymentRequests[$i]->getPersonIncurringExpense());
$this->assertEquals($expected[$i][6], $paymentRequests[$i]->getExpenseDescription());
$this->assertEquals($expected[$i][7], $paymentRequests[$i]->getExpenseAmount());
$this->assertEquals($expected[$i][8], $paymentRequests[$i]->getPaymentMadeTo());
$this->assertEquals($expected[$i][9], $paymentRequests[$i]->getThirdPartyAccountNumber());
$this->assertEquals($expected[$i][10], $paymentRequests[$i]->getMailAddress());
$this->assertEquals($expected[$i][11], $paymentRequests[$i]->getComments());
$this->assertEquals($expected[$i][12], $paymentRequests[$i]->getDatePaid());
$this->assertEquals($expected[$i][13], $paymentRequests[$i]->getCheckNumber());
$this->assertEquals($expected[$i][14], $paymentRequests[$i]->getStatus());
}
$this->assertTrue(mysql_query("DELETE FROM `hs_hr_hsp_payment_request` WHERE `id` IN (11);", $this->connection), mysql_error());
UniqueIDGenerator::getInstance()->resetIDs();
$paymentRequests = HspPaymentRequest::listUnPaidHspRequests();
$this->assertNull($paymentRequests);
}