public function save() { $expire = $this->expire->getTimestamp(); $after = $this->alert_after_date->getTimestamp(); $before = $this->alert_before_date->getTimestamp(); $notifyii = new ModelNotifyii(); $notifyii->expire = date('Y-m-d', $expire); $notifyii->alert_after_date = date('Y-m-d', $after); $notifyii->alert_before_date = date('Y-m-d', $before); $notifyii->content = $this->message; $notifyii->role = $this->role; $notifyii->link = $this->link; $notifyii->save(); }
public static function getAllRoledNotifications($role = 'admin') { $criteria = new CDbCriteria(array( 'condition' => ':now >= t.alert_after_date AND :now <= t.alert_before_date AND t.role = :role', 'params' => array( ':now' => date('Y-m-d'), ':role' => $role, ) )); $notifiche = ModelNotifyii::model() ->findAll($criteria); return $notifiche; }