| Current Path : /var/www/iplanru/data/www/i-plan.ru/administrator/components/com_pay/tables/ |
| Current File : /var/www/iplanru/data/www/i-plan.ru/administrator/components/com_pay/tables/payment.php |
<?php
// No direct access
defined( '_JEXEC' ) or die;
// Подключаем библиотеку таблиц Joomla.
jimport('joomla.database.table');
class TablePayment extends JTable
{
function __construct( &$db )
{
parent::__construct( '#__payment', 'id', $db );
}
public function bind( $array, $ignore = '' )
{
$componentParams = JComponentHelper::getParams('com_pay');
$mmail = $componentParams->get('mmail', '');
if ( isset( $array['rules'] ) && is_array( $array['rules'] ) ) {
$rules = new JAccessRules( $array['rules'] );
$this->setRules( $rules );
}
if ( isset( $array['params'] ) && is_array( $array['params'] ) )
{
$registry = new JRegistry;
$registry->loadArray( $array['params'] );
$array['params'] = (string) $registry;
}
if ( $array['date']=='' or $array['date']=='0000-00-00 00:00:00' ) {
$array['date'] = date( 'Y-m-d H:i:s' );
}
if ( $array['pr']=='') {
$array['pr'] = '0';
}
if ( $array['method']=='ocn' or $array['method']=='gmn') {
$array['for_project'] = $array['for_project2'];
}
return parent::bind( $array, $ignore );
}
public function load($pk = null, $reset = true)
{
if (parent::load($pk, $reset))
{
// Конвертируем поле параметров в регистр.
$params = new JRegistry;
$params->loadString($this->params);
$this->params = $params;
return true;
}
else
{
return false;
}
}
/**
* Метод для вычисления уникального имени ассета по умолчанию.
* По умолчанию имя берется из формы: `table_name.id`,
* где id - это значение первичного ключа таблицы.
*
* @return string Название ассета.
*/
protected function _getAssetName()
{
$k = $this->_tbl_key;
return 'com_pay.payment.' . ( int )$this->$k;
}
/**
* Метод для получения названия ассета для таблицы ассетов.
*
* @return string
*/
protected function _getAssetTitle()
{
return $this->fio;
}
/**
* Метод для получения id родителя записи.
*
* @return int Id родителя записи.
*/
protected function _getAssetParentId( $table = null, $id = null )
{
$asset = JTable::getInstance( 'Asset' );
$asset->loadByName( 'com_pay' );
return $asset->id;
}
}