Changeset 29 for base.php


Ignore:
Timestamp:
Dec 9, 2008, 1:24:32 PM (16 years ago)
Author:
george
Message:
  • Upraveno: Hledání položek v seznamu dle zadaného filtru.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • base.php

    r28 r29  
    11<?php
    22
    3 function ShowList($List, $Column = '', $ColumnValue = 0, $Title = '')
     3function ShowList($List, $Column = '', $ColumnValue = 0, $Title = '', $Filter = '')
    44{
    55  global $Database, $Config;
     
    3333    $FullListLink = '';
    3434  }
     35  if($Filter != '') $Where .= ' AND '.$Filter;
    3536
    3637  // Handle ordering
     
    5354  //$Where .= ' AND (ValidFromTime <= NOW()) AND ((ValidToTime >= NOW()) OR (ValidToTime IS NULL))';
    5455  $Where .= ' '.$Order;
    55   $DbResult = $Database->query('SELECT COUNT(*) AS Count FROM `'.$List['TableName'].'` WHERE 1'.$Where);
     56  $DbResult = $Database->query('SELECT COUNT(*) AS Count FROM `'.$List['TableName'].'` WHERE '.$Where);
    5657  $DbRow = $DbResult->fetch_row();
    5758  $TotalItemCount = $DbRow[0];
     
    177178  (
    178179    'Title' => '',
    179     'SubmitBuffonText' => 'Uložit',
     180    'SubmitButtonText' => 'Uložit',
    180181    'Items' => $DefinitionItems,
    181182  );
     
    214215  (
    215216    'Title' => '',
    216     'SubmitBuffonText' => 'Uložit',
     217    'SubmitButtonText' => 'Uložit',
    217218    'Items' => $DefinitionItems,
    218219  );
     
    258259  (
    259260    'Title' => '',
    260     'SubmitBuffonText' => 'Přidat',
     261    'SubmitButtonText' => 'Přidat',
    261262    'Items' => $DefinitionItems,
    262263  );
     
    299300  (
    300301    'Title' => '',
    301     'SubmitBuffonText' => 'Přidat',
     302    'SubmitButtonText' => 'Přidat',
    302303    'Items' => $DefinitionItems,
    303304  );
     
    404405  (
    405406    'Title' => 'Hledání',
    406     'SubmitBuffonText' => 'Vyhledat',
     407    'SubmitButtonText' => 'Vyhledat',
    407408    'Items' => $DefinitionItems,
    408409  );
     
    417418
    418419  if(!CheckPermission('Write', $List['Id'])) return(SystemMessage('Řízení přístupu', 'Nemáte dostatečná oprávnění'));
    419   $System->Modules['Log']->Add($List['Id'], $Id, $LogActionType['Delete']);
    420   $System->Modules['DatabaseList']->DeleteItem($List['Id'], $Id);
    421   $Output = 'Položka smazána.';
    422   $Output .= ShowList($List, $_SESSION['Column'], $_SESSION['ColumnValue']).'<br /><br />';
    423   ExecuteListEvent($List['Id'], 'OnDelete', $Id);
    424   return($Output);
    425 
    426   $Output = ShowList($List);
     420  $DefinitionItems = array();
     421  $AfterTableOutput = '';
     422  foreach($List['Items'] as $Item)
     423  {
     424    //echo($Item['Name'].',');
     425    $Type = GetTypeDefinition($Item['Type']);
     426    if(($Type['BaseType'] != 'PointerOneToMany') and ($Item['Name'] != $Column))
     427    {
     428      if($Item['Required'] == 1) $Required = '*'; else $Required = '';
     429      $DefinitionItems[] = array('Name' => $Item['Name'], 'Type' => $Item['Type'], 'Caption' => $Item['TextBefore'].$Required, 'Value' => '', 'SourceTable' => $List['Id'], 'SourceItemId' => 0);
     430    } else
     431    if($Item['Name'] == $Column)
     432    {
     433      $DefinitionItems[] = array('Name' => $Column, 'Type' => TypeHiddenId, 'Caption' => '', 'Value' => $ColumnValue);
     434    }
     435  }
     436
     437  $Form = new Form();
     438  $Form->Definition = array
     439  (
     440    'Title' => '',
     441    'SubmitButtonText' => 'Přidat',
     442    'Items' => $DefinitionItems,
     443  );
     444  $Form->LoadValuesFromForm();
     445  $Filter = '1';
     446  print_r($Form);
     447  foreach($Form->Definition['Items'] as $Item)
     448  {
     449    //if($Item['Editable'] == 1)
     450    {
     451      //echo($Item['Name'].',');
     452      $Type = GetTypeDefinition($Item['Type']);
     453      $TypeObject = $Type['Class'];
     454      $Filter .= ' AND (`'.$Item['Name'].'` LIKE '.$TypeObject->DatabaseEscape($Form->Values[$Item['Name']]).')';
     455    }
     456  }
     457  echo('d'.$Filter.'d');
     458  $Output = ShowList($List, $_SESSION['Column'], $_SESSION['ColumnValue'], '', $Filter).'<br /><br />';
    427459  return($Output);
    428460}
     
    476508        case 'ShowSearch':
    477509          $Output = ShowSearch($List);
     510          break;
     511        case 'Search':
     512          $Output = Search($List);
    478513          break;
    479514        case 'EditItem':
     
    620655
    621656  $Result = FALSE;
    622   //return(TRUE);
     657  return(TRUE);
    623658  $DbResult = $Database->query('SELECT t1.* FROM `Permission` AS t1 WHERE t1.PermissionGroup = (SELECT PermissionGroup.Id FROM PermissionGroup WHERE PermissionGroup.Id=(SELECT User.PermissionGroup FROM User WHERE User.Id='.$System->Modules['User']->User['Id'].')) AND t1.List='.$ListId);
    624659  if($DbResult->num_rows > 0)
Note: See TracChangeset for help on using the changeset viewer.