5 * Copyright 1999-2001 (c) VA Linux Systems
6 * The rest Copyright 2002-2004 (c) GForge Team
9 * This file is part of GForge.
11 * GForge is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * GForge is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with GForge; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 require_once('../env.inc.php');
27 require_once $gfwww.'include/pre.php';
28 require_once $gfwww.'people/people_utils.php';
30 if (!forge_get_config('use_people')) {
34 $group_id = getIntFromRequest('group_id');
36 if ($group_id && (user_ismember($group_id, 'A'))) {
37 $title = getStringFromRequest('title');
38 $description = getStringFromRequest('description');
39 $category_id = getStringFromRequest('category_id');
40 $status_id = getStringFromRequest('status_id');
41 $job_id = getStringFromRequest('job_id');
42 $skill_id = getStringFromRequest('skill_id');
43 $skill_level_id = getStringFromRequest('skill_level_id');
44 $skill_year_id = getStringFromRequest('skill_year_id');
46 if (getStringFromRequest('add_job')) {
50 if (!$title || !$description || $category_id==100) {
51 exit_error(_('error - missing info'),_('Fill in all required fields'));
53 if (!form_key_is_valid(getStringFromRequest('form_key'))) {
54 exit_form_double_submit();
56 $result=db_query_params("INSERT INTO people_job (group_id,created_by,title,description,post_date,status_id,category_id)
57 VALUES ($1, $2, $3, $4, $5, $6, $7)",
58 array($group_id, user_getid(), htmlspecialchars($title), htmlspecialchars($description), time(), '1',$category_id));
59 if (!$result || db_affected_rows($result) < 1) {
60 $feedback .= _('JOB insert FAILED');
62 form_release_key(getStringFromRequest("form_key"));
64 $job_id=db_insertid($result,'people_job','job_id');
65 $feedback .= _('JOB inserted successfully');
68 } else if (getStringFromRequest('update_job')) {
70 update the job's description, status, etc
72 if (!$title || !$description || $category_id==100 || $status_id==100 || !$job_id) {
74 exit_error(_('error - missing info'),_('Fill in all required fields'));
77 $result=db_query_params("UPDATE people_job SET title=$1,description=$2,status_id=$3,category_id=$4 WHERE job_id=$5 AND group_id=$6",
78 array(htmlspecialchars($title), htmlspecialchars($description), $status_id, $category_id, $job_id, $group_id));
79 if (!$result || db_affected_rows($result) < 1) {
80 $feedback = _('JOB update FAILED');
83 $feedback = _('JOB updated successfully');
86 } else if (getStringFromRequest('add_to_job_inventory')) {
88 add item to job inventory
90 if ($skill_id == "xyxy" || $skill_level_id==100 || $skill_year_id==100 || !$job_id) {
92 exit_error(_('error - missing info'),_('Fill in all required fields'));
95 if (people_verify_job_group($job_id,$group_id)) {
96 people_add_to_job_inventory($job_id,$skill_id,$skill_level_id,$skill_year_id);
97 $feedback .= _('JOB updated successfully');
99 $feedback .= _('JOB update failed - wrong project_id');
102 } else if (getStringFromRequest('update_job_inventory')) {
104 Change Skill level, experience etc.
106 if ($skill_level_id==100 || $skill_year_id==100 || !$job_id || !$job_inventory_id) {
108 exit_error(_('error - missing info'),_('Fill in all required fields'));
111 if (people_verify_job_group($job_id,$group_id)) {
112 $result=db_query_params("UPDATE people_job_inventory SET skill_level_id=$1,skill_year_id=$2 WHERE job_id=$3 AND job_inventory_id=$4",
113 array($skill_level_id, $skill_year_id, $job_id, $job_inventory_id));
114 if (!$result || db_affected_rows($result) < 1) {
115 $feedback .= _('JOB skill update FAILED');
118 $feedback .= _('JOB skill updated successfully');
121 $feedback .= _('JOB skill update failed - wrong project_id');
124 } else if (getStringFromRequest('delete_from_job_inventory')) {
126 remove this skill from this job
130 exit_error(_('error - missing info'),_('Fill in all required fields'));
133 if (people_verify_job_group($job_id,$group_id)) {
134 $result = db_query_params("DELETE FROM people_job_inventory WHERE job_id=$1 AND job_inventory_id=$2", array($job_id, $job_inventory_id));
135 if (!$result || db_affected_rows($result) < 1) {
136 $feedback .= _('JOB skill delete FAILED');
139 $feedback .= _('JOB skill deleted successfully');
142 $feedback .= _('JOB skill delete failed - wrong project_id');
148 Fill in the info to create a job
150 people_header(array('title'=>_('Edit Job')));
152 //for security, include group_id
153 $result=db_query_params("SELECT * FROM people_job WHERE job_id=$1 AND group_id=$2", array($job_id, $group_id));
154 if (!$result || db_numrows($result) < 1) {
156 $feedback .= _('POSTING fetch FAILED');
157 echo '<h2>'._('No such posting for this project').'</h2>';
160 echo _('<p>Now you can edit/change the list of skills attached to this posting. Developers will be able to match their skills with your requirements.</p><p>All postings are automatically closed after two weeks.</p>').'
162 <p /><form action="'.getStringFromServer('PHP_SELF').'" method="post">
163 <input type="hidden" name="group_id" value="'.$group_id.'" />
164 <input type="hidden" name="job_id" value="'.$job_id.'" />
165 <strong>'._('Category').'</strong><br />
166 '. people_job_category_box('category_id',db_result($result,0,'category_id')) .'
168 <strong>'._('Status').'</strong><br />
169 '. people_job_status_box('status_id',db_result($result,0,'status_id')) .'</p>
171 <strong>'._('Short Description').':</strong><br />
172 <input type="text" name="title" value="'. db_result($result,0,'title') .'" size="40" maxlength="60" /></p>
174 <strong>'._('Long Description').':</strong><br />
175 <textarea name="description" rows="10" cols="60">'. db_result($result,0,'description') .'</textarea></p>
177 <input type="submit" name="update_job" value="'._('Update Descriptions').'" /></p>
180 //now show the list of desired skills
181 echo '<p>'.people_edit_job_inventory($job_id,$group_id) . '</p>';
182 echo '<p /><form action="/people/" method="post"><input type="submit" name="submit" value="'._('Finished').'" /></form>';
186 people_footer(array());
190 Not logged in or insufficient privileges
195 exit_permission_denied();
201 // c-file-style: "bsd"