예제 #1
0
파일: logic.php 프로젝트: alerque/bibledit
 public static function getInstance()
 {
     if (empty(self::$instance)) {
         self::$instance = new Notes_Logic();
     }
     return self::$instance;
 }
예제 #2
0
<?php

/*
Copyright (©) 2003-2014 Teus Benschop.

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
require_once "../bootstrap/bootstrap.php";
page_access_level(Filter_Roles::CONSULTANT_LEVEL);
$database_notes = Database_Notes::getInstance();
$notes_logic = Notes_Logic::getInstance();
$database_users = Database_Users::getInstance();
$header = new Assets_Header(Locale_Translate::_("Severity"));
$header->run();
$view = new Assets_View(__FILE__);
$severities = $database_notes->getPossibleSeverities();
$view->view->severities = $severities;
$view->render("severity-n.php");
Assets_Page::footer();
예제 #3
0
 public function testSubscriptions()
 {
     $database_notes = Database_Notes::getInstance();
     $session_logic = Session_Logic::getInstance();
     // Normally creating a new note would subscribe the current user to the note.
     // But since this PHPUnit test runs without sessions, it would have subscribed an empty user.
     $session_logic->setUsername("");
     $identifier = $database_notes->storeNewNote("", 0, 0, 0, "Summary", "Contents", false);
     $this->identifiers[] = $identifier;
     $subscribers = $database_notes->getSubscribers($identifier);
     $this->assertEquals(array(), $subscribers);
     // Create a note again, but this time set the session variable to a certain user.
     $session_logic->setUsername("phpunit");
     $database_config_user = Database_Config_User::getInstance();
     $database_config_user->setSubscribeToConsultationNotesEditedByMe(true);
     $identifier = $database_notes->storeNewNote("", 1, 1, 1, "Summary", "Contents", false);
     $this->identifiers[] = $identifier;
     $notes_logic = Notes_Logic::getInstance();
     $notes_logic->handlerNewNote($identifier);
     $subscribers = $database_notes->getSubscribers($identifier);
     $this->assertEquals(array("phpunit"), $subscribers);
     $this->assertTrue($database_notes->isSubscribed($identifier, "phpunit"));
     $database_config_user->setSubscribeToConsultationNotesEditedByMe(false);
     // Test various other subscription related functions.
     $this->assertFalse($database_notes->isSubscribed($identifier, "phpunit_phpunit"));
     $database_notes->unsubscribe($identifier);
     $this->assertFalse($database_notes->isSubscribed($identifier, "phpunit"));
     $database_notes->subscribeUser($identifier, "phpunit_phpunit_phpunit");
     $this->assertTrue($database_notes->isSubscribed($identifier, "phpunit_phpunit_phpunit"));
     $database_notes->unsubscribeUser($identifier, "phpunit_phpunit_phpunit");
     $this->assertFalse($database_notes->isSubscribed($identifier, "phpunit_phpunit_phpunit"));
 }
예제 #4
0
<?php

/*
Copyright (©) 2003-2014 Teus Benschop.

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
require_once "../bootstrap/bootstrap.php";
page_access_level(Filter_Roles::CONSULTANT_LEVEL);
$assets_header = new Assets_Header(Locale_Translate::_("Bibles"));
$assets_header->run();
$view = new Assets_View(__FILE__);
$bibles = Access_Bible::bibles();
// Add general Bible.
$bibles[] = Notes_Logic::generalBibleName();
$view->view->bibles = $bibles;
$view->render("bible-n.php");
Assets_Page::footer();
예제 #5
0
파일: bulk.php 프로젝트: alerque/bibledit
    Assets_Page::success(Locale_Translate::_("The status of the notes was updated"));
    $database_logs->log("Status update of notes: {$identifierlist}", true);
}
@($severity = $_GET['severity']);
if (isset($severity)) {
    foreach ($identifiers as $identifier) {
        if ($database_notes->getRawSeverity($identifier) != $severity) {
            $notes_logic->setRawSeverity($identifier, $severity);
        }
    }
    Assets_Page::success(Locale_Translate::_("The severity of the notes was updated"));
    $database_logs->log("Severity update of notes: {$identifierlist}", true);
}
@($bible = $_GET['bible']);
if (isset($bible)) {
    if ($bible == Notes_Logic::generalBibleName()) {
        $bible = "";
    }
    foreach ($identifiers as $identifier) {
        if ($database_notes->getBible($identifier) != $bible) {
            $notes_logic->setBible($identifier, $bible);
        }
    }
    Assets_Page::success(Locale_Translate::_("The Bible of the notes was updated"));
    $database_logs->log("Bible update of notes: {$identifierlist}", true);
}
@($delete = $_GET['delete']);
if (isset($delete)) {
    @($confirm = $_GET['confirm']);
    if ($confirm != "yes") {
        $dialog_yes = new Dialog_Yes2(Locale_Translate::_("Would you like to delete the notes?"), "&delete=");