[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] CVS: phpgwapi/inc class.sbox2.inc.php,1.11,1.12
From: |
Mark A Peters <address@hidden> |
Subject: |
[Phpgroupware-cvs] CVS: phpgwapi/inc class.sbox2.inc.php,1.11,1.12 |
Date: |
Sun, 30 Jun 2002 08:18:10 -0400 |
Update of /cvsroot/phpgroupware/phpgwapi/inc
In directory subversions:/tmp/cvs-serv19691/phpgwapi/inc
Modified Files:
class.sbox2.inc.php
Log Message:
GNU Patch #305.
Index: class.sbox2.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/phpgwapi/inc/class.sbox2.inc.php,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -r1.11 -r1.12
*** class.sbox2.inc.php 24 Feb 2002 21:21:53 -0000 1.11
--- class.sbox2.inc.php 30 Jun 2002 12:18:07 -0000 1.12
***************
*** 125,128 ****
--- 125,205 ----
}
+ function event2name( $event )
+ {
+ if (!is_object($this->bocal))
+ {
+ $this->bocal =
createobject('calendar.bocalendar');
+ }
+ if (!is_array($event) && (int) $event > 0)
+ {
+ $event = $this->bocal->read_entry($event);
+ }
+ if (!is_array($event))
+ {
+ return 'not an event !!!';
+ }
+ $name =
$GLOBALS['phpgw']->common->show_date($this->bocal->maketime($event['start']) -
$this->bocal->datetime->tz_offset);
+ $name .= ' -- ' .
$GLOBALS['phpgw']->common->show_date($this->bocal->maketime($event['end']) -
$this->bocal->datetime->tz_offset);
+ $name .= ': ' . $event['title'];
+
+ return $GLOBALS['phpgw']->strip_html($name);
+ }
+
+ /*
+ * Function Allows you to show and select an event
from the calendar (works with and without javascript !!!)
+ * Parameters $name string with basename of all
variables (not to conflict with the name other template or submitted vars !!!)
+ * $id_name
id of the address for edit or 0 if none selected so far
+ * $query_name have to be
called $query_XXX, the search pattern after the submit, has to be passed back
to the function
+ * $multipe present
a multiple selectable box instead of one selector-button
+ * On Submit $id_XXX contains the selected event (if
!= 0)
+ * $query_XXX search
pattern if the search button is pressed by the user, or '' if regular submit
+ * Returns array with vars to set for the
template, set with: $template->set_var( getEvent( ... )); (see getId( ))
+ *
+ * Note As query's for an event are submitted,
you have to check $query_XXX if it is a search or a regular submit
(!$query_string)
+ */
+ function getEvent(
$name,$id_name,$query_name,$title='',$multiple=False)
+ {
+ // echo
"<p>getEvent('$name',$id_name,'$query_name','$title')</p>";
+
+ // fallback if calendar is not installed or not enabled
for user
+ if (!file_exists(PHPGW_SERVER_ROOT.'/calendar') ||
!$GLOBALS['phpgw_info']['user']['apps']['calendar']['enabled'])
+ {
+ return array(
+ $name => "<input type=\"hidden\"
name=\"id_$name\" value=\"$id_name\">\n",
+ $name.'_no_js' => '',
+ $name.'_title' => ''
+ );
+ }
+ if ($id_name || $query_name)
+ {
+ if (!is_object($this->bocal))
+ {
+ $this->bocal =
createobject('calendar.bocalendar');
+ }
+ if ($query_name)
+ {
+ $event_ids =
$this->bocal->search_keywords($query_name);
+ $content = array( );
+ while ($event_ids && list( $key,$id ) =
each( $event_ids ))
+ {
+ $content[$id] =
$this->event2name( $id );
+ }
+ }
+ else
+ {
+ $event = $this->bocal->read_entry(
$id_name );
+ if ($event && is_array($event))
+ {
+ $content = $this->event2name(
$event );
+ }
+ }
+ }
+ if (!$title)
+ {
+ $title = lang('Calendar');
+ }
+ return $this->getId($name,$title,lang('Pattern for
Search in Calendar'),$id_name,$content,lang('use Button to search for
Calendarevent'),$multiple);
+ }
+
function addr2name( $addr )
{
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] CVS: phpgwapi/inc class.sbox2.inc.php,1.11,1.12,
Mark A Peters <address@hidden> <=