Пример #1
0
<?php

include "config.php";
include "Essay.php";
session_start();
$conn = new PDO('mysql:host=' . DB_SERVER . ';dbname=' . DB_NAME, DB_USERNAME, DB_PASSWORD);
$essayList = Essay::getColleagueEssays($conn, $_SESSION["user_id"]);
$conn = null;
?>
<html>
<head>
<title>Реферати на колеги</title>
<link rel="stylesheet" href="css/bootstrap.min.css">
<script src="js/jquery-1.11.2.min.js"></script>
</head>
<body>
<?php 
include "menu.php";
?>
<div class="container">
<div class="page-header">
<h1>Реферати на колеги</h1>
</div>
<?php 
if ($essayList == null) {
    echo "Все още не са добавени реферати от други студенти.";
} else {
    ?>
<table class="table table-hover">
<tr>
<th>Тема на реферата</th>
 public function testFindOneWithDuplicateRelation()
 {
     EssayPeer::doDeleteAll();
     $auth1 = new Author();
     $auth1->setFirstName('John');
     $auth1->save();
     $auth2 = new Author();
     $auth2->setFirstName('Jack');
     $auth2->save();
     $essay = new Essay();
     $essay->setTitle('Foo');
     $essay->setFirstAuthor($auth1->getId());
     $essay->setSecondAuthor($auth2->getId());
     $essay->save();
     AuthorPeer::clearInstancePool();
     EssayPeer::clearInstancePool();
     $c = new ModelCriteria('bookstore', 'Essay');
     $c->setFormatter(ModelCriteria::FORMAT_ARRAY);
     $c->join('Essay.AuthorRelatedByFirstAuthor');
     $c->with('AuthorRelatedByFirstAuthor');
     $c->where('Essay.Title = ?', 'Foo');
     $essay = $c->findOne();
     $this->assertEquals($essay['Title'], 'Foo', 'Main object is correctly hydrated');
     $firstAuthor = $essay['AuthorRelatedByFirstAuthor'];
     $this->assertEquals($firstAuthor['FirstName'], 'John', 'Related object is correctly hydrated');
     $this->assertFalse(array_key_exists('AuthorRelatedBySecondAuthor', $essay), 'Only related object specified in with() is hydrated');
 }
 public function testFindOneWithDuplicateRelation()
 {
     EssayPeer::doDeleteAll();
     $auth1 = new Author();
     $auth1->setFirstName('John');
     $auth1->save();
     $auth2 = new Author();
     $auth2->setFirstName('Jack');
     $auth2->save();
     $essay = new Essay();
     $essay->setTitle('Foo');
     $essay->setFirstAuthor($auth1->getId());
     $essay->setSecondAuthor($auth2->getId());
     $essay->save();
     AuthorPeer::clearInstancePool();
     EssayPeer::clearInstancePool();
     $c = new ModelCriteria('bookstore', 'Essay');
     $c->join('Essay.AuthorRelatedByFirstAuthor');
     $c->with('AuthorRelatedByFirstAuthor');
     $c->where('Essay.Title = ?', 'Foo');
     $con = Propel::getConnection(BookPeer::DATABASE_NAME);
     $essay = $c->findOne($con);
     $count = $con->getQueryCount();
     $this->assertEquals($essay->getTitle(), 'Foo', 'Main object is correctly hydrated');
     $firstAuthor = $essay->getAuthorRelatedByFirstAuthor();
     $this->assertEquals($count, $con->getQueryCount(), 'with() hydrates the related objects to save a query');
     $this->assertEquals($firstAuthor->getFirstName(), 'John', 'Related object is correctly hydrated');
     $secondAuthor = $essay->getAuthorRelatedBySecondAuthor();
     $this->assertEquals($count + 1, $con->getQueryCount(), 'with() does not hydrate objects not in with');
 }
Пример #4
0
<?php

include "config.php";
include "Essay.php";
include "Subject.php";
session_start();
$conn = new PDO('mysql:host=' . DB_SERVER . ';dbname=' . DB_NAME, DB_USERNAME, DB_PASSWORD);
$essay = Essay::getEssayById($conn, $_GET["id"]);
$subjectList = Subject::getAllSubjects($conn);
$conn = null;
?>
<html>
<head>
<title>Редакция на реферат</title>
<link rel="stylesheet" href="css/bootstrap.min.css">
<script src="js/jquery-1.11.2.min.js"></script>
</head>
<body>
<?php 
include "menu.php";
?>
<div class="container">
<div class="page-header">
<h1>Редакция на реферат</h1>
</div>
<form action="saveEssay.php" method="post">
<input type="hidden" name="id" value="<?php 
echo $essay->id;
?>
" />
<input type="hidden" name="old_content" value="<?php 
Пример #5
0
<?php

include "config.php";
include "Essay.php";
session_start();
$conn = new PDO('mysql:host=' . DB_SERVER . ';dbname=' . DB_NAME, DB_USERNAME, DB_PASSWORD);
$essayList = Essay::getEssaysByAuthor($conn, $_SESSION["user_id"]);
$conn = null;
?>
<html>
<head>
<title>Моят реферат</title>
<link rel="stylesheet" href="css/bootstrap.min.css">
<script src="js/jquery-1.11.2.min.js"></script>
</head>
<body>
<?php 
include "menu.php";
?>
<div class="container">
<div class="page-header">
<h1>Моят реферат</h1>
</div>
<?php 
if ($essayList != null) {
    $currentVersion = $essayList[0];
    array_shift($essayList);
    ?>
<fieldset>
<legend>Текуща версия</legend>
<table class="table">
Пример #6
0
<?php

include "config.php";
include "Essay.php";
session_start();
$conn = new PDO('mysql:host=' . DB_SERVER . ';dbname=' . DB_NAME, DB_USERNAME, DB_PASSWORD);
$essayList = Essay::getTopTenEssays($conn);
$conn = null;
?>
<html>
<head>
<title>Топ 10 реферати</title>
<link rel="stylesheet" href="css/style.css">
<link rel="stylesheet" href="css/bootstrap.min.css">
<script src="js/jquery-1.11.2.min.js"></script>
</head>
<body>
<?php 
include "menu.php";
?>
<div class="container">
<div class="page-header">
<h1>Топ 10 реферати</h1>
</div>
<table class="table table-hover">
<tr>
<th>Тема на реферата</th>
<th>Студент</th>
<th>Рейтинг</th>
</tr>
<?php 
Пример #7
0
<?php

include "config.php";
include "Essay.php";
session_start();
$conn = new PDO('mysql:host=' . DB_SERVER . ';dbname=' . DB_NAME, DB_USERNAME, DB_PASSWORD);
$essay = Essay::getEssayById($conn, $_GET["id"]);
$grade = Essay::grade($conn, $_SESSION["user_id"], $_GET["id"]);
$conn = null;
?>
<html>
<head>
<title>Преглед на реферат</title>
<link rel="stylesheet" href="css/style.css">
<link rel="stylesheet" href="css/bootstrap.min.css">
<script src="js/jquery-1.11.2.min.js"></script>
</head>
<body>
<?php 
include "menu.php";
?>
<div class="container">
<div class="page-header">
<h1>Преглед на реферат</h1>
</div>
<div class="row">
<div class="col-md-4">
<label for="author">Автор</label>
<input class="form-control" value="<?php 
echo $essay->user->firstName . " " . $essay->user->lastName;
?>