gpt4 book ai didi

php - 如何在orangehrm中添加自定义输入字段(添加空缺部分)

转载 作者:行者123 更新时间:2023-12-02 21:20:55 25 4
gpt4 key购买 nike

我需要在 Orangehrm 的添加空缺部分中添加自定义归档文本框(技能)。

我正在尝试以下代码。它显示表单中提交的文本,但不添加到数据库中。

orangehrm-3.1\symfony\plugins\orangehrmRecruitmentPlugin\modules\recruitment\templates\addJobVacancySuccess.php

代码:-

<?php
use_stylesheet(plugin_web_path('orangehrmRecruitmentPlugin', 'css/addJobVacancySuccess'));
use_javascript(plugin_web_path('orangehrmRecruitmentPlugin', 'js/addJobVacancySuccess'));
?>

<div class="box" id="addJobVacancy">

<div class="head">
<h1><?php echo isset($vacancyId) ? __('Edit Job Vacancy') : __('Add Job Vacancy'); ?></h1>
</div>

<div class="inner">
<?php include_partial('global/flash_messages'); ?>
<form name="frmAddJobVacancy" id="frmAddJobVacancy" method="post">

<?php echo $form['_csrf_token']; ?>
<?php echo $form["hiringManagerId"]->render();

?>
<fieldset>
<ol>

<li>
<?php echo $form['jobTitle']->renderLabel(__('Job Title') . ' <em>*</em>'); ?>
<?php echo $form['jobTitle']->render(array("maxlength" => 50)); ?>
</li>
<li>
<?php echo $form['name']->renderLabel(__('Vacancy Name') . ' <em>*</em>'); ?>
<?php echo $form['name']->render(array("maxlength" => 50)); ?>
</li>
<li>
<?php echo $form['hiringManager']->renderLabel(__('Hiring Manager') . ' <em>*</em>'); ?>
<?php echo $form['hiringManager']->render(array("maxlength" => 100)); ?>
</li>
<li>
<?php echo $form['noOfPositions']->renderLabel(__('Number of Positions')); ?>
<?php echo $form['noOfPositions']->render(array("maxlength" => 2)); ?>
</li>
<li class="largeTextBox">
<?php echo $form['description']->renderLabel(__('Description')); ?>
<?php echo $form['description']->render(array("cols" => 30, "rows" => 9)); ?>
</li>
<li>

<?php echo $form['skill']->renderLabel(__('Vacancy Skills') . ' <em>*</em>'); ?>
<?php echo $form['skill']->render(array("maxlength" => 50)); ?>
</li>

<li>
<?php echo $form['status']->renderLabel(__('Active')); ?>
<?php echo $form['status']->render(); ?>
</li>

<li class="labelRight">
<?php echo $form['publishedInFeed']->render(); ?>
<?php echo $form['publishedInFeed']->renderLabel(__('Publish in RSS feed(1) and web page(2)')); ?>
</li>

<?php include_component('core', 'ohrmPluginPannel', array('location' => 'add_layout_before_navigation_bar_1')) ?>

<li class="required">
<em>*</em> <?php echo __(CommonMessages::REQUIRED_FIELD); ?>
</li>
<li class="helpText">
1 : <?php echo __('RSS Feed URL') ?> : <?php echo link_to(null, 'recruitmentApply/jobs.rss', array('absolute' => true, 'target' => '_new')); ?>
</li>
<li class="helpText">
2 : <?php echo __('Web Page URL') ?> : <?php echo link_to(null, 'recruitmentApply/jobs.html', array('absolute' => true, 'target' => '_new')); ?>
</li>

</ol>
<p>
<?php if (isset($vacancyId)) { ?>
<input type="button" class="savebutton" name="btnSave" id="btnSave" value="<?php echo __("Edit"); ?>"/>
<input type="button" class="backbutton" name="btnBack" id="btnBack" value="<?php echo __("Back"); ?>"/>
<?php } else { ?>
<input type="button" class="savebutton" name="btnSave" id="btnSave"value="<?php echo __("Save"); ?>"/>
<?php } ?>
</p>
</fieldset>
</form>
</div>
<?php
if (isset($vacancyId)) {
echo include_component('recruitment', 'attachments', array('id' => $vacancyId, 'screen' => JobVacancy::TYPE));
}
?>
</div>

