|
From: <pan...@us...> - 2009-02-14 10:38:24
|
Revision: 506
http://acmcontester.svn.sourceforge.net/acmcontester/?rev=506&view=rev
Author: panzaboi
Date: 2009-02-14 10:38:19 +0000 (Sat, 14 Feb 2009)
Log Message:
-----------
1) Added News
2) Moved Users out of ACM module to default
3) Changed contest to not include registration
4) Added Rank Table for contests
5) Added application/view path to include general views there. (Should consider the same for models)
Modified Paths:
--------------
website/application/layouts/layout.phtml
website/application/modules/acm/controllers/ContestController.php
website/application/modules/acm/models/Calc/ACM.php
website/application/modules/acm/models/Contest.php
website/application/modules/acm/models/Table/Contests.php
website/application/modules/acm/models/Table/ContestsResults.php
website/application/modules/acm/models/Table/Submits.php
website/application/modules/acm/models/Table/UsersDetails.php
website/application/modules/acm/models/Table/UsersStats.php
website/application/modules/acm/views/scripts/archive/entry.phtml
website/application/modules/acm/views/scripts/archive/index.phtml
website/application/modules/acm/views/scripts/contest/contest.phtml
website/application/modules/acm/views/scripts/contest/entry.phtml
website/application/modules/acm/views/scripts/contest/index.phtml
website/application/modules/acm/views/scripts/contest/problemset.phtml
website/application/modules/acm/views/scripts/contest/result.phtml
website/application/modules/acm/views/scripts/contest/results.phtml
website/config/config.ini
website/httpdocs/index.php
website/lang/uk.csv
website/library/Application.php
website/library/Ostacium/Controller/Router/Route/Language.php
Added Paths:
-----------
website/application/modules/acm/views/scripts/contest/source.phtml
website/application/modules/acm/views/scripts/contest/table.phtml
website/application/modules/default/controllers/NewsController.php
website/application/modules/default/controllers/UserController.php
website/application/modules/default/models/
website/application/modules/default/models/Form/
website/application/modules/default/models/News.php
website/application/modules/default/models/Table/
website/application/modules/default/models/Table/News.php
website/application/modules/default/models/Table/Users.php
website/application/modules/default/models/User.php
website/application/modules/default/views/scripts/news/
website/application/modules/default/views/scripts/news/entry.phtml
website/application/modules/default/views/scripts/news/index.phtml
website/application/modules/default/views/scripts/news/view.phtml
website/application/view/
website/application/view/helpers/
website/application/view/scripts/
website/application/view/scripts/logedin.phtml
website/application/view/scripts/paginator.phtml
Removed Paths:
-------------
website/application/layouts/old_layout.phtml
website/application/modules/acm/controllers/UserController.php
website/application/modules/acm/models/Archieve.php
website/application/modules/acm/models/Table/Users.php
website/application/modules/acm/models/User.php
website/application/modules/acm/views/scripts/contest/incontest.phtml
website/application/modules/acm/views/scripts/contest/notincontest.phtml
website/application/modules/acm/views/scripts/error/
website/application/modules/acm/views/scripts/logedin.phtml
website/application/modules/acm/views/scripts/paginator.phtml
website/application/modules/acm/views/scripts/user/
website/application/modules/default/views/scripts/error/
Modified: website/application/layouts/layout.phtml
===================================================================
--- website/application/layouts/layout.phtml 2009-02-14 01:29:23 UTC (rev 505)
+++ website/application/layouts/layout.phtml 2009-02-14 10:38:19 UTC (rev 506)
@@ -51,8 +51,8 @@
<div id="topmenu">
<ul>
- <li><a href="#" class="current">home</a></li>
- <li><a href="#">news</a></li>
+ <li><a href="<?= $this->url(array(), null, true) ?>" class="current">home</a></li>
+ <li><a href="<?= $this->url(array('module' => 'default', 'controller' => 'news'), null, true) ?>">news</a></li>
<li><a href="#">forum</a></li>
<li><a href="#">links</a></li>
<li><a href="#">search</a></li>
@@ -79,12 +79,7 @@
</ul>
</li>
<li>
- <a href="#Archieve" onclick="return toggle('sub2');">Контести</a>
- <ul id="sub2">
- <li><a href="<?= $this->url(array('module' => 'acm', 'controller' => 'contest', 'action' => 'index'), null, true) ?>">Зареєструватись</a></li>
- <li><a href="#Problems">Набір Завдань</a></li>
- <li><a href="#Results">Результати</a></li>
- </ul>
+ <a href="<?= $this->url(array('module' => 'acm', 'controller' => 'contest', 'action' => 'index'), null, true) ?>">Контести</a>
</li>
<li>
<a href="#Archieve" onclick="return toggle('sub3');">Віртуальні Контести</a>
Deleted: website/application/layouts/old_layout.phtml
===================================================================
--- website/application/layouts/old_layout.phtml 2009-02-14 01:29:23 UTC (rev 505)
+++ website/application/layouts/old_layout.phtml 2009-02-14 10:38:19 UTC (rev 506)
@@ -1,87 +0,0 @@
-<?= $this->doctype() ?>
-<? $this->dojo()->enable()
- ->setDjConfigOption('parseOnLoad', true)
- ->registerModulePath('custom', '../custom/')
- ->requireModule('dijit.form.FilteringSelect') ?>
-<html>
- <head>
- <base href="<?= 'http://' . $_SERVER["HTTP_HOST"] . $this->baseUrl() ?>/" />
- <?= $this->headTitle($this->placeholder('title')->toString()) ?>
- <?= $this->headMeta()->appendHttpEquiv('Content-Type', 'text/html; charset=UTF-8') ?>
-
- <?= $this->headLink()->appendStylesheet('styles/style.css') ?>
- <?= /*$this->headLink()->appendStylesheet('styles/ie6.css', 'screen', 'IE 6')*/'' ?>
- <?= /*$this->headLink()->appendStylesheet('styles/ie7.css', 'screen', 'IE 7')*/'' ?>
- <?= $this->headScript()->appendFile('/scripts/main.js') ?>
-
- <? if ($this->dojo()->isEnabled()):
- $this->dojo()->setLocalPath('/scripts/dojo/dojo.js')
- ->addStyleSheetModule('dijit.themes.tundra');
-
- echo $this->dojo();
- endif; ?>
- </head>
- <body class="tundra">
- <table border="0" cellpadding="0" cellspacing="0" width="100%">
- <tr bgcolor="#122a5b">
- <td><img height="43" src="images/logo.gif" width="490"></td>
- </tr>
- <tr bgcolor="#e1e1e1">
- <td><img height=26 src="images/logod.gif" width="490"></td>
- </tr>
- <tr>
- <td bgcolor=#122a5b colspan=2><img height=2 src="images/0.gif" width=1></td>
- </tr>
- </table>
- <table border=0 cellpadding=0 cellspacing=0 width="100%" summary="" height="20%">
- <tr>
- <td bgcolor=#e1e1e1 valign=top width="200">
- <table width="100%" border="0" cellpadding="0" cellspacing="5">
- <tr><td><img border="0" src="images/arrow.gif" width="8" height="8" hspace="5"><a href="index/about">Що це за проект</a></td></tr>
- <tr><td><img border="0" src="images/arrow.gif" width="8" height="8" hspace="5"><a href="index/rule">Правила</a></td></tr>
- <tr><td><img border="0" src="images/arrow.gif" width="8" height="8" hspace="5"><a href="/acm/archive/index">Набір завдань</a></td></tr>
- <tr><td><img border="0" src="images/arrow.gif" width="8" height="8" hspace="5"><a href="/acm/archive/submit">Протестувати Розв'язок</a></td></tr>
- <tr><td><img border="0" src="images/arrow.gif" width="8" height="8" hspace="5"><a href="/acm/archive/results">Результати Тестувань</a></td></tr>
- <tr><td><img border="0" src="images/arrow.gif" width="8" height="8" hspace="5"><a href="/acm/archive/ranks">Рейтинг Учасників</a></td></tr>
- <tr><td><hr></td></tr>
- </table>
-
- <table border=0 cellpadding=4 cellspacing=0 width="100%" summary="">
- <tr><td align=middle bgcolor=#122a5b><font color=#d4d0e2><b><small>вхід</small></b></font></td></tr>
- <tr><td>
- <form onsubmit="return checkform(this);" method="post" action="login.php?rid=45fed5d9b297f" style="margin:0">
- <input type="hidden" name="path" value="/">
- <table border=0 cellPadding=1 cellSpacing=0 summary="" width=100%>
- <tr>
- <td class=name nowrap><small><font color=#122a5b> логін:</font></small></td>
- <td><input name=lgn style="height: 18px; width: 100px"></td>
- <td> </td>
- </tr>
- <tr>
- <td class=name nowrap><small><font color=#122a5b> пароль:</font></small></td>
- <td><input name=pswd type=password style="height: 18px; width: 100px"></td>
- <td><input name="login" src="images/b_find.gif" type="image">
- </tr>
- </table>
- </form>
-
-<CENTER><A href="register.php">Зареєструватись</a><BR><a href=createteam.php>Створити команду</a></CENTER>
-</TABLE><TABLE border=0 cellPadding=4 cellSpacing=0 width="100%">
-<TR><TD align=middle bgColor=#122a5b>
-<FONT color=#d4d0e2><B><SMALL>F.A.Q.</SMALL></B></FONT>
-<TR><TD><TABLE border=0 cellPadding=0 cellSpacing=2 width="100%"><TR><TD><P>Мені здається що програма написана правильно, але система видає "Помилка під час виконання"...
-<P>Якщо Ви використовуєте С++, і описали функцію void main(){...} - навіть якщо програма видасть
-правильний результат, то система видасть "помилка під час виконання". Це пов'язано з тим, що
-в такому випадку код завершення програми непердбачуваний, і практично ніколи небуває нульовим.
-<BR>Для того, щоб програму Вам зарахувало (якщо все правильно), необхідно описувати основну
-функцію як int main(){...} і обов'язково завершувати програму через return 0.
-<TR><TD align=right><P><SMALL><A href="allfaq.php">[ Всі питання ]</p></SMALL></TABLE><TR><TD align=middle bgColor=#122a5b>
-<FONT color=#d4d0e2> </FONT>
-<TR><TD><TABLE border=0 cellPadding=0 cellSpacing=2 width="100%"><TR><TD align=center>
-
-</TABLE></TABLE><TD bgColor=#f4f3f8 vAlign=top height=100%><?= $this->placeholder('message') ?><br /><?= $this->layout()->content ?></table></table>
-<TABLE>
-<TR vAlign=Bottom><TABLE border=0 cellPadding=0 cellSpacing=0 width="100%" summary=""><TR bgColor=#122a5b><TD colSpan=3><IMG alt="" height=5 src="images/pixel.gif" width=1><TR bgColor=#122a5b><TD class=copyright>© 2004-2005, <a class=copyrightlink href="mailto: ac...@ia..."><B><FONT COLOR="#d1d1d1">A-S</FONT>tudio</B></A><TD align=middle><TD align=right class=copyright><A class=copyrightlink href="http://www.acm.lviv.ua">ACM Контестер</A><TR bgColor=#122a5b><TD colSpan=3><IMG alt="" height=5 src="images/pixel.gif" width=1></TABLE>
- <?= $this->debugInfo(true) ?>
- </body>
-</html>
\ No newline at end of file
Modified: website/application/modules/acm/controllers/ContestController.php
===================================================================
--- website/application/modules/acm/controllers/ContestController.php 2009-02-14 01:29:23 UTC (rev 505)
+++ website/application/modules/acm/controllers/ContestController.php 2009-02-14 10:38:19 UTC (rev 506)
@@ -21,7 +21,7 @@
{
}
-
+ /*
public function registerAction()
{
$contestid = $this->_getParam('contestid');
@@ -40,7 +40,7 @@
return $this->render('registered');
}
-
+ */
public function viewAction()
{
$id = $this->_getParam('id');
@@ -54,14 +54,27 @@
$this->view->assign($problem);
}
+ public function sourceAction()
+ {
+ $id = $this->_getParam('id');
+ $contestid = $this->_getParam('contestid');
+
+ $source = $this->_model->getSubmit($id, $contestid);
+
+ if (!$source)
+ return $this->_forward('index', null, null, $this->_getAllParams() + array('message' => 'noProblem'));
+
+ $this->view->assign($source);
+ }
+
public function problemsetAction()
{
$contestid = $this->_getParam('contestid');
- if (!$this->_model->isInContest($contestid))
+ /*if (!$this->_model->isInContest($contestid))
{
return $this->render('notincontest');
- }
+ }*/
$this->view->challenges = $this->_model->getChallenges($contestid);
}
@@ -149,4 +162,12 @@
$this->view->submits = $this->_model->getSubmits($contestid);
}
+
+ public function tableAction()
+ {
+ $contestid = $this->_getParam('contestid');
+
+ $this->view->challenges = $this->_model->getChallenges($contestid);
+ $this->view->table = $this->_model->getTable($contestid);
+ }
}
\ No newline at end of file
Deleted: website/application/modules/acm/controllers/UserController.php
===================================================================
--- website/application/modules/acm/controllers/UserController.php 2009-02-14 01:29:23 UTC (rev 505)
+++ website/application/modules/acm/controllers/UserController.php 2009-02-14 10:38:19 UTC (rev 506)
@@ -1,80 +0,0 @@
-<?php
-
-class Acm_UserController extends Ostacium_Controller_Action
-{
- public function registerAction()
- {
- $this->_helper->getHelper('viewRenderer')->setNoRender(true);
-
- $form = new Form_Register();
-
- if (!$this->getRequest()->isPost())
- {
- echo $form;
- return;
- }
-
- if (!$form->isValid($this->getRequest()->getPost()))
- {
- echo $form;
- return;
- }
-
- // check cpassword == password
-
- $values = $form->getValues();
- $values['ip'] = $this->getRequest()->getIp();
- $code = substr(md5(time()), mt_rand(0, 27), 5);
- $result = $this->_model->registerUser($values, $code);
-
- if (!$result)
- {
- $form->setDescription($this->view->translate('wrongEmailPwd'));
-
- echo $form;
- }
- else
- {
- $arguments = array('code' => $code, 'fullname' => $values['name'].' '.$values['surname'], 'username' => $values['username']);
- $mail = new Ostacium_Mail();
- $mail->setFrom($this->_config->email->from.'@'.$_SERVER["SERVER_NAME"], $this->_config->general->title.' Staff')
- ->addTo($values['email'], $values['name'].' '.$values['surname'])
- ->setSubject($this->_('registration_email'))
- ->setBodyTemplate(array('template' => 'register.phtml', 'arguments' => $arguments))
- ->send();
-
- return $this->_redirect($this->view->url(array('action' => 'registered')));
- }
- }
-
- public function registeredAction()
- {
-
- }
-
- public function activateAction()
- {
- $username = $this->_getParam('username');
- $code = $this->_getParam('code');
-
- $result = $this->_model->activateUser($username, $code);
-
- if ($result)
- {
- return $this->render('activated');
- }
- else
- {
- return $this->render('notactivated');
- }
- }
-
- public function viewAction()
- {
- $username = $this->_getParam('username');
- $this->view->assign($this->_model->getUser($username));
- var_dump($this->_model->getUser($username));
-
- //var_dump($this->view->user);
- }
-}
\ No newline at end of file
Deleted: website/application/modules/acm/models/Archieve.php
===================================================================
--- website/application/modules/acm/models/Archieve.php 2009-02-14 01:29:23 UTC (rev 505)
+++ website/application/modules/acm/models/Archieve.php 2009-02-14 10:38:19 UTC (rev 506)
@@ -1,68 +0,0 @@
-<?php
-
-class Archieve extends Ostacium_Model
-{
- public function getChallenges()
- {
- $challenges = new Challenges();
- return $challenges->getAll();
- }
-
- public function getSubmits()
- {
- $submits = new Submits();
- return $submits->getAll();
- }
-
- public function getChallenge($id)
- {
- $challenges = new Challenges();
- return $challenges->get($id);
- }
-
- public function addSubmit($values)
- {
- $data = array(
- 'contestid' => 0,
- 'username' => Zend_Auth::getInstance()->getStorage()->read()->username,
- 'challengeid' => (int)$values['id'],
- 'codelangid' => $values['languageid'],
- 'firsttest' => $values['firsttest'],
- 'when' => time()
- );
-
- //$challenges = new Challenges();
- //$challenges->update(array('tries' => 'tries + 1'), $this->_db->quoteInto('id = ?', $data['challengeid']));
- // move this to the page, where we recieve data from Tester, add tries and accepts there.
-
- $submits = new Submits();
- return $submits->insert($data);
- }
-}
-
-class Challenges extends Ostacium_Db_Table
-{
- protected $_name = 'challenges';
- protected $_primary = 'id';
-
- public function get($id)
- {
- return $this->selectLang(array('name', 'description'))->where('challenges.id = ? AND enabled = 1', $id)->query()->fetch();
- }
-
- public function getAll()
- {
- return $this->selectLang(array('name', 'description'))->where('challenges.enabled = 1')->query()->fetchAll();
- }
-}
-
-class Submits extends Ostacium_Db_Table
-{
- protected $_name = 'submits';
- protected $_primary = 'id';
-
- public function getAll()
- {
- return $this->select()->from($this)->setIntegrityCheck(false)->joinLeft('code_languages', 'code_languages.id = submits.codelangid', array('codelang' => 'name'))->where('contestid = 0')->order('submits.id DESC')->query()->fetchAll();
- }
-}
\ No newline at end of file
Modified: website/application/modules/acm/models/Calc/ACM.php
===================================================================
--- website/application/modules/acm/models/Calc/ACM.php 2009-02-14 01:29:23 UTC (rev 505)
+++ website/application/modules/acm/models/Calc/ACM.php 2009-02-14 10:38:19 UTC (rev 506)
@@ -31,7 +31,7 @@
}
elseif ($submit['state'] > 1)
{
- $result['penalty'] += $_config->calc->acm->penalty;
+ $result['penalty'] += $_config->acm->calc->penalty;
}
return $result;
Modified: website/application/modules/acm/models/Contest.php
===================================================================
--- website/application/modules/acm/models/Contest.php 2009-02-14 01:29:23 UTC (rev 505)
+++ website/application/modules/acm/models/Contest.php 2009-02-14 10:38:19 UTC (rev 506)
@@ -20,7 +20,7 @@
$contests = new Table_Contests();
return $contests->getAll();
}
-
+ /*
public function registerUser($id)
{
$username = Zend_Auth::getInstance()->getStorage()->read()->username;
@@ -30,13 +30,13 @@
return true;
}
-
+ */
public function isContestRunning($contestid)
{
$contest = new Table_Contests();
return $contest->isRunning($contestid);
}
-
+ /*
public function isInContest($contestid)
{
$username = Zend_Auth::getInstance()->getStorage()->read()->username;
@@ -44,7 +44,7 @@
return $contest->isInContest($contestid, $username);
}
-
+ */
public function getChallenges($contestid)
{
$challenges = new Table_Challenges();
@@ -57,6 +57,12 @@
return $challenges->getFromContest($id, $contestid);
}
+ public function getSubmit($id, $contestid)
+ {
+ $submits = new Table_Submits();
+ return $submits->getFromContest($id, $contestid);
+ }
+
public function addSubmit($values)
{
$data = array(
@@ -87,7 +93,7 @@
public function updateResults($submit)
{
- // LOG THIS/FAIL!
+ //TODO: LOG THIS/FAIL!
if (!$this->calc) return false;
$contests = new Table_Contests();
@@ -118,6 +124,17 @@
$results->update($newresult, $where);
}
}
+
+ public function getTable($contestid)
+ {
+ $results = new Table_ContestsResults();
+ return $results->getResults($contestid);
+
+ /*if ($results)
+ return $results->toArray();
+ else
+ return false;*/
+ }
}
Modified: website/application/modules/acm/models/Table/Contests.php
===================================================================
--- website/application/modules/acm/models/Table/Contests.php 2009-02-14 01:29:23 UTC (rev 505)
+++ website/application/modules/acm/models/Table/Contests.php 2009-02-14 10:38:19 UTC (rev 506)
@@ -23,7 +23,7 @@
->where('enabled = 1 AND start <= UNIX_TIMESTAMP() AND end > UNIX_TIMESTAMP()')
->query()->fetchAll();
}
-
+/*
public function isInContest($contestid, $username)
{
$id = $this->select()->setIntegrityCheck(false)
@@ -36,4 +36,5 @@
if ($id && $id == $contestid) return true;
else return false;
}
+*/
}
\ No newline at end of file
Modified: website/application/modules/acm/models/Table/ContestsResults.php
===================================================================
--- website/application/modules/acm/models/Table/ContestsResults.php 2009-02-14 01:29:23 UTC (rev 505)
+++ website/application/modules/acm/models/Table/ContestsResults.php 2009-02-14 10:38:19 UTC (rev 506)
@@ -4,4 +4,17 @@
{
protected $_name = 'contests_results';
protected $_primary = array('contestid', 'username', 'challengeid');
+
+ public function getResults($contestid)
+ {
+ return $this->select()->setIntegrityCheck(false)
+ ->from($this, array('*', 'SUM(penalty) as total_penalty', 'SUM(accepted) AS total_accepts', 'GROUP_CONCAT(challengeid) as challenges', 'GROUP_CONCAT(accepted) as accepts', 'GROUP_CONCAT(tries) as alltries', 'GROUP_CONCAT(created-contests.start) as allcreated'))
+ ->joinLeft('contests', 'contests.id=contests_results.contestid', array())
+ ->order('total_accepts DESC')
+ ->order('total_penalty ASC')
+ ->order('accepted DESC')
+ ->where('contestid = ?', $contestid)
+ ->group('username')
+ ->query()->fetchAll();
+ }
}
\ No newline at end of file
Modified: website/application/modules/acm/models/Table/Submits.php
===================================================================
--- website/application/modules/acm/models/Table/Submits.php 2009-02-14 01:29:23 UTC (rev 505)
+++ website/application/modules/acm/models/Table/Submits.php 2009-02-14 10:38:19 UTC (rev 506)
@@ -16,6 +16,17 @@
->query()->fetchAll();
}
+ public function getFromContest($id, $contestid)
+ {
+ return $this->select()->setIntegrityCheck(false)
+ ->from($this)
+ ->joinLeft('code_languages', 'code_languages.id = submits.codelangid', array('codelang' => 'name'))
+ ->joinLeft(array('c' => 'contests'), 'submits.contestid = c.id', array())
+ ->where('submits.id = ?', $id)
+ ->where('submits.contestid = ?', $contestid)
+ ->query()->fetch();
+ }
+
public function getAll()
{
return $this->select()->setIntegrityCheck(false)
Deleted: website/application/modules/acm/models/Table/Users.php
===================================================================
--- website/application/modules/acm/models/Table/Users.php 2009-02-14 01:29:23 UTC (rev 505)
+++ website/application/modules/acm/models/Table/Users.php 2009-02-14 10:38:19 UTC (rev 506)
@@ -1,16 +0,0 @@
-<?php
-
-class Table_Users extends Ostacium_Db_Table
-{
- protected $_name = 'users';
- protected $_primaty = 'username';
-
- function getUser($username)
- {
- return $this->select()->setIntegrityCheck(false)->from($this)
- ->joinLeft(array('r' => 'roles'), 'r.id=users.roleid', array('role' => 'name'))
- ->joinLeft(array('d' => 'usersdetails'), 'd.username=users.username')
- ->where('users.username = ?', $username)
- ->query()->fetch();
- }
-}
\ No newline at end of file
Modified: website/application/modules/acm/models/Table/UsersDetails.php
===================================================================
--- website/application/modules/acm/models/Table/UsersDetails.php 2009-02-14 01:29:23 UTC (rev 505)
+++ website/application/modules/acm/models/Table/UsersDetails.php 2009-02-14 10:38:19 UTC (rev 506)
@@ -3,5 +3,5 @@
class Table_UsersDetails extends Ostacium_Db_Table
{
protected $_name = 'usersdetails';
- protected $_primaty = 'username';
+ protected $_primary = 'username';
}
\ No newline at end of file
Modified: website/application/modules/acm/models/Table/UsersStats.php
===================================================================
--- website/application/modules/acm/models/Table/UsersStats.php 2009-02-14 01:29:23 UTC (rev 505)
+++ website/application/modules/acm/models/Table/UsersStats.php 2009-02-14 10:38:19 UTC (rev 506)
@@ -3,5 +3,5 @@
class Table_UsersStats extends Ostacium_Db_Table
{
protected $_name = 'usersstats';
- protected $_primaty = 'username';
+ protected $_primary = 'username';
}
\ No newline at end of file
Deleted: website/application/modules/acm/models/User.php
===================================================================
--- website/application/modules/acm/models/User.php 2009-02-14 01:29:23 UTC (rev 505)
+++ website/application/modules/acm/models/User.php 2009-02-14 10:38:19 UTC (rev 506)
@@ -1,39 +0,0 @@
-<?php
-
-class User extends Ostacium_Model
-{
- public function registerUser($data, $code)
- {
- $data['registered'] = time();
- $data['online'] = $data['registered'];
- $data['roleid'] = Zend_Registry::get('config')->general->roleid;
- $data['activated'] = $code;
- $data['password'] = md5($data['password']);
-
- $users = new Table_Users();
- $users->insert($data);
-
- $usersdetails = new Table_UsersDetails();
- $usersdetails->insert($data);
-
- $usersstats = new Table_UsersStats();
- $usersstats->insert($data);
-
- return true;
- }
-
- public function activateUser($username, $code)
- {
- $where = $this->_db->quoteInto('username = ?', $username).' AND activated = ?';
- $where = $this->_db->quoteInto($where, $code);
-
- $users = new Table_Users();
- return $users->update(array('activated' => null), $where);
- }
-
- public function getUser($username)
- {
- $users = new Table_Users();
- return $users->getUser($username);
- }
-}
\ No newline at end of file
Modified: website/application/modules/acm/views/scripts/archive/entry.phtml
===================================================================
--- website/application/modules/acm/views/scripts/archive/entry.phtml 2009-02-14 01:29:23 UTC (rev 505)
+++ website/application/modules/acm/views/scripts/archive/entry.phtml 2009-02-14 10:38:19 UTC (rev 506)
@@ -7,4 +7,4 @@
<a href="<?= $this->url( array('action' => 'submit', 'id' => $this->id), null) ?>"><img height="20" width="20" alt="<?= $this->translate('submit_solution') ?>" src="images/acm/submit.png"/></a>
<a href="<?= $this->url( array('action' => 'status', 'id' => $this->id), null) ?>"><img height="20" width="20" alt="<?= $this->translate('solution_status') ?>" src="images/acm/status.png"/>
</td>
-</tr>
+</tr>
\ No newline at end of file
Modified: website/application/modules/acm/views/scripts/archive/index.phtml
===================================================================
--- website/application/modules/acm/views/scripts/archive/index.phtml 2009-02-14 01:29:23 UTC (rev 505)
+++ website/application/modules/acm/views/scripts/archive/index.phtml 2009-02-14 10:38:19 UTC (rev 506)
@@ -18,4 +18,4 @@
<tr>
<td colspan="5" class="footer tc"><?= $this->challenges ?></td>
</tr>
-</table>
+</table>
\ No newline at end of file
Modified: website/application/modules/acm/views/scripts/contest/contest.phtml
===================================================================
--- website/application/modules/acm/views/scripts/contest/contest.phtml 2009-02-14 01:29:23 UTC (rev 505)
+++ website/application/modules/acm/views/scripts/contest/contest.phtml 2009-02-14 10:38:19 UTC (rev 506)
@@ -3,5 +3,9 @@
<td align="center"><?= $this->name ?></td>
<td align="center"><?= $this->date($this->start, "d.m.Y H:i:s") ?></td>
<td align="center"><?= $this->date($this->end, "d.m.Y H:i:s") ?></td>
- <td align="center"><a href="<?= $this->url(array('action' => 'register', 'contestid' => $this->id), null) ?>"><?= $this->translate('register') ?></a></td>
+ <td align="center">
+ <a href="<?= $this->url(array('action' => 'problemset', 'contestid' => $this->id), null) ?>"><?= $this->translate('problem_set') ?></a>
+ <a href="<?= $this->url(array('action' => 'results', 'contestid' => $this->id), null) ?>"><?= $this->translate('results') ?></a>
+ <a href="<?= $this->url(array('action' => 'table', 'contestid' => $this->id), null) ?>"><?= $this->translate('table') ?></a>
+ </td>
</tr>
\ No newline at end of file
Modified: website/application/modules/acm/views/scripts/contest/entry.phtml
===================================================================
--- website/application/modules/acm/views/scripts/contest/entry.phtml 2009-02-14 01:29:23 UTC (rev 505)
+++ website/application/modules/acm/views/scripts/contest/entry.phtml 2009-02-14 10:38:19 UTC (rev 506)
@@ -1,14 +1,10 @@
-<tr bgcolor="#f4f3f8" align="middle">
- <td style="border-left: 0px none; border-right: 1px solid rgb(196, 196, 219);">
- <a href="<?= $this->url( array('action' => 'view', 'contest' => $this->contestid, 'id' => $this->id), null) ?>"><?= $this->id ?></a>
+<tr class="tc">
+ <td width="10%"><a href="<?= $this->url( array('action' => 'view', 'id' => $this->id), null) ?>"><?= $this->id ?></a></td>
+ <td width="60%" class="tl"><a href="<?= $this->url( array('action' => 'view', 'id' => $this->id), null) ?>"><?= $this->name ?></a></td>
+ <td width="10%"><?= $this->tries ?></td>
+ <td width="10%"><?= $this->accepts ?></td>
+ <td width="10%">
+ <a href="<?= $this->url( array('action' => 'submit', 'id' => $this->id), null) ?>"><img height="20" width="20" alt="<?= $this->translate('submit_solution') ?>" src="images/acm/submit.png"/></a>
+ <a href="<?= $this->url( array('action' => 'status', 'id' => $this->id), null) ?>"><img height="20" width="20" alt="<?= $this->translate('solution_status') ?>" src="images/acm/status.png"/>
</td>
-
- <td align="left" style="border-left: 0px none; border-right: 1px solid rgb(196, 196, 219);">
- <a href="<?= $this->url( array('action' => 'view', 'contest' => $this->contestid, 'id' => $this->id), null) ?>"><?= $this->name ?></a>
- </td>
-
- <td style="border-left: 0px none; border-right: 0px solid rgb(196, 196, 219);">
- <a href="<?= $this->url( array('action' => 'submit', 'contest' => $this->contestid, 'id' => $this->id), null) ?>"><img height="17" width="22" alt="Здати" title="Здати" src="images/b_find.gif"/></a>
- <a href="<?= $this->url( array('action' => 'status', 'contest' => $this->contestid, 'id' => $this->id), null) ?>"><img height="17" width="22" alt="Показати як здають" src="images/probstatus.png"/>
- </td>
</tr>
\ No newline at end of file
Deleted: website/application/modules/acm/views/scripts/contest/incontest.phtml
===================================================================
--- website/application/modules/acm/views/scripts/contest/incontest.phtml 2009-02-14 01:29:23 UTC (rev 505)
+++ website/application/modules/acm/views/scripts/contest/incontest.phtml 2009-02-14 10:38:19 UTC (rev 506)
@@ -1 +0,0 @@
-You are already in this contest
\ No newline at end of file
Modified: website/application/modules/acm/views/scripts/contest/index.phtml
===================================================================
--- website/application/modules/acm/views/scripts/contest/index.phtml 2009-02-14 01:29:23 UTC (rev 505)
+++ website/application/modules/acm/views/scripts/contest/index.phtml 2009-02-14 10:38:19 UTC (rev 506)
@@ -2,11 +2,11 @@
<br />
<table class="table">
<tr>
- <th>Номер</th>
- <th>Назва</th>
- <th>Початок</th>
- <th>Кінець</th>
- <th>Зареєструватись</th>
+ <th><?= $this->translate('id') ?></th>
+ <th><?= $this->translate('name') ?></th>
+ <th><?= $this->translate('start') ?></th>
+ <th><?= $this->translate('end') ?></th>
+ <th><?= $this->translate('options') ?></th>
</tr>
<? if (count($this->contests)): ?>
<?= $this->partialLoop('contest/contest.phtml', $this->contests) ?>
Deleted: website/application/modules/acm/views/scripts/contest/notincontest.phtml
===================================================================
--- website/application/modules/acm/views/scripts/contest/notincontest.phtml 2009-02-14 01:29:23 UTC (rev 505)
+++ website/application/modules/acm/views/scripts/contest/notincontest.phtml 2009-02-14 10:38:19 UTC (rev 506)
@@ -1 +0,0 @@
-You are not taking part in this contest
\ No newline at end of file
Modified: website/application/modules/acm/views/scripts/contest/problemset.phtml
===================================================================
--- website/application/modules/acm/views/scripts/contest/problemset.phtml 2009-02-14 01:29:23 UTC (rev 505)
+++ website/application/modules/acm/views/scripts/contest/problemset.phtml 2009-02-14 10:38:19 UTC (rev 506)
@@ -1,10 +1,21 @@
-<table cellspacing="1" cellpadding="8" border="0" width="100%"><tbody><tr><td width="100%" valign="top" class="name">
-
-<table cellspacing="0" cellpadding="0" border="0" width="100%"><tbody><tr><td bgcolor="#d0d4de" width="4" class="name">
-
-<img height="18" width="4" src="http://web.archive.org/web/20070323032706/http://acm.lviv.ua/"/></td>
-
-<td nowrap="" bgcolor="#122a5b" width="*" class="name"> <font color="#d4d0e2"><b><small>Набiр задач</small></b><small/></font></td><td nowrap="" bgcolor="#122a5b" align="right" class="name"> <font color="#d4d0e2"><b><small> 05:26 23 березня 2007 року </small></b><small/></font></td></tr></tbody></table> <table cellspacing="0" cellpadding="0" border="0" summary="" align="center"><tbody><tr><td bgcolor="#f4f3f8" align="middle" colspan="14"><b>Архів задач</b></td></tr><tr><td bgcolor="#c4c4db" colspan="20"><img height="1" width="1" src="http://web.archive.org/web/20070323032706/http://acm.lviv.ua/" alt=""/></td></tr><tr bgcolor="#e1e1e1" align="middle">
-<th width="70">Задача</th><th align="left" width="270"> Назва</th><th align="middle" width="70">Дії</th></tr><tr><td height="1" bgcolor="#c4c4db" colspan="20"><img height="1" width="1" src="http://web.archive.org/web/20070323032706/http://acm.lviv.ua/" alt=""/></td></tr>
-<?= $this->partialLoop('contest/entry.phtml', $this->challenges) ?>
-</table><br/></td></tr></table>
\ No newline at end of file
+<h2><?= $this->translate('problem_set') ?></h2>
+<br />
+<table class="table">
+ <tr>
+ <th><?= $this->translate('problem') ?></th>
+ <th><?= $this->translate('name') ?></th>
+ <th><?= $this->translate('tries') ?></th>
+ <th><?= $this->translate('accepts') ?></th>
+ <th><?= $this->translate('actions') ?></th>
+ </tr>
+ <? if (count($this->challenges)): ?>
+ <?= $this->partialLoop('contest/entry.phtml', $this->challenges) ?>
+ <? else: ?>
+ <tr>
+ <td colspan="5" class="tc error"><?= $this->translate('no_problems') ?></td>
+ </tr>
+ <? endif; ?>
+ <tr>
+ <td colspan="5" class="footer tc"><?= $this->challenges ?></td>
+ </tr>
+</table>
\ No newline at end of file
Modified: website/application/modules/acm/views/scripts/contest/result.phtml
===================================================================
--- website/application/modules/acm/views/scripts/contest/result.phtml 2009-02-14 01:29:23 UTC (rev 505)
+++ website/application/modules/acm/views/scripts/contest/result.phtml 2009-02-14 10:38:19 UTC (rev 506)
@@ -1,10 +1,10 @@
-<tr>
- <td align="center"><?= $this->id ?></td>
- <td align="center"><?= $this->date($this->when) ?></td>
- <td align="center"><?= $this->username ?></td>
- <td align="center"><a href="<?= $this->url( array('action' => 'view', 'id' => $this->challengeid), null) ?>"><?= $this->challengeid ?></a></td>
- <td align="center"><?= $this->codelang ?></td>
- <td align="center"><?= $this->state($this->state) ?></td>
- <td align="center"><?= ($this->tests == 0 ? '-' : $this->tests) ?></td>
- <td align="center"><?= ($this->runtime == 0 ? '-' : $this->runtime) ?>/<?= ($this->memory == 0 ? '-' : $this->memory) ?></td>
+<tr class="tc">
+ <td><a href="<?= $this->url( array('controller' => 'contest','action' => 'source', 'id' => $this->id), null) ?>"><?= $this->id ?></a></td>
+ <td><?= $this->date($this->when) ?></td>
+ <td><a href="<?= $this->url( array('module' => 'acm', 'controller' => 'user','action' => 'view', 'username' => $this->username), null, true) ?>"><?= $this->username ?></a></td>
+ <td><a href="<?= $this->url( array('action' => 'view', 'id' => $this->challengeid), null) ?>"><?= $this->challengeid ?></a></td>
+ <td><?= $this->codelang ?></td>
+ <td><?= $this->state($this->state) ?></td>
+ <td><?= ($this->tests == 0 ? '-' : $this->tests) ?></td>
+ <td><?= ($this->runtime == 0 ? '-' : $this->runtime) ?>/<?= ($this->memory == 0 ? '-' : $this->memory) ?></td>
</tr>
\ No newline at end of file
Modified: website/application/modules/acm/views/scripts/contest/results.phtml
===================================================================
--- website/application/modules/acm/views/scripts/contest/results.phtml 2009-02-14 01:29:23 UTC (rev 505)
+++ website/application/modules/acm/views/scripts/contest/results.phtml 2009-02-14 10:38:19 UTC (rev 506)
@@ -1,33 +1,24 @@
-<table cellspacing="1" cellpadding="8" border="0" width="100%"><tbody><tr><td width="100%" valign="top" class="name">
-
-<table cellspacing="0" cellpadding="0" border="0" width="100%">
-<tbody>
-<tr>
-<td nowrap="" bgcolor="#122a5b" width="*" class="name">
-<font color="#d4d0e2"><b><small>Набiр задач</small></b><small/></font>
-</td>
-<td nowrap="" bgcolor="#122a5b" align="right" class="name">
-<font color="#d4d0e2"><b><small> 05:26 23 березня 2007 року </small></b><small/></font>
-</td>
-</tr>
-</tbody>
-</table>
-
-<table cellspacing="0" cellpadding="0" border="0" summary="" align="center" width="80%">
-<tbody>
-<tr><td bgcolor="#f4f3f8" align="middle" colspan="14"><b>Архів задач</b></td></tr>
-<tr bgcolor="#e1e1e1" align="middle">
-<th>ID</th>
-<th>Дата</th>
-<th>Логін</th>
-<th>Задача</th>
-<th>Мова</th>
-<th>Стан</th>
-<th>Тест</th>
-<th>Час/Пам'ять</th>
-</tr>
-
-<?= $this->partialLoop('ontest/result.phtml', $this->submits) ?>
-</table>
-
-</td></tr></table>
\ No newline at end of file
+<h2><?= $this->translate('results') ?></h2>
+<br />
+<table class="table">
+ <tr>
+ <th>ID</th>
+ <th><?= $this->translate('date') ?></th>
+ <th><?= $this->translate('username') ?></th>
+ <th><?= $this->translate('problem') ?></th>
+ <th><?= $this->translate('language') ?></th>
+ <th><?= $this->translate('state') ?></th>
+ <th><?= $this->translate('tests') ?></th>
+ <th><?= $this->translate('runtime') ?></th>
+ </tr>
+ <? if (count($this->submits)): ?>
+ <?= $this->partialLoop('contest/result.phtml', $this->submits) ?>
+ <? else: ?>
+ <tr>
+ <td colspan="8" class="tc error"><?= $this->translate('no_results') ?></td>
+ </tr>
+ <? endif; ?>
+ <tr>
+ <td colspan="8" class="footer tc"><?= $this->submits ?></td>
+ </tr>
+</table>
\ No newline at end of file
Added: website/application/modules/acm/views/scripts/contest/source.phtml
===================================================================
--- website/application/modules/acm/views/scripts/contest/source.phtml (rev 0)
+++ website/application/modules/acm/views/scripts/contest/source.phtml 2009-02-14 10:38:19 UTC (rev 506)
@@ -0,0 +1,2 @@
+<a href="<?= $this->url( array('controller' => 'contest', 'action' => 'results', 'id' => null), null) ?>">Назад</a><br /><br />
+<code class="prettyprint"><?= htmlspecialchars(file_get_contents(Application::getDocRoot().'/other/submits/'.$this->id)) ?></code>
\ No newline at end of file
Added: website/application/modules/acm/views/scripts/contest/table.phtml
===================================================================
--- website/application/modules/acm/views/scripts/contest/table.phtml (rev 0)
+++ website/application/modules/acm/views/scripts/contest/table.phtml 2009-02-14 10:38:19 UTC (rev 506)
@@ -0,0 +1,49 @@
+<h2><?= $this->translate('contests_list') ?></h2>
+<br />
+<table class="table">
+ <tr>
+ <th><?= $this->translate('rank') ?></th>
+ <th><?= $this->translate('name') ?></th>
+ <? foreach ($this->challenges as $challenge): ?>
+ <th><?= $challenge['id'] ?></th>
+ <? endforeach; ?>
+ <th><?= $this->translate('AC') ?></th>
+ <th><?= $this->translate('penalty') ?></th>
+ </tr>
+ <? $i = 1; ?>
+ <? if (count($this->table)): ?>
+ <? foreach ($this->table as $item):?>
+ <?
+ $ch = explode(',', $item['challenges']);
+ $ac = explode(',', $item['accepts']);
+ $tr = explode(',', $item['alltries']);
+ $tm = explode(',', $item['allcreated']);
+ ?>
+ <tr>
+ <td class="tc"><?= ($i++) ?></th>
+ <td class="tc"><?= $item['username'] ?></th>
+ <? foreach ($this->challenges as $challenge): ?>
+ <td class="tc">
+ <?
+ if (($key = array_search($challenge['id'], $ch)) !== false):
+ if ($ac[$key] == 1):
+ echo "+" . ($tr[$key] > 1 ? ($tr[$key]-1) : '') . '<br />' . $this->date($tm[$key], "H:i");
+ else:
+ echo "-" . $tr[$key];
+ endif;
+ else:
+ echo "-";
+ endif;
+ ?>
+ </td>
+ <? endforeach; ?>
+ <td class="tc"><?= $item['total_accepts'] ?></td>
+ <td class="tc"><?= $item['total_penalty'] ?></td>
+ </tr>
+ <? endforeach; ?>
+ <? else: ?>
+ <tr>
+ <td colspan="5" class="tc error"><?= $this->translate('no_results') ?></td>
+ </tr>
+ <? endif; ?>
+</table>
Deleted: website/application/modules/acm/views/scripts/logedin.phtml
===================================================================
--- website/application/modules/acm/views/scripts/logedin.phtml 2009-02-14 01:29:23 UTC (rev 505)
+++ website/application/modules/acm/views/scripts/logedin.phtml 2009-02-14 10:38:19 UTC (rev 506)
@@ -1,4 +0,0 @@
-<div class="box2 c">
- <h2><?= $this->translate('user_menu') ?></h2>
- <a href="<?= $this->url(array('module' => 'acm', 'controller' => 'index', 'action' => 'logout'), null, true) ?>"><?= $this->translate('log_out') ?></a>
-</div>
\ No newline at end of file
Deleted: website/application/modules/acm/views/scripts/paginator.phtml
===================================================================
--- website/application/modules/acm/views/scripts/paginator.phtml 2009-02-14 01:29:23 UTC (rev 505)
+++ website/application/modules/acm/views/scripts/paginator.phtml 2009-02-14 10:38:19 UTC (rev 506)
@@ -1,30 +0,0 @@
-<?php if ($this->pageCount): ?>
-<div class="paginationControl">
-<!-- Previous page link -->
-<?php if (isset($this->previous)): ?>
- <a href="<?= $this->url(array('page' => $this->previous)); ?>">
- < Previous
- </a> |
-<?php else: ?>
- <span class="disabled">< Previous</span> |
-<?php endif; ?>
-
-<!-- Numbered page links -->
-<?php foreach ($this->pagesInRange as $page): ?>
- <?php if ($page != $this->current): ?>
- <a href="<?= $this->url(array('page' => $page)); ?>"><?= $page; ?></a> |
- <?php else: ?>
- <?= $page; ?> |
- <?php endif; ?>
-<?php endforeach; ?>
-
-<!-- Next page link -->
-<?php if (isset($this->next)): ?>
- <a href="<?= $this->url(array('page' => $this->next)); ?>">
- Next >
- </a>
-<?php else: ?>
- <span class="disabled">Next ></span>
-<?php endif; ?>
-</div>
-<?php endif; ?>
\ No newline at end of file
Added: website/application/modules/default/controllers/NewsController.php
===================================================================
--- website/application/modules/default/controllers/NewsController.php (rev 0)
+++ website/application/modules/default/controllers/NewsController.php 2009-02-14 10:38:19 UTC (rev 506)
@@ -0,0 +1,25 @@
+<?php
+
+class NewsController extends Ostacium_Controller_Action
+{
+ public function indexAction()
+ {
+ $news = $this->_model->getNews();
+ $paginator = Zend_Paginator::factory($news);
+ $paginator->setItemCountPerPage($this->_config->table->perpage);
+ $paginator->setCurrentPageNumber($this->_getParam('page'));
+
+ $this->view->news = $paginator;
+ }
+
+ public function viewAction()
+ {
+ $id = $this->_getParam('id');
+ $entry = $this->_model->getNewsItem($id);
+
+ if ($entry)
+ $this->view->assign($entry);
+ else
+ return $this->_redirect($this->view->url(array(), null, true));
+ }
+}
\ No newline at end of file
Added: website/application/modules/default/controllers/UserController.php
===================================================================
--- website/application/modules/default/controllers/UserController.php (rev 0)
+++ website/application/modules/default/controllers/UserController.php 2009-02-14 10:38:19 UTC (rev 506)
@@ -0,0 +1,81 @@
+<?php
+
+class UserController extends Ostacium_Controller_Action
+{
+ public function registerAction()
+ {
+ $this->_helper->getHelper('viewRenderer')->setNoRender(true);
+
+ $form = new Form_Register();
+
+ if (!$this->getRequest()->isPost())
+ {
+ echo $form;
+ return;
+ }
+
+ if (!$form->isValid($this->getRequest()->getPost()))
+ {
+ echo $form;
+ return;
+ }
+
+ // check cpassword == password
+
+ $values = $form->getValues();
+ $values['ip'] = $this->getRequest()->getIp();
+ $code = substr(md5(time()), mt_rand(0, 27), 5);
+ $result = $this->_model->registerUser($values, $code);
+
+ if (!$result)
+ {
+ $form->setDescription($this->view->translate('wrongEmailPwd'));
+
+ echo $form;
+ }
+ else
+ {
+ $arguments = array('code' => $code, 'fullname' => $values['name'].' '.$values['surname'], 'username' => $values['username']);
+ $mail = new Ostacium_Mail();
+ $mail->setFrom($this->_config->email->from.'@'.$_SERVER["SERVER_NAME"], $this->_config->general->title.' Staff')
+ ->addTo($values['email'], $values['name'].' '.$values['surname'])
+ ->setSubject($this->_('registration_email'))
+ ->setBodyTemplate(array('template' => 'register.phtml', 'arguments' => $arguments))
+ ->send();
+
+ return $this->_redirect($this->view->url(array('action' => 'registered')));
+ }
+ }
+
+ public function registeredAction()
+ {
+
+ }
+
+ public function activateAction()
+ {
+ $username = $this->_getParam('username');
+ $code = $this->_getParam('code');
+
+ $result = $this->_model->activateUser($username, $code);
+
+ if ($result)
+ {
+ return $this->render('activated');
+ }
+ else
+ {
+ return $this->render('notactivated');
+ }
+ }
+
+ public function viewAction()
+ {
+ $username = $this->_getParam('username');
+
+ if ($username)
+ $this->view->assign($this->_model->getUser($username));
+ else
+ return $this->_redirect($this->view->url(array(), null, true));
+ }
+}
\ No newline at end of file
Property changes on: website/application/modules/default/models
___________________________________________________________________
Added: tsvn:logminsize
+ 5
Property changes on: website/application/modules/default/models/Form
___________________________________________________________________
Added: tsvn:logminsize
+ 5
Added: website/application/modules/default/models/News.php
===================================================================
--- website/application/modules/default/models/News.php (rev 0)
+++ website/application/modules/default/models/News.php 2009-02-14 10:38:19 UTC (rev 506)
@@ -0,0 +1,15 @@
+<?php
+
+class News extends Ostacium_Model
+{
+ public function getNews()
+ {
+ $news = new Table_News();
+ return $news->getAll();
+ }
+
+ public function getNewsItem($id)
+ {
+
+ }
+}
\ No newline at end of file
Property changes on: website/application/modules/default/models/Table
___________________________________________________________________
Added: tsvn:logminsize
+ 5
Added: website/application/modules/default/models/Table/News.php
===================================================================
--- website/application/modules/default/models/Table/News.php (rev 0)
+++ website/application/modules/default/models/Table/News.php 2009-02-14 10:38:19 UTC (rev 506)
@@ -0,0 +1,16 @@
+<?php
+
+class Table_News extends Ostacium_Db_Table
+{
+ protected $_name = 'news';
+ protected $_primary = 'id';
+
+ function getAll()
+ {
+ return $this->selectLang(array('title', 'teaser'))
+ ->where('enabled = 1')
+ ->order('created DESC')
+ ->query()
+ ->fetchAll();
+ }
+}
\ No newline at end of file
Added: website/application/modules/default/models/Table/Users.php
===================================================================
--- website/application/modules/default/models/Table/Users.php (rev 0)
+++ website/application/modules/default/models/Table/Users.php 2009-02-14 10:38:19 UTC (rev 506)
@@ -0,0 +1,16 @@
+<?php
+
+class Table_Users extends Ostacium_Db_Table
+{
+ protected $_name = 'users';
+ protected $_primary = 'username';
+
+ function getUser($username)
+ {
+ return $this->select()->setIntegrityCheck(false)->from($this)
+ ->joinLeft(array('r' => 'roles'), 'r.id=users.roleid', array('role' => 'name'))
+ ->joinLeft(array('d' => 'usersdetails'), 'd.username=users.username')
+ ->where('users.username = ?', $username)
+ ->query()->fetch();
+ }
+}
\ No newline at end of file
Added: website/application/modules/default/models/User.php
===================================================================
--- website/application/modules/default/models/User.php (rev 0)
+++ website/application/modules/default/models/User.php 2009-02-14 10:38:19 UTC (rev 506)
@@ -0,0 +1,39 @@
+<?php
+
+class User extends Ostacium_Model
+{
+ public function registerUser($data, $code)
+ {
+ $data['registered'] = time();
+ $data['online'] = $data['registered'];
+ $data['roleid'] = Zend_Registry::get('config')->general->roleid;
+ $data['activated'] = $code;
+ $data['password'] = md5($data['password']);
+
+ $users = new Table_Users();
+ $users->insert($data);
+
+ $usersdetails = new Table_UsersDetails();
+ $usersdetails->insert($data);
+
+ $usersstats = new Table_UsersStats();
+ $usersstats->insert($data);
+
+ return true;
+ }
+
+ public function activateUser($username, $code)
+ {
+ $where = $this->_db->quoteInto('username = ?', $username).' AND activated = ?';
+ $where = $this->_db->quoteInto($where, $code);
+
+ $users = new Table_Users();
+ return $users->update(array('activated' => null), $where);
+ }
+
+ public function getUser($username)
+ {
+ $users = new Table_Users();
+ return $users->getUser($username);
+ }
+}
\ No newline at end of file
Property changes on: website/application/modules/default/views/scripts/news
___________________________________________________________________
Added: tsvn:logminsize
+ 5
Added: website/application/modules/default/views/scripts/news/entry.phtml
===================================================================
--- website/application/modules/default/views/scripts/news/entry.phtml (rev 0)
+++ website/application/modules/default/views/scripts/news/entry.phtml 2009-02-14 10:38:19 UTC (rev 506)
@@ -0,0 +1,5 @@
+<div class="news">
+ <div class="title"><a href="<?= $this->url(array('action' => 'view', 'id' => $this->id), null) ?>"><?= $this->title ?></a></div>
+ <div class="image"><img src="" /></div>
+ <div class="entry"><?= $this->teaser ?></div>
+</div>
\ No newline at end of file
Added: website/application/modules/default/views/scripts/news/index.phtml
===================================================================
--- website/application/modules/default/views/scripts/news/index.phtml (rev 0)
+++ website/application/modules/default/views/scripts/news/index.phtml 2009-02-14 10:38:19 UTC (rev 506)
@@ -0,0 +1,7 @@
+<h2><?= $this->translate('news') ?></h2>
+<br />
+<? if (count($this->news)): ?>
+<?= $this->partialLoop('news/entry.phtml', $this->news) ?>
+<? else: ?>
+<div class="error"><?= $this->translate('no_news') ?></div>
+<? endif; ?>
\ No newline at end of file
Added: website/application/modules/default/views/scripts/news/view.phtml
===================================================================
--- website/application/modules/default/views/scripts/news/view.phtml (rev 0)
+++ website/application/modules/default/views/scripts/news/view.phtml 2009-02-14 10:38:19 UTC (rev 506)
@@ -0,0 +1,2 @@
+<div>
+</div>
\ No newline at end of file
Property changes on: website/application/view
___________________________________________________________________
Added: tsvn:logminsize
+ 5
Property changes on: website/application/view/helpers
___________________________________________________________________
Added: tsvn:logminsize
+ 5
Property changes on: website/application/view/scripts
___________________________________________________________________
Added: tsvn:logminsize
+ 5
Added: website/application/view/scripts/logedin.phtml
===================================================================
--- website/application/view/scripts/logedin.phtml (rev 0)
+++ website/application/view/scripts/logedin.phtml 2009-02-14 10:38:19 UTC (rev 506)
@@ -0,0 +1,4 @@
+<div class="box2 c">
+ <h2><?= $this->translate('user_menu') ?></h2>
+ <a href="<?= $this->url(array('module' => 'acm', 'controller' => 'index', 'action' => 'logout'), null, true) ?>"><?= $this->translate('log_out') ?></a>
+</div>
\ No newline at end of file
Added: website/application/view/scripts/paginator.phtml
===================================================================
--- website/application/view/scripts/paginator.phtml (rev 0)
+++ website/application/view/scripts/paginator.phtml 2009-02-14 10:38:19 UTC (rev 506)
@@ -0,0 +1,30 @@
+<?php if ($this->pageCount): ?>
+<div class="paginationControl">
+<!-- Previous page link -->
+<?php if (isset($this->previous)): ?>
+ <a href="<?= $this->url(array('page' => $this->previous)); ?>">
+ < Previous
+ </a> |
+<?php else: ?>
+ <span class="disabled">< Previous</span> |
+<?php endif; ?>
+
+<!-- Numbered page links -->
+<?php foreach ($this->pagesInRange as $page): ?>
+ <?php if ($page != $this->current): ?>
+ <a href="<?= $this->url(array('page' => $page)); ?>"><?= $page; ?></a> |
+ <?php else: ?>
+ <?= $page; ?> |
+ <?php endif; ?>
+<?php endforeach; ?>
+
+<!-- Next page link -->
+<?php if (isset($this->next)): ?>
+ <a href="<?= $this->url(array('page' => $this->next)); ?>">
+ Next >
+ </a>
+<?php else: ?>
+ <span class="disabled">Next ></span>
+<?php endif; ?>
+</div>
+<?php endif; ?>
\ No newline at end of file
Modified: website/config/config.ini
===================================================================
--- website/config/config.ini 2009-02-14 01:29:23 UTC (rev 505)
+++ website/config/config.ini 2009-02-14 10:38:19 UTC (rev 506)
@@ -48,7 +48,8 @@
view.encoding = "UTF-8"
view.helperPathPrefix = "Ostacium_View_Helper"
-view.helperPath = "/library/Ostacium/View/Helper"
+view.helperPath = "Ostacium/View/Helper"
+view.scriptPath = "application/view/scripts/"
log.table = "log"
log.columnMap.type = "priorityName"
@@ -77,7 +78,8 @@
crud.perpage = "25"
-calc.acm.penalty = "20"
+acm.calc.penalty = "20"
+acm,
[development: general]
Modified: website/httpdocs/index.php
===================================================================
--- website/httpdocs/index.php 2009-02-14 01:29:23 UTC (rev 505)
+++ website/httpdocs/index.php 2009-02-14 10:38:19 UTC (rev 506)
@@ -3,10 +3,10 @@
error_reporting(E_ALL);
ini_set('display_errors', 1);
-$_docroot = dirname($_SERVER["DOCUMENT_ROOT"]);
+//$_docroot = dirname($_SERVER["DOCUMENT_ROOT"]);
$_approot = dirname(__FILE__);
-require_once $_docroot . '/library/Application.php';
+require_once 'Application.php';
$app = new Application($_approot);
$app->setEnvironment('development');
Modified: website/lang/uk.csv
===================================================================
--- website/lang/uk.csv 2009-02-14 01:29:23 UTC (rev 505)
+++ website/lang/uk.csv 2009-02-14 10:38:19 UTC (rev 506)
@@ -58,6 +58,15 @@
timus_handle;Timus handle
not_specified;Не вказано
+id;ID
+start;Початок
+end;Кінець
+options;Опції
+rank;Ранк
+
+news;Новини
+no_news;Немає Новин
+
# Errors
error_other;There was unknow error, please contact administrator
Modified: website/library/Application.php
===================================================================
--- website/library/Application.php 2009-02-14 01:29:23 UTC (rev 505)
+++ website/library/Application.php 2009-02-14 10:38:19 UTC (rev 506)
@@ -188,7 +188,8 @@
$_config = Zend_Registry::get('config');
$options = $_config->view->toArray();
- $options['helperPath'] = self::$_docroot . '/' . $options['helperPath'];
+ //$options['helperPath'] = self::$_docroot . '/' . $options['helperPath'];
+ $options['scriptPath'] = self::$_docroot . '/' . $options['scriptPath'];
$view = new Zend_View($options);
// Setup DocType
Modified: website/library/Ostacium/Controller/Router/Route/Language.php
===================================================================
--- website/library/Ostacium/Controller/Router/Route/Language.php 2009-02-14 01:29:23 UTC (rev 505)
+++ website/library/Ostacium/Controller/Router/Route/Language.php 2009-02-14 10:38:19 UTC (rev 506)
@@ -16,7 +16,7 @@
parent::__construct($defaults, $dispatcher, $request);
$this->translate = Zend_Registry::get('Zend_Translate');
- $this->locale = Zend_Registry::get('Zend_Locale');
+ $this->locale =& Zend_Registry::get('Zend_Locale');
$this->config = Zend_Registry::get('config');
$this->extention = $extention;
}
@@ -90,7 +90,7 @@
$this->_setRequestKeys();
}
- $params = (!$reset) ? $this->_values : array();
+ $params = (!$reset) ? $this->_values : array($this->_languageKey => $this->locale->toString());
foreach ($data as $key => $value) {
if ($value !== null) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|