Changeset 27


Ignore:
Timestamp:
Dec 8, 2008, 8:41:25 AM (15 years ago)
Author:
george
Message:
  • Upraveno: Rozpracovaná funkce pro vyhledávání a filtrování seznamů.
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • base.php

    r26 r27  
    1111  }
    1212
    13   if($Title == '') $Output = '<div>'.$List['Title'].'</div>';
    14     else $Output = '<div>'.$Title.'</div>';
     13  if($Title == '') $Output .= '<div>'.$List['Title'].'</div>';
     14    else $Output .= '<div>'.$Title.'</div>';
    1515  $Output .= '<table class="WideTable"><tr>';
    1616  foreach($List['Items'] as $Item)
     
    8080  if(strlen($PageList) != 0) $Output .= $PageList.'<br />';
    8181  if(CheckPermission('Write', $List['ItemId'])) $Output .= ' <a href="?Action=AddItem&amp;Table='.$List['ItemId'].$ColumnSelection.'">Přidat</a> '.$FullListLink;
     82  if(CheckPermission('Read', $List['ItemId'])) $Output .= ' <a href="?Action=ShowSearch&amp;Table='.$List['ItemId'].$ColumnSelection.'">Hledat</a> '.$FullListLink;
    8283  return($Output);
    8384}
     
    374375}
    375376
     377function ShowSearch($List)
     378{
     379  global $Database;
     380
     381  if(!CheckPermission('Read', $List['ItemId'])) return(SystemMessage('Řízení přístupu', 'Nemáte dostatečná oprávnění'));
     382  $DefinitionItems = array();
     383  $AfterTableOutput = '';
     384  foreach($List['Items'] as $Item)
     385  {
     386    //echo($Item['Name'].',');
     387    $Type = GetTypeDefinition($Item['Type']);
     388    if(($Type['BaseType'] != 'PointerOneToMany') and ($Item['Name'] != $Column))
     389    {
     390      if($Item['Editable'] == 1)
     391        $DefinitionItems[] = array('Name' => $Item['Name'], 'Type' => $Item['Type'], 'Caption' => $Item['TextBefore'], 'Value' => '', 'SourceTable' => $List['ItemId'], 'SourceItemId' => 0);
     392    } else
     393    if($Item['Name'] == $Column)
     394    {
     395      $DefinitionItems[] = array('Name' => $Column, 'Type' => TypeHiddenId, 'Caption' => '', 'Value' => $ColumnValue);
     396    }
     397  }
     398  $DefinitionItems[] = array('Name' => 'Column', 'Type' => TypeHiddenId, 'Caption' => '', 'Value' => $Column);
     399
     400  $Form = new Form();
     401  $Form->Definition = array
     402  (
     403    'Title' => 'Hledání',
     404    'SubmitBuffonText' => 'Vyhledat',
     405    'Items' => $DefinitionItems,
     406  );
     407  $Form->OnSubmit = '?Action=Search';
     408  $Output .= $Form->ShowEditForm();
     409  return($Output);
     410}
     411
     412function Search($List)
     413{
     414  global $Database, $System, $LogActionType;
     415
     416  if(!CheckPermission('Write', $List['ItemId'])) return(SystemMessage('Řízení přístupu', 'Nemáte dostatečná oprávnění'));
     417  $System->Modules['Log']->Add($List['ItemId'], $Id, $LogActionType['Delete']);
     418  $System->Modules['DatabaseList']->DeleteItem($List['ItemId'], $Id);
     419  $Output = 'Položka smazána.';
     420  $Output .= ShowList($List, $_SESSION['Column'], $_SESSION['ColumnValue']).'<br /><br />';
     421  ExecuteListEvent($List['ItemId'], 'OnDelete', $Id);
     422  return($Output);
     423
     424  $Output = ShowList($List);
     425  return($Output);
     426}
     427
    376428function ShowMenu()
    377429{
     
    395447  return($Output);
    396448}
     449
    397450
    398451function Output()
     
    419472      switch($_SESSION['Action'])
    420473      {
     474        case 'ShowSearch':
     475          $Output = ShowSearch($List);
     476          break;
    421477        case 'EditItem':
    422478          $Output = ShowEditItem($List, $_SESSION['Item']);
  • config.sample.php

    r25 r27  
    11<?php
    22
    3 $Config = array(
    4   'Database' => array(
     3$Config = array
     4(
     5  'Database' => array
     6  (
    57    'Host' => 'localhost',
    68    'User' => 'webis',
     
    1012    'Charset' => 'utf8',
    1113  ),
    12   'Web' => array(
     14  'Web' => array
     15  (
     16    'Charset' => 'UTF-8',
     17    'Host' => 'localhost',
     18    'RootFolder' => 'http://localhost/webis',
     19    'Description' => 'Web information system',
     20    'Title' => 'Webis',
     21    'Admin' => 'Admin',
     22    'AdminEmail' => 'admin@localhost',
    1323    'ItemsPerPage' => 20,
    1424  ),
  • lists/SystemListItem.php

    r26 r27  
    3030  {
    3131    $this->RebuildOrder();
    32   }
     32  }
    3333
    3434  function OnDelete($Parameters)
Note: See TracChangeset for help on using the changeset viewer.