Esempio n. 1
0
 public static function init($dirTop, $htmlDirTop, $dirProject)
 {
     self::$dirTop = $dirTop;
     self::$htmlDirTop = $htmlDirTop;
     self::$dirProject = $dirProject;
     self::$dirService = self::$dirTop . '/service';
     // восстановить параметры //
 }
Esempio n. 2
0
/**
 * Загрузчик классов
 * имя файла совпадает с именем класса
 */
function my_autoloader($class)
{
    $classDirs = TaskStore::getClassDirs();
    // список директорий для поиска класса
    $classFile = false;
    foreach ($classDirs as $dir) {
        $file = findFile($dir, $class);
        // ищем во внутренних директориях
        if (false !== $file) {
            $classFile = $file;
            break;
        }
    }
    if (false !== $classFile) {
        include $classFile;
    }
}
Esempio n. 3
0
<?php

/**
* Привязка текущейДиректории к корневойПроекта
*/
// определяем верхний уровень
$topDir = realpath(__DIR__ . '/..');
$pi = pathinfo($_SERVER['PHP_SELF']);
$currentHtmlDir = $pi['dirname'];
// относительный адрес для HTML-ссылок
$topHtmlDir = $currentHtmlDir;
$arr = explode('/', $topHtmlDir);
$n = count($arr);
$topHtmlDir = '';
for ($i = 0; $i < $n - 1; $i++) {
    $topHtmlDir .= (0 == $i ? '' : '/') . $arr[$i];
}
$firstSymb = $topHtmlDir[0];
if ('/' !== $firstSymb) {
    $topHtmlDir = '/' . $topHtmlDir;
}
$dirProject = realpath(__DIR__ . '/../..');
// подключаем класс TaskStore - общие параметры
$dirService = $topDir . '/service';
include_once $dirService . '/TaskStore.php';
include_once $dirService . '/DbConnector.php';
//------ подключение БД -------------//
TaskStore::init($topDir, $topHtmlDir, $dirProject);
//  подключаем autoLoad  - авт подключение классов
include_once $dirService . '/autoload.php';
//-------------------------------------------//
Esempio n. 4
0
<?php

include_once "../app.class.php";
include_once "../TaskStore.class.php";
include_once "../utils.php";
//get the q parameter from URL
$q = $_GET["q"];
$app = getAPP();
$store = new TaskStore($app->getDB());
echo "<ul class='menu'>";
for ($i = 1; $i < 5; $i++) {
    $task = new Task(getTaskName($i), $q);
    $store->addTask($task);
    echo "<li id='" . $task->getName() . $task->getWeek() . "' onClick=\"taskMade('" . $app->getUser()->getName() . "', '" . $task->getWeek() . "', '" . $task->getName() . "');\">" . $task->getName() . "<br>User: None</li>";
}
echo "</ul>";
Esempio n. 5
0
<?php

/**
* Привязка текущейДиректории к корневойПроекта
*/
$currentDir = __DIR__;
// определяем верхний уровень
$topDir = realpath($currentDir . '/..');
$pi = pathinfo($_SERVER['PHP_SELF']);
$currentHtmlDir = $pi['dirname'];
// относительный адрес для HTML-ссылок
$topHtmlDir = $currentHtmlDir;
$firstSymb = $topHtmlDir[0];
if ('/' !== $firstSymb) {
    $topHtmlDir = '/' . $topHtmlDir;
}
// подключаем класс TaskStore - общие параметры
$dirService = $topDir . '/service';
include_once $dirService . '/TaskStore.php';
include_once $dirService . '/Message.php';
include_once $dirService . '/TaskParameters.php';
//------ подключение БД -------------//
TaskStore::init($topDir, $topHtmlDir);
//  подключаем autoLoad  - авт подключение классов
include_once $dirService . '/autoload.php';
//-------------------------------------------//
Esempio n. 6
0
<?php

include_once "../TaskStore.class.php";
include_once "../UserStore.class.php";
include_once "../utils.php";
$user = $_GET['user'];
$week = $_GET['week'];
$task = $_GET['task'];
$app = getAPP();
$taskStore = new TaskStore($app->getDB());
if ($taskStore->weekHasUser($week, $user)) {
    echo "User already exists";
} else {
    $taskStore->modifyTask($user, $week, $task);
    echo "<li id='" . $task . $week . "' class='selected'><b>" . $task . "<br>User: "******"</b></li>";
}
Esempio n. 7
0
<?php

$app;
include_once "../TaskStore.class.php";
include_once "../DebtStore.class.php";
include_once "../app.class.php";
include_once "../utils.php";
$app = getAPP();
$db = $app->getDB();
$taskStore = new TaskStore($db);
$tasks = $taskStore->getTasks();
$debtStore = new DebtStore($db);
$debts = $debtStore->getDebts();
function fillDiv($global_user, $t)
{
    $new_week = false;
    $prev = null;
    $i = 0;
    while ($t[$i] != null) {
        $task = $t[$i];
        $is_user = false;
        if ($prev != $task->getWeek()) {
            echo "<div class='week' id='" . $task->getWeek() . "'>\n";
            echo "<ul class='menu'>\n";
        }
        if ($task->getUser() == null) {
            $user = "******";
            $c = "no-user";
        } else {
            $user = $task->getUser()->getName();
            $c = "selected";