Changeset 24 for database_list.php


Ignore:
Timestamp:
Oct 27, 2008, 5:10:59 PM (16 years ago)
Author:
george
Message:
  • Upraveno: Odkazy na seznamy pomocí ItemId namísto jmen tabulek.
  • Přidáno: Potvrzovací dialog při mazání položek.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • database_list.php

    r19 r24  
    55  var $Dependencies = array('Log', 'User');
    66
    7   function AddItem($TableName, $Values)
     7  function AddItem($TableId, $Values)
    88  {
     9    $DbResult = $this->Database->query('SELECT TableName FROM SystemList WHERE ItemId='.$TableId.' ORDER BY Id DESC LIMIT 1');
     10    $DbRow = $DbResult->fetch_assoc();
     11    $TableName = $DbRow['TableName'];
     12
    913    $Values['Author'] = $this->System->Modules['User']->User['ItemId'];
    1014    $Values['CreationTime'] = 'NOW()';
     
    1822  }
    1923
    20   function DeleteItem($TableName, $Id)
     24  function DeleteItem($TableId, $ItemId)
    2125  {
    22     $DbResult = $this->Database->select($TableName, 'Id', 'ItemId='.$Id.' ORDER BY Id DESC LIMIT 1');
     26    $DbResult = $this->Database->query('SELECT TableName FROM SystemList WHERE ItemId='.$TableId.' ORDER BY Id DESC LIMIT 1');
     27    $DbRow = $DbResult->fetch_assoc();
     28    $TableName = $DbRow['TableName'];
     29
     30    $DbResult = $this->Database->select($TableName, 'Id', 'ItemId='.$ItemId.' ORDER BY Id DESC LIMIT 1');
    2331    $DbRow = $DbResult->fetch_assoc();
    2432    $this->Database->update($TableName, 'Id='.$DbRow['Id'], array('DeletionTime' => 'NOW()'));
    2533  }
    2634
    27   function EditItem($TableName, $Values, $Id)
     35  function EditItem($TableId, $Values, $ItemId)
    2836  {
    29     $this->DeleteItem($TableName, $Id);
    30     $Values['ItemId'] = $Id;
     37    $DbResult = $this->Database->query('SELECT TableName FROM SystemList WHERE ItemId='.$TableId.' ORDER BY Id DESC LIMIT 1');
     38    $DbRow = $DbResult->fetch_assoc();
     39    $TableName = $DbRow['TableName'];
     40    $this->DeleteItem($TableId, $ItemId);
     41    $Values['ItemId'] = $ItemId;
    3142    $Values['Author'] = $this->System->Modules['User']->User['ItemId'];
    3243    $Values['CreationTime'] = 'NOW()';
Note: See TracChangeset for help on using the changeset viewer.