示例#1
0
 function __construct(&$oConfig)
 {
     parent::__construct($oConfig);
     $this->_sTableEvt2Usr = $this->_sPrefix . 'events2users';
 }
示例#2
0
 protected function _getSqlPartsEvents($aParams)
 {
     $sMethod = 'getAll';
     $sSelectClause = $sJoinClause = $sWhereClause = $sOrderClause = $sLimitClause = "";
     switch ($aParams['browse']) {
         case 'owner_id':
             $sWhereClause = $this->prepare("AND `{$this->_sTable}`.`owner_id`=? ", $aParams['value']);
             break;
         case 'common_by_object':
             $sCommonPostPrefix = $this->_oConfig->getPrefix('common_post');
             $sWhereClause = $this->prepare("AND SUBSTRING(`{$this->_sTable}`.`type`, 1, " . strlen($sCommonPostPrefix) . ")='" . $sCommonPostPrefix . "' AND `{$this->_sTable}`.`object_id`=? ", $aParams['value']);
             break;
         case 'descriptor':
             $sMethod = 'getRow';
             $sWhereClause = "";
             if (isset($aParams['type'])) {
                 $sWhereClause .= $this->prepare("AND `{$this->_sTable}`.`type`=? ", $aParams['type']);
             }
             if (isset($aParams['action'])) {
                 $sWhereClause .= $this->prepare("AND `{$this->_sTable}`.`action`=? ", $aParams['action']);
             }
             if (isset($aParams['object_id'])) {
                 $sWhereClause .= $this->prepare("AND `{$this->_sTable}`.`object_id`=? ", $aParams['object_id']);
             }
             $sLimitClause = "LIMIT 1";
             break;
         case 'shared_by_descriptor':
             $sWhereClause = "";
             if (isset($aParams['type'])) {
                 $sWhereClause .= "AND `{$this->_sTable}`.`content` LIKE '%" . $this->escape($aParams['type']) . "%'";
             }
             if (isset($aParams['action'])) {
                 $sWhereClause .= "AND `{$this->_sTable}`.`content` LIKE '%" . $this->escape($aParams['action']) . "%'";
             }
             break;
         default:
             list($sMethod, $sSelectClause, $sJoinClause, $sWhereClause, $sOrderClause, $sLimitClause) = parent::_getSqlPartsEvents($aParams);
     }
     $sSelectClause .= "YEAR(FROM_UNIXTIME(`{$this->_sTable}`.`date`)) AS `year`, ";
     return array($sMethod, $sSelectClause, $sJoinClause, $sWhereClause, $sOrderClause, $sLimitClause);
 }