Exemple #1
0
 protected function afterDelete()
 {
     // Обновить структуру
     $count = brs_model_Banner::count(array(array('category', $this->_data['category'])));
     static::$_db->update(cot::$db->structure, array('structure_count' => $count), "structure_area='brs' AND structure_code=?", $this->_data['category']);
     cot::$cache && cot::$cache->db->remove('structure', 'system');
 }
Exemple #2
0
 public function notifyUserModerated()
 {
     global $db_users, $L;
     $advertUrl = $this->getUrl();
     if (!cot_url_check($advertUrl)) {
         $advertUrl = COT_ABSOLUTE_URL . $advertUrl;
     }
     $tmpL = $L;
     $text = $this->_data['description'];
     if (empty($text)) {
         $text = $this->_data['text'];
     }
     $user = null;
     $userLang = cot::$cfg['defaultlang'];
     if (!$this->issetEmail(true)) {
         return false;
     }
     $this->getOwner();
     if ($this->_data['user'] > 0) {
         if (cot::$cfg['defaultlang'] != $this->_owner['user_lang']) {
             $userLang = $this->_owner['user_lang'];
             include cot_langfile('main', 'core', cot::$cfg['defaultlang'], $this->_owner['user_lang']);
             include cot_langfile('advboard', 'module', cot::$cfg['defaultlang'], $this->_owner['user_lang']);
         }
     }
     $mailView = new View();
     $mailView->advert = $this;
     $mailView->user = $this->_owner;
     $mailView->advertUrl = $advertUrl;
     $mailView->advertText = $text;
     $mailSubject = $L['advboard_moderated'];
     $mailBody = $mailView->render('advboard.notify_user_moderated.' . $userLang . '.' . $this->_data['category']);
     cot_mail($this->getEmail(false, true), $mailSubject, $mailBody, '', false, null, true);
     // Вернем язык на место
     $L = $tmpL;
     // Сбросить флаг уведомления
     static::$_db->update(static::$_tbname, array('admin_notified' => '1970-01-01 00:00:01'), 'id=' . $this->_data['id']);
 }