<commit_before><?php
/**
 * HUBzero CMS
 *
 * Copyright 2005-2011 Purdue University. All rights reserved.
 *
 * This file is part of: The HUBzero(R) Platform for Scientific Collaboration
 *
 * The HUBzero(R) Platform for Scientific Collaboration (HUBzero) is free
 * software: you can redistribute it and/or modify it under the terms of
 * the GNU Lesser General Public License as published by the Free Software
 * Foundation, either version 3 of the License, or (at your option) any
 * later version.
 *
 * HUBzero is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 * HUBzero is a registered trademark of Purdue University.
 *
 * @package   hubzero-cms
 * @copyright Copyright 2005-2011 Purdue University. All rights reserved.
 * @license   GNU General Public License, version 2 (GPLv2)
 */

// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die( 'Restricted access' );

	/* Post New Job / Edit Job Form */

	// load some classes
	$sitename = Config::get('sitename');

	$jobsHtml = new \Components\Jobs\Helpers\Html();

	$job = $this->job;
	$employer = $this->employer;
	$profile = $this->profile;
	$id = $this->jobid;

	$startdate = ($job->startdate && $job->startdate !='0000-00-00 00:00:00') ? Date::of($job->startdate)->toLocal('Y-m-d') : '';
	$closedate = ($job->closedate && $job->closedate !='0000-00-00 00:00:00') ? Date::of($job->closedate)->toLocal('Y-m-d') : '';

	$status = $this->task != 'addjob' ? $job->status : 4; // draft mode

	$hubzero_Geo = new \Hubzero\Geocode\Geocode();
	$countries = $hubzero_Geo->countries();
?>
<header id="content-header">
	<h2><?php echo $this->title; ?></h2>

	<div id="content-header-extra">
		<ul id="useroptions">
		<?php if ($this->emp) {  ?>
			<li><a class="icon-dashboard myjobs btn" href="<?php echo Route::url('index.php?option=' . $this->option . '&task=dashboard'); ?>"><?php echo Lang::txt('COM_JOBS_EMPLOYER_DASHBOARD'); ?></a></li>
			<li><a class="icon-list shortlist btn" href="<?php echo Route::url('index.php?option=' . $this->option . '&task=resumes&filterby=shortlisted'); ?>"><?php echo Lang::txt('COM_JOBS_SHORTLIST'); ?></a></li>
		<?php } else { ?>
			<li>
				<!-- <?php echo Lang::txt('COM_JOBS_NOTICE_YOU_ARE_ADMIN'); ?> -->
				<a class="icon-dashboard myjobs btn" href="<?php echo Route::url('index.php?option=' . $this->option . '&task=dashboard'); ?>"><?php echo Lang::txt('COM_JOBS_ADMIN_DASHBOARD'); ?></a>
			</li>
		<?php } ?>
		</ul>
	</div><!-- / #content-header-extra -->
</header><!-- / #content-header -->

<?php
	if ($this->getError()) { ?>
	<p class="error"><?php echo $this->getError(); ?></p>
	<?php }
		$html = '';

		$model = new \Components\Jobs\Models\Job($job);

		$job->title = trim(stripslashes($job->title));
		$job->description = $model->content('raw');
		$job->companyLocation = $id ? $job->companyLocation : $employer->companyLocation;
		$job->companyLocationCountry = $id ? $job->companyLocationCountry : $this->escape($hubzero_Geo->getcountry($profile->get('countryresident')));
		$job->companyName = $id ? $job->companyName : $employer->companyName;
		$job->companyWebsite = $id ? $job->companyWebsite : $employer->companyWebsite;
		$usonly = $this->config->get('usonly', 0);
