* * http://www.radix.net/~cknudsen * * Originaly modified by Mark Peters * * -------------------------------------------- * * This program is free software; you can redistribute it and/or modify it * * under the terms of the GNU General Public License as published by the * * Free Software Foundation; either version 2 of the License, or (at your * * option) any later version. * \**************************************************************************/ class uiresources { var $dbb; var $template; var $cat; var $debug = False; var $cat_id; var $theme; var $link_tpl; var $public_functions = array( 'index' => True, 'view' => True, 'edit' => True, 'update'=> True, 'delete' => True, 'close' => True, 'import_mail' => True, 'search' => True, 'search2' => True, 'header' => True, 'footer' => True ); var $prefs; /** * instance of the bo-class * * @var boresources */ var $bo; /** * reference to instance of the link-class of bo * * @var bolink */ var $link; /** * instance of the etemplate class * * @var etemplate */ var $tmpl; /** * reference to the html object of etemplate * * @var html */ var $html; /** * allowed units and hours per day, can be overwritten by the projectmanager configuration, default all units, 8h * * @var string */ var $duration_format = ','; // comma is necessary! var $icons = array( 'type' => array( 'task' => 'task.png', 'task_alt' => 'Task', 'phone' => 'phone.gpng', 'phone_alt' => 'Phonecall', 'note' => 'note.png', 'note_alt' => 'Note', 'confirm' => 'confirm.png', 'confirm_alt' => 'Confirmation', 'reject' => 'reject.png', 'reject_alt' => 'Reject', 'email' => 'email.png', 'email_alt' => 'Email' ), 'action' => array( 'new' => 'new.png', 'new_alt' => 'Add Sub', 'view' => 'view.png', 'view_alt' => 'View Subs', 'parent' => 'parent.png', 'parent_alt' => 'View other Subs', 'edit' => 'edit.png', 'edit_alt' => 'Edit', 'addfile' => 'addfile.png', 'addfile_alt' => 'Add a file', 'delete' => 'delete.png', 'delete_alt' => 'Delete', 'close' => 'done.png', 'close_alt' => 'Close' ), 'status' => array( 'billed' => 'billed.png', 'billed_alt' => 'billed', 'done' => 'done.png', 'done_alt' => 'done', 'will-call' => 'will-call.png', 'will-call_alt' => 'will-call', 'call' => 'call.png', 'call_alt' => 'call', 'ongoing' => 'ongoing.png', 'ongoing_alt' => 'ongoing', 'offer' => 'offer.png', 'offer_alt' => 'offer' ) ); var $filters = array( 'none' => 'no Filter', 'done' => 'done', 'responsible' => 'responsible', 'responsible-open-today' => 'responsible open', 'responsible-open-overdue' => 'responsible overdue', 'responsible-upcoming' => 'responsible upcoming', 'delegated' => 'delegated', 'delegated-open-today' => 'delegated open', 'delegated-open-overdue' => 'delegated overdue', 'delegated-upcoming' => 'delegated upcomming', 'own' => 'own', 'own-open-today' => 'own open', 'own-open-overdue' => 'own overdue', 'own-upcoming' => 'own upcoming', 'open-today' => 'open', 'open-overdue' => 'overdue', 'upcoming' => 'upcoming', ); var $messages = array( 'edit' => 'resources - Edit', 'add' => 'resources - New', 'add_sub' => 'resources - New Subproject', 'sp' => '- Subprojects from', 're' => 'Re:' ); var $optionldap; /** * Constructor * * @return uiresources */ function uiresources() { $localtime = $GLOBALS['phpgw']->datetime->users_localtime; $this->year = date('Y',$localtime); $this->month = date('m',$localtime); $this->day = date('d',$localtime); $this->today = date('Ymd',$GLOBALS['phpgw']->datetime->users_localtime); //print_r($GLOBALS); $GLOBALS['phpgw']->nextmatchs = CreateObject('phpgwapi.nextmatchs'); $this->bo = CreateObject('resources.boresources',1); $this->cat = &$this->bo->cat; //echo "pwnre".$this->bo->owner." ".$this->bo->today." ".$this->bo->evento; $this->dbb = CreateObject('class.DBAccess',1); $this->cat = &$this->bo->cat; $this->resources = &$this->bo->resources; $this->project = &$this->bo->project; $this->tarea = &$this->bo->tarea; print_debug('BO Owner',$this->bo->owner); $this->template = $GLOBALS['phpgw']->template; $this->template_dir = $GLOBALS['phpgw']->common->get_tpl_dir('resources'); $this->cat_id = $this->bo->cat_id; $this->link_tpl = CreateObject('phpgwapi.Template',$this->template_dir); $this->link_tpl->set_unknowns('remove'); $this->link_tpl->set_file( Array( 'link_picture' => 'link_pict.tpl' ) ); $this->link_tpl->set_block('link_picture','link_pict','link_pict'); $this->link_tpl->set_block('link_picture','pict','pict'); $this->link_tpl->set_block('link_picture','link_open','link_open'); $this->link_tpl->set_block('link_picture','link_close','link_close'); $this->link_tpl->set_block('link_picture','link_text','link_text'); $this->ds = $GLOBALS['phpgw']->common->ldapConnect(); if(!$this->ds) $this->ds = $GLOBALS['phpgw']->common->ldapConnect(); if(!@is_object($GLOBALS['phpgw']->translation)) { $GLOBALS['phpgw']->translation = CreateObject('phpgwapi.translation'); } $this->user_context = $GLOBALS['phpgw_info']['server']['ldap_context']; $this->group_context = $GLOBALS['phpgw_info']['server']['ldap_group_context']; /*************************************************/ $this->always_app_header = $this->bo->prefs['common']['template_set'] == 'idots'; //print_debug('UI',$this->_debug_sqsof()); if (!is_object($GLOBALS['phpgw']->html)) { $GLOBALS['phpgw']->html = CreateObject('phpgwapi.html'); } $this->html = &$GLOBALS['phpgw']->html; } /* Public functions */ function index($params='') { if (!$params) { foreach(array('date','year','month','day') as $field) { if (isset($_GET[$field])) { $params[$field] = $_REQUEST[$field]; } } } //$todos = $this->get_todos($todo_label); $GLOBALS['phpgw']->redirect($this->page('search',$params)); } function page($_page='',$params='') { if($_page == '') { $page_ = explode('.',$this->bo->prefs['resources']['defaultresources']); $_page = $page_[0]; if ($_page=='planner_cat' || $_page=='planner_user') { $_page = 'month'; } elseif ($_page=='index' || ($_page != 'day' && $_page != 'week' && $_page != 'month' && $_page != 'year' && $_page != 'planner')) { $_page = 'month'; $GLOBALS['phpgw']->preferences->add('resources','defaultresources','month'); $GLOBALS['phpgw']->preferences->save_repository(); } } if($GLOBALS['phpgw_info']['flags']['currentapp'] == 'home' || strstr($GLOBALS['phpgw_info']['flags']['currentapp'],'mail')) // email, felamimail, ... { $page_app = 'resources'; } else { $page_app = $GLOBALS['phpgw_info']['flags']['currentapp']; } if (is_array($params)) { $params['menuaction'] = $page_app.'.ui'.$page_app.'.'.$_page; } else { $params = 'menuaction='.$page_app.'.ui'.$page_app.'.'.$_page.$params; } return $GLOBALS['phpgw']->link('/index.php',$params); } // NDEE: printer-friendly function printer_friendly($body,$app_header='') { $_SESSION['resources']['category'] = $this->cat->formated_list('select','all',$this->bo->cat_id,'True'); $_SESSION['resources']['resources'] = $this->resources->formated_list('select','all',$this->bo->resources_id,'True'); if((!isset($GLOBALS['phpgw_info']['server']['deny_user_granres_access']) || !$GLOBALS['phpgw_info']['server']['deny_user_granres_access']) && count($this->bo->grants) > 0) $_SESSION['resources']['cals'] = $this->bo->list_cals(); unset($GLOBALS['phpgw_info']['flags']['noheader']); unset($GLOBALS['phpgw_info']['flags']['nonavbar']); unset($GLOBALS['phpgw_info']['flags']['noappheader']); unset($GLOBALS['phpgw_info']['flags']['noappfooter']); if ($app_header && $this->always_app_header) { $GLOBALS['phpgw_info']['flags']['app_header'] = $GLOBALS['phpgw_info']['apps']['resources']['title'].' - '.$app_header; } $GLOBALS['phpgw']->common->phpgw_header(); return $new_body; } function normalizeminutes(&$minutes) { $hour = 0; $min = (int)$minutes; if($min >= 60) { $hour += $min / 60; $min %= 60; } settype($minutes,'integer'); $minutes = $min; return $hour; } function header() { $cols = 8; if($this->bo->check_perms(PHPGW_ACL_PRIVATE) == True) { $cols++; } $tpl = $GLOBALS['phpgw']->template; $tpl->set_unknowns('remove'); if (!file_exists($file = $this->template_dir.'/header.inc.php')) { $file = $GLOBALS['phpgw_info']['server']['webserver_url'] . '/resources/templates/default/header.inc.php'; } include($file); $refer = explode('.',$GLOBALS['HTTP_GET_VARS']['menuaction']); if($refer[2] != 'view') { $header = $tpl->fp('out','head'); unset($tpl); echo $header; } unset($tpl); } function footer() { $menuaction = $_GET['menuaction']; list(,,$method) = explode('.',$menuaction); if (@$this->bo->printer_friendly) { return; } $p = $GLOBALS['phpgw']->template; $p->set_file( Array( 'footer' => 'footer.tpl', 'form_button' => 'form_button_script.tpl' ) ); $p->set_block('footer','footer_table','footer_table'); $p->set_block('footer','footer_row','footer_row'); $p->set_block('footer','blank_row','blank_row'); $p->set_block('footer','num_dias','num_dias'); $m = $this->bo->month; $y = $this->bo->year; $hoje = date('Ymd',$GLOBALS['phpgw']->datetime->gmtnow); $mes_hoje = (int)substr($hoje,4,2); $mes_footer = (int)substr($_POST['date'],4,2); if($_GET['sday']) { if($_GET['month'] == $mes_hoje) { $day = $this->bo->day; } else { $day = $_GET['sday']; } } else { $day = $this->bo->day; $dia_ini = $day; } if($mes_footer == $mes_hoje) { $dia_ini = (int)substr($hoje,6,2); $day = $dia_ini; } /********************************************************************************************/ } /****************************************************************************************/ function edit($cd=0,$readsess=0) { $this->today = date('Ymd',$GLOBALS['phpgw']->datetime->users_localtime); if(!$this->bo->check_perms(PHPGW_ACL_ADD)) { $this->index(); } if($readsess) { $event = $this->bo->restore_from_appsession; if(!$event['owner']) { $this->bo->add_attribute('owner',$this->bo->owner); } $can_edit = True; } else { $this->bo->event_init(); $this->bo->add_attribute('id',0); $can_edit = True; $participants = (string)(get_var('participants',array('GET'),FALSE)); $starthour = (int)(get_var('hour',array('GET'),$this->bo->prefs['resources']['workdaystarts'])); $startmin = (int)(get_var('minute',array('GET'),0)); $endmin = $startmin + (int)$this->bo->prefs['resources']['defaultlength']; $endhour = $starthour + $this->bo->normalizeminutes($endmin); $subject = (string)(get_var('title',array('GET'),0)); if ($subject != '0') { $description = (string)(get_var('description',array('GET'),0)); $description1 = (string)(get_var('description1',array('GET'),0)); $location = (string)(get_var('location',array('GET'),0)); } else unset($subject); $this->bo->set_start($this->bo->year,$this->bo->month,$this->bo->day,$starthour,$startmin,0); $this->bo->set_end($this->bo->year,$this->bo->month,$this->bo->day,$endhour,$endmin,0); if(@$this->bo->prefs['resources']['default_private']) { $this->bo->set_class(False); } else { $this->bo->set_class(True); } $event = $this->bo->restore_from_appsession; } if(isset($_REQUEST['error'])){ $cd=$_REQUEST['error']; } $this->edit_form( Array( 'event' => $event, 'cd' => $cd, 'plain' => $_GET['plain'] ) ); $GLOBALS['phpgw']->common->phpgw_footer(); } function edit_form($param) { if(isset($_REQUEST['id'])){ $event=$this->select($_REQUEST['id']); }else{ $event=$this->select_init(); } unset($GLOBALS['phpgw_info']['flags']['noheader']); unset($GLOBALS['phpgw_info']['flags']['nonavbar']); $justthese = array("uidnumber", "gidnumber", "uid", "cn", "givenname", "sn", "mail","telephonenumber","gecos","dn"); $sri = @ldap_search($this->ds, "ou=usuarios,ou=cnti,dc=gob,dc=ve", ("(&(sn=*)(mail=*@*)(structuralObjectClass=inetOrgPerson)(deliveryMode=virtual))"), $justthese); if(!$sri) return null; $allValues = ldap_get_entries($this->ds, $sri); $ttt=count($allValues); for($i=0;$i<$ttt;$i++){ if(isset($allValues[$i]['mail'][0])) { $option = ' '."\n"; $optionldap .= $option; $option2 = ' '."\n"; $optionldap2 .= $option2; } } if(!is_array($param)) { $this->index(); } if(isset($param['event'])) { $event = $param['event']; } $hourformat = substr($this->bo->users_timeformat,0,1); $jscal = CreateObject('phpgwapi.jscalendar'); // before phpgw_header() !!! unset($GLOBALS['phpgw_info']['flags']['noheader']); unset($GLOBALS['phpgw_info']['flags']['nonavbar']); $GLOBALS['phpgw_info']['flags']['noappheader'] = True; $GLOBALS['phpgw_info']['flags']['noappfooter'] = True; $GLOBALS['phpgw_info']['flags']['app_header'] = $event['id'] ? lang('Editing event') : lang('Adding resources'); if ($param['plain'] != "True"){ $GLOBALS['phpgw']->common->phpgw_header(); } else{ $GLOBALS['phpgw_info']['theme']['row_on'] = "F8F8F8"; $GLOBALS['phpgw_info']['theme']['row_off'] = "F8F8F8"; } $p = &$GLOBALS['phpgw']->template; $p->set_file( Array( 'edit' => 'edit.tpl', 'form_button' => 'form_button_script.tpl' ) ); $p->set_block('edit','edit_entry','edit_entry'); $p->set_block('edit','list','list'); $p->set_block('edit','hr','hr'); $vars = Array( 'font' => $this->theme['font'], 'bg_color' => $this->theme['bg_text'], 'action_url' => $GLOBALS['phpgw']->link('/index.php',Array('menuaction'=>'resources.uiresources.update')), 'accounres_link' => $GLOBALS['phpgw']->link('/index.php','menuaction=resources.uiresources.accounres_popup'), 'common_hidden' => ''."\n" . ''."\n" . (@isset($GLOBALS['phpgw_info']['server']['deny_user_granres_access']) && $GLOBALS['phpgw_info']['server']['deny_user_granres_access']? ''."\n":''), 'errormsg' => ($param['cd']?$GLOBALS['phpgw']->common->check_code($param['cd']):'') ); $p->set_var($vars); // res_type //echo $event['type']; // Display Categories if(strpos($event['category'],',')) { $temp_cats = explode(',',$event['category']); @reset($temp_cats); while(list($key,$value) = each($temp_cats)) { $check_cats[] = (int)$value; } } elseif($event['category']) { $check_cats[] = (int)$event['category']; } else { $check_cats[] = 0; } $var['category'] = Array( 'field' => lang('Category'), 'data' => '' ); // nombre $var['name'] = Array( 'field' => lang('name'), 'data' => '' ); // location $var['location'] = Array( 'field' => lang('location'), 'data' => '' ); //cantidad $var['cantidad'] = Array( 'field' => lang('quantity'), 'data' => '' ); // Full Description $var['description'] = Array( 'field' => lang('Description'), 'data' => '' ); //responsable if(!isset($GLOBALS['phpgw_info']['server']['deny_user_grants_access']) || !$GLOBALS['phpgw_info']['server']['deny_user_grants_access']) { $str2 = utf8_decode($optionldap2); $var['administrador'] = array ( 'field' => lang('Responsable'), 'data' => " " ); } //email $var['email'] = Array( 'field' => lang('email'), 'data' => '' ); $valorfechainicio=$this->bo->time2array($event['fechainicio'],$alarm = 0); $start=$valorfechainicio['mday']."/".$valorfechainicio['month']."/".$valorfechainicio['year']; $var['startdate'] = Array( 'field' => lang('Start Date'), 'data' => $jscal->input('start[str]',$start) ); // $this->output_template_array($p,'row','list',Array('data' => '')); if (!isset($this->fields)) { $this->custom_fields = CreateObject('resources.bocustom_fields'); $this->fields = &$this->custom_fields->fields; $this->stock_fields = &$this->custom_fields->stock_fields; } // $this->output_template_array($p,'row','list',$var['access']); unset($var['access']); $preserved = False; foreach($this->fields as $field => $data) { if (!$data['disabled']) { if (isset($var[$field])) { switch($field) { case 'startdate': $this->output_template_array($p,'row','list',$var['startdate']); $this->output_template_array($p,'row','list',$var['starttime']); break; case 'enddate': $this->output_template_array($p,'row','list',$var['enddate']); $this->output_template_array($p,'row','list',$var['endtime']); break; case 'recure_type': $p->set_var('tr_color',$this->theme['th_bg']); $p->set_var('hr_text','
'.lang('Repeating Event Information').'
'); $p->parse('row','hr',True); $this->output_template_array($p,'row','list',$var['recure_type']); $this->output_template_array($p,'row','list',$var['recure_enddate']); $this->output_template_array($p,'row','list',$var['recure_day']); $this->output_template_array($p,'row','list',$var['recure_interval']); break; default: $this->output_template_array($p,'row','list',$var[$field]); } } elseif (!isset($this->stock_fields[$field])) // Custom field { $lang = lang($name = substr($field,1)); $size = 'SIZE='.($data['shown'] ? $data['shown'] : ($data['length'] ? $data['length'] : 30)). ' MAXLENGTH='.($data['length'] ? $data['length'] : 255); $v = array( 'field' => $lang == $name.'*' ? $name : $lang, 'data' => '' ); if ($data['title']) { $v['tr_color'] = $this->theme['th_bg']; } if (!$data['length'] && $data['title']) { $p->set_var('tr_color',$this->theme['th_bg']); $p->set_var('hr_text','
'.$v['field'].'
'); $p->parse('row','hr',True); } else { $this->output_template_array($p,'row','list',$v); } } } else // preserve disabled fields { switch ($field) { case 'owner': $preserved[$field] = $event['id'] ? $event['participants'][$event['owner']] : 'A'; break; case 'recure_type': foreach(array('recur_type','recur_enddate','recur_data','recur_interval') as $field) { $preserved[$field] = $event[$field]; } break; case 'startdate': case 'enddate': $field = substr($field,0,-4); default: $preserved[$field] = $event[$field]; } } } unset($var); if (is_array($preserved)) { //echo "preserving
"; print_r($preserved); echo "
\n"; $p->set_var('common_hidden',$p->get_var('common_hidden').''."\n"); } $p->set_var('submit_button',lang('Save')); $delete_button = $cancel_button = ''; if ($event['id'] > 0) { $var = Array( 'action_url_button' => $this->page('delete','&cal_id='.$event['id']), 'action_text_button' => lang('Delete'), 'action_confirm_button' => "onClick=\"return confirm('".lang('Are you sure want to delete this entry?\\nThis will delete this entry for all users.')."')\"", 'action_extra_field' => '', 'button_id' => 'delete_button' ); $p->set_var($var); $delete_button = $p->fp('out','form_button'); } $p->set_var('delete_button',$delete_button); $p->set_var('alert_msg',lang('Required field (category) is empty')); if ($this->bo->return_to) { $var = Array( 'action_url_button' => $GLOBALS['phpgw']->link('/index.php','menuaction='.$this->bo->return_to), 'action_text_button' => lang('Cancel'), 'action_confirm_button' => '', 'action_extra_field' => '', 'button_id' => 'cancel_button' ); $p->set_var($var); $cancel_button = $p->fp('out','form_button'); } $p->set_var('cancel_button',$cancel_button); $p->pparse('out','edit_entry'); } function output_template_array(&$p,$row,$list,$var) { if (!isset($var['hidden_vars'])) { $var['hidden_vars'] = ''; } if (!isset($var['tr_color'])) { $var['tr_color'] = $GLOBALS['phpgw']->nextmatchs->alternate_row_color(); } $p->set_var($var); $p->parse($row,$list,True); } function get_organizations($context, $selected='', $recursive = false) { $s = CreateObject('phpgwapi.sector_search_ldap'); return ($recursive ? $s->get_organizations($context, $selected, false ,true) : $s->get_sectors($selected, false, false)); } /**********************************************/ function _debug_sqsof() { $data = array( 'filter' => $this->bo->filter, 'cat_id' => $this->bo->cat_id, 'owner' => $this->bo->owner, 'year' => $this->bo->year, 'month' => $this->bo->month, 'day' => $this->bo->day, 'sortby' => $this->bo->sortby, 'num_months' => $this->bo->num_months ); Return _debug_array($data,False); } /***********************************/ function search() { //print_r($_REQUEST); //echo "kkkkkkkkkkk".$_REQUEST['errormsg']; unset($GLOBALS['phpgw_info']['flags']['noheader']); unset($GLOBALS['phpgw_info']['flags']['nonavbar']); $GLOBALS['phpgw_info']['flags']['app_header'] = $GLOBALS['phpgw_info']['apps']['resources']['title'].' - '.lang('Search Results'); $GLOBALS['phpgw']->common->phpgw_header(); $error = ''; $matches = 0; //$event = $this->bo->read_entry($res_id); $event = $this->get_event_ids($adicional); //$event_ids = $this->bo->search_keywords($_POST['keywords']); $matches = count($event); //echo "matches" . $matches; if ($matches == 1) { $quantity = lang('1 match found').'.'; } elseif ($matches > 0) { $quantity = lang('%1 matches found',$matches).'.'; } else { echo lang('no matches found'); return; } $p = $GLOBALS['phpgw']->template; $p->set_file( Array( 'search_form' => 'search.tpl' ) ); $p->set_block('search_form','search','search'); $p->set_block('search_form','search_list_header','search_list_header'); $p->set_block('search_form','search_list','search_list'); $p->set_block('search_form','search_list_footer','search_list_footer'); $script=''; if($matches > 0) { $p->parse('rows','search_list_header',True); } //if($info){ foreach($event as $id => $data) { $datetime = $this->bo->maketime($event['start']) - $GLOBALS['phpgw']->datetime->tz_offset; $info = array( 'tr_color' => $GLOBALS['phpgw']->nextmatchs->alternate_row_color(), 'date' => $GLOBALS['phpgw']->common->show_date($datetime), 'id' => $data['id'], 'name' => $data['name'], 'description' => $data['short_description'], 'category' => $data['cat_name'], 'picture_src' => $data['picture_src'], 'administrador'=>$data['administrador'], 'email'=>$data['email'], 'owner'=>$data['owner'], 'accionmodificar' =>'index.php?menuaction=resources.uiresources.edit&id='. $data['id'], 'accionlistar' =>'index.php?menuaction=resources.uiresources.search2&id='. $data['name'], 'accionborrar' =>'index.php?menuaction=resources.uiresources.delete&id='. $data['id'], 'accionreservar' =>'index.php?menuaction=calendar.uicalendar.add&location='. $data['name'] ); //'accionagregar' =>'index.php?menuaction=resources.uiresources.edit&parent='. $data['id'] $p->set_var($info); $p->set_var($data); $p->parse('rows','search_list',True); } // } if($matches > 0) { $p->parse('rows','search_list_footer',True); } $p->pparse('out','search'); } function get_event_ids($search) { //echo "tamannn".count($search)." ".$search[0]; $from =""; //if (isset($_REQUEST['id'])){ // $from = ' and t1.res_id='.$_REQUEST['id']; // } $sql = "select t1.*,t2.cat_name from phpgw_resources t1 ,phpgw_categories t2 where t1.cat_id=t2.cat_id and t1.name !='n/a'" . $from; //.$search; //. 'WHERE (phpgw_cal_user.res_id = phpgw_cal.res_id) ' //. $where . $extra; //echo "FULL SQL : ".$sql."
\n"; if($this->debug) { echo "FULL SQL : ".$sql."
\n"; } //$resultado=pg_query($this->bo->connect(),$sql) or die("Error al mostrar"); $GLOBALS['phpgw']->db->query($sql,__LINE__,__FILE__); while( $GLOBALS['phpgw']->db->next_record() ) { // $valorfechaini=$this->bo->time2array($GLOBALS['phpgw']->db->f('res_start'),$alarm = 0); $ini=$valorfechaini['mday']."/".$valorfechaini['month']."/".$valorfechaini['year']; $valorfechaend=$this->bo->time2array($GLOBALS['phpgw']->db->f('res_end'),$alarm = 0); $end=$valorfechaend['mday']."/".$valorfechaend['month']."/".$valorfechaend['year']; $valorfechaend2=$this->bo->time2array($GLOBALS['phpgw']->db->f('res_modified'),$alarm = 0); $end2=$valorfechaend2['mday']."/".$valorfechaend2['month']."/".$valorfechaend2['year']; $imagen2=""; if($GLOBALS['phpgw']->db->f('picture_src')!=""){ $imagen2="db->f('picture_src')."'>"; } $retval[] = array( 'id' => $GLOBALS['phpgw']->db->f('res_id'), 'name' => $GLOBALS['phpgw']->db->f('name'), 'description' => $GLOBALS['phpgw']->db->f('short_description'), 'category' => $GLOBALS['phpgw']->db->f('cat_name'), 'picture_src' => $imagen2, 'administrador'=>$GLOBALS['phpgw']->db->f('administrador'), 'location'=>$GLOBALS['phpgw']->db->f('location'), 'email'=>$GLOBALS['phpgw']->db->f('email'), 'owner'=>$GLOBALS['phpgw']->db->f('owner') ); } return $retval; } function update() { # $vars = get_defined_vars(); # print_r($vars); /*foreach($_POST as $k=>$v){ $$k=$v; echo $$k."
"; } foreach($_POST as $nombre_campo => $valor){ $asignacion = "\$" . $nombre_campo . "='" . $valor . "';"; echo $asignacion."
"; } */ unset($GLOBALS['phpgw_info']['flags']['noheader']); unset($GLOBALS['phpgw_info']['flags']['nonavbar']); $GLOBALS['phpgw_info']['flags']['app_header'] = $GLOBALS['phpgw_info']['apps']['resources']['title'].' - '.lang('Search Results'); $GLOBALS['phpgw']->common->phpgw_header(); $error = ''; $matches = 0; list($dia,$mes,$ano)=split("/",$_POST['start']['str']); $starttime = $this->bo->maketime2($_POST['start']['hour'],$_POST['start']['min'],0,$dia,$mes,$ano,$_POST['start']['ampm']) - $GLOBALS['phpgw']->datetime->tz_offset; //echo $starttime; list($dia2,$mes2,$ano2)=split("/",$_POST['end']['str']); $endtime = $this->bo->maketime2($_POST['end']['hour'],$_POST['end']['min'],0,$dia2,$mes2,$ano2,$_POST['end']['ampm']) - $GLOBALS['phpgw']->datetime->tz_offset; //echo "gggg".$_POST['end2']['month']; if($_POST['end2']['str']['month']>0){ list($dia3,$mes3,$ano3)=split("/",$_POST['end2']['str']); $endtime2 = $this->bo->maketime2($_POST['end2']['hour'],$_POST['end2']['min'],0,$dia3,$mes3,$ano3,$_POST['end2']['ampm']) - $GLOBALS['phpgw']->datetime->tz_offset; }else{ $endtime2=0; } //$starttime = $this->bo->maketime2($starthora,$startmin,0,$startfecha) - $GLOBALS['phpgw']->datetime->tz_offset; //echo "kkkk3".$_POST['exec']['accesso']; if($_REQUEST['resources']['parent']==""){ $parent=0; }else{ $parent=$_REQUEST['resources']['parent']; } $resources=Array( name=>$_POST['resources']['name'], descripction=>$_POST['resources']['description'] ); $valores="&name=".$_POST['resources']['name']."&description=".$_POST['resources']['description']."&category=".$_POST['resources']['category']."&cantidad=".$_POST['resources']['cantidad']."&email=".$_POST['resources']['email']."&administrador=".$_POST['resources']['administrador']."&location=".$_POST['resources']['location'].""; //$GLOBALS['phpgw']->redirect($this->page($valores,'')); if($_POST['resources']['name']==""){ $GLOBALS['phpgw']->redirect($this->page('edit&error=44'.$valores,'')); } if($_POST['resources']['location']==""){ $GLOBALS['phpgw']->redirect($this->page('edit&error=45'.$valores,'')); } if($_POST['resources']['cantidad']==""){ $GLOBALS['phpgw']->redirect($this->page('edit&error=46'.$valores,'')); } if($_POST['resources']['email']==""){ $GLOBALS['phpgw']->redirect($this->page('edit&error=47'.$valores,'')); } if($_POST['resources']['description']==""){ $GLOBALS['phpgw']->redirect($this->page('edit&error=48'.$valores,'')); } /*ExecMethod('resources.uiresources.edit', Array( 'cd' => 13, 'readsess' => 1 ) );*/ //$parms['errormsg']=$GLOBALS['phpgw']->common->check_code(13); //echo $GLOBALS['phpgw']->common->check_code(13); //ExecMethod('resources.uiresources.index',$parms); // $GLOBALS['phpgw']->common->phpgw_exit(); // $endtime = $this->bo->maketime($event['end']) - $GLOBALS['phpgw']->datetime->tz_offset; if(isset($_POST['resources']['id'])&&$_POST['resources']['id']>0){ $sql = "update phpgw_resources set name='".$_POST['resources']['name']."',short_description='".$_POST['resources']['description']."',cat_id=".$_POST['resources']['category'].",quantity=".$_POST['resources']['cantidad'].",location='".$_POST['resources']['location']."',picture_src='".$_POST['resources']['picture_src']."', administrador='". $this->get_account_name($_POST['resources']['administrador'],'gecos')."',email='".$_POST['resources']['email']."',owner=".$_POST['resources']['owner']." where res_id='".$_POST['resources']['id']."'"; }else{ $sql = "insert into phpgw_resources (name,short_description,cat_id,quantity,location,picture_src, administrador,email,owner) values ('".$_POST['resources']['name']."','".$_POST['resources']['description']."',".$_POST['resources']['category'].",".$_POST['resources']['cantidad'].",'". $this->get_account_name($_POST['resources']['administrador'],'gecos')."','".$_POST['resources']['picture_src']."','".$_POST['resources']['administrador']."','".$_POST['resources']['email']."',".$_POST['resources']['owner'].")"; } $GLOBALS['phpgw']->db->query($sql,__LINE__,__FILE__); $GLOBALS['phpgw']->redirect($this->page('edit&error=14','')); return ""; } function get_account_name($account_id,$valor) { $acct_type = $this->get_type($account_id); /* jakjr: using justthese with ldap_search */ //$justthese = array("cn","uid","givenname","sn","gecos"); /* search the dn for the given uid */ $justthese = array("uidnumber", "cn", "mail","gecos","dn"); // $sri = @ldap_search($this->ds, "ou=usuarios,ou=cnti,dc=gob,dc=ve", ("(&(sn=*)(mail=*@*)(structuralObjectClass=inetOrgPerson)(deliveryMode=virtual))"), $justthese); if(($acct_type == 'g') && $this->group_context) { $sri = @ldap_search($this->ds, $this->group_context, '(gidnumber=' . (int)$account_id . ')', $justthese); } else { $sri = @ldap_search($this->ds, $this->user_context, '(uidnumber=' . (int)$account_id . ')', $justthese); } //echo $this->ds.",". $this->user_context.",". '(uidnumber=' . (int)$account_id . ')'.",". $justthese; if(!$sri) return False; $allValues = ldap_get_entries($this->ds, $sri); $retorna=""; if($acct_type =='g') { if($valor=='gecos') { $retorna=$GLOBALS['phpgw']->translation->convert($allValues[0]['gecos'][0],'utf-8'); } if($valor=='uidnumber') { $retorna=$GLOBALS['phpgw']->translation->convert($allValues[0]['uidnumber'][0],'utf-8'); } if($valor=='cn') { $retorna=$GLOBALS['phpgw']->translation->convert($allValues[0]['cn'][0],'utf-8'); } if($valor=='mail') { $retorna=$GLOBALS['phpgw']->translation->convert($allValues[0]['mail'][0],'utf-8'); } if($valor=='dn') { $retorna=$GLOBALS['phpgw']->translation->convert($allValues[0]['dn'][0],'utf-8'); } } else { if($valor=='gecos') { $retorna=$GLOBALS['phpgw']->translation->convert($allValues[0]['gecos'][0],'utf-8'); } if($valor=='uidnumber') { $retorna=$GLOBALS['phpgw']->translation->convert($allValues[0]['uidnumber'][0],'utf-8'); } if($valor=='cn') { $retorna=$GLOBALS['phpgw']->translation->convert($allValues[0]['cn'][0],'utf-8'); } if($valor=='mail') { $retorna=$GLOBALS['phpgw']->translation->convert($allValues[0]['mail'][0],'utf-8'); } if($valor=='dn') { $retorna=$GLOBALS['phpgw']->translation->convert($allValues[0]['dn'][0],'utf-8'); } } return $retorna; } function get_type($account_id) { $allValues = array(); /* jakjr: using justthese with ldap_search */ $sri = @ldap_search($this->ds, $this->user_context, '(&(uidnumber=' . (int)$account_id . ')(phpgwaccounttype=u))', array("phpgwaccounttype")); if(!$sri) return False; $allValues = ldap_get_entries($this->ds, $sri); if ($allValues[0]['phpgwaccounttype'][0]) { return $allValues[0]['phpgwaccounttype'][0]; } $allValues = array(); /* jakjr: using justthese with ldap_search */ $sri = @ldap_search($this->ds, $this->group_context, '(&(gidnumber=' . (int)$account_id . ')(phpgwaccounttype=g))', array("phpgwaccounttype")); if(!$sri) return False; $allValues = ldap_get_entries($this->ds, $sri); if ($allValues[0]['phpgwaccounttype'][0]) { return $allValues[0]['phpgwaccounttype'][0]; } return False; } function select($id) { $sql = "select * from phpgw_resources where res_id='".$id."'"; $GLOBALS['phpgw']->db->query($sql,__LINE__,__FILE__); if( $GLOBALS['phpgw']->db->next_record() ) { $retval = array( 'id' => $GLOBALS['phpgw']->db->f('res_id'), 'name' => $GLOBALS['phpgw']->db->f('name'), 'descripcion' => $GLOBALS['phpgw']->db->f('short_description'), 'category' => $GLOBALS['phpgw']->db->f('cat_id'), 'picture_src' => $GLOBALS['phpgw']->db->f('picture_src'), 'administrador'=>$GLOBALS['phpgw']->db->f('administrador'), 'email'=>$GLOBALS['phpgw']->db->f('email'), 'location'=>$GLOBALS['phpgw']->db->f('location'), 'cantidad'=>$GLOBALS['phpgw']->db->f('quantity'), 'owner'=>$GLOBALS['phpgw']->db->f('owner') ); } //echo "iddd".$id." 56666 ".$retval['id']; return $retval; } function select_init() { $id=0; if(isset($_REQUEST['resources[id]'])){ $id=$_REQUEST['resources[id]']; } $name=""; if(isset($_REQUEST['name'])){ $name=$_REQUEST['name']; } $description=""; if(isset($_REQUEST['description'])){ $description=$_REQUEST['description']; } $catgory=0; if(isset($_REQUEST['category'])){ $category=$_REQUEST['category']; } $administrador=""; if(isset($_REQUEST['administrador'])){ $administrador=$_REQUEST['administrador']; } $email=""; if(isset($_REQUEST['email'])){ $email=$_REQUEST['email']; } $cantidad=0; if(isset($_REQUEST['cantidad'])){ $cantidad=$_REQUEST['cantidad']; } $location=""; if(isset($_REQUEST['location'])){ $location=$_REQUEST['location']; } $retval = array( 'id' => $id, 'name' => $name, 'descripcion' => $description, 'category' => $category, 'picture_src' => 'generic.png', 'administrador'=>$administrador, 'location'=>$location, 'email'=>$email, 'cantidad'=>$cantidad, 'owner'=>$this->bo->owner ); return $retval; } function delete() { # $vars = get_defined_vars(); # print_r($vars); /*foreach($_POST as $k=>$v){ $$k=$v; echo $$k."
"; } foreach($_POST as $nombre_campo => $valor){ $asignacion = "\$" . $nombre_campo . "='" . $valor . "';"; echo $asignacion."
"; } */ unset($GLOBALS['phpgw_info']['flags']['noheader']); unset($GLOBALS['phpgw_info']['flags']['nonavbar']); $GLOBALS['phpgw_info']['flags']['app_header'] = $GLOBALS['phpgw_info']['apps']['infolog']['title'].' - '.lang('Search Results'); $GLOBALS['phpgw']->common->phpgw_header(); $error = ''; $matches = 0; // $endtime = $this->bo->maketime($event['end']) - $GLOBALS['phpgw']->datetime->tz_offset; $sql = "delete from phpgw_resources where res_id='".$_GET['id']."'"; $GLOBALS['phpgw']->db->query($sql,__LINE__,__FILE__); $params['errormsg'] = ''; $GLOBALS['phpgw']->redirect($this->page('search',$params)); return ""; } function translate($key,$vars=false, $not_found='*' ) { if ($this->async) return $GLOBALS['phpgw']->translation->translate_async($key, $vars); return lang($key, $vars); } function maketime($time) { return mktime(intval($time['hour']),intval($time['min']),intval($time['sec']),intval($time['month']),intval($time['mday']),intval($time['year'])); } function search2() { //print_r($_REQUEST); $this->today = date('Ymd',$GLOBALS['phpgw']->datetime->users_localtime); $jscal = CreateObject('phpgwapi.jscalendar'); // before phpgw_header() !!! unset($GLOBALS['phpgw_info']['flags']['noheader']); unset($GLOBALS['phpgw_info']['flags']['nonavbar']); $GLOBALS['phpgw_info']['flags']['app_header'] = $GLOBALS['phpgw_info']['apps']['resources']['title'].' - '.lang('Search Results'); $GLOBALS['phpgw']->common->phpgw_header(); $error = ''; $matches = 0; //echo "aaaaa".$GLOBALS['phpgw']->common->show_date(1288884600); //echo "aaaaa".$GLOBALS['phpgw']->common->show_date(1288886400); if (isset($_REQUEST['fecha'])){ list($dia,$mes,$ano)=split("/",$_REQUEST['fecha']); if (isset($_REQUEST['fecha2'])){ list($dia2,$mes2,$ano2)=split("/",$_REQUEST['fecha2']); }else{ list($dia2,$mes2,$ano2)=split("/",$_REQUEST['fecha']); } if(isset($_REQUEST['hora'])){ list($horai,$minutoi,$horaf,$minutof)=split(":",$_REQUEST['hora']); }else{ $horai=0; $minutoi=0; $horaf=23; $minutof=59; } $starttimea = $this->bo->maketime2(0,0,0,$dia,$mes,$ano,'am') - $GLOBALS['phpgw']->datetime->tz_offset; }else{ $localtime = $GLOBALS['phpgw']->datetime->users_localtime; $ano = date('Y',$localtime); $mes = date('m',$localtime); $dia = date('d',$localtime); $ano2 = date('Y',$localtime); $mes2 = date('m',$localtime); $dia2 = date('d',$localtime); $horai=0; $minutoi=0; $horaf=23; $minutof=59; //$starttime = $this->bo->maketime2(0,0,0,$dia,$mes,$ano,'am') - $GLOBALS['phpgw']->datetime->tz_offset; ///echo $starttime; //$starttime2 = $this->bo->maketime2(23,59,59,$dia,$mes,$ano,'pm') - $GLOBALS['phpgw']->datetime->tz_offset; ///echo $starttime2; } $pm='pm'; if($horaf<12){ $pm='am'; }else{ $horaf=$horaf-12; } $am='am'; if($horai>11){ $am='pm'; $horai=$horai-12; } //echo $horai."
".$starttimea."
".$horaf; $starttime = $this->bo->maketime2($horai,$minutoi,0,$dia,$mes,$ano,$am) - $GLOBALS['phpgw']->datetime->tz_offset; //echo "fff".$starttime; $starttime2 = $this->bo->maketime2($horaf,$minutof,59,$dia2,$mes2,$ano2,$pm) - $GLOBALS['phpgw']->datetime->tz_offset; ///echo $starttime2; //$event = $this->bo->read_entry($res_id); $location=''; if($_GET['id']!=''){ $location=$_GET['id'];}else{ $location='n/a';} /*$eventtt=$this->bo->store_to_cache( Array( 'syear' => $ano, 'smonth' => $mes, 'sday' => $dia, 'shour' => $horai, 'smin' => $minutoi, 'eyear' => $ano, 'emonth' => $mes, 'eday' => $dia, 'fhour' => $horaf, 'fmin' => $minutof, 'location' => $location ) ); */ $date_to_eval = sprintf("%04d%02d%02d",$ano,$mes,$dia); // echo "date _to _eval".$date_to_eval."
"; //$events = $this->bo->cached_events[$date_to_eval];//(5,23,0,22,10,2010) $events=$this->bo->overlap($starttime,$starttime2,Array(),0,0,'False',$location); print_debug('Date',$date_to_eval); print_debug('Count',count($events)); //echo "llll
".'Date'.$date_to_eval; //echo "llll
".'Count'.count($events); if(count($events)>0){ foreach($events as $event) { if ($this->bo->rejected_no_show($event)) { continue; // user does not want to see rejected events } if ($event['recur_type']) // calculate start- + end-datetime for recuring events { $this->bo->set_recur_date($event,$date_to_eval); } //$events_to_show[] = array( // 'starttime' => $this->bo->maketime($event['start']), // 'endtime' => $this->bo->maketime($event['end']), // 'content' => $this->link_to_entry($event,$mes,$dia,$ano) //); } } //echo "eeeevento".count($event)."
"; $date_to_eval = sprintf("%04d%02d%02d",$ano,$mes,$dia); //$event = $this->get_event_ids2($_REQUEST['id'],$starttime,$starttime2); //$event_ids = $this->bo->search_keywords($_POST['keywords']); $matches = count($event); //echo "matches" . $matches."
"; if ($matches == 1) { $quantity = lang('1 match found').'.'; } elseif ($matches > 0) { $quantity = lang('%1 matches found',$matches).'.'; } else { echo lang('no matches found')." para el ".$dia."/".$mes."/".$ano." en la sala:".$location; //return; } if ($matches > 0){ $p = $GLOBALS['phpgw']->template; $p->set_file( Array( 'search_form' => 'search2.tpl' ) ); }else{ $p = $GLOBALS['phpgw']->template; $p->set_file( Array( 'search_form' => 'search3.tpl' ) ); } $p->set_block('search_form','search','search'); $p->set_block('search_form','search_list_header','search_list_header'); $p->set_block('search_form','search_list','search_list'); $p->set_block('search_form','search_list_footer','search_list_footer'); $script=''; if($matches > 0) { $p->parse('rows','search_list_header',True); } //if($info){ //echo $matches; //for($i=0;$i<$matches;$i++) // { //echo "i".$i; if(count($events)>0){ foreach($events as $id => $data) { //echo "
dataaaa".$data['title']; //echo "
".$this->get_account_name($data['owner'],'gecos')." ".$data['owner']; $datetime = $this->bo->maketime($event['start']) - $GLOBALS['phpgw']->datetime->tz_offset; //echo "ffffffeeecha".$GLOBALS['phpgw']->common->show_date($data[$i]['datetime'])." ".$data[$i]['start']." ".$this->bo->maketime($data[$i]['start']); //echo $data['location']." .. ".$data['last_status']." .. ".$data['is_public']; if($data['public']==1){ $descripcion=$data['description']; $name=$data['title']; }else{ $descripcion='-'; $name='Privado'; } $dueno=$this->get_account_name($data['owner'],'gecos'); $info = array( 'tr_color' => $GLOBALS['phpgw']->nextmatchs->alternate_row_color(), 'date' => $GLOBALS['phpgw']->common->show_date($datetime), 'id' => $data['id'], 'name' => $name, 'description' => $descripcion, 'location' =>$data['location'], 'owner'=>$this->get_account_name($data['owner'],'gecos'), 'fecha'=> $dia."/".$mes."/".$ano."
".$GLOBALS['phpgw']->common->show_hour($this->bo->maketime($data['start']))."-".$GLOBALS['phpgw']->common->show_hour($this->bo->maketime($data['end'])), 'priority'=>'', 'ispublic'=>$data['is_public'], 'accionmodificar' =>'index.php?menuaction=resources.uiresources.edit&id='. $data['id'], 'accionlistar' =>'index.php?menuaction=resources.uiresources.search2&id='. $data['id'], 'accionborrar' =>$data['id'], 'accionreservar' =>'index.php?menuaction=calendar.uicalendar.add&location='. $data['id'] ); //'accionagregar' =>'index.php?menuaction=resources.uiresources.edit&parent='. $data['id'] $p->set_var($info); $p->set_var($info); $p->parse('rows','search_list',True); } //} // } } if($matches > 0) { $p->parse('rows','search_list_footer',True); } $p->pparse('out','search'); } function search22() { //print_r($_REQUEST); $jscal = CreateObject('phpgwapi.jscalendar'); // before phpgw_header() !!! unset($GLOBALS['phpgw_info']['flags']['noheader']); unset($GLOBALS['phpgw_info']['flags']['nonavbar']); $GLOBALS['phpgw_info']['flags']['app_header'] = $GLOBALS['phpgw_info']['apps']['resources']['title'].' - '.lang('Search Results'); $GLOBALS['phpgw']->common->phpgw_header(); $error = ''; $matches = 0; //echo "aaaaa".$GLOBALS['phpgw']->common->show_date(1288884600); //echo "aaaaa".$GLOBALS['phpgw']->common->show_date(1288886400); if (isset($_REQUEST['fecha'])){ list($dia,$mes,$ano)=split("/",$_REQUEST['fecha']); $starttime = $this->bo->maketime2(0,0,0,$dia,$mes,$ano,'am') - $GLOBALS['phpgw']->datetime->tz_offset; ///echo $starttime; $starttime2 = $this->bo->maketime2(23,59,59,$dia,$mes,$ano,'pm') - $GLOBALS['phpgw']->datetime->tz_offset; ///echo $starttime2; } //$event = $this->bo->read_entry($res_id); $event = $this->get_event_ids2($_REQUEST['id'],$starttime,$starttime2); //$event_ids = $this->bo->search_keywords($_POST['keywords']); $matches = count($event); //echo "matches" . $matches; if ($matches == 1) { $quantity = lang('1 match found').'.'; } elseif ($matches > 0) { $quantity = lang('%1 matches found',$matches).'.'; } else { echo lang('no matches found'); return; } $p = $GLOBALS['phpgw']->template; $p->set_file( Array( 'search_form' => 'search2.tpl' ) ); $p->set_block('search_form','search','search'); $p->set_block('search_form','search_list_header','search_list_header'); $p->set_block('search_form','search_list','search_list'); $p->set_block('search_form','search_list_footer','search_list_footer'); $script=''; if($matches > 0) { $p->parse('rows','search_list_header',True); } //if($info){ foreach($event as $id => $data) { $datetime = $this->bo->maketime($event['start']) - $GLOBALS['phpgw']->datetime->tz_offset; $info = array( 'tr_color' => $GLOBALS['phpgw']->nextmatchs->alternate_row_color(), 'date' => $GLOBALS['phpgw']->common->show_date($datetime), 'id' => $data['id'], 'name' => $data['name'], 'description' => $data['short_description'], 'location' =>$data['namelocation'], 'owner'=>$this->get_account_name($data['owner'],'gecos'), 'fecha'=>$data['fech'], 'priority'=>$data['priority'], 'ispublic'=>$data['ispublic'], 'accionmodificar' =>'index.php?menuaction=resources.uiresources.edit&id='. $data['id'], 'accionlistar' =>'index.php?menuaction=resources.uiresources.search2&id='. $data['id'], 'accionborrar' =>$data['id'], 'accionreservar' =>'index.php?menuaction=calendar.uicalendar.add&location='. $data['id'] ); //'accionagregar' =>'index.php?menuaction=resources.uiresources.edit&parent='. $data['id'] $p->set_var($info); $p->set_var($data); $p->parse('rows','search_list',True); } // } if($matches > 0) { $p->parse('rows','search_list_footer',True); } $p->pparse('out','search'); } function get_event_ids2($idd,$starttime,$starttime2) { $from =""; $from =""; if (isset($idd)){ $from = ' and t1.location=\''.$idd.'\' '; } if (isset($starttime)){ $from =$from .' and t1.datetime>=\''.$starttime.'\''; if (isset($starttime2)){ $from =$from .' and t1.datetime<=\''.$starttime2.'\' '; } } $sql = 'select t1.cal_id ,t1.owner,t1.groups,t1.datetime,t1.edatetime, t1.priority ,t1.cal_type, t1.is_public , t1.title,t1.description,t1.location , t2.list_descripcion as publico,t3.list_descripcion as priority ,t4.name as namelocation from phpgw_cal t1, phpgw_listas t2, phpgw_listas t3 ,phpgw_resources t4 where t1.is_public =t2.list_id and t2.list_name=\'visibility\' and t1.priority=t3.list_id and t3.list_name=\'priority\' and t1.location=t4.name ' . $from. "order by t1.datetime desc "; //.$search; //. 'WHERE (phpgw_cal_user.res_id = phpgw_cal.res_id) ' //. $where . $extra; //echo $sql; if($this->debug) { echo "FULL SQL : ".$sql."
\n"; } //$resultado=pg_query($this->bo->connect(),$sql) or die("Error al mostrar"); $GLOBALS['phpgw']->db->query($sql,__LINE__,__FILE__); while( $GLOBALS['phpgw']->db->next_record() ) { // //$valorfechaini=$this->bo->time2array($GLOBALS['phpgw']->db->f('datetime'),$alarm = 0); //$ini=$valorfechaini['mday']."/".$valorfechaini['month']."/".$valorfechaini['year']; $ini=$GLOBALS['phpgw']->common->show_date($GLOBALS['phpgw']->db->f('datetime'))."-".$GLOBALS['phpgw']->common->show_date($GLOBALS['phpgw']->db->f('edatetime')); $retval[] = array( 'id' => $GLOBALS['phpgw']->db->f('cat_id'), 'name' => $GLOBALS['phpgw']->db->f('title'), 'description' => $GLOBALS['phpgw']->db->f('description'), 'location'=>$GLOBALS['phpgw']->db->f('namelocation'), 'groups'=>$GLOBALS['phpgw']->db->f('groups'), 'owner'=>$this->get_account_name($GLOBALS['phpgw']->db->f('owner'),'gecos'), 'fecha'=>$ini, 'priority'=>$GLOBALS['phpgw']->db->f('priority'), 'ispublic'=>$GLOBALS['phpgw']->db->f('publico') ); } return $retval; } function link_to_entry($event,$month,$day,$year) { $str = ''; $is_private = !$event['public'] && !$this->bo->check_perms(PHPGW_ACL_READ,$event); $viewable = !$this->bo->printer_friendly && $this->bo->check_perms(PHPGW_ACL_READ,$event); $starttime = $this->bo->maketime($event['start']) - $GLOBALS['phpgw']->datetime->tz_offset; $endtime = $this->bo->maketime($event['end']) - $GLOBALS['phpgw']->datetime->tz_offset; $rawdate = mktime(0,0,0,$month,$day,$year); $rawdate_offset = $rawdate - $GLOBALS['phpgw']->datetime->tz_offset; $nextday = mktime(0,0,0,$month,$day + 1,$year) - $GLOBALS['phpgw']->datetime->tz_offset; if ((int)$GLOBALS['phpgw']->common->show_date($starttime,'Hi') && $starttime == $endtime) { $time = $GLOBALS['phpgw']->common->show_date($starttime,$this->bo->users_timeformat); } elseif ($starttime <= $rawdate_offset && $endtime >= $nextday - 60) { $time = '[ '.lang('All Day').' ]'; } elseif ((int)$GLOBALS['phpgw']->common->show_date($starttime,'Hi') || $starttime != $endtime) { if($starttime < $rawdate_offset && $event['recur_type'] == MCAL_RECUR_NONE) { $start_time = $GLOBALS['phpgw']->common->show_date($rawdate_offset,$this->bo->users_timeformat); } else { $start_time = $GLOBALS['phpgw']->common->show_date($starttime,$this->bo->users_timeformat); } if($endtime >= ($rawdate_offset + 86400)) { $end_time = $GLOBALS['phpgw']->common->show_date(mktime(23,59,59,$month,$day,$year) - $GLOBALS['phpgw']->datetime->tz_offset,$this->bo->users_timeformat); } else { $end_time = $GLOBALS['phpgw']->common->show_date($endtime,$this->bo->users_timeformat); } $time = $start_time.'-'.$end_time; } else { $time = ''; } $texttitle = $texttime = $textdesc = $textlocation = $textstatus = ''; if(!$is_private) { //$text .= $this->bo->display_status($event['users_status']); // split text for better display by templates, also see $texttime $texttitle $textdesc $textlocation $textstatus=$this->bo->display_status($event['users_status']); } /* $text = ' '.$time.'  '.$this->bo->get_short_field($event,$is_private,'title').$text. (!$is_private && $event['description'] ? ': '.$this->bo->get_short_field($event,$is_private,'description').'':''). $GLOBALS['phpgw']->browser->br; */ $texttime=$time; $texttitle=$this->bo->get_short_field($event,$is_private,'title'); $textdesc=(!$is_private && $event['description'] ? $this->bo->get_short_field($event,$is_private,'description'):''); // added $textlocation but this must be activated in the actual pict_link.tpl file of the used template set $textlocation=$this->bo->get_short_field($event,$is_private,'location'); if ($viewable) { $date = sprintf('%04d%02d%02d',$year,$month,$day); $this->link_tpl->set_var('link_link',$this->page('view','&cal_id='.$event['id'].'&date='.$date)); $this->link_tpl->set_var('lang_view',lang('View this entry')); $this->link_tpl->set_var('desc', $textdesc); $this->link_tpl->set_var('location', $textlocation); $this->link_tpl->parse('picture','link_open',True); } if (!$is_private) { if($event['priority'] == 3) { $picture[] = Array( 'pict' => $GLOBALS['phpgw']->common->image('calendar','high'), 'width' => 16, 'height'=> 16, 'title' => lang('high priority') ); } if($event['recur_type'] == MCAL_RECUR_NONE) { $picture[] = Array( 'pict' => $GLOBALS['phpgw']->common->image('calendar','circle'), 'width' => 9, 'height'=> 9, 'title' => lang('single event') ); } else { $picture[] = Array( 'pict' => $GLOBALS['phpgw']->common->image('calendar','recur'), 'width' => 12, 'height'=> 12, 'title' => lang('recurring event') ); } } if($event['public'] == 0) { $picture[] = Array( 'pict' => $GLOBALS['phpgw']->common->image('calendar','private'), 'width' => 13, 'height'=> 13, 'title' => lang('private') ); } /** if(@isset($event['alarm']) && count($event['alarm']) >= 1 && !$is_private) { // if the alarm is to go off the day before the event // the icon does not show up because of 'alarm_today' // - TOM if($this->bo->alarm_today($event,$rawdate_offset,$starttime)) { $picture[] = Array( 'pict' => $GLOBALS['phpgw']->common->image('calendar','alarm'), 'width' => 13, 'height'=> 13, 'title' => lang('alarm') ); } }*/ $description = $this->bo->get_short_field($event,$is_private,'description'); for($i=0;$i $picture[$i]['pict'], 'width' => $picture[$i]['width'], 'height' => $picture[$i]['height'], 'title' => $picture[$i]['title'] ); $this->output_template_array($this->link_tpl,'picture','pict',$var); } if ($texttitle) { $var = Array( // 'text' => $text, 'time'=> $texttime, 'title'=> $texttitle, 'users_status'=>$textstatus, 'desc'=> $textdesc, 'location'=> "
Local: ".$textlocation ); $this->output_template_array($this->link_tpl,'picture','link_text',$var); } if ($viewable) { $this->link_tpl->parse('picture','link_close',True); } $str = $this->link_tpl->fp('out','link_pict'); $this->link_tpl->set_var('picture',''); $this->link_tpl->set_var('out',''); // unset($p); return $str; } } ?>