<script type="text/javascript">
//<![CDATA[
var hiringManagers = <?php echo str_replace('&#039;', "'", $form->getHiringManagerListAsJson()) ?> ;
var hiringManagersArray = eval(hiringManagers);
var lang_typeForHints = '<?php echo __("Type for hints") . "..."; ?>';
var lang_negativeAmount = "<?php echo __("Should be a positive number"); ?>";
var lang_tooLargeAmount = "<?php echo __("Should be less than %amount%", array("%amount%" => '99')); ?>";
var lang_jobTitleRequired = '<?php echo __(ValidationMessages::REQUIRED); ?>';
var lang_vacancyNameRequired = '<?php echo __(ValidationMessages::REQUIRED); ?>';
var lang_enterAValidEmployeeName = "<?php echo __(ValidationMessages::INVALID); ?>";
var lang_nameExistmsg = "<?php echo __("Already exists"); ?>";
var vacancyNames = <?php echo $form->getVacancyList(); ?>;
var vacancyNameList = eval(vacancyNames);
var lang_edit = "<?php echo __("Edit"); ?>";
var lang_save = "<?php echo __("Save"); ?>";
var lang_cancel = "<?php echo __("Cancel"); ?>";
var lang_back = "<?php echo __("Back"); ?>";
var linkForAddJobVacancy = "<?php echo url_for('recruitment/addJobVacancy'); ?>";
var lang_descriptionLength = "<?php echo __(ValidationMessages::TEXT_LENGTH_EXCEEDS, array('%amount%' => 40000)) ?>";
var backBtnUrl = '<?php echo url_for('recruitment/viewJobVacancy?'); ?>';
var backCancelUrl = '<?php echo url_for('recruitment/addJobVacancy?'); ?>';
<?php if (isset($vacancyId)) { ?>
var vacancyId = '<?php echo $vacancyId; ?>';
<?php } else { ?>
var vacancyId = "";
<?php } ?>
//]]>
</script>

最佳答案

试试这个..

1)您需要在表中创建字段名(技能)。

2)将以下行添加到orangehrm-3.1\symfony\lib\model\doctrine\orangehrmRecruitmentPlugin\base\BaseJobVacancy.class.php

 Inside public function setTableDefinition(){}
$this->hasColumn('skill', 'string', 100, array(
'type' => 'string',
'length' => 100,
));

3)将以下行添加到orangehrm-3.1\symfony\plugins\orangehrmRecruitmentPlugin\modules\recruitment\templates\addJobVacancySuccess.php

Inside the form following lines

<li>
<?php echo $form['skill']->renderLabel(__('Vacancy Skills') . ' <em>*</em>'); ?>
<?php echo $form['skill']->render(array("maxlength" => 50)); ?>
</li>

4)添加以下行到orangehrm-3.1\symfony\plugins\orangehrmRecruitmentPlugin\lib\form\AddJobVacancyForm.php

Inside Widgetarray like following code

$this->setWidgets(array(
'jobTitle' => new sfWidgetFormSelect(array('choices' => $jobTitleList)),
'name' => new sfWidgetFormInputText(),
'hiringManager' => new sfWidgetFormInputText(),
......
.....
'skill' => new sfWidgetFormInputText(),
));

Inside setValidatorsarray like following code

$this->setValidators(array(
'jobTitle' => new sfValidatorString(array('required' => true)),
'name' => new sfValidatorString(array('required' => true)),
'hiringManager' => new sfValidatorString(array('required' => true)),
.....
.....
....
'skill' => new sfValidatorString(array('required' => true)),
));

Inside following code in if loop "if (isset($vacancy) && $vacancy != null) {}"

$this->setDefault('skill', $vacancy->getSkill());

Inside save() function add following following code

$jobVacancy->skill = $this->getValue('skill');

关于php - 如何在orangehrm中添加自定义输入字段(添加空缺部分),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27780354/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com