|
Server IP : 10.2.73.233 / Your IP : 216.73.216.59 Web Server : Apache/2.4.59 (Debian) System : Linux polon 4.19.0-27-amd64 #1 SMP Debian 4.19.316-1 (2024-06-25) x86_64 User : www-data ( 33) PHP Version : 5.6.40-64+0~20230107.71+debian10~1.gbp673146 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON Directory (0755) : /home/ifk/web/protected/Layouts/ |
| [ Home ] | [ C0mmand ] | [ Upload File ] |
|---|
<?php
class MainLayout extends TTemplateControl {
public function onLoad($p) {
parent::onLoad($p);
$this->bindMainMenu();
$this->bindStudentNews();
$this->bindNewestBooks();
$this->bindRightBoxes();
$this->Page->Title = "Instytut Filologii Klasycznej Uniwersytetu Warszawskiego";
$titlePrefix = $this->Page->getTitlePrefix();
if (! empty($titlePrefix))
$this->Page->Title = $titlePrefix . " - " . $this->Page->Title;
}
public function bindMainMenu() {
$crit = new TActiveRecordCriteria();
$crit->OrdersBy['sort_pos'] = 'asc';
$crit->Condition = "menu_item = -1 AND lang = '" . $this->Page->Lang . "'";
$this->menuItems->setDataSource(KContentItem::finder()->findAll($crit));
$this->menuItems->dataBind();
}
public function bindStudentNews() {
$crit = new TActiveRecordCriteria();
$crit->OrdersBy['added_date'] = "desc";
$crit->Condition = "lang = '" . $this->Page->getLang() . "' and type=" . KNewsItem::TYPE_STUDENT;
// $crit->Limit = "10";
// $this->StudentNews->setDataSource(KNewsItem::finder()->findAll($crit));
// a$this->StudentNews->dataBind();
}
public function bindRightBoxes() {
if (!$this->rightColumnHide()) {
$crit = new TActiveRecordCriteria();
$crit->OrdersBy['sort_pos'] = "asc";
$this->RightBoxList->setDataSource(KRightBox::finder()->findAll($crit));
$this->RightBoxList->dataBind();
}
}
public function setLang($sender, $param) {
$lang = $param->CommandParameter;
$this->Session['ifklang'] = $lang;
$this->Response->redirect($this->Application->Parameters['BASE_URL']);
}
public function fillSubMenu($sender, $param) {
$crit = new TActiveRecordCriteria();
$crit->Condition = "lang = '" . $this->Page->Lang . "' AND menu_item = " . $param->Item->Data->id;
$crit->OrdersBy['sort_pos'] = 'asc';
$param->Item->subMenuItems->setDataSource(KContentItem::finder()->findAll($crit));
$param->Item->subMenuItems->dataBind();
}
public function headerHide() {
return
$this->Page->PagePath === 'Front.Error404' ||
$this->Page->PagePath === 'Front.Login' ||
$this->Page->PagePath === 'Front.AccessibilityDeclaration' ;
}
public function leftColumnHide() {
return ($this->Page->PagePath === 'Front.Error404') ||
$this->Page->PagePath === 'Front.BookList' ||
$this->Page->PagePath === 'Front.Login' ||
$this->Page->PagePath === 'Front.Schedule' ||
$this->Page->PagePath === 'Front.AccessibilityDeclaration';
}
public function rightColumnHide() {
return $this->Page->PagePath === 'Front.Login' ||
($this->Page->PagePath === 'Front.Error404') ||
($this->Page->PagePath === 'Front.Schedule') ||
($this->Page->PagePath === 'Front.PersonDetails') ||
($this->Page->PagePath === 'Front.ContentItem' && ($this->Request['cid'] == 24 || $this->Request['cid'] == 26 || $this->Request['cid'] == 46)) ||
$this->Page->PagePath === 'Front.AccessibilityDeclaration';
}
public function validatePassword($sender, $param) {
$authManager = $this->Application->getModule('auth');
if (! $authManager->login(strtolower($this->FEmail->Text), $this->FPass->Text))
$param->IsValid = false;
}
public function validateActivity($sender, $param) {
if ($this->Page->IsValid) {
$user = KUserRecord::finder()->findByEmail($this->FEmail->Text);
if (! $user->active)
$param->IsValid = false;
}
}
public function redirectToAdminPanel($sender, $param) {
// if ($this->Page->IsValid) {
/*if ($this->User->getRole() == 2)
$this->Response->redirect($this->Service->constructUrl('Admin.UserEdit', array(
'uid' => $this->User->id
)));
else*/
$this->Response->redirect($this->Service->constructUrl('Admin.Home'));
// }
}
public function commitSearch($sender, $param) {
$this->Response->redirect($this->Service->constructUrl('Front.Search', array(
'q' => $this->TopLinksSearchBox->SafeText
)));
}
public function commitSearch2($sender, $param) {
$this->Response->redirect($this->Service->constructUrl('Front.Search', array(
'q' => $this->TopLinksSearchBox2->SafeText
)));
}
public function bindNewestBooks() {
$crit = new TActiveRecordCriteria();
$crit->Condition = "type = " . KPaper::PUBTYPE_BOOK . " and LENGTH(title)>2";
$crit->OrdersBy["year"] = "DESC";
$crit->OrdersBy['added_date'] = "DESC";
$crit->Limit = "6";
if ($this->Page->PagePath !== 'Front.PersonDetails') {
$this->NewestBooks->setDataSource(KPaper::finder()->findAll($crit));
$this->NewestBooks->dataBind();
}
}
}
?>