本文整理汇总了PHP中Misc::generateCopyName方法的典型用法代码示例。如果您正苦于以下问题:PHP Misc::generateCopyName方法的具体用法?PHP Misc::generateCopyName怎么用?PHP Misc::generateCopyName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Misc
的用法示例。
在下文中一共展示了Misc::generateCopyName方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: copyUserPreference
/**
* Copy one or more UserPreferencees.
* @param array $data UserPreference IDs
* @return array
*/
function copyUserPreference($data)
{
if (is_numeric($data)) {
$data = array($data);
}
if (!is_array($data)) {
return $this->returnHandler(FALSE);
}
Debug::Text('Received data for: ' . count($data) . ' UserPreferences', __FILE__, __LINE__, __METHOD__, 10);
Debug::Arr($data, 'Data: ', __FILE__, __LINE__, __METHOD__, 10);
$src_rows = $this->stripReturnHandler($this->getUserPreference(array('filter_data' => array('id' => $data)), TRUE));
if (is_array($src_rows) and count($src_rows) > 0) {
Debug::Arr($src_rows, 'SRC Rows: ', __FILE__, __LINE__, __METHOD__, 10);
foreach ($src_rows as $key => $row) {
unset($src_rows[$key]['id'], $src_rows[$key]['manual_id']);
//Clear fields that can't be copied
$src_rows[$key]['name'] = Misc::generateCopyName($row['name']);
//Generate unique name
}
//Debug::Arr($src_rows, 'bSRC Rows: ', __FILE__, __LINE__, __METHOD__, 10);
return $this->setUserPreference($src_rows);
//Save copied rows
}
return $this->returnHandler(FALSE);
}
示例2: copyRecurringScheduleTemplateControl
/**
* Copy one or more recurring_schedule_template_controles.
* @param array $data recurring_schedule_template_control IDs
* @return array
*/
function copyRecurringScheduleTemplateControl($data)
{
if (is_numeric($data)) {
$data = array($data);
}
if (!is_array($data)) {
return $this->returnHandler(FALSE);
}
Debug::Text('Received data for: ' . count($data) . ' RecurringScheduleTemplateControls', __FILE__, __LINE__, __METHOD__, 10);
Debug::Arr($data, 'Data: ', __FILE__, __LINE__, __METHOD__, 10);
$src_rows = $this->stripReturnHandler($this->getRecurringScheduleTemplateControl(array('filter_data' => array('id' => $data)), TRUE));
if (is_array($src_rows) and count($src_rows) > 0) {
Debug::Arr($src_rows, 'SRC Rows: ', __FILE__, __LINE__, __METHOD__, 10);
foreach ($src_rows as $key => $row) {
unset($src_rows[$key]['id']);
//Clear fields that can't be copied
$src_rows[$key]['name'] = Misc::generateCopyName($row['name']);
//Generate unique name
}
//Debug::Arr($src_rows, 'bSRC Rows: ', __FILE__, __LINE__, __METHOD__, 10);
$recurring_schedule_template_control_id = $this->setRecurringScheduleTemplateControl($src_rows);
//Save copied rows
Debug::Text('New Recurring Schedule Template Control ID: ' . $recurring_schedule_template_control_id, __FILE__, __LINE__, __METHOD__, 10);
$rstlf = TTnew('APIRecurringScheduleTemplate');
$template_src_rows = $rstlf->getRecurringScheduleTemplate(array('filter_data' => array('recurring_schedule_template_control_id' => $data)), TRUE);
if (is_array($template_src_rows) and count($template_src_rows) > 0) {
//Debug::Arr($template_src_rows, 'TEMPLATE SRC Rows: ', __FILE__, __LINE__, __METHOD__, 10);
foreach ($template_src_rows as $key => $row) {
unset($template_src_rows[$key]['id']);
//Clear fields that can't be copied
$template_src_rows[$key]['recurring_schedule_template_control_id'] = $recurring_schedule_template_control_id;
}
$rstlf->setRecurringScheduleTemplate($template_src_rows);
//Save copied rows
}
return $this->returnHandler($recurring_schedule_template_control_id);
}
return $this->returnHandler(FALSE);
}
示例3: switch
}
Debug::Arr($ids, 'Selected Objects', __FILE__, __LINE__, __METHOD__, 10);
$action = Misc::findSubmitButton();
switch ($action) {
case 'add':
Redirect::Page(URLBuilder::getURL(NULL, 'EditPermissionControl.php', FALSE));
break;
case 'copy':
$pclf = new PermissionControlListFactory();
$pclf->StartTransaction();
foreach ($ids as $id) {
$pclf->getByIdAndCompanyId($id, $current_company->getId());
foreach ($pclf as $pc_obj) {
$permission_arr = $pc_obj->getPermission();
$pc_obj->setId(FALSE);
$pc_obj->setName(Misc::generateCopyName($pc_obj->getName()));
if ($pc_obj->isValid()) {
$pc_obj->Save(FALSE);
$pc_obj->setPermission($permission_arr);
}
unset($pc_obj, $permission_arr);
}
}
$pclf->CommitTransaction();
Redirect::Page(URLBuilder::getURL(NULL, 'PermissionControlList.php'));
break;
case 'delete':
case 'undelete':
if (strtolower($action) == 'delete') {
$delete = TRUE;
} else {
示例4: copyAccrualPolicy
/**
* Copy one or more accrual_policyes.
* @param array $data accrual_policy IDs
* @return array
*/
function copyAccrualPolicy($data)
{
if (is_numeric($data)) {
$data = array($data);
}
if (!is_array($data)) {
return $this->returnHandler(FALSE);
}
Debug::Text('Received data for: ' . count($data) . ' AccrualPolicys', __FILE__, __LINE__, __METHOD__, 10);
Debug::Arr($data, 'Data: ', __FILE__, __LINE__, __METHOD__, 10);
$src_rows = $this->stripReturnHandler($this->getAccrualPolicy(array('filter_data' => array('id' => $data)), TRUE));
if (is_array($src_rows) and count($src_rows) > 0) {
Debug::Arr($src_rows, 'SRC Rows: ', __FILE__, __LINE__, __METHOD__, 10);
foreach ($src_rows as $key => $row) {
$original_ids[$key] = $src_rows[$key]['id'];
unset($src_rows[$key]['id'], $src_rows[$key]['manual_id']);
//Clear fields that can't be copied
$src_rows[$key]['name'] = Misc::generateCopyName($row['name']);
//Generate unique name
}
//Debug::Arr($src_rows, 'bSRC Rows: ', __FILE__, __LINE__, __METHOD__, 10);
$retval = $this->setAccrualPolicy($src_rows);
//Save copied rows
//Now we need to loop through the result set, and copy the milestones as well.
if (isset($original_ids)) {
Debug::Arr($original_ids, ' Original IDs: ', __FILE__, __LINE__, __METHOD__, 10);
foreach ($original_ids as $key => $original_id) {
$new_id = NULL;
if (is_array($retval)) {
if (isset($retval['api_details']['details'][$key])) {
$new_id = $retval['api_details']['details'][$key];
}
} elseif (is_numeric($retval)) {
$new_id = $retval;
}
if ($new_id !== NULL) {
//Get milestones by original_id.
$apmlf = TTnew('AccrualPolicyMilestoneListFactory');
$apmlf->getByAccrualPolicyID($original_id);
if ($apmlf->getRecordCount() > 0) {
foreach ($apmlf as $apm_obj) {
Debug::Text('Copying Milestone ID: ' . $apm_obj->getID() . ' To Accrual Policy: ' . $new_id, __FILE__, __LINE__, __METHOD__, 10);
//Copy milestone to new_id
$apm_obj->setId(FALSE);
$apm_obj->setAccrualPolicy($new_id);
if ($apm_obj->isValid()) {
$apm_obj->Save();
}
}
}
}
}
}
return $retval;
}
return $this->returnHandler(FALSE);
}
示例5: copyCompany
/**
* Copy one or more companyes.
* @param array $data company data
* @return array
*/
function copyCompany($data)
{
$src_rows = $this->stripReturnHandler($this->getCompany($data, TRUE));
if (is_array($src_rows) and count($src_rows) > 0) {
Debug::Arr($src_rows, 'SRC Rows: ', __FILE__, __LINE__, __METHOD__, 10);
foreach ($src_rows as $key => $row) {
unset($src_rows[$key]['id']);
//Clear fields that can't be copied
$src_rows[$key]['name'] = Misc::generateCopyName($row['name']);
//Generate unique name
$src_rows[$key]['short_name'] = rand(1000, 9999);
}
Debug::Arr($src_rows, 'bSRC Rows: ', __FILE__, __LINE__, __METHOD__, 10);
return $this->setCompany($src_rows);
//Save copied rows
}
return $this->returnHandler(FALSE);
}
示例6: TTnew
$cd_obj->setDeleted($delete);
if ($cd_obj->isValid()) {
$cd_obj->Save();
}
}
}
Redirect::Page(URLBuilder::getURL(NULL, 'CompanyDeductionList.php'));
break;
case 'copy':
$cdlf = TTnew('CompanyDeductionListFactory');
foreach ($ids as $id) {
$cdlf->getByCompanyIdAndId($current_company->getId(), $id);
foreach ($cdlf as $cd_obj) {
$tmp_cd_obj = clone $cd_obj;
$tmp_cd_obj->setId(FALSE);
$tmp_cd_obj->setName(Misc::generateCopyName($cd_obj->getName()));
if ($tmp_cd_obj->isValid()) {
$tmp_cd_obj->Save(FALSE);
$tmp_cd_obj->setIncludePayStubEntryAccount($cd_obj->getIncludePayStubEntryAccount());
$tmp_cd_obj->setExcludePayStubEntryAccount($cd_obj->getExcludePayStubEntryAccount());
$tmp_cd_obj->setUser($cd_obj->getUser());
if ($tmp_cd_obj->isValid()) {
$tmp_cd_obj->Save();
}
}
}
}
unset($tmp_cd_obj, $cd_obj);
Redirect::Page(URLBuilder::getURL(NULL, 'CompanyDeductionList.php'));
break;
default: