diff --git a/blocks/html/users/addUserForm.inc b/blocks/html/users/addUserForm.inc deleted file mode 100644 index b2a86c6..0000000 --- a/blocks/html/users/addUserForm.inc +++ /dev/null @@ -1,54 +0,0 @@ - - */ -?> -

New User Account

-
-
Login Info - - - - - - - - - - - - - -
-
-
-
- - - -
-
diff --git a/blocks/html/users/list.inc b/blocks/html/users/list.inc new file mode 100644 index 0000000..d6cfb25 --- /dev/null +++ b/blocks/html/users/list.inc @@ -0,0 +1,63 @@ + + * @param Zend\Db\Sql\Select $users + */ +use Application\Models\Person; +use Blossom\Classes\View; +?> +
+

_(['user','users',2]); + + $helper = $this->template->getHelper('buttonLink'); + if (Person::isAllowed('users')) { + echo $helper->buttonLink(BASE_URI.'/users/update', $this->_('create_account'), 'add'); + } + ?> +

+ + + + + + + + + + + + users as $user) { + $editButton = ''; + $deleteButton = ''; + if (Person::isAllowed('users')) { + $editButton = $helper->buttonLink( + BASE_URI.'/users/update?user_id='.$user->getId(), + $this->_('edit_account'), + 'edit' + ); + $deleteButton = $helper->buttonLink( + BASE_URI.'/users/delete?user_id='.$user->getId(), + $this->_('delete_account'), + 'delete' + ); + } + + $name = View::escape($user->getFullname()); + echo " + + + + + + + + "; + } + ?> + +
_('username'); ?>_('name'); ?>_('authenticationMethod'); ?>_('role'); ?>
$editButton{$user->getUsername()}$name{$user->getAuthenticationMethod()}{$user->getRole()}$deleteButton
+
diff --git a/blocks/html/users/updateForm.inc b/blocks/html/users/updateForm.inc new file mode 100644 index 0000000..6f19aab --- /dev/null +++ b/blocks/html/users/updateForm.inc @@ -0,0 +1,58 @@ + + * @param User $this->user + */ +use Application\Models\Person; +use Blossom\Classes\View; + +?> +
+
+
_(['user','users',2]); ?> + + + + + + + + + + + + + + +
+
+
+
+ template->getHelper('saveAndCancelButtons'); + echo $helper->saveAndCancelButtons(BASE_URI.'/users'); + ?> +
+
+
diff --git a/blocks/html/users/updateUserForm.inc b/blocks/html/users/updateUserForm.inc deleted file mode 100644 index 97203c1..0000000 --- a/blocks/html/users/updateUserForm.inc +++ /dev/null @@ -1,55 +0,0 @@ - - * @param User $this->user - */ -?> -

Edit user->getUsername(); ?>

-
-
Login Info - - - - - - - - - - - - - - -
-
-
-
- - -
-
diff --git a/blocks/html/users/userList.inc b/blocks/html/users/userList.inc deleted file mode 100644 index c82af03..0000000 --- a/blocks/html/users/userList.inc +++ /dev/null @@ -1,57 +0,0 @@ - - * @param UserList $this->userList - */ -?> -
-

- Add User Account - - "; - } - ?> - User Accounts -

