*** empty log message ***

This commit is contained in:
sebastian 2005-02-23 12:58:49 +00:00
parent 08b043e08c
commit 4dcf3881d0
3 changed files with 288 additions and 0 deletions

View File

@ -0,0 +1,38 @@
<?php
class uiPlaylist
{
function uiPlaylist(&$uiBase)
{
$this->Base =& $uiBase;
$this->items =& $_SESSION[UI_PLAYLIST_SESSNAME]['content'];
$this->reloadUrl = UI_BROWSER.'?popup[]=_reload_parent&popup[]=_close';
}
function setReload()
{
$this->Base->redirUrl = $this->reloadUrl;
}
function get()
{ #print_r($this->items);
return $this->items;
}
function activate($id)
{
$this->items = $this->Base->gb->getPlaylistArray($id, $this->Base->sessid);
$this->Base->_retMsg('Playlist $1 activated', $this->Base->_getMDataValue($id, 'title'));
}
function addItem($id)
{
}
function removeItem($id)
{
}
}

View File

@ -0,0 +1,142 @@
<?php
class uiScratchPad
{
function uiScratchPad(&$uiBase)
{
$this->Base =& $uiBase;
$this->items =& $_SESSION[UI_SCRATCHPAD_SESSNAME]['content'];
$this->order =& $_SESSION[UI_SCRATCHPAD_SESSNAME]['order'];
$this->reloadUrl = UI_BROWSER.'?popup[]=_reload_parent&popup[]=_close';
}
function setReload()
{
$this->Base->redirUrl = $this->reloadUrl;
}
function &get()
{
if (!is_array($this->items))
$this->_load();
return $this->items;
}
function _load()
{
$this->items = array();
$spData = $this->Base->gb->loadPref($this->Base->sessid, UI_SCRATCHPAD_KEY);
if (!PEAR::isError($spData)) {
## ScratchPad found in DB
$arr = explode(' ', $spData);
/*
## Akos old format #####################################
foreach($arr as $val) {
if (preg_match(UI_SCRATCHPAD_REGEX, $val)) {
list ($gunid, $date) = explode(':', $val);
if ($this->Base->gb->_idFromGunid($gunid) != FALSE) {
$res[] = array_merge($this->Base->_getMetaInfo($this->Base->gb->_idFromGunid($gunid)), array('added' => $date));
}
}
}
*/
## new format ##########################################
foreach($arr as $gunid) {
if (preg_match('/[0-9]{1,20}/', $gunid)) {
if ($this->Base->gb->_idFromGunid($this->Base->_toHex($gunid)) != FALSE) {
if ($i = $this->Base->_getMetaInfo($this->Base->gb->_idFromGunid($this->Base->_toHex($gunid))))
$this->items[] = $i;
}
}
}
}
}
function save()
{
foreach($this->items as $val) {
#$str .= $val['gunid'].':'.$val['added'].' '; ## new format ###
$str .= $this->Base->_toInt8($val['gunid']).' '; ## Akos´ old format ###
}
$this->Base->gb->savePref($this->Base->sessid, UI_SCRATCHPAD_KEY, $str);
}
function addItem($id)
{
if(!$this->Base->SYSTEMPREFS[UI_SCRATCHPAD_MAXLENGTH_KEY]) {
$this->Base->_retMsg('ScratchPad length is not set in System Preferences, so it cannot be used.');
return false;
}
$item = $this->Base->_getMetaInfo($id);
$sp = $this->get();
foreach ($sp as $key=>$val) {
if ($val['id'] == $item['id']) {
unset($sp[$key]);
$this->Base->_retMsg('Entry $1 was already on SP since $2.\nMoved to Top.', $item['title'], $val['added']);
} else {
#$this->Base->incAccessCounter($id);
}
}
$sp = array_merge(array($item), is_array($sp) ? $sp : NULL);
for ($n=0; $n<$this->Base->SYSTEMPREFS[UI_SCRATCHPAD_MAXLENGTH_KEY]; $n++) {
if (is_array($sp[$n])) $this->items[$n] = $sp[$n];
}
}
function removeItems($ids)
{
if (!$ids)
return FALSE; ## empty parameter
if (!is_array($ids))
$ids = array($ids); ## just single id given
foreach ($ids as $id) {
#$info = $this->Base->_getMetaInfo($id);
$sp =& $this->get();
foreach ($sp as $key=>$val) {
#if ($val['id'] == $info['id']) {
if ($val['id'] == $id) {
unset ($sp[$key]);
#$this->Base->decAccessCounter($id);
}
}
}
return TRUE;
}
function reOrder($by)
{
foreach ($this->items as $key=>$val) {
$s[$key] = $val[$by];
}
$curr = $this->order[$by];
$this->order = array();
(is_null($curr) || $curr=='DESC') ? $this->order[$by] = 'ASC' : $this->order[$by] = 'DESC';
switch($this->order[$by]) {
case "ASC": asort($s); break;
case "DESC": arsort($s); break;
}
foreach ($s as $key=>$val) {
$res[] = $this->items[$key];
}
$this->items = $res;
}
function reLoadM()
{
foreach($this->items as $key=>$val)
$this->items[$key] = $this->Base->_getMetaInfo($val['id']);
}
}
?>

