1 |
dashley |
35 |
<?php
|
2 |
|
|
//$Header: /hl/cvsroots/gpl01/gpl01/webprojs/fboprime/sw/phplib/cslx.inc,v 1.2 2006/11/04 23:46:57 dashley Exp $
|
3 |
|
|
//********************************************************************************
|
4 |
|
|
//Copyright (C)2006 David T. Ashley
|
5 |
|
|
//********************************************************************************
|
6 |
|
|
//This program or source file is free software; you can redistribute it and/or
|
7 |
|
|
//modify it under the terms of the GNU General Public License as published by
|
8 |
|
|
//the Free Software Foundation; either version 2 of the License, or (at your
|
9 |
|
|
//option) any later version.
|
10 |
|
|
//
|
11 |
|
|
//This program or source file is distributed in the hope that it will
|
12 |
|
|
//be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 |
|
|
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14 |
|
|
//GNU General Public License for more details.
|
15 |
|
|
//
|
16 |
|
|
//You may have received a copy of the GNU General Public License
|
17 |
|
|
//along with this program; if not, write to the Free Software
|
18 |
|
|
//Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
19 |
|
|
//********************************************************************************
|
20 |
|
|
//Dave Ashley, 04/06
|
21 |
|
|
//
|
22 |
|
|
//This source file contains functions to deal with comma-separated lists not
|
23 |
|
|
//required by the dayview scheduler.
|
24 |
|
|
//
|
25 |
|
|
//require_once("sitehashkey.inc");
|
26 |
|
|
//
|
27 |
|
|
//--------------------------------------------------------------------------------
|
28 |
|
|
//Transitions from a comma-separated list to an array of strings. Returns
|
29 |
|
|
//FALSE if empty set.
|
30 |
|
|
//
|
31 |
|
|
function CSL_csl_to_string_array($csl_in)
|
32 |
|
|
{
|
33 |
|
|
//Rip of end spaces.
|
34 |
|
|
//
|
35 |
|
|
$csl_in = Trim($csl_in);
|
36 |
|
|
|
37 |
|
|
if (strlen($csl_in) == 0)
|
38 |
|
|
{
|
39 |
|
|
return(FALSE);
|
40 |
|
|
}
|
41 |
|
|
else
|
42 |
|
|
{
|
43 |
|
|
//Remove any leading comma.
|
44 |
|
|
//
|
45 |
|
|
if (SubStr($csl_in, 0, 1) == ",")
|
46 |
|
|
$csl_in = SubStr($csl_in, 1);
|
47 |
|
|
|
48 |
|
|
if (strlen($csl_in) == 0)
|
49 |
|
|
{
|
50 |
|
|
return(FALSE);
|
51 |
|
|
}
|
52 |
|
|
|
53 |
|
|
//Remove any trailing comma.
|
54 |
|
|
if (SubStr($csl_in, strlen($csl_in) - 1) == ",")
|
55 |
|
|
$csl_in = SubStr($csl_in, 0, strlen($csl_in) - 1);
|
56 |
|
|
|
57 |
|
|
if (strlen($csl_in) == 0)
|
58 |
|
|
{
|
59 |
|
|
return(FALSE);
|
60 |
|
|
}
|
61 |
|
|
|
62 |
|
|
//Form the string array.
|
63 |
|
|
return(explode(",", $csl_in));
|
64 |
|
|
}
|
65 |
|
|
}
|
66 |
|
|
//
|
67 |
|
|
//--------------------------------------------------------------------------------
|
68 |
|
|
//Transitions from a comma-separated string list to an array of integers.
|
69 |
|
|
//
|
70 |
|
|
function CSL_string_array_to_csl($int_array_in)
|
71 |
|
|
{
|
72 |
|
|
if ($int_array_in === FALSE)
|
73 |
|
|
{
|
74 |
|
|
return("");
|
75 |
|
|
}
|
76 |
|
|
else
|
77 |
|
|
{
|
78 |
|
|
return("," . implode(",", $int_array_in) . ",");
|
79 |
|
|
}
|
80 |
|
|
}
|
81 |
|
|
//
|
82 |
|
|
//--------------------------------------------------------------------------------
|
83 |
|
|
//End of $RCSfile: cslx.inc,v $.
|
84 |
|
|
//--------------------------------------------------------------------------------
|
85 |
|
|
?>
|