Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added all views

- Created PeepText helper, for echoing peep texts with links
- Created all view scripts
  • Loading branch information...
commit 886c29bdbf25edf76c71a6a1e42578e0e64431e6 1 parent 942a301
@weierophinney authored
View
3  config/module.config.php
@@ -65,6 +65,9 @@
),
),
'service_manager' => array(
+ 'invokables' => array(
+ 'peeptext' => 'PhlyPeep\View\PeepText',
+ ),
'factories' => array(
'peepform' => 'PhlyPeep\Service\PeepViewFormFactory',
'phly-peep-service' => 'PhlyPeep\Service\PeepServiceFactory',
View
2  src/PhlyPeep/View/PeepForm.phtml
@@ -16,7 +16,7 @@ class PeepForm extends AbstractHelper
public function __invoke($form, $template = 'phly-peep/peep/form')
{
if (!$this->auth || $this->auth->hasIdentity()) {
- return '';
+ return $this->view->render('phly-peep/peep/register');
}
return $this->view->render($template, array('form' => $form));
View
30 src/PhlyPeep/View/PeepText.phtml
@@ -0,0 +1,30 @@
+<?php
+
+namespace PhlyPeep\View;
+
+use Zend\View\Helper\AbstractHelper;
+
+class PeepText extends AbstractHelper
+{
+ protected function filterLinks($text)
+ {
+ return preg_replace_callback(
+ '#(http://[a-zA-Z0-9_%&~@/\#.-]+)#',
+ array($this, 'markupLink'),
+ $text
+ );
+ }
+
+ public function markupLink($matches)
+ {
+ $link = $matches[1];
+ return sprintf('<a href="%s" target="_blank">%s</a>', $link, $link);
+ }
+
+ public function __invoke($text)
+ {
+ $text = $this->view->escape($text);
+ $text = $this->filterLinks($text);
+ return $text;
+ }
+}
View
5 view/phly-peep/peep/401.phtml
@@ -0,0 +1,5 @@
+<div class="span12">
+ <h2>Have something to peep?</h2>
+
+ <p>You need to <a href="<?php echo $this->url('zfcuser') ?>">login to peep</a>!</p>
+</div>
View
29 view/phly-peep/peep/form-error.phtml
@@ -0,0 +1,29 @@
+<div class="row">
+ <div class="span12">
+ <h2>Error with your submission</h2>
+ <p class="help-block error">
+ There were one or more errors with your submission; please correct and re-submit!
+ </p>
+<?php
+$form = $this->form;
+$form->setAttributes(array(
+ 'method' => 'post',
+ 'action' => $this->url('phly-peep/submit'),
+ 'class' => 'well',
+));
+$label = $this->plugin('form_label');
+echo $this->form()->openTag($form);
+
+$peepElement = $form->get('peep_text');
+$peepElement->setAttribute('class', 'span4');
+echo $label->openTag() . $this->escape($peepElement->getAttribute('label')) . $label->closeTag();
+echo $this->formTextarea($peepElement);
+if ($peepElement->getMessages()) {
+ echo '<span class="help-block error">' . $this->formElementErrors($peepElement) . "</span>\n";
+}
+echo $this->formInput($form->get('secure'));
+?>
+<button type="submit" class="btn">Peep!</button>
+<?php echo $this->form()->closeTag() ?>
+ </div>
+</div>
View
18 view/phly-peep/peep/form.phtml
@@ -0,0 +1,18 @@
+<?php
+$form = $this->form;
+$form->setAttributes(array(
+ 'method' => 'post',
+ 'action' => $this->url('phly-peep/submit'),
+ 'class' => 'well',
+));
+$label = $this->plugin('form_label');
+echo $this->form()->openTag($form);
+
+$peepElement = $form->get('peep_text');
+$peepElement->setAttribute('class', 'span4');
+echo $label->openTag() . $this->escape($peepElement->getAttribute('label')) . $label->closeTag();
+echo $this->formTextarea($peepElement);
+echo $this->formInput($form->get('secure'));
+?>
+<button type="submit" class="btn">Peep!</button>
+<?php echo $this->form()->closeTag() ?>
View
17 view/phly-peep/peep/index.phtml
@@ -0,0 +1,17 @@
+<div class="row">
+ <div class="span6 peeps">
+ <?php if (0 == count($this->peeps)): ?>
+ <h2>Nothing in the timeline!</h2>
+ <?php else:
+ foreach ($this->peeps as $peep) {
+ echo $this->render('phly-peep/peep/peep', array('peep' => $peep));
+ }
+
+ echo $this->paginationControl($this->peeps, 'Sliding', 'phly-peep/peep/pagination');
+ endif; ?>
+ </div>
+
+ <div class="span6 form">
+ <?php echo $this->peepForm(); ?>
+ </div>
+</div>
View
27 view/phly-peep/peep/pagination.phtml
@@ -0,0 +1,27 @@
+<?php if ($this->pageCount): ?>
+<div class="pagination"><ul>
+
+<!-- Previous page link -->
+<?php if (isset($this->previous)): ?>
+ <li><a href="<?php echo $this->url(); ?>?page=<?php echo $this->previous ?>">Prev</a></li>
+<?php else: ?>
+ <li><a href="#">Prev</a></li>
+<?php endif; ?>
+
+<!-- Numbered page links -->
+<?php foreach ($this->pagesInRange as $page): ?>
+ <?php if ($page != $this->current): ?>
+ <li><a href="<?php echo $this->url() ?>?page=<?php echo $page ?>"><?php echo $page; ?></a></li>
+ <?php else: ?>
+ <li class="active"><a href="#"><?php echo $page; ?></a></li>
+ <?php endif; ?>
+<?php endforeach; ?>
+
+<!-- Next page link -->
+<?php if (isset($this->next)): ?>
+ <li><a href="<?php echo $this->url(); ?>?page=<?php echo $this->next ?>">Next</a></li>
+<?php else: ?>
+ <li><a href="#">Next</a></li>
+<?php endif; ?>
+</ul></div>
+<?php endif; ?>
View
32 view/phly-peep/peep/peep.phtml
@@ -0,0 +1,32 @@
+<?php
+$peep = $this->peep;
+$username = $peep->getUsername();
+$url = $this->url('phly-peep/user', array('username' => $username));
+?>
+<div class="well row peep">
+ <div class="span1">
+ <ul class="thumbnails">
+ <li><a href="<?php echo $url ?>"><?php echo $this->gravatar($peep->getEmail()) ?></a></li>
+ </ul>
+ </div>
+ <div class="span5">
+ <?php
+ $displayName = $this->peep->getDisplayName();
+ $displayName = $displayName ?: $username;
+ ?>
+ <h4><a href="<?php echo $url ?>"><?php echo $this->escape($displayName) ?></a> <small>@<?php echo $this->escape($username) ?></small></h4>
+ <p><?php echo $this->peepText($peep->getPeepText()) ?></p>
+ <div class="row">
+ <div class="span5 date">
+ <a href="<?php echo $this->url('phly-peep/status', array('identifier' => $peep->getIdentifier())) ?>">
+ <?php
+ $date = new DateTime();
+ $date->setTimestamp($peep->getTimestamp());
+ $date->setTimezone('UTC');
+ echo $date->format('h:i a - d M Y');
+ ?>
+ </a>
+ </div>
+ </div>
+ </div>
+</div>
View
10 view/phly-peep/peep/status.phtml
@@ -0,0 +1,10 @@
+<div class="row">
+ <div class="span6">
+ <?php echo $this->render('phly-peep/peep/peep') ?>
+ </div>
+
+ <div class="span6 form">
+ <?php echo $this->peepForm(); ?>
+ </div>
+</div>
+
View
14 view/phly-peep/peep/username.phtml
@@ -0,0 +1,14 @@
+<?php
+if (!isset($this->username)) {
+ $peep = $this->peeps->current();
+ $username = $peep->getUsername();
+ $this->username = $username;
+}
+?>
+<div class="row">
+ <div class="span12">
+ <h2>Peeps for <?php echo $this->escape($this->username) ?></h2>
+ </div>
+</div>
+
+<?php echo $this->render('phly-peep/peep/index');
Please sign in to comment.
Something went wrong with that request. Please try again.