View File

@ -0,0 +1,108 @@
<?php
class uiSearch
{
function uiSearch(&$uiBase)
{
$this->Base =& $uiBase;
$this->results =& $_SESSION[UI_SEARCH_SESSNAME]['results'];
$this->criteria =& $_SESSION[UI_SEARCH_SESSNAME]['criteria'];
$this->reloadUrl = UI_BROWSER.'?popup[]=_reload_parent&popup[]=_close';
}
function setReload()
{
$this->Base->redirUrl = $this->reloadUrl;
}
function form($id, &$mask2)
{
include dirname(__FILE__).'/formmask/metadata.inc.php';
$form = new HTML_QuickForm('search', UI_STANDARD_FORM_METHOD, UI_HANDLER);
$form->setConstants(array('id'=>$id, 'counter'=>UI_SEARCH_MIN_ROWS));
foreach ($mask['tabs']['group']['group'] as $k=>$v) {
foreach ($mask['pages'][$v] as $val){
$col1[$this->Base->_formElementEncode($val['element'])] = $val['label'];
if (isset($val['relation']))
$col2[$this->Base->_formElementEncode($val['element'])] = $mask2['relations'][$val['relation']];
else
$col2[$this->Base->_formElementEncode($val['element'])] = $mask2['relations']['standard'];
};
};
for($n=1; $n<=UI_SEARCH_MAX_ROWS; $n++) {
unset ($group);
$form->addElement('static', 's1', NULL, "<div id='searchRow_$n'>");
if ($n > UI_SEARCH_MIN_ROWS) $form->addElement('static', 's1_style', NULL, "<style type='text/css'>#searchRow_$n {visibility : hidden; height : 0px;}</style>");
$sel = &$form->createElement('hierselect', "row_$n", NULL);
$sel->setOptions(array($col1, $col2));
$group[] = &$sel;
$group[] = &$form->createElement('text', "row_$n".'[2]', NULL);
$group[] = &$form->createElement('button', "dropRow_$n", 'Drop', array('onClick' => "SearchForm_dropRow('$n')"));
$form->addGroup($group);
$form->addElement('static', 's2', NULL, "</div id='searchRow_$n'>");
}
$this->Base->_parseArr2Form($form, $mask2['search']);
$form->setConstants($this->criteria['form']);
$form->validate();
$renderer =& new HTML_QuickForm_Renderer_Array(true, true);
$form->accept($renderer);
$output['dynform'] = $renderer->toArray();
#print_r($output);
return $output;
}
function newsearch(&$formdata)
{
$this->results = NULL;
$this->criteria = NULL;
$this->criteria['operator'] = $formdata['operator'];
$this->criteria['filetype'] = $formdata['filetype'];
$this->criteria['form']['operator'] = $formdata['operator'];
$this->criteria['form']['filetype'] = $formdata['filetype'];
foreach ($formdata as $key=>$val) {
if (is_array($val) && strlen($val[2])) {
$this->criteria['conditions'][$key] = array('cat' => $this->Base->_formElementDecode($val[0]),
'op' => $val[1],
'val' => $val[2]);
$this->criteria['form'][$key] = array(0 => $this->Base->_formElementDecode($val[0]),
1 => $val[1],
2 => $val[2]);
}
}
$this->Base->redirUrl = UI_BROWSER.'?act=SEARCH';
$this->searchDB();
}
function searchDB()
{
#print_r($this->criteria);
$results = $this->Base->gb->localSearch($this->criteria, $this->Base->sessid);
foreach ($results['results'] as $rec) {
$this->results[] = $this->Base->_getMetaInfo($this->Base->gb->_idFromGunid($rec));
}
}
function reOrder($by)
{
$this->results = NULL;
if ($this->criteria['orderby'] == $by && !$this->criteria['desc'])
$this->criteria['desc'] = TRUE;
else
$this->criteria['desc'] = FALSE;
$this->criteria['orderby'] = $by;
$this->setReload();
$this->searchDB();
}
function clear()
{
#$this->results = NULL;
$this->criteria['form'] = NULL;
$this->setReload();
}
}
?>