?>
<section class="main section">
	<form id="hubForm" method="post" action="<?php echo Route::url('index.php?option=' . $this->option); ?>">
		<div class="explaination">
			<p><?php echo Lang::txt('COM_JOBS_EDITJOB_OVERVIEW_INFO'); ?></p>
		</div>
		<fieldset>
			<legend><?php echo Lang::txt('COM_JOBS_EDITJOB_JOB_OVERVIEW'); ?></legend>

			<input type="hidden" name="task" value="savejob" />
			<input type="hidden" name="code" value="<?php echo $job->code; ?>" />
			<input type="hidden" name="id" id="id" value="<?php echo $id; ?>" />
			<input type="hidden" name="status" value="<?php echo $status; ?>" />
			<input type="hidden" name="employerid" value="<?php echo $this->uid; ?>" />

			<label for="title">
				<?php echo Lang::txt('COM_JOBS_EDITJOB_JOB_TITLE'); ?>: <span class="required"><?php echo Lang::txt('COM_JOBS_REQUIRED'); ?></span>
				<input name="title" maxlength="190" id="title" type="text" value="<?php echo $this->escape($job->title); ?>" />
			</label>

			<label for="companyLocation">
				<?php echo Lang::txt('COM_JOBS_EDITJOB_JOB_LOCATION'); ?>: <span class="required"><?php echo Lang::txt('COM_JOBS_REQUIRED'); ?></span>
				<input name="companyLocation" maxlength="190" id="companyLocation" type="text" value="<?php echo $this->escape(stripslashes($job->companyLocation)); ?>" />
			</label>
		<?php if ($usonly == 0 && !empty($countries)) { ?>
			<label for="companyLocationCountry">
				<?php echo Lang::txt('COM_JOBS_EDITJOB_COUNTRY'); ?>: <span class="required"><?php echo Lang::txt('COM_JOBS_REQUIRED'); ?></span>
				<select name="companyLocationCountry" id="companyLocationCountry">
					<option value=""><?php echo Lang::txt('COM_JOBS_OPTION_SELECT_FROM_LIST'); ?></option>
					<?php
					foreach ($countries as $country)
					{
						$selected = $job->companyLocationCountry ? $job->companyLocationCountry : 'United States';
						?>
						<option value="<?php echo $this->escape($country['name']); ?>"<?php if (strtoupper($country['name']) == strtoupper($selected)) { echo ' selected="selected"'; } ?>><?php echo $this->escape($country['name']); ?></option>
						<?php
					}
					?>
				</select>
			</label>
		<?php } else { ?>
			<p class="warning"><?php echo Lang::txt('COM_JOBS_EDITJOB_US_ONLY'); ?></p>
			<input type="hidden" id="companyLocationCountry" name="companyLocationCountry" value="us" /><commit_msg>[HABRI][#569][COM_JOBS] Updates value access for country object.<commit_after><?php
/**
 * HUBzero CMS
 *
 * Copyright 2005-2011 Purdue University. All rights reserved.
 *
 * This file is part of: The HUBzero(R) Platform for Scientific Collaboration
 *
 * The HUBzero(R) Platform for Scientific Collaboration (HUBzero) is free
 * software: you can redistribute it and/or modify it under the terms of
 * the GNU Lesser General Public License as published by the Free Software
 * Foundation, either version 3 of the License, or (at your option) any
 * later version.
 *
 * HUBzero is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 * HUBzero is a registered trademark of Purdue University.
 *
 * @package   hubzero-cms
 * @copyright Copyright 2005-2011 Purdue University. All rights reserved.
 * @license   GNU General Public License, version 2 (GPLv2)
 */

// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die( 'Restricted access' );

	/* Post New Job / Edit Job Form */

	// load some classes
	$sitename = Config::get('sitename');

	$jobsHtml = new \Components\Jobs\Helpers\Html();

	$job = $this->job;
	$employer = $this->employer;
	$profile = $this->profile;
	$id = $this->jobid;

	$startdate = ($job->startdate && $job->startdate !='0000-00-00 00:00:00') ? Date::of($job->startdate)->toLocal('Y-m-d') : '';
	$closedate = ($job->closedate && $job->closedate !='0000-00-00 00:00:00') ? Date::of($job->closedate)->toLocal('Y-m-d') : '';

	$status = $this->task != 'addjob' ? $job->status : 4; // draft mode

	$hubzero_Geo = new \Hubzero\Geocode\Geocode();
	$countries = $hubzero_Geo->countries();
?>
<header id="content-header">
	<h2><?php echo $this->title; ?></h2>

	<div id="content-header-extra">
		<ul id="useroptions">
		<?php if ($this->emp) {  ?>
			<li><a class="icon-dashboard myjobs btn" href="<?php echo Route::url('index.php?option=' . $this->option . '&task=dashboard'); ?>"><?php echo Lang::txt('COM_JOBS_EMPLOYER_DASHBOARD'); ?></a></li>
			<li><a class="icon-list shortlist btn" href="<?php echo Route::url('index.php?option=' . $this->option . '&task=resumes&filterby=shortlisted'); ?>"><?php echo Lang::txt('COM_JOBS_SHORTLIST'); ?></a></li>
		<?php } else { ?>
			<li>
				<!-- <?php echo Lang::txt('COM_JOBS_NOTICE_YOU_ARE_ADMIN'); ?> -->
				<a class="icon-dashboard myjobs btn" href="<?php echo Route::url('index.php?option=' . $this->option . '&task=dashboard'); ?>"><?php echo Lang::txt('COM_JOBS_ADMIN_DASHBOARD'); ?></a>
			</li>
		<?php } ?>
		</ul>
	</div><!-- / #content-header-extra -->
</header><!-- / #content-header -->

<?php
	if ($this->getError()) { ?>
	<p class="error"><?php echo $this->getError(); ?></p>
	<?php }
		$html = '';

		$model = new \Components\Jobs\Models\Job($job);

		$job->title = trim(stripslashes($job->title));
		$job->description = $model->content('raw');
		$job->companyLocation = $id ? $job->companyLocation : $employer->companyLocation;
		$job->companyLocationCountry = $id ? $job->companyLocationCountry : $this->escape($hubzero_Geo->getcountry($profile->get('countryresident')));
		$job->companyName = $id ? $job->companyName : $employer->companyName;
		$job->companyWebsite = $id ? $job->companyWebsite : $employer->companyWebsite;
		$usonly = $this->config->get('usonly', 0);
?>
<section class="main section">
	<form id="hubForm" method="post" action="<?php echo Route::url('index.php?option=' . $this->option); ?>">
		<div class="explaination">
			<p><?php echo Lang::txt('COM_JOBS_EDITJOB_OVERVIEW_INFO'); ?></p>
		</div>
		<fieldset>
			<legend><?php echo Lang::txt('COM_JOBS_EDITJOB_JOB_OVERVIEW'); ?></legend>

			<input type="hidden" name="task" value="savejob" />
			<input type="hidden" name="code" value="<?php echo $job->code; ?>" />
			<input type="hidden" name="id" id="id" value="<?php echo $id; ?>" />
			<input type="hidden" name="status" value="<?php echo $status; ?>" />
			<input type="hidden" name="employerid" value="<?php echo $this->uid; ?>" />

			<label for="title">
				<?php echo Lang::txt('COM_JOBS_EDITJOB_JOB_TITLE'); ?>: <span class="required"><?php echo Lang::txt('COM_JOBS_REQUIRED'); ?></span>
				<input name="title" maxlength="190" id="title" type="text" value="<?php echo $this->escape($job->title); ?>" />
			</label>

			<label for="companyLocation">
				<?php echo Lang::txt('COM_JOBS_EDITJOB_JOB_LOCATION'); ?>: <span class="required"><?php echo Lang::txt('COM_JOBS_REQUIRED'); ?></span>
				<input name="companyLocation" maxlength="190" id="companyLocation" type="text" value="<?php echo $this->escape(stripslashes($job->companyLocation)); ?>" />
			</label>
		<?php if ($usonly == 0 && !empty($countries)) { ?>
			<label for="companyLocationCountry">
				<?php echo Lang::txt('COM_JOBS_EDITJOB_COUNTRY'); ?>: <span class="required"><?php echo Lang::txt('COM_JOBS_REQUIRED'); ?></span>
				<select name="companyLocationCountry" id="companyLocationCountry">
					<option value=""><?php echo Lang::txt('COM_JOBS_OPTION_SELECT_FROM_LIST'); ?></option>
					<?php
					foreach ($countries as $country)
					{
						$selected = $job->companyLocationCountry ? $job->companyLocationCountry : 'United States';
						?>
						<option value="<?php echo $this->escape($country->name); ?>"<?php if (strtoupper($country->name) == strtoupper($selected)) { echo ' selected="selected"'; } ?>><?php echo $this->escape($country->name); ?></option>
						<?php
					}
					?>
				</select>
			</label>
		<?php } else { ?>
			<p class="warning"><?php echo Lang::txt('COM_JOBS_EDITJOB_US_ONLY'); ?></p>
			<input type="hidden" id="companyLocationCountry" name="companyLocationCountry" value="us" />
{'fraction_non_alphanumeric': 0.2012652889076339, 'fraction_numerical': 0.010037958667229016, 'mean_word_length': 4.76934306569343, 'pattern_counts': {'":': 0, '<': 207, '<?xml version=': 0, '>': 316, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2399565', 'n_tokens_mistral': 4293, 'n_tokens_neox': 3922, 'n_words': 936}