本文整理汇总了PHP中UniqueIDGenerator类的典型用法代码示例。如果您正苦于以下问题:PHP UniqueIDGenerator类的具体用法?PHP UniqueIDGenerator怎么用?PHP UniqueIDGenerator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了UniqueIDGenerator类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: getInstance
/**
* Get the singleton instance of this class
*/
public static function getInstance()
{
if (!is_object(self::$instance)) {
self::$instance = new UniqueIDGenerator();
}
return self::$instance;
}
开发者ID:THM068,项目名称:orangehrm,代码行数:10,代码来源:UniqueIDGenerator.php
示例2: 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();
}
开发者ID:noikiy,项目名称:owaspbwa,代码行数:13,代码来源:WorkshiftTest.php
示例3: 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();
}
开发者ID:noikiy,项目名称:owaspbwa,代码行数:13,代码来源:SubDivisionHistoryTest.php
示例4: 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();
}
开发者ID:noikiy,项目名称:owaspbwa,代码行数:15,代码来源:DefineHspTest.php
示例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->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();
}
开发者ID:noikiy,项目名称:owaspbwa,代码行数:17,代码来源:HolidaysTest.php
示例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->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();
}
开发者ID:noikiy,项目名称:owaspbwa,代码行数:18,代码来源:LeaveTypeTest.php
示例7: 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)");
}
开发者ID:googlecode-mirror,项目名称:pucit-orangehrm,代码行数:24,代码来源:HolidaysTest.php
示例8: 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;
}
开发者ID:rabbitdigital,项目名称:HRM,代码行数:22,代码来源:ApplicationSetupUtility.php
示例9: _createJobSpecs
/**
* Saves the given JobSpec objects in the databas
*
* @param array $specs Array of JobSpec objects to save.
*/
private function _createJobSpecs($specs)
{
foreach ($specs as $spec) {
$sql = sprintf("INSERT INTO hs_hr_job_spec(jobspec_id, jobspec_name, jobspec_desc, jobspec_duties) " . "VALUES(%d, '%s', '%s', '%s')", $spec->getId(), $spec->getName(), $spec->getDesc(), $spec->getDuties());
$this->assertTrue(mysql_query($sql), mysql_error());
}
UniqueIDGenerator::getInstance()->initTable();
}
开发者ID:googlecode-mirror,项目名称:pucit-orangehrm,代码行数:13,代码来源:JobSpecTest.php
示例10: _insert
/**
* Add new CustomExport object to database
*/
private function _insert()
{
$fields[0] = self::DB_FIELDS_ID;
$fields[1] = self::DB_FIELDS_NAME;
$fields[2] = self::DB_FIELDS_FIELDS;
$fields[3] = self::DB_FIELDS_HEADINGS;
$this->id = UniqueIDGenerator::getInstance()->getNextID(self::TABLE_NAME, self::DB_FIELDS_ID);
$values[0] = $this->id;
$values[1] = "'{$this->name}'";
$values[2] = "'" . implode(",", $this->assignedFields) . "'";
$values[3] = empty($this->headings) ? "''" : "'" . implode(",", $this->headings) . "'";
$sqlBuilder = new SQLQBuilder();
$sqlBuilder->table_name = self::TABLE_NAME;
$sqlBuilder->flg_insert = 'true';
$sqlBuilder->arr_insert = $values;
$sqlBuilder->arr_insertfield = $fields;
$sql = $sqlBuilder->addNewRecordFeature2();
$conn = new DMLFunctions();
$result = $conn->executeQuery($sql);
if (!$result || mysql_affected_rows() != 1) {
throw new CustomExportException("Insert failed. {$sql}", CustomExportException::DB_EXCEPTION);
}
}
开发者ID:googlecode-mirror,项目名称:pucit-orangehrm,代码行数:26,代码来源:CustomExport.php
示例11: 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;
}
开发者ID:googlecode-mirror,项目名称:pucit-orangehrm,代码行数:17,代码来源:LeaveType.php
示例12: define
<?php
define('ROOT_PATH', dirname(__FILE__) . '/..');
require_once ROOT_PATH . '/installer/utils/DMLFunctions.php';
require_once ROOT_PATH . '/installer/utils/UniqueIDGenerator.php';
echo "Running UniqueIDGenerator\n";
$conn = new DMLFunctions();
UniqueIDGenerator::getInstance()->initTable();
echo "Finished fixing ID's\n";
开发者ID:lahirwisada,项目名称:orangehrm,代码行数:9,代码来源:fix-ids.php
示例13: _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();
}
开发者ID:noikiy,项目名称:owaspbwa,代码行数:19,代码来源:RecruitmentAuthManagerTest.php
示例14: 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;
}
开发者ID:noikiy,项目名称:owaspbwa,代码行数:30,代码来源:JobTitle.php
示例15: addUserGroups
function addUserGroups()
{
$this->userGroupID = UniqueIDGenerator::getInstance()->getNextID($this->tableName, 'userg_id', 'USG');
$arrFieldList[0] = "'" . $this->getUserGroupID() . "'";
$arrFieldList[1] = "'" . $this->getUserGroupName() . "'";
$arrFieldList[2] = "'" . $this->getUserGroupRepDef() . "'";
$arrRecordsList[0] = 'userg_id';
$arrRecordsList[1] = 'userg_name';
$arrRecordsList[2] = 'userg_repdef';
$this->sql_builder->table_name = $this->tableName;
$this->sql_builder->flg_insert = 'true';
$this->sql_builder->arr_insertfield = $arrRecordsList;
$this->sql_builder->arr_insert = $arrFieldList;
$sqlQString = $this->sql_builder->addNewRecordFeature2();
$message2 = $this->dbConnection->executeQuery($sqlQString);
//Calling the addData() function
return $message2;
}
开发者ID:noikiy,项目名称:owaspbwa,代码行数:18,代码来源:UserGroups.php
示例16: tearDown
/**
* Tears down the fixture, removed database entries created during test.
*
* @access protected
*/
protected function tearDown()
{
$this->_deleteTables();
UniqueIDGenerator::getInstance()->resetIDs();
}
开发者ID:noikiy,项目名称:owaspbwa,代码行数:10,代码来源:LocationHistoryTest.php
示例17: 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;
}
}
开发者ID:noikiy,项目名称:owaspbwa,代码行数:29,代码来源:SalaryGrades.php
示例18: 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);
}
开发者ID:noikiy,项目名称:owaspbwa,代码行数:28,代码来源:HspPaymentRequestTest.php
示例19: _insert
/**
* Insert new object to database
*/
private function _insert()
{
$this->id = UniqueIDGenerator::getInstance()->getNextID(self::TABLE_NAME, self::DB_FIELD_ID);
if (empty($this->appliedDateTime)) {
$this->appliedDateTime = date(LocaleUtil::STANDARD_TIMESTAMP_FORMAT);
}
$sqlBuilder = new SQLQBuilder();
$sqlBuilder->table_name = self::TABLE_NAME;
$sqlBuilder->flg_insert = 'true';
$sqlBuilder->arr_insert = $this->_getFieldValuesAsArray();
$sqlBuilder->arr_insertfield = $this->dbFields;
$sql = $sqlBuilder->addNewRecordFeature2();
$conn = new DMLFunctions();
$result = $conn->executeQuery($sql);
if (!$result || mysql_affected_rows() != 1) {
throw new JobApplicationException("Insert failed. ", JobApplicationException::DB_ERROR);
}
return $this->id;
}
开发者ID:noikiy,项目名称:owaspbwa,代码行数:22,代码来源:JobApplication.php
示例20: addTimesheet
/**
* Add a new timesheet
*
* Status will be overwritten
*/
public function addTimesheet()
{
$newId = UniqueIDGenerator::getInstance()->getNextID(self::TIMESHEET_DB_TABLE_TIMESHEET, self::TIMESHEET_DB_FIELD_TIMESHEET_ID);
$this->setTimesheetId($newId);
if ($this->getStartDate() == '' || $this->getEndDate() == '') {
$this->_getNewDates();
}
$this->setStatus(self::TIMESHEET_STATUS_NOT_SUBMITTED);
$sql_builder = new SQLQBuilder();
$insertTable = self::TIMESHEET_DB_TABLE_TIMESHEET;
$insertFields[0] = "`" . self::TIMESHEET_DB_FIELD_TIMESHEET_ID . "`";
$insertFields[1] = "`" . self::TIMESHEET_DB_FIELD_EMPLOYEE_ID . "`";
$insertFields[2] = "`" . self::TIMESHEET_DB_FIELD_TIMESHEET_PERIOD_ID . "`";
$insertFields[3] = "`" . self::TIMESHEET_DB_FIELD_START_DATE . "`";
$insertFields[4] = "`" . self::TIMESHEET_DB_FIELD_END_DATE . "`";
$insertFields[5] = "`" . self::TIMESHEET_DB_FIELD_STATUS . "`";
$insertValues[0] = $this->getTimesheetId();
$insertValues[1] = $this->getEmployeeId();
$insertValues[2] = $this->getTimesheetPeriodId();
$insertValues[3] = "'" . $this->getStartDate() . "'";
$insertValues[4] = "'" . $this->getEndDate() . "'";
$insertValues[5] = $this->getStatus();
$insertValues = $sql_builder->quoteCorrect($insertValues);
$query = $sql_builder->simpleInsert($insertTable, $insertValues, $insertFields);
$dbConnection = new DMLFunctions();
$result = $dbConnection->executeQuery($query);
if ($result && mysql_affected_rows() > 0) {
return true;
}
return false;
}
开发者ID:noikiy,项目名称:owaspbwa,代码行数:36,代码来源:Timesheet.php
注:本文中的UniqueIDGenerator类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论