FOSSology  3.2.0rc1
Open Source License Compliance by Open Source Software
common-ui.php File Reference

Common function for UI operations. More...

Go to the source code of this file.

Functions

 Array2SingleSelect ($KeyValArray, $SLName="unnamed", $SelectedVal="", $FirstEmpty=false, $SelElt=true, $Options="", $ReturnKey=true)
 Build a single choice select pulldown. More...
 
 Fatal ($msg, $filenm, $lineno)
 Write message to stdout and die. More...
 
 debugbacktrace ()
 Debug back trace.
 
 debugprint ($val, $title)
 Print debug message. More...
 
 HumanSize ($bytes)
 Translate a byte number to a proper type, xxx bytes to xxx B/KB/MB/GB/TB/PB. More...
 
 GetFileExt ($fname)
 Get File Extension (text after last period) More...
 
 GetArrayVal ($Key, $Arr)
 Get the value from a array(map) More...
 
 HostListOption ()
 Get host list. More...
 
 DownloadString2File ($text, $name, $contentType)
 Send a string to a user as a download file. More...
 
 GetUploadtreeTableName ($upload_pk)
 Get the uploadtree table name for this upload_pk If upload_pk does not exist, return "uploadtree". More...
 
 GetUploadName ($upload_pk)
 Get Upload Name through upload id. More...
 
 GetUploadID ($uploadtreeid)
 Get upload id through uploadtreeid. More...
 
 Get1stUploadtreeID ($upload)
 Get 1st uploadtree id through upload id. More...
 
 Convert2BrowserTime ($server_time)
 Convert the server time to browser time. More...
 

Detailed Description

Common function for UI operations.

Definition in file common-ui.php.

Function Documentation

Array2SingleSelect (   $KeyValArray,
  $SLName = "unnamed",
  $SelectedVal = "",
  $FirstEmpty = false,
  $SelElt = true,
  $Options = "",
  $ReturnKey = true 
)

Build a single choice select pulldown.

Parameters
array$KeyValArrayAssoc array. Use key/val pairs for list
string$SLNameSelect list name (default is "unnamed"),
string$SelectedValInitially selected value or key, depends on $SelElt
bool$FirstEmptyTrue if the list starts off with an empty choice (default is false)
bool$SelEltTrue (default) if $SelectedVal is a value False if $SelectedVal is a key
string$OptionsOptional. Options to add to the select statement. For example, "id=myid onclick= ..."
bool$ReturnKeyTrue (default) return the Key as value, if False return the Value
Returns
A string of select HTML
Examples:
/home/travis/build/GMishx/fossology/src/www/ui/ui-picker.php.

Definition at line 41 of file common-ui.php.

Convert2BrowserTime (   $server_time)

Convert the server time to browser time.

Parameters
time$server_timeto be converted

Definition at line 298 of file common-ui.php.

debugprint (   $val,
  $title 
)

Print debug message.

Parameters
mixed$valVariable to be printed
string$titleTitle of the variable

Definition at line 98 of file common-ui.php.

DownloadString2File (   $text,
  $name,
  $contentType 
)

Send a string to a user as a download file.

Parameters
string$textText to download as file
string$nameFile name
string$contentTypeDownload file Content-Type
Returns
True on success, error message on failure.

Definition at line 184 of file common-ui.php.

Fatal (   $msg,
  $filenm,
  $lineno 
)

Write message to stdout and die.

Parameters
string$msgMessage to write
string$filenmFile name (FILE)
int$linenoLine number of the caller (LINE)
Returns
None, prints error, file, and line number, then exits(1)
See also
debugbacktrace()

Definition at line 75 of file common-ui.php.

Get1stUploadtreeID (   $upload)

Get 1st uploadtree id through upload id.

Parameters
int$uploadUpload id
Returns
1st uploadtree id

Definition at line 279 of file common-ui.php.

GetArrayVal (   $Key,
  $Arr 
)

Get the value from a array(map)

Parameters
mixed$KeyKey to look
array$ArrWithin the Array, you can get value according to the key
Returns
An array value, or "" if the array key does not exist

Definition at line 143 of file common-ui.php.

GetFileExt (   $fname)

Get File Extension (text after last period)

Parameters
string$fnameFile name
Returns
The file extension of the specified file name
Examples:
/home/travis/build/GMishx/fossology/src/www/ui/ui-picker.php.

Definition at line 127 of file common-ui.php.

GetUploadID (   $uploadtreeid)

Get upload id through uploadtreeid.

Parameters
int$uploadtreeidUploadtree id
Returns
Upload id

Definition at line 258 of file common-ui.php.

GetUploadName (   $upload_pk)

Get Upload Name through upload id.

Parameters
int$upload_idUpload ID
Returns
Upload name, "" if upload does not exists

Definition at line 237 of file common-ui.php.

GetUploadtreeTableName (   $upload_pk)

Get the uploadtree table name for this upload_pk If upload_pk does not exist, return "uploadtree".

Parameters
int$upload_pk
Returns
Uploadtree table name

Definition at line 219 of file common-ui.php.

HostListOption ( )

Get host list.

Returns
Return HTML of the host name tree

Definition at line 160 of file common-ui.php.

HumanSize (   $bytes)

Translate a byte number to a proper type, xxx bytes to xxx B/KB/MB/GB/TB/PB.

Parameters
int$bytesBytes to be converted

Definition at line 109 of file common-ui.php.