<?php
-/* This file is part of Syj, Copyright (c) 2010 Arnaud Renevier,
+/* This file is part of Syj, Copyright (c) 2010-2011 Arnaud Renevier,
and is published under the AGPL license. */
class AccountController extends Zend_Controller_Action
{
public function init() {
- $this->view->headScript()->appendFile('js/prototype.js');
- $this->view->headScript()->appendFile('js/forms.js');
- $this->view->headScript()->appendFile('js/account.js');
- $this->view->headLink()->appendStylesheet('css/generic.css');
- $this->view->headLink()->appendStylesheet('css/account.css');
+ $this->_helper->SyjUserManager->needsLogin();
+ $this->_helper->SyjMedias->addScripts('account');
+
+ $this->view->headLink()->appendStylesheet('css/generic.css', 'all');
+ $this->view->headLink()->appendStylesheet('css/form.css', 'all');
+ $this->view->headLink()->appendStylesheet('css/account.css', 'all');
$this->view->headTitle($this->view->translate("my account"));
}
public function indexAction() {
- $user = $this->view->loggedUser();
+ $user = $this->_helper->SyjUserManager->current();
$request = $this->getRequest();
- if ($user === null) {
- $encodeduri = implode('/', array_map('urlencode', explode('/', $request->getRequestUri())));
- $loginurl = $this->view->addParamToUrl($this->view->baseUrl() . '/' . 'login', 'redirect', $encodeduri);
- $translator = Zend_Registry::get('Zend_Translate');
- $lang = Zend_Controller_Front::getInstance()->getRequest()->getQuery('lang');
- if ($lang) {
- $adapter = $translator->getAdapter();
- if ($adapter->isAvailable($lang)) {
- $loginurl = $this->view->addParamToUrl($loginurl, 'lang', $lang);
- }
- }
- $this->_helper->Redirector->gotoURL($loginurl, array('prependBase' => false));
- }
-
$form = new Syj_Form_Account(array('name' => 'accountform'));
$formData = $request->getPost();
protected function _jsLocaleStrings() {
$this->view->jslocales = array(
- 'notEmptyField' => __("Value is required and can't be empty"),
+ 'notEmptyField' => __("Value is required"),
'passwordNoMatchWarn' => __("Password do not match"),
'passwordLenghtWarn' => array(__("At least %d characters"), 6),
'nochangeWarn' => __("You have made no change"),