Source for file behavior.php

Documentation is available at behavior.php

  1. <?php
  2. /**
  3.  * @package     FrameworkOnFramework
  4.  * @subpackage  table
  5.  * @copyright   Copyright (C) 2010 - 2012 Akeeba Ltd. All rights reserved.
  6.  * @license     GNU General Public License version 2 or later; see LICENSE.txt
  7.  */
  8. // Protect from unauthorized access
  9. defined('_JEXEC'or die;
  10.  
  11. /**
  12.  * FrameworkOnFramework table behavior class. It defines the events which are
  13.  * called by a Table.
  14.  *
  15.  * @package  FrameworkOnFramework
  16.  * @since    2.1
  17.  */
  18. abstract class FOFTableBehavior extends JEvent
  19. {
  20.     /**
  21.      * This event runs before binding data to the table
  22.      *
  23.      * @param   FOFTable  &$table  The table which calls this event
  24.      * @param   array     &$data   The data to bind
  25.      *
  26.      * @return  boolean  True on success
  27.      */
  28.     public function onBeforeBind(&$table&$data)
  29.     {
  30.         return true;
  31.     }
  32.  
  33.     /**
  34.      * The event which runs after binding data to the table
  35.      *
  36.      * @param   FOFTable  &$table  The table which calls this event
  37.      * @param   object|array &$src  The data to bind
  38.      *
  39.      * @return  boolean  True on success
  40.      */
  41.     public function onAfterBind(&$table&$src)
  42.     {
  43.         return true;
  44.     }
  45.  
  46.     /**
  47.      * The event which runs after loading a record from the database
  48.      *
  49.      * @param   FOFTable  &$table  The table which calls this event
  50.      * @param   boolean  &$result  Did the load succeeded?
  51.      *
  52.      * @return  void 
  53.      */
  54.     public function onAfterLoad(&$table&$result)
  55.     {
  56.  
  57.     }
  58.  
  59.     /**
  60.      * The event which runs before storing (saving) data to the database
  61.      *
  62.      * @param   FOFTable  &$table  The table which calls this event
  63.      * @param   boolean  $updateNulls  Should nulls be saved as nulls (true) or just skipped over (false)?
  64.      *
  65.      * @return  boolean  True to allow saving
  66.      */
  67.     public function onBeforeStore(&$table$updateNulls)
  68.     {
  69.         return true;
  70.     }
  71.  
  72.     /**
  73.      * The event which runs after storing (saving) data to the database
  74.      *
  75.      * @param   FOFTable  &$table  The table which calls this event
  76.      * 
  77.      * @return  boolean  True to allow saving without an error
  78.      */
  79.     public function onAfterStore(&$table)
  80.     {
  81.         return true;
  82.     }
  83.  
  84.     /**
  85.      * The event which runs before moving a record
  86.      *
  87.      * @param   FOFTable  &$table  The table which calls this event
  88.      * @param   boolean  $updateNulls  Should nulls be saved as nulls (true) or just skipped over (false)?
  89.      *
  90.      * @return  boolean  True to allow moving
  91.      */
  92.     public function onBeforeMove(&$table$updateNulls
  93.     {
  94.         return true;
  95.     }
  96.  
  97.     /**
  98.      * The event which runs after moving a record
  99.      *
  100.      * @param   FOFTable  &$table  The table which calls this event
  101.      * 
  102.      * @return  boolean  True to allow moving without an error
  103.      */
  104.     public function onAfterMove(&$table)
  105.     {
  106.         return true;
  107.     }
  108.  
  109.     /**
  110.      * The event which runs before reordering a table
  111.      *
  112.      * @param   FOFTable  &$table  The table which calls this event
  113.      * @param   string  $where  The WHERE clause of the SQL query to run on reordering (record filter)
  114.      *
  115.      * @return  boolean  True to allow reordering
  116.      */
  117.     public function onBeforeReorder(&$table$where '')
  118.     {
  119.         return true;
  120.     }
  121.  
  122.     /**
  123.      * The event which runs after reordering a table
  124.      *
  125.      * @param   FOFTable  &$table  The table which calls this event
  126.      * 
  127.      * @return  boolean  True to allow the reordering to complete without an error
  128.      */
  129.     public function onAfterReorder(&$table)
  130.     {
  131.         return true;
  132.     }
  133.  
  134.     /**
  135.      * The event which runs before deleting a record
  136.      *
  137.      * @param   FOFTable &$table  The table which calls this event
  138.      * @param   integer  $oid  The PK value of the record to delete
  139.      *
  140.      * @return  boolean  True to allow the deletion
  141.      */
  142.     public function onBeforeDelete(&$table$oid)
  143.     {
  144.         return true;
  145.     }
  146.  
  147.     /**
  148.      * The event which runs after deleting a record
  149.      *
  150.      * @param   FOFTable &$table  The table which calls this event
  151.      * @param   integer  $oid  The PK value of the record which was deleted
  152.      *
  153.      * @return  boolean  True to allow the deletion without errors
  154.      */
  155.     public function onAfterDelete(&$table$oid)
  156.     {
  157.         return true;
  158.     }
  159.  
  160.     /**
  161.      * The event which runs before hitting a record
  162.      *
  163.      * @param   FOFTable &$table  The table which calls this event
  164.      * @param   integer  $oid  The PK value of the record to hit
  165.      * @param   boolean  $log  Should we log the hit?
  166.      *
  167.      * @return  boolean  True to allow the hit
  168.      */
  169.     public function onBeforeHit(&$table$oid$log)
  170.     {
  171.         return true;
  172.     }
  173.  
  174.     /**
  175.      * The event which runs after hitting a record
  176.      *
  177.      * @param   FOFTable &$table  The table which calls this event
  178.      * @param   integer  $oid  The PK value of the record which was hit
  179.      *
  180.      * @return  boolean  True to allow the hitting without errors
  181.      */
  182.     public function onAfterHit(&$table$oid)
  183.     {
  184.         return true;
  185.     }
  186.  
  187.     /**
  188.      * The even which runs before copying a record
  189.      *
  190.      * @param   FOFTable &$table  The table which calls this event
  191.      * @param   integer  $oid  The PK value of the record being copied
  192.      *
  193.      * @return  boolean  True to allow the copy to take place
  194.      */
  195.     public function onBeforeCopy(&$table$oid)
  196.     {
  197.         return true;
  198.     }
  199.  
  200.     /**
  201.      * The even which runs after copying a record
  202.      *
  203.      * @param   FOFTable &$table  The table which calls this event
  204.      * @param   integer  $oid  The PK value of the record which was copied (not the new one)
  205.      *
  206.      * @return  boolean  True to allow the copy without errors
  207.      */
  208.     public function onAfterCopy(&$table$oid)
  209.     {
  210.         return true;
  211.     }
  212.  
  213.     /**
  214.      * The event which runs before a record is (un)published
  215.      *
  216.      * @param   FOFTable &$table  The table which calls this event
  217.      * @param   integer|array &$cid     The PK IDs of the records being (un)published
  218.      * @param   integer        $publish  1 to publish, 0 to unpublish
  219.      *
  220.      * @return  boolean  True to allow the (un)publish to proceed
  221.      */
  222.     public function onBeforePublish(&$table&$cid$publish)
  223.     {
  224.         return true;
  225.     }
  226.  
  227.     /**
  228.      * The event which runs after the object is reset to its default values.
  229.      *
  230.      * @param   FOFTable &$table  The table which calls this event
  231.      * 
  232.      * @return  boolean  True to allow the reset to complete without errors
  233.      */
  234.     public function onAfterReset(&$table)
  235.     {
  236.         return true;
  237.     }
  238.  
  239.     /**
  240.      * The even which runs before the object is reset to its default values.
  241.      *
  242.      * @param   FOFTable &$table  The table which calls this event
  243.      * 
  244.      * @return  boolean  True to allow the reset to complete
  245.      */
  246.     public function onBeforeReset(&$table)
  247.     {
  248.         return true;
  249.     }
  250. }

Documentation generated on Tue, 19 Nov 2013 14:54:32 +0100 by phpDocumentor 1.4.3