* * 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 uiresourcescal { var $dbb; var $template; var $cat; var $debug = False; var $cat_id; var $theme; var $link_tpl; var $public_functions = array( 'search4' => True,'search5' => True ); var $prefs; var $bo; var $link; var $tmpl; var $html; var $duration_format = ','; // comma is necessary! var $optionldap; function search4() { $this->bo = CreateObject('resources.boresources',1); $this->today = date('Ymd',$GLOBALS['phpgw']->datetime->users_localtime); $error = ''; $matches = 0; 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; } $pm='pm'; if($horaf<12){ $pm='am'; }else{ $horaf=$horaf-12; } $am='am'; if($horai>11){ $am='pm'; $horai=$horai-12; } $starttime = $this->bo->maketime2($horai,$minutoi,0,$dia,$mes,$ano,$am) - $GLOBALS['phpgw']->datetime->tz_offset; $starttime2 = $this->bo->maketime2($horaf,$minutof,59,$dia2,$mes2,$ano2,$pm) - $GLOBALS['phpgw']->datetime->tz_offset; $location=''; if($_GET['id']!=''){ $location=$_GET['id'];}else{ $location='n/a';} $date_to_eval = sprintf("%04d%02d%02d",$ano,$mes,$dia); if($_GET['calid']!='0'){ $l_ids=array($_GET['calid']); }else{ $l_ids=0; } $events=$this->bo->overlap($starttime,$starttime2,Array(),0,$l_ids,'False',$location); print_debug('Date',$date_to_eval); print_debug('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); } } } $date_to_eval = sprintf("%04d%02d%02d",$ano,$mes,$dia); $matches = count($event); $hay="Para el ".$dia."/".$mes."/".$ano." en la sala: ".$location ." y a la hora indicada esta ocupada por:"; if ($matches == 1) { $quantity = lang('1 match found').'.'; } elseif ($matches > 0) { $quantity = lang('%1 matches found',$matches).'.'; } else { $nohay="Para el ".$dia."/".$mes."/".$ano." en la sala: ".$location ." y a la hora indicada por ud esta disponible."; } $script=''; ?> Expresso CNTI [Recursos] 0){ echo $hay;?>

$data) { $datetime = $this->bo->maketime($event['start']) - $GLOBALS['phpgw']->datetime->tz_offset; if($data['public']==1){ $descripcion=$data['description']; $name=$data['title']; }else{ $descripcion='-'; $name='Privado'; } $dueno=$this->get_account_name($data['owner'],'gecos'); echo ""; } }else{ echo $nohay; } ?>
Nombre Descripción Responsable Hora
".$name."".$descripcion."".$dueno." ".$GLOBALS['phpgw']->common->show_hour($this->bo->maketime($data['start']))."-".$GLOBALS['phpgw']->common->show_hour($this->bo->maketime($data['end']))."
0) { // $p->parse('rows','search_list_footer',True); }*/ // $p->pparse('out','search'); } function search5() { $this->bo = CreateObject('resources.boresources',1); $this->today = date('Ymd',$GLOBALS['phpgw']->datetime->users_localtime); $error = ''; $matches = 0; 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; } $pm='pm'; if($horaf<12){ $pm='am'; }else{ $horaf=$horaf-12; } $am='am'; if($horai>11){ $am='pm'; $horai=$horai-12; } $starttime = $this->bo->maketime2($horai,$minutoi,0,$dia,$mes,$ano,$am) - $GLOBALS['phpgw']->datetime->tz_offset; $starttime2 = $this->bo->maketime2($horaf,$minutof,59,$dia2,$mes2,$ano2,$pm) - $GLOBALS['phpgw']->datetime->tz_offset; $location=''; if($_GET['id']!=''){ $location=$_GET['id'];}else{ $location='n/a';} $date_to_eval = sprintf("%04d%02d%02d",$ano,$mes,$dia); //echo $_GET['participants'].size; //$participantes=Array($_GET['participants']); $partes=split(",",$_GET['participants']); $l_participants = array(); for ($i = 0; $i < count($partes); $i++) { $l_participants[$partes[$i]]='U'; } if($_GET['calid']!='0'){ $l_ids=array($_GET['calid']); }else{ $l_ids=0; } $events=$this->bo->overlap($starttime,$starttime2,$l_participants,0,$l_ids,'False'); //$events=$this->bo->overlap($starttime,$starttime2,Array(),0,0,'False',$location); print_debug('Date',$date_to_eval); print_debug('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); } } } $date_to_eval = sprintf("%04d%02d%02d",$ano,$mes,$dia); $matches = count($event); $hay="Para el ".$dia."/".$mes."/".$ano." y a la hora indicada por ud esta(n) ocupados los participantes:"; if ($matches == 1) { $quantity = lang('1 match found').'.'; } elseif ($matches > 0) { $quantity = lang('%1 matches found',$matches).'.'; } else { $nohay="Para el ".$dia."/".$mes."/".$ano." y a la hora indicada por ud estan disponible los participantes."; } $script=''; ?> Expresso CNTI [Recursos] 0){ echo $hay;?>

$data) { $datetime = $this->bo->maketime($event['start']) - $GLOBALS['phpgw']->datetime->tz_offset; if($data['public']==1){ $descripcion=$data['description']; $name=$data['title']; }else{ $descripcion='-'; $name='Privado'; } $dueno=$this->get_account_name($data['owner'],'gecos'); $participantesreunion=""; $overlapped_event = $this->bo->read_entry2($data['id'],True); // echo "rrrr".$overlapped_event."lllll".count($overlapped_event); $participantesreunion=""; foreach($overlapped_event['participants'] as $id => $status) { //$conflict = isset($event['participants'][$id]); for ($i = 0; $i < count($partes); $i++) { //echo $partes[$i]; if($partes[$i]==$id) $participantesreunion .= '
  • '.$GLOBALS['phpgw']->common->grab_owner_name($id)."
  • "; } } echo ""; } }else{ echo $nohay; } ?>
    Nombre Descripción Responsable Participantes Hora
    ".$name."".$descripcion."".$dueno."".$participantesreunion." ".$GLOBALS['phpgw']->common->show_hour($this->bo->maketime($data['start']))."-".$GLOBALS['phpgw']->common->show_hour($this->bo->maketime($data['end']))."
    0) { // $p->parse('rows','search_list_footer',True); }*/ // $p->pparse('out','search'); } 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 get_account_name($account_id,$valor) { $this->user_context = $GLOBALS['phpgw_info']['server']['ldap_context']; $this->group_context = $GLOBALS['phpgw_info']['server']['ldap_group_context']; $acct_type = $this->get_type($account_id); $this->ds = $GLOBALS['phpgw']->common->ldapConnect(); if(!$this->ds) $this->ds = $GLOBALS['phpgw']->common->ldapConnect(); /* 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; } } ?>