public function addFeedback( $user_id, $commentator_name, $commentator_title, $commentator_message, $score_quality, $score_delivery, $score_communication, $active, $pub_date, $commentator_ip = null ) { $aSet = array( 'user_id' => $user_id, 'commentator_name' => $commentator_name, 'commentator_title' => $commentator_title, 'commentator_message' => $commentator_message, 'active' => $active, 'pub_date' => $pub_date ); if($score_quality <> '') { $aSet['score_quality'] = $score_quality; } if($score_delivery <> '') { $aSet['score_delivery'] = $score_delivery; } if($score_communication <> '') { $aSet['score_communication'] = $score_communication; } if($commentator_ip) { $aSet['commentator_ip'] = $commentator_ip; } return $this->dao->insert( $this->getTable_UserBO(), $aSet); } public function countFeedback( $active, $user_id = null, $filters = array() ) { $this->dao->select('COUNT(*) as total'); $this->dao->from( $this->getTable_UserBO() . ' s, ' . $this->getTable_User() . ' u' ); $this->dao->where( 's.user_id = u.pk_i_id' ); $this->dao->where( 's.active', $active ); if($user_id) { $this->dao->where( 's.user_id', $user_id ); } if (!empty($filters)) { if (!empty($filters['user_name'])) { $this->dao->like('lower(u.s_name)', strtolower(trim($filters['user_name']))); } if (!empty($filters['commentator_name'])) { $this->dao->like('lower(s.commentator_name)', strtolower(trim($filters['commentator_name']))); } if (!empty($filters['commentator_title'])) { $this->dao->like('lower(s.commentator_title)', strtolower(trim($filters['commentator_title']))); } if (!empty($filters['commentator_message'])) { $this->dao->like('lower(s.commentator_message)', strtolower(trim($filters['commentator_message']))); } } $result = $this->dao->get(); if( !$result ) { return 0; } $row = $result->row(); return isset($row['total']) ? (int)$row['total'] : 0; } public function getFeedbackPaged( $active, $start, $limit, $user_id = null, $filters = array() ) { $this->dao->select('s.*, u.s_name as user_name'); $this->dao->from( $this->getTable_UserBO() . ' s, ' . $this->getTable_User() . ' u' ); $this->dao->where( 's.user_id = u.pk_i_id' ); $this->dao->where( 's.active', $active ); if($user_id) { $this->dao->where( 's.user_id', $user_id ); } if (!empty($filters)) { if (!empty($filters['user_name'])) { $this->dao->like('lower(u.s_name)', strtolower(trim($filters['user_name']))); } if (!empty($filters['commentator_name'])) { $this->dao->like('lower(s.commentator_name)', strtolower(trim($filters['commentator_name']))); } if (!empty($filters['commentator_title'])) { $this->dao->like('lower(s.commentator_title)', strtolower(trim($filters['commentator_title']))); } if (!empty($filters['commentator_message'])) { $this->dao->like('lower(s.commentator_message)', strtolower(trim($filters['commentator_message']))); } } $this->dao->orderBy('s.pub_date DESC'); $this->dao->limit($start, $limit); $result = $this->dao->get(); if( !$result ) { return array(); } return $result->result(); } Lucca - pagina 4 - Armiusate.it, Armi Usate, Armi Nuove, vendita, acquisto

Dalla Vetrina del nostro Sponsor
Bossoli 6.5 Large Rifle!

 

 

 

Apri il sito

Chiudiamo l'estate in bellezza!!
WhatsApp