View fix rescaled null grades.

@return void The notifications API will render the notifications at the appropriate part of the page.
429751
protected function view_fix_rescaled_null_grades() {
        global $OUTPUT;

        $o = '';

        require_capability('mod/assign:grade', $this->get_context());

        $instance = $this->get_instance();

        $o .= $this->get_renderer()->render(
            new assign_header(
                $instance,
                $this->get_context(),
                $this->show_intro(),
                $this->get_course_module()->id
            )
        );

        $confirm = optional_param('confirm', 0, PARAM_BOOL);

        if ($confirm) {
            confirm_sesskey();

            // Fix the grades.
            $this->fix_null_grades();
            unset_config('has_rescaled_null_grades_' . $instance->id, 'assign');

            // Display the notice.
            $o .= $this->get_renderer()->notification(get_string('fixrescalednullgradesdone', 'assign'), 'notifysuccess');
            $url = new moodle_url(
                '/mod/assign/view.php',
                array(
                    'id' => $this->get_course_module()->id,
                    'action' => 'grading'
                )
            );
            $o .= $this->get_renderer()->continue_button($url);
        } else {
            // Ask for confirmation.
            $continue = new \moodle_url('/mod/assign/view.php', array('id' => $this->get_course_module()->id, 'action' => 'fixrescalednullgrades', 'confirm' => true, 'sesskey' => sesskey()));
            $cancel = new \moodle_url('/mod/assign/view.php', array('id' => $this->get_course_module()->id));
            $o .= $OUTPUT->confirm(get_string('fixrescalednullgradesconfirm', 'mod_assign'), $continue, $cancel);
        }

        $o .= $this->view_footer();

        return $o;
    }
21310
@SuppressLint("SetTextI18n")
	public void setNotifications(Integer notifications) {

		if ((notifications != null) && (notifications > 0)) {
			setVisibility(VISIBLE);
			if (notifications > maximum) {
				this.setText(maximum + "+");
			} else {
				this.setText(notifications.toString());
			}
		} else {
			setVisibility(GONE);
		}
	}
11811
public function display()
    {
        if (!$this->visible) {
            return;
        }

        if ($this->getMessageCount() === 0) {
            return;
        }

        parent::display();

        $wrapper_div = new SwatHtmlTag('div');
        $wrapper_div->id = $this->id;
        $wrapper_div->class = $this->getCSSClassString();
        $wrapper_div->open();

        $has_dismiss_link = false;

        $message_count = count($this->display_messages);

        $count = 1;
        foreach ($this->display_messages as $key => $message) {
            if (in_array($key, $this->dismissable_messages)) {
                $has_dismiss_link = true;
            }

            $first = $count === 1;
            $last = $count === $message_count;

            $this->displayMessage($key, $message, $first, $last);

            $count++;
        }

        $wrapper_div->close();

        if ($has_dismiss_link) {
            Swat::displayInlineJavaScript($this->getInlineJavaScript());
        }
    }
1356773
public function onAfterWrite()
    {
        parent::onAfterWrite();

        // Deal with sending the status emails
        if ($this->isChanged('Status')) {
            $notifications = Notification::get()
                ->filter("Status", $this->Status);
                
            // Loop through available notifications and send
            foreach ($notifications as $notification) {
                $notification->sendNotification($this);
            }
        }
    }
556187
public function display()
	{
        App::$Alias->setCustomLibrary('js', $this->baseUrl . '/ckeditor.js');
        App::$Alias->setCustomLibrary('js', $this->baseUrl . '/adapters/jquery.js');
        $jsInitializeCode = "$('.{$this->targetClass}').ckeditor({";
        $jsInitializeCode .= "language: '{$this->language}', customConfig: '{$this->config}.js', ";
        if ($this->jsConfig !== null && Any::isArray($this->jsConfig)) {
            foreach ($this->jsConfig as $obj => $value) {
                $jsInitializeCode .= $obj . ": '" . $value . "', ";
            }
        }
	    $jsInitializeCode .= "});";

        App::$Alias->addPlainCode('js', $jsInitializeCode);
		return null;
	}
366553
public function toHTML($custom_template = null)
    {
        $custom_template = is_null($custom_template)
            ? 'laravel-notifications/'.config('laravel-notifications.view')
            : $custom_template;

        if (view()->exists($custom_template)) {
            return view($custom_template, ['messages' => $this->filtered])->render();
        } else {
            return view('laravel-notifications::bootstrap3', ['messages' => $this->filtered])->render();
        }
    }