- - userList as $user) { - $editButton = ''; - $deleteButton = ''; - if (userIsAllowed('Users')) { - $editButton = " - - "; - - $deleteButton = " - - "; - } - - echo " - - - - - - - "; - } - ?> -
$editButton{$user->getUsername()}{$user->getFirstname()} {$user->getLastname()}{$user->getAuthenticationMethod()} - "; - foreach ($user->getRoles() as $role) { - echo "$role "; - } - echo " -
-
diff --git a/html/people/addPerson.php b/html/people/addPerson.php deleted file mode 100644 index 4107951..0000000 --- a/html/people/addPerson.php +++ /dev/null @@ -1,33 +0,0 @@ - - */ -if (!userIsAllowed('Users')) { - $_SESSION['errorMessages'][] = new Exception('noAccessAllowed'); - header('Location: '.BASE_URL); - exit(); -} - -if (isset($_POST['person'])) { - $person = new Person(); - foreach ($_POST['person'] as $field=>$value) { - $set = 'set'.ucfirst($field); - $person->$set($value); - } - - try { - $person->save(); - header('Location: '.BASE_URL.'/people'); - exit(); - } - catch(Exception $e) { - $_SESSION['errorMessages'][] = $e; - } -} - -$template = new Template(); -$template->title = 'Add a person'; -$template->blocks[] = new Block('people/addPersonForm.inc'); -echo $template->render(); diff --git a/html/people/home.php b/html/people/home.php deleted file mode 100644 index 8254c53..0000000 --- a/html/people/home.php +++ /dev/null @@ -1,19 +0,0 @@ - - */ -if (!userIsAllowed('Users')) { - $_SESSION['errorMessages'][] = new Exception('noAccessAllowed'); - header('Location: '.BASE_URL); - exit(); -} - -$personList = new PersonList(); -$personList->find(); - -$template = new Template(); -$template->title = 'People'; -$template->blocks[] = new Block('people/personList.inc',array('personList'=>$personList)); -echo $template->render(); diff --git a/html/people/updatePerson.php b/html/people/updatePerson.php deleted file mode 100644 index f0920da..0000000 --- a/html/people/updatePerson.php +++ /dev/null @@ -1,35 +0,0 @@ - - * @param Request person_id - */ -if (!userIsAllowed('Users')) { - $_SESSION['errorMessages'][] = new Exception('noAccessAllowed'); - header('Location: '.BASE_URL); - exit(); -} - -$person = new Person($_REQUEST['person_id']); - -if (isset($_POST['person'])) { - foreach ($_POST['person'] as $field=>$value) { - $set = 'set'.ucfirst($field); - $person->$set($value); - } - - try { - $person->save(); - header('Location: '.BASE_URL.'/people'); - exit(); - } - catch (Exception $e) { - $_SESSION['errorMessages'][] = $e; - } -} - -$template = new Template(); -$template->title = 'Update a person'; -$template->blocks[] = new Block('people/updatePersonForm.inc',array('person'=>$person)); -echo $template->render(); diff --git a/html/people/viewPerson.php b/html/people/viewPerson.php deleted file mode 100644 index 5fdaeca..0000000 --- a/html/people/viewPerson.php +++ /dev/null @@ -1,13 +0,0 @@ - - * @param GET person_id - */ -$person = new Person($_GET['person_id']); - -$template = new Template(); -$template->title = $person->getFullname(); -$template->blocks[] = new Block('people/personInfo.inc',array('person'=>$person)); -echo $template->render(); diff --git a/html/users/addUser.php b/html/users/addUser.php deleted file mode 100644 index 7031540..0000000 --- a/html/users/addUser.php +++ /dev/null @@ -1,74 +0,0 @@ - - * @param GET person_id - */ -if (!userIsAllowed('Users')) { - $_SESSION['errorMessages'][] = new Exception('noAccessAllowed'); - header('Location: '.BASE_URL); - exit(); -} - -if (isset($_REQUEST['person_id'])) { - try { - $person = new Person($_REQUEST['person_id']); - } - catch (Exception $e) { - } -} - -if (isset($_POST['user'])) { - - $user = new User(); - foreach ($_POST['user'] as $field=>$value) { - $set = 'set'.ucfirst($field); - $user->$set($value); - } - - if (isset($person)) { - $user->setPerson_id($person->getId()); - } - else { - // Load their information from LDAP - if ($user->getAuthenticationMethod() != 'local') { - try { - $externalIdentity = $user->getAuthenticationMethod(); - $identity = new $externalIdentity($user->getUsername()); - - try { - $person = new Person($identity->getEmail()); - } - catch (Exception $e) { - $person = new Person(); - $person->setFirstname($identity->getFirstname()); - $person->setLastname($identity->getLastname()); - $person->setEmail($identity->getEmail()); - $person->save(); - } - $user->setPerson($person); - } - catch (Exception $e) { - $_SESSION['errorMessages'][] = $e; - } - } - } - - try { - $user->save(); - header('Location: '.BASE_URL.'/users'); - exit(); - } - catch (Exception $e) { - $_SESSION['errorMessages'][] = $e; - } -} - -$template = new Template(); -$template->title = 'Create a user account'; -$template->blocks[] = new Block('users/addUserForm.inc'); -if (isset($person)) { - $template->blocks[] = new Block('people/personInfo.inc',array('person'=>$person)); -} -echo $template->render(); diff --git a/html/users/deleteUser.php b/html/users/deleteUser.php deleted file mode 100644 index 8d12d6b..0000000 --- a/html/users/deleteUser.php +++ /dev/null @@ -1,17 +0,0 @@ - - * @param GET user_id - */ -if (!userIsAllowed('Users')) { - $_SESSION['errorMessages'][] = new Exception('noAccessAllowed'); - header('Location: '.BASE_URL); - exit(); -} - -$user = new User($_GET['user_id']); -$user->delete(); - -header('Location: '.BASE_URL.'/users'); diff --git a/html/users/home.php b/html/users/home.php deleted file mode 100644 index 601752a..0000000 --- a/html/users/home.php +++ /dev/null @@ -1,20 +0,0 @@ - - */ -if (!userIsAllowed('Users')) { - $_SESSION['errorMessages'][] = new Exception('noAccessAllowed'); - header('Location: '.BASE_URL); - exit(); -} - -$template = new Template(); -$template->title = 'User accounts'; - -$userList = new UserList(); -$userList->find(); -$template->blocks[] = new Block('users/userList.inc',array('userList'=>$userList)); - -echo $template->render(); diff --git a/html/users/updateUser.php b/html/users/updateUser.php deleted file mode 100644 index e97aeb9..0000000 --- a/html/users/updateUser.php +++ /dev/null @@ -1,35 +0,0 @@ - - * @param REQUEST user_id - */ -if (!userIsAllowed('Users')) { - $_SESSION['errorMessages'][] = new Exception('noAccessAllowed'); - header('Location: '.BASE_URL); - exit(); -} - -$user = new User($_REQUEST['user_id']); - -if (isset($_POST['user'])) { - foreach ($_POST['user'] as $field=>$value) { - $set = 'set'.ucfirst($field); - $user->$set($value); - } - - try { - $user->save(); - header('Location: '.BASE_URL.'/users'); - exit(); - } - catch (Exception $e) { - $_SESSION['errorMessages'][] = $e; - } -} - -$template = new Template(); -$template->blocks[] = new Block('users/updateUserForm.inc',array('user'=>$user)); -$template->blocks[] = new BlocK('people/personInfo.inc',array('person'=>$user->getPerson())); -echo $template->render(); diff --git a/language/en_US.mo b/language/en_US.mo index dc3ad4e..2855536 100644 Binary files a/language/en_US.mo and b/language/en_US.mo differ diff --git a/language/en_US.po b/language/en_US.po index d0800a8..9709d90 100644 --- a/language/en_US.po +++ b/language/en_US.po @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: uReport 1.9\n" "Report-Msgid-Bugs-To: dev@bloomington.in.gov\n" "POT-Creation-Date: 2013-09-20 16:33-0400\n" -"PO-Revision-Date: 2014-08-11 13:43-0500\n" +"PO-Revision-Date: 2014-08-18 16:18-0500\n" "Last-Translator: Cliff Ingham \n" "Language-Team: City of Bloomington \n" "MIME-Version: 1.0\n" diff --git a/templates/html/helpers/ButtonLink.php b/templates/html/helpers/ButtonLink.php new file mode 100644 index 0000000..486f96e --- /dev/null +++ b/templates/html/helpers/ButtonLink.php @@ -0,0 +1,27 @@ + + */ +namespace Application\Templates\Helpers; + +use Blossom\Classes\Template; + +class ButtonLink +{ + private $template; + + public function __construct(Template $template) + { + $this->template = $template; + } + + public function buttonLink($url, $label, $type) + { + $a = '%s'; + return sprintf($a, $url, $type, $label); + } +} diff --git a/templates/html/helpers/SaveAndCancelButtons.php b/templates/html/helpers/SaveAndCancelButtons.php new file mode 100644 index 0000000..45ffbac --- /dev/null +++ b/templates/html/helpers/SaveAndCancelButtons.php @@ -0,0 +1,27 @@ + + */ +namespace Application\Templates\Helpers; + +use Blossom\Classes\Template; + +class SaveAndCancelButtons +{ + private $template; + + public function __construct(Template $template) + { + $this->template = $template; + } + + public function saveAndCancelButtons($cancelURL) + { + return " + + {$this->template->_('labels.cancel')} + "; + } +} diff --git a/templates/html/partials/banner.inc b/templates/html/partials/banner.inc index ea568d1..4bf5340 100644 --- a/templates/html/partials/banner.inc +++ b/templates/html/partials/banner.inc @@ -7,14 +7,14 @@ use Blossom\Classes\View; $li = '
  • %s
  • '; if (isset($_SESSION['USER'])) { - echo sprintf($li, BASE_URI.'/login/logout', $this->translate('labels.logout')); + echo sprintf($li, BASE_URI.'/login/logout', $this->translate('logout')); $name = View::escape($_SESSION['USER']->getFullname()); echo sprintf('
  • '.sprintf($this->translate('messages.signed_in_as'), $name).'
  • '); } else { $return_url = View::escape($_SERVER['REQUEST_URI']); - echo sprintf($li, BASE_URI.'/login?return_url='.$return_url, $this->translate('labels.login')); + echo sprintf($li, BASE_URI.'/login?return_url='.$return_url, $this->translate('login')); } ?> diff --git a/templates/html/partials/footer.inc b/templates/html/partials/footer.inc index b61f368..00808e4 100644 --- a/templates/html/partials/footer.inc +++ b/templates/html/partials/footer.inc @@ -1,11 +1,13 @@ diff --git a/templates/html/partials/menubar.inc b/templates/html/partials/menubar.inc index 6d46d8c..4411545 100644 --- a/templates/html/partials/menubar.inc +++ b/templates/html/partials/menubar.inc @@ -14,7 +14,7 @@ use Application\Models\Person; ]; foreach ($routes as $singular=>$plural) { if (Person::isAllowed($plural, 'index')) { - echo sprintf($a, BASE_URI.'/'.$plural, $this->_(["labels.$singular", "labels.$plural", 2])); + echo sprintf($a, BASE_URI.'/'.$plural, $this->_(["$singular", "$plural", 2])); } } ?> diff --git a/templates/html/partials/panel-one.inc b/templates/html/partials/panel-one.inc index b236177..fb0144a 100644 --- a/templates/html/partials/panel-one.inc +++ b/templates/html/partials/panel-one.inc @@ -14,7 +14,7 @@
  • White Oak Cemetery

    Driving Directions, Interment Information, History - +

  • Guidelines for Plot Owners @@ -40,10 +40,10 @@
    -
    Rose Hill Cemetery" />
    -
    White Oak Cemetery" />
    +
    Rose Hill Cemetery" />
    +
    White Oak Cemetery" />
    - \ No newline at end of file +