[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] hrm/inc class.uiplace.inc.php, 1.1 class.soplace.inc.
From: |
sigurdne |
Subject: |
[Phpgroupware-cvs] hrm/inc class.uiplace.inc.php, 1.1 class.soplace.inc.php, 1.1 class.boplace.inc.php, 1.1 class.menu.inc.php, 1.4 |
Date: |
Tue, 22 Nov 2005 16:25:00 +0100 |
Update of hrm/inc
Added Files:
Branch: MAIN
class.uiplace.inc.php
class.soplace.inc.php
class.boplace.inc.php
Modified Files:
Branch: MAIN
class.menu.inc.php lines: +10 -1
Log Message:
*** empty log message ***
====================================================
Index: class.uiplace.inc.php
<?php
/**
* phpGroupWare - HRM: a human resource competence management system.
*
* @author Sigurd Nes <address@hidden>
* @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
* @license http://www.gnu.org/licenses/gpl.html GNU General Public
License
* @internal Development of this application was funded by
http://www.bergen.kommune.no/bbb_/ekstern/
* @package hrm
* @subpackage place
* @version $Id: class.uiplace.inc.php,v 1.1 2005/11/22 15:25:21
sigurdne Exp $
*/
/**
* Description
* @package hrm
*/
class uiplace
{
var $grants;
var $start;
var $query;
var $sort;
var $order;
var $sub;
var $currentapp;
var $public_functions = array
(
'index' => True,
'view' => True,
'training'=> True,
'edit' => True,
'delete' => True
);
function uiplace()
{
$GLOBALS['phpgw_info']['flags']['xslt_app'] = True;
$this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
$this->nextmatchs =
CreateObject('phpgwapi.nextmatchs');
$this->account =
$GLOBALS['phpgw_info']['user']['account_id'];
$this->bo =
CreateObject($this->currentapp.'.boplace',true);
$this->bocommon =
CreateObject($this->currentapp.'.bocommon');
$this->menu =
CreateObject($this->currentapp.'.menu');
$this->menu->sub ='place';
$this->start =
$this->bo->start;
$this->query =
$this->bo->query;
$this->sort =
$this->bo->sort;
$this->order =
$this->bo->order;
$this->allrows =
$this->bo->allrows;
}
function save_sessiondata()
{
$data = array
(
'start' => $this->start,
'query' => $this->query,
'sort' => $this->sort,
'order' => $this->order,
);
$this->bo->save_sessiondata($data);
}
function index()
{
$GLOBALS['phpgw']->xslttpl->add_file(array('place','nextmatchs','menu',
'search_field'));
$links = $this->menu->links();
$place_info = $this->bo->read();
while (is_array($place_info) && list(,$entry) =
each($place_info))
{
$content[] = array
(
'name'
=> $entry['name'],
'link_edit'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiplace.edit&place_id='
. $entry['id']),
'link_delete'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiplace.delete&place_id='
. $entry['id']),
'link_view'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiplace.view&place_id='
. $entry['id']),
'lang_view_place_text'
=> lang('view the place'),
'lang_edit_place_text'
=> lang('edit the place'),
'text_view'
=> lang('view'),
'text_edit'
=> lang('edit'),
'text_delete'
=> lang('delete'),
'lang_delete_place_text'
=> lang('delete the place'),
);
}
//_debug_array($content);
$table_header[] = array
(
'sort_name' =>
$this->nextmatchs->show_sort_order(array
(
'sort' => $this->sort,
'var' => 'name',
'order' => $this->order,
'extra' => array('menuaction' =>
$this->currentapp.'.uiplace.index',
'query' =>$this->query,
'cat_id' =>$this->cat_id,
'allrows' => $this->allrows)
)),
'lang_delete' => lang('delete'),
'lang_edit' => lang('edit'),
'lang_view' => lang('view'),
);
if(!$this->allrows)
{
$record_limit =
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
}
else
{
$record_limit = $this->bo->total_records;
}
$link_data = array
(
'menuaction' =>
$this->currentapp.'.uiplace.index',
'sort'
=>$this->sort,
'order'
=>$this->order,
'cat_id'
=>$this->cat_id,
'filter'
=>$this->filter,
'query'
=>$this->query
);
$table_add[] = array
(
'lang_add' =>
lang('add'),
'lang_add_statustext' => lang('add a place'),
'add_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiplace.edit'),
);
$msgbox_data = $this->bocommon->msgbox_data($receipt);
$data = array
(
'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
'links'
=> $links,
'allow_allrows'
=> True,
'allrows'
=> $this->allrows,
'start_record'
=> $this->start,
'record_limit'
=> $record_limit,
'num_records'
=> count($place_info),
'all_records'
=> $this->bo->total_records,
'link_url'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
'img_path'
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
'lang_searchfield_statustext' => lang('Enter
the search string. To show all entries, empty this field and press the SUBMIT
button again'),
'lang_searchbutton_statustext' => lang('Submit
the search string'),
'query'
=> $this->query,
'lang_search'
=> lang('search'),
'table_header'
=> $table_header,
'table_add'
=> $table_add,
'values'
=> $content
);
$appname =
lang('place');
;
$function_msg =
lang('list place');
$GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list' => $data));
$this->save_sessiondata();
}
function edit()
{
$place_id =
get_var('place_id',array('POST','GET'));
$place_id =
get_var('place_id',array('POST','GET'));
$values = get_var('values',array('POST'));
$GLOBALS['phpgw']->xslttpl->add_file(array('place'));
if (is_array($values))
{
$values['place_id']=
get_var('place_id',array('POST'));
$values['place_id']= $place_id;
if ($values['save'] || $values['apply'])
{
if(!$values['place_name'])
{
$receipt['error'][]=array('msg'=>lang('Please enter a name !'));
}
if(!$values['place_address'])
{
$receipt['error'][]=array('msg'=>lang('Please enter an address !'));
}
if(!$values['place_zip'])
{
$receipt['error'][]=array('msg'=>lang('Please enter a zip code !'));
}
if(!$values['place_town'])
{
$receipt['error'][]=array('msg'=>lang('Please enter a town !'));
}
if($place_id)
{
$values['place_id']=$place_id;
$action='edit';
}
if(!$receipt['error'])
{
$receipt =
$this->bo->save($values,$action);
$place_id =
$receipt['place_id'];
if ($values['save'])
{
$GLOBALS['phpgw']->session->appsession('session_data','hrm_training_receipt',$receipt);
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uiplace.index&place_id='
. $place_id);
}
}
}
else
{
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uiplace.index&place_id='
. $place_id);
}
}
if ($place_id)
{
if(!$receipt['error'])
{
$values =
$this->bo->read_single($place_id);
}
$function_msg = lang('edit place');
$action='edit';
}
else
{
$function_msg = lang('add place');
$action='add';
}
$link_data = array
(
'menuaction' =>
$this->currentapp.'.uiplace.edit',
'place_id' => $place_id,
'place_id' => $place_id
);
//_debug_array($link_data);
$msgbox_data = $this->bocommon->msgbox_data($receipt);
$data = array
(
'value_title' =>
$values['title'],
'value_entry_date' =>
$values['entry_date'],
'value_reference' =>
$values['reference'],
'value_place_name' =>
$values['name'],
'value_place_address' =>
$values['address'],
'value_place_zip' =>
$values['zip'],
'value_place_town' =>
$values['town'],
'value_place_remark' =>
$values['remark'],
'lang_entry_date' =>
lang('Entry date'),
'lang_title' =>
lang('Title'),
'lang_title_status_text' =>
lang('Title of the training item'),
'lang_skill' =>
lang('Skill'),
'lang_skill_status_text' =>
lang('Select your skill'),
'skill_list' =>
$this->bo->select_skill_list($values['skill']),
'lang_no_skill' =>
lang('select a skill'),
'lang_place' =>
lang('place'),
'lang_place_status_text' =>
lang('Select a place'),
'lang_place_status_text' =>
lang('Enter a new place'),
'lang_no_place'
=> lang('select a place'),
'lang_place_name' =>
lang('name'),
'lang_place_address' =>
lang('address'),
'lang_place_zip' =>
lang('zip'),
'lang_place_town' =>
lang('town'),
'lang_place_remark' =>
lang('remark'),
'msgbox_data' =>
$GLOBALS['phpgw']->common->msgbox($msgbox_data),
'form_action' =>
$GLOBALS['phpgw']->link('/index.php',$link_data),
'lang_id' =>
lang('training ID'),
'lang_descr' =>
lang('Descr'),
'lang_save' =>
lang('save'),
'lang_cancel' =>
lang('cancel'),
'value_id' =>
$place_id,
'lang_id_status_text' =>
lang('Enter the training ID'),
'lang_descr_status_text' =>
lang('Enter a description the training'),
'lang_done_status_text' =>
lang('Back to the list'),
'lang_save_status_text' =>
lang('Save the training'),
'type_id' =>
$training['type_id'],
'lang_apply' =>
lang('apply'),
'lang_apply_status_text' =>
lang('Apply the values'),
);
$appname =
lang('Training');
$GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('edit' => $data));
}
function view()
{
$place_id =
get_var('place_id',array('POST','GET'));
$values = get_var('values',array('POST'));
$GLOBALS['phpgw']->xslttpl->add_file(array('place'));
if ($place_id)
{
$values =
$this->bo->read_single_training($place_id);
$function_msg = lang('view training');
}
else
{
return;
}
$data = array
(
'value_descr' =>
$values['descr'],
'value_title' =>
$values['title'],
'value_start_date' =>
$values['start_date'],
'value_end_date' =>
$values['end_date'],
'value_entry_date' =>
$values['entry_date'],
'value_reference' =>
$values['reference'],
'lang_start_date' =>
lang('start date'),
'lang_end_date' => lang('end
date'),
'lang_start_date_title' =>
lang('select start date'),
'lang_end_date_title' =>
lang('select end date'),
'lang_start_date_status_text' =>
lang('Select the start date for your training'),
'lang_end_date_status_text' =>
lang('Select the end date for your training'),
'calendar_setup_start' =>
"Calendar.setup({inputField : 'values[start_date]',button :
'values[start_date]-trigger'});",
'calendar_setup_end' =>
"Calendar.setup({inputField : 'values[end_date]',button :
'values[end_date]-trigger'});",
'lang_reference' =>
lang('reference'),
'lang_entry_date'
=> lang('Entry date'),
'lang_title'
=> lang('Title'),
'lang_title_status_text'
=> lang('Title of the training item'),
'lang_skill'
=> lang('Skill'),
'lang_skill_status_text'
=> lang('Select your skill'),
'skill_list'
=> $this->bo->select_skill_list($values['skill']),
'lang_no_skill'
=> lang('select a skill'),
'place_list'
=> $this->bo->select_place_list($values['place_id']),
'lang_place'
=> lang('place'),
'lang_place' =>
lang('new place'),
'lang_place_status_text' =>
lang('Select a place'),
'lang_place_status_text' => lang('Enter
a new place'),
'lang_no_place'
=> lang('select a place'),
'form_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiplace.training&place_id='
. $place_id),
'lang_id' =>
lang('training ID'),
'lang_descr'
=> lang('Descr'),
'lang_save'
=> lang('save'),
'lang_cancel'
=> lang('cancel'),
'value_id' =>
$place_id,
'lang_id_status_text' => lang('Enter the
training ID'),
'lang_descr_status_text'
=> lang('Enter a description the training'),
'lang_done_status_text' =>
lang('Back to the list'),
'lang_save_status_text' =>
lang('Save the training'),
'type_id' =>
$training['type_id'],
'lang_apply'
=> lang('apply'),
'lang_apply_status_text'
=> lang('Apply the values'),
'lang_category' =>
lang('category'),
'cat_list' =>
$this->bo->select_category_list('select',$values['cat_id']),
'lang_no_cat' =>
lang('no category'),
'lang_cat_status_text' =>
lang('Select the category the building belongs to. To do not use a category
select NO CATEGORY'),
'select_name' =>
'values[cat_id]',
);
$appname =
lang('Training');
$GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('view' => $data));
}
function delete()
{
$place_id =
get_var('place_id',array('POST','GET'));
$confirm =
get_var('confirm',array('POST'));
$link_data = array
(
'menuaction' =>
$this->currentapp.'.uiplace.training',
'place_id' => $place_id
);
if (get_var('confirm',array('POST')))
{
$this->bo->delete_training($place_id,$place_id);
Header('Location: ' .
$GLOBALS['phpgw']->link('/index.php',$link_data));
}
$GLOBALS['phpgw']->xslttpl->add_file(array('app_delete'));
$data = array
(
'done_action' =>
$GLOBALS['phpgw']->link('/index.php',$link_data),
'delete_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiplace.delete&place_id='
. $place_id),
'lang_confirm_msg' => lang('do you
really want to delete this entry'),
'lang_yes' =>
lang('yes'),
'lang_yes_statustext' => lang('Delete the
entry'),
'lang_no_statustext' => lang('Back to the
list'),
'lang_no' =>
lang('no')
);
$appname =
lang('Place');
$function_msg =
lang('delete');
$GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('delete' => $data));
}
}
====================================================
Index: class.soplace.inc.php
<?php
/**
* phpGroupWare - HRM: a human resource competence management system.
*
* @author Sigurd Nes <address@hidden>
* @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
* @license http://www.gnu.org/licenses/gpl.html GNU General Public
License
* @internal Development of this application was funded by
http://www.bergen.kommune.no/bbb_/ekstern/
* @package hrm
* @subpackage place
* @version $Id: class.soplace.inc.php,v 1.1 2005/11/22 15:25:21
sigurdne Exp $
*/
/**
* Description
* @package hrm
*/
class soplace
{
var $grants;
var $db;
var $db2;
var $account;
function soplace()
{
$this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
$this->db = $GLOBALS['phpgw']->db;
$this->db2 = $this->db;
$this->account =
$GLOBALS['phpgw_info']['user']['account_id'];
$this->bocommon =
CreateObject($this->currentapp.'.bocommon');
$this->grants =
$GLOBALS['phpgw']->acl->get_grants('hrm');
$this->left_join =
$this->bocommon->left_join;
$this->join = $this->bocommon->join;
$this->like = $this->bocommon->like;
}
function read($data)
{
if(is_array($data))
{
if ($data['start'])
{
$start=$data['start'];
}
else
{
$start=0;
}
$query =
(isset($data['query'])?$data['query']:'');
$sort =
(isset($data['sort'])?$data['sort']:'DESC');
$order =
(isset($data['order'])?$data['order']:'');
$allrows =
(isset($data['allrows'])?$data['allrows']:'');
}
if ($order)
{
$ordermethod = " order by $order $sort";
}
else
{
$ordermethod = ' order by name asc';
}
$table = 'hrm_training_place';
if($query)
{
$query = ereg_replace("'",'',$query);
$query = ereg_replace('"','',$query);
$querymethod = " WHERE name $this->like
'%$query%'";
}
$sql = "SELECT * FROM $table $querymethod";
$this->db2->query($sql,__LINE__,__FILE__);
$this->total_records = $this->db2->num_rows();
if(!$allrows)
{
$this->db->limit_query($sql .
$ordermethod,$start,__LINE__,__FILE__);
}
else
{
$this->db->query($sql .
$ordermethod,__LINE__,__FILE__);
}
while ($this->db->next_record())
{
$place_info[] = array
(
'id' => $this->db->f('id'),
'name' =>
stripslashes($this->db->f('name')),
'descr' =>
stripslashes($this->db->f('descr'))
);
}
return $place_info;
}
function read_single($id)
{
$sql = 'SELECT * FROM hrm_training_place where id=' .
intval($id);
$this->db->query($sql,__LINE__,__FILE__);
if ($this->db->next_record())
{
$values['id'] = $id;
$values['name'] =
stripslashes($this->db->f('name'));
$values['address'] =
stripslashes($this->db->f('address'));
$values['remark'] =
stripslashes($this->db->f('remark'));
$values['town'] =
stripslashes($this->db->f('town'));
$values['zip'] = $this->db->f('zip');
$values['entry_date'] =
$this->db->f('entry_date');
$values['owner'] = $this->db->f('owner');
}
return $values;
}
function read_training($id)
{
$sql = "SELECT hrm_training.id as
training_id,hrm_training.title as title,
hrm_training.start_date,hrm_training.end_date,hrm_training_place.name as place
FROM hrm_training $this->left_join hrm_training_place on
hrm_training.place_id=hrm_training_place.id WHERE hrm_training.user_id=" .
intval($id);
$this->db->query($sql,__LINE__,__FILE__);
while ($this->db->next_record())
{
$training[] = array
(
'training_id' =>
$this->db->f('training_id'),
'start_date' =>
$this->db->f('start_date'),
'end_date' =>
$this->db->f('end_date'),
'title' =>
stripslashes($this->db->f('title')),
'place' =>
stripslashes($this->db->f('place'))
);
}
return $training;
}
function add_place($values)
{
$values['new_place_name'] =
$this->db->db_addslashes($values['new_place_name']);
$values['new_place_address'] =
$this->db->db_addslashes($values['new_place_address']);
$values['new_place_town'] =
$this->db->db_addslashes($values['new_place_town']);
$values['new_place_descr'] =
$this->db->db_addslashes($values['new_place_descr']);
$values['place_id'] =
$this->bocommon->next_id('hrm_training_place');
$insert_values=array(
$values['place_id'],
$values['new_place_name'],
$values['new_place_address'],
$values['new_place_zip'],
$values['new_place_town'],
$values['new_place_remark'],
);
$insert_values =
$this->bocommon->validate_db_insert($insert_values);
$this->db->query("INSERT INTO hrm_training_place
(id,name,address,zip,town, remark) "
. "VALUES ($insert_values)",__LINE__,__FILE__);
return $values['place_id'];
}
function add_training($values)
{
$values['descr'] =
$this->db->db_addslashes($values['descr']);
$values['title'] =
$this->db->db_addslashes($values['title']);
$this->db->transaction_begin();
if($values['new_place_name'] &&
$values['place_id']=='new_place')
{
$values['place_id'] = $this->add_place($values);
}
$training_id = $this->bocommon->next_id('hrm_training');
$insert_values=array(
$training_id,
$values['user_id'],
$values['cat_id'],
$values['title'],
$values['start_date'],
$values['end_date'],
$values['reference'],
$values['skill'],
$values['place_id'],
$values['descr'],
time(),
$this->account
);
$insert_values =
$this->bocommon->validate_db_insert($insert_values);
$this->db->query("INSERT INTO hrm_training
(id,user_id,category,title,start_date,end_date,reference,skill,place_id,descr,entry_date,owner)
"
. "VALUES ($insert_values)",__LINE__,__FILE__);
$receipt['message'][]=array('msg'=>lang('training item
has been saved'));
$receipt['training_id']= $training_id;
$this->db->transaction_commit();
return $receipt;
}
function edit_training($values)
{
$this->db->transaction_begin();
if($values['new_place_name'] &&
$values['place_id']=='new_place')
{
$values['place_id'] = $this->add_place($values);
}
$value_set['descr'] =
$this->db->db_addslashes($values['descr']);
$value_set['category'] = $values['cat_id'];
$value_set['title'] =
$this->db->db_addslashes($values['title']);
$value_set['start_date'] = $values['start_date'];
$value_set['end_date'] = $values['end_date'];
$value_set['reference'] =
$this->db->db_addslashes($values['reference']);
$value_set['skill'] =
$values['skill'];
$value_set['place_id'] = $values['place_id'];
$value_set =
$this->bocommon->validate_db_update($value_set);
$table='hrm_training';
$this->db->query("UPDATE $table set $value_set WHERE
id=" . $values['training_id'],__LINE__,__FILE__);
$this->db->transaction_commit();
$receipt['message'][]=array('msg'=>lang('Training item
has been edited'));
$receipt['training_id']= $values['training_id'];
return $receipt;
}
function delete_training($user_id,$id)
{
$this->db->query('DELETE FROM hrm_training WHERE id='
. intval($id) . ' AND user_id=' . intval($user_id),__LINE__,__FILE__);
}
function select_category_list()
{
$this->db->query("SELECT id, descr FROM
hrm_training_category ORDER BY descr ");
$i = 0;
while ($this->db->next_record())
{
$categories[$i]['id']
= $this->db->f('id');
$categories[$i]['name']
= stripslashes($this->db->f('descr'));
$i++;
}
return $categories;
}
function select_place_list()
{
$this->db->query("SELECT * FROM hrm_training_place
ORDER BY name ");
$i = 0;
while ($this->db->next_record())
{
$place[$i]['id']
= $this->db->f('id');
$place[$i]['name']
= stripslashes($this->db->f('name'));
$i++;
}
return $place;
}
}
?>
====================================================
Index: class.boplace.inc.php
<?php
/**
* phpGroupWare - HRM: a human resource competence management system.
*
* @author Sigurd Nes <address@hidden>
* @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
* @license http://www.gnu.org/licenses/gpl.html GNU General Public
License
* @internal Development of this application was funded by
http://www.bergen.kommune.no/bbb_/ekstern/
* @package hrm
* @subpackage place
* @version $Id: class.boplace.inc.php,v 1.1 2005/11/22 15:25:21
sigurdne Exp $
*/
/**
* Description
* @package hrm
*/
class boplace
{
var $start;
var $query;
var $filter;
var $sort;
var $order;
var $cat_id;
var $public_functions = array
(
'read' => True,
'read_single' => True,
'save' => True,
'delete' => True,
'check_perms' => True
);
var $soap_functions = array(
'list' => array(
'in' =>
array('int','int','struct','string','int'),
'out' => array('array')
),
'read' => array(
'in' => array('int','struct'),
'out' => array('array')
),
'save' => array(
'in' => array('int','struct'),
'out' => array()
),
'delete' => array(
'in' => array('int','struct'),
'out' => array()
)
);
function boplace($session=False)
{
$this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
$this->so =
CreateObject($this->currentapp.'.soplace');
$this->bocommon =
CreateObject($this->currentapp.'.bocommon');
if ($session)
{
$this->read_sessiondata();
$this->use_session = True;
}
$start = get_var('start',array('POST','GET'));
$query = get_var('query',array('POST','GET'));
$sort = get_var('sort',array('POST','GET'));
$order = get_var('order',array('POST','GET'));
$filter = get_var('filter',array('POST','GET'));
$cat_id = get_var('cat_id',array('POST','GET'));
$allrows= get_var('allrows',array('POST','GET'));
if ($start)
{
$this->start=$start;
}
else
{
$this->start=0;
}
if(array_key_exists('query',$_POST) ||
array_key_exists('query',$_GET))
{
$this->query = $query;
}
if(array_key_exists('filter',$_POST) ||
array_key_exists('filter',$_GET))
{
$this->filter = $filter;
}
if(array_key_exists('sort',$_POST) ||
array_key_exists('sort',$_GET))
{
$this->sort = $sort;
}
if(array_key_exists('order',$_POST) ||
array_key_exists('order',$_GET))
{
$this->order = $order;
}
if(array_key_exists('cat_id',$_POST) ||
array_key_exists('cat_id',$_GET))
{
$this->cat_id = $cat_id;
}
if ($allrows)
{
$this->allrows = $allrows;
}
}
function save_sessiondata($data)
{
if ($this->use_session)
{
$GLOBALS['phpgw']->session->appsession('session_data','hr_place',$data);
}
}
function read_sessiondata()
{
$data =
$GLOBALS['phpgw']->session->appsession('session_data','hr_place');
$this->start = $data['start'];
$this->query = $data['query'];
$this->filter = $data['filter'];
$this->sort = $data['sort'];
$this->order = $data['order'];
$this->cat_id = $data['cat_id'];
}
function read()
{
$place_info = $this->so->read(array('start' =>
$this->start,'query' => $this->query,'sort' => $this->sort,'order' =>
$this->order,
'allrows'=>$this->allrows));
$this->total_records = $this->so->total_records;
return $place_info;
}
function read_single($id)
{
$values =$this->so->read_single($id);
$dateformat =
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
if($values['entry_date'])
{
$values['entry_date'] =
$GLOBALS['phpgw']->common->show_date($values['entry_date'],$dateformat);
}
return $values;
}
function read_training($user_id)
{
$values = $this->so->read_training($user_id);
return $values;
}
function save($values,$action='')
{
$values['start_date'] =
$this->bocommon->date_to_timestamp($values['start_date']);
$values['end_date'] =
$this->bocommon->date_to_timestamp($values['end_date']);
if ($action=='edit')
{
if ($values['training_id'] != '')
{
$receipt =
$this->so->edit_training($values);
}
else
{
$receipt['error'][]=array('msg'=>lang('Error'));
}
}
else
{
$receipt = $this->so->add_training($values);
}
return $receipt;
}
function delete_training($user_id,$id)
{
$this->so->delete_training($user_id,$id);
}
function select_category_list($format='',$selected='')
{
switch($format)
{
case 'select':
$GLOBALS['phpgw']->xslttpl->add_file(array('cat_select'));
break;
case 'filter':
$GLOBALS['phpgw']->xslttpl->add_file(array('cat_filter'));
break;
}
$categories= $this->so->select_category_list();
while (is_array($categories) && list(,$category) =
each($categories))
{
$sel_category = '';
if ($category['id']==$selected)
{
$sel_category = 'selected';
}
$category_list[] = array
(
'cat_id' => $category['id'],
'name' => $category['name'],
'selected' => $sel_category
);
}
for ($i=0;$i<count($category_list);$i++)
{
if ($category_list[$i]['selected'] !=
'selected')
{
unset($category_list[$i]['selected']);
}
}
return $category_list;
}
function select_skill_list($selected='')
{
$skill_comment[0]=' - '.lang('None');
$skill_comment[1]=' - '.lang('Medium');
$skill_comment[2]=' - '.lang('Good');
$skill_comment[3]=' - '.lang('Expert');
for ($i=0; $i<=3; $i++)
{
$skill_list[$i]['id'] =$i;
$skill_list[$i]['name'] =$i .
$skill_comment[$i];
}
while (is_array($skill_list) && list(,$entry) =
each($skill_list))
{
$sel_entry = '';
if ($entry['id']==$selected)
{
$sel_entry = 'selected';
}
$entry_list[] = array
(
'id' => $entry['id'],
'name' => $entry['name'],
'selected' => $sel_entry
);
}
for ($i=0;$i<count($entry_list);$i++)
{
if ($entry_list[$i]['selected'] != 'selected')
{
unset($entry_list[$i]['selected']);
}
}
return $entry_list;
}
function select_place_list($selected='')
{
$places= $this->so->select_place_list();
while (is_array($places) && list(,$place) =
each($places))
{
$sel_place = '';
if ($place['id']==$selected)
{
$sel_place = 'selected';
}
$place_list[] = array
(
'id' => $place['id'],
'name' => $place['name'],
'selected' => $sel_place
);
}
for ($i=0;$i<count($place_list);$i++)
{
if ($place_list[$i]['selected'] != 'selected')
{
unset($place_list[$i]['selected']);
}
}
return $place_list;
}
}
====================================================
Index: hrm/inc/class.menu.inc.php
diff -u hrm/inc/class.menu.inc.php:1.3 hrm/inc/class.menu.inc.php:1.4
--- hrm/inc/class.menu.inc.php:1.3 Tue Nov 22 13:26:35 2005
+++ hrm/inc/class.menu.inc.php Tue Nov 22 15:25:21 2005
@@ -55,6 +55,15 @@
$menu['module'][$i]['statustext'] =
lang('Job');
$i++;
+ if($sub=='place')
+ {
+ $menu['module'][$i]['this']=True;
+ }
+ $menu['module'][$i]['link'] =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uiplace.index');
+ $menu['module'][$i]['name'] =
lang('PLace');
+ $menu['module'][$i]['statustext'] =
lang('Place');
+ $i++;
+
$j=0;
if ($sub == 'job')
{
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] hrm/inc class.uiplace.inc.php, 1.1 class.soplace.inc.php, 1.1 class.boplace.inc.php, 1.1 class.menu.inc.php, 1.4,
sigurdne <=