923636
function show_notification(msg, type, reload_page, timeout){
    // defaults to false
    reload_page = reload_page || false;
    timeout = timeout || 3000;

    $('#notify_message').removeClass();
    $('#notify_message').addClass('notify_message-' + type);
    $('#notify_message').html(msg);
    $('#notify_message').slideDown(600).delay(timeout).slideUp(600, function(){
        if(reload_page === true){
            location.reload();
        }
    });
}
672434
public function actionIndex()
    {
        $userId = Yii::$app->getUser()->getId();
        $query = (new Query())
            ->from('{{%notifications}}')
            ->andWhere(['or', 'user_id = 0', 'user_id = :user_id'], [':user_id' => $userId]);

        $pagination = new Pagination([
            'pageSize' => 20,
            'totalCount' => $query->count(),
        ]);

        $list = $query
            ->orderBy(['id' => SORT_DESC])
            ->offset($pagination->offset)
            ->limit($pagination->limit)
            ->all();

        $notifs = $this->prepareNotifications($list);

        return $this->render('index', [
            'notifications' => $notifs,
            'pagination' => $pagination,
        ]);
    }
1697
def prepare_content_for(target, notification_index, params)
        content_for :notification_index do
          @target = target
          begin
            render_notification notification_index, params
          rescue ActionView::MissingTemplate
            params.delete(:target)
            render_notification notification_index, params
          end
        end
      end
210144
protected function fix_null_grades() {
        global $DB;
        $result = $DB->set_field_select(
            'assign_grades',
            'grade',
            ASSIGN_GRADE_NOT_SET,
            'grade <> ? AND grade < 0',
            [ASSIGN_GRADE_NOT_SET]
        );
        $assign = clone $this->get_instance();
        $assign->cmidnumber = $this->get_course_module()->idnumber;
        assign_update_grades($assign);
        return $result;
    }
873815
public static function init() : void
    {
        if ( ! empty($_SESSION[Notification::SESSION_KEY]) && is_array($_SESSION[Notification::SESSION_KEY])) {
            Notification::$notifications = $_SESSION[Notification::SESSION_KEY];
        }

        $_SESSION[Notification::SESSION_KEY] = [];
    }
641750
public function display() {
        global $OUTPUT;
        groups_print_activity_menu($this->feedbackstructure->get_cm(), $this->baseurl->out());
        $grandtotal = $this->get_total_responses_count();
        if (!$grandtotal) {
            echo $OUTPUT->box(get_string('nothingtodisplay'), 'generalbox nothingtodisplay');
            return;
        }

        if (count($this->feedbackstructure->get_items(true)) > self::PREVIEWCOLUMNSLIMIT) {
            echo $OUTPUT->notification(get_string('questionslimited', 'feedback', self::PREVIEWCOLUMNSLIMIT), 'info');
        }

        $this->out($this->showall ? $grandtotal : FEEDBACK_DEFAULT_PAGE_COUNT,
                $grandtotal > FEEDBACK_DEFAULT_PAGE_COUNT);

        // Toggle 'Show all' link.
        if ($this->totalrows > FEEDBACK_DEFAULT_PAGE_COUNT) {
            if (!$this->use_pages) {
                echo html_writer::div(html_writer::link(new moodle_url($this->baseurl, [$this->showallparamname => 0]),
                        get_string('showperpage', '', FEEDBACK_DEFAULT_PAGE_COUNT)), 'showall');
            } else {
                echo html_writer::div(html_writer::link(new moodle_url($this->baseurl, [$this->showallparamname => 1]),
                        get_string('showall', '', $this->totalrows)), 'showall');
            }
        }
    }
1021790
protected function fires()
    {
        $className = isset($this->notification->classname) ? snake_case(class_basename($this->notification->classname)) : false;

        if (! $className) {
            return [];
        }

        $before = event('notifications:' . $className . '.render.before');
        $after  = event('notifications:' . $className . '.render.after');

        return [
            'before' => !empty($before) ? current($before) : '',
            'after'  => !empty($after) ? current($after) : ''
        ];
    }
634067
public function versionNotify()
    {
        if (true === \OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('preventModuleVersionNotify')) {
            return;
        }

        $oOMNCaller = $this->_getOnlineModuleNotifierCaller();
        $oOMNCaller->doRequest($this->_formRequest());
    }
1288389
protected function execute(): void
    {
        /*
        $notification_class = static::NOTIFICATION;
        $notification = new $notification_class($this);
        if(!$notification instanceof Framework\Notification) {
            throw new Framework\Exceptions\NotificationNotFoundException(get_class($this));
        }*/
        if(isset($this->notification))
            $this->tail()->node()->notifySubscribers($this->notification);
    }
627322
public function render(): string
    {
        $toastr = '<script type="text/javascript">'.$this->options().$this->notificationsAsString().'</script>';

        $this->session->forget(self::TOASTR_NOTIFICATIONS);

        return $toastr;
    }
584638
public static function getAllNotificationsToDisplay()
    {
        $notifications = static::getAllNotifications();

        uasort($notifications, function ($n1, $n2) {
            /** @var Notification $n1 */ /** @var Notification $n2 */
            if ($n1->getPriority() == $n2->getPriority()) {
                return 0;
            }

            return $n1->getPriority() > $n2->getPriority() ? -1 : 1;
        });

        return $notifications;
    }