mirror of
https://github.com/bodyrep/bodyrep-sandpit.git
synced 2026-01-26 14:51:44 +00:00
Django import
Django import
This commit is contained in:
9
symfony/src/BodyRep/BodyRep.php
Normal file
9
symfony/src/BodyRep/BodyRep.php
Normal file
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace BodyRep;
|
||||
|
||||
use Symfony\Component\HttpKernel\Bundle\Bundle;
|
||||
|
||||
class BodyRep extends Bundle
|
||||
{
|
||||
}
|
||||
68
symfony/src/BodyRep/Controller/AuthController.php
Normal file
68
symfony/src/BodyRep/Controller/AuthController.php
Normal file
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
|
||||
namespace BodyRep\Controller;
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
||||
use Symfony\Component\Security\Core\SecurityContext;
|
||||
use Symfony\Component\HttpFoundation\RedirectResponse;
|
||||
|
||||
# Annotations & templates
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
|
||||
|
||||
class AuthController extends Controller
|
||||
{
|
||||
/**
|
||||
* @Route("/", name="_auth")
|
||||
* @Template()
|
||||
*/
|
||||
public function indexAction()
|
||||
{
|
||||
return new RedirectResponse($this->generateUrl('_login'));
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* @Route("/login", name="_login")
|
||||
* @Template()
|
||||
*/
|
||||
public function loginAction()
|
||||
{
|
||||
$request = $this->getRequest();
|
||||
$session = $request->getSession();
|
||||
|
||||
// get the login error if there is one
|
||||
if ($request->attributes->has(SecurityContext::AUTHENTICATION_ERROR)) {
|
||||
$error = $request->attributes->get(SecurityContext::AUTHENTICATION_ERROR);
|
||||
} else {
|
||||
$error = $session->get(SecurityContext::AUTHENTICATION_ERROR);
|
||||
}
|
||||
|
||||
return $this->render('BodyRep:Auth:login.html.twig', array(
|
||||
// last username entered by the user
|
||||
'last_username' => $session->get(SecurityContext::LAST_USERNAME),
|
||||
'error' => $error,
|
||||
));
|
||||
}
|
||||
/**
|
||||
* @Route("/login/check", name="_login_check")
|
||||
* @Template()
|
||||
*/
|
||||
public function securityCheckAction()
|
||||
{
|
||||
// The security layer will intercept this request
|
||||
}
|
||||
/**
|
||||
* @Route("/logout", name="_logout")
|
||||
* @Template()
|
||||
*/
|
||||
public function logoutAction()
|
||||
{
|
||||
// The security layer will intercept this request
|
||||
}
|
||||
|
||||
public function navbarAction()
|
||||
{
|
||||
// The security layer will intercept this request
|
||||
}
|
||||
}
|
||||
65
symfony/src/BodyRep/Controller/CommentController.php
Normal file
65
symfony/src/BodyRep/Controller/CommentController.php
Normal file
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
namespace BodyRep\Controller;
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
||||
use Symfony\Component\Security\Core\SecurityContext;
|
||||
use Symfony\Component\HttpFoundation\RedirectResponse;
|
||||
use JMS\SecurityExtraBundle\Annotation\Secure;
|
||||
|
||||
# Annotations
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
|
||||
|
||||
class CommentController extends Controller
|
||||
{
|
||||
/**
|
||||
* @Route("/", name="_profile")
|
||||
* @Template()
|
||||
*/
|
||||
public function indexAction($username)
|
||||
{
|
||||
|
||||
if ($this->getUser()->getUsername() == $username)
|
||||
return new RedirectResponse($this->generateUrl('_member_profile'));
|
||||
|
||||
$db = $this->getDoctrine()->getManager();
|
||||
|
||||
$query = $db->createQuery('
|
||||
SELECT p
|
||||
FROM BodyRep:Profile p
|
||||
WHERE p.username = :username')
|
||||
->setParameter('username', $username)
|
||||
->setMaxResults(1);
|
||||
if (sizeof($query->getResult()) != 1)
|
||||
throw $this->createNotFoundException("User '".$username."' not found");
|
||||
|
||||
$profile = $query->getSingleResult();
|
||||
$username = $this->getUser()->getUsername();
|
||||
$db = $this->getDoctrine()->getManager();
|
||||
$query = $db->createQuery('
|
||||
SELECT m
|
||||
FROM BodyRep:Member m
|
||||
WHERE m.username = :username')
|
||||
->setParameter('username', $username)
|
||||
->setMaxResults(1);
|
||||
|
||||
if (sizeof($query->getResult()) != 1)
|
||||
throw $this->createNotFoundException("User '".$username."' not found");
|
||||
|
||||
$member = $query->getSingleResult();
|
||||
|
||||
return (array('sFullName' => $profile->getFullName(), 'name' => $member->getFullName()));
|
||||
|
||||
}
|
||||
/**
|
||||
* @Route("/rep", name="_profile_reputation")
|
||||
* @Template()
|
||||
*/
|
||||
public function reputationAction($username)
|
||||
{
|
||||
return $this->indexAction($username);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
43
symfony/src/BodyRep/Controller/LandingController.php
Normal file
43
symfony/src/BodyRep/Controller/LandingController.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace BodyRep\Controller;
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
||||
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
|
||||
use BodyRep\Form\ContactType;
|
||||
|
||||
class LandingController extends Controller
|
||||
{
|
||||
/**
|
||||
* @Route("/", name="_landing")
|
||||
* @Template()
|
||||
*/
|
||||
public function indexAction()
|
||||
{
|
||||
|
||||
/*
|
||||
* The action's view can be rendered using render() method
|
||||
* or @Template annotation as demonstrated in DemoController.
|
||||
*
|
||||
*/
|
||||
|
||||
return $this->render('BodyRep:Landing:index.html.twig');
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/about", name="_landing_about")
|
||||
* @Template()
|
||||
*/
|
||||
public function aboutAction()
|
||||
{
|
||||
|
||||
/*
|
||||
* The action's view can be rendered using render() method
|
||||
* or @Template annotation as demonstrated in DemoController.
|
||||
*
|
||||
*/
|
||||
return $this->render('BodyRep:Landing:about.html.twig');
|
||||
}
|
||||
}
|
||||
192
symfony/src/BodyRep/Controller/MemberController.php
Normal file
192
symfony/src/BodyRep/Controller/MemberController.php
Normal file
@@ -0,0 +1,192 @@
|
||||
<?php
|
||||
|
||||
namespace BodyRep\Controller;
|
||||
|
||||
# Core requirements
|
||||
use Symfony\Component\Security\Core\Encoder\EncoderFactoryInterface;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
||||
use Symfony\Component\Security\Core\SecurityContext;
|
||||
# use JMS\SecurityExtraBundle\Annotation\Secure;
|
||||
|
||||
# Entities
|
||||
use BodyRep\Form\Profile;
|
||||
|
||||
# Annotations & templates
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
|
||||
|
||||
# Ensure container access to member object
|
||||
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
|
||||
class MemberController extends Controller
|
||||
{
|
||||
private $member;
|
||||
public function setContainer(ContainerInterface $container = null)
|
||||
{
|
||||
parent::setContainer($container);
|
||||
|
||||
# Lookup member if logged in
|
||||
$user = $this->getUser();
|
||||
|
||||
if (method_exists($user, 'getUsername'))
|
||||
{
|
||||
$db = $this->getDoctrine()->getManager();
|
||||
$username = $this->getUser()->getUsername();
|
||||
|
||||
$query = $db->createQuery('
|
||||
SELECT m
|
||||
FROM BodyRep:Member m
|
||||
WHERE m.username = :username')
|
||||
->setParameter('username', $username)
|
||||
->setMaxResults(1);
|
||||
|
||||
if (sizeof($query->getResult()) != 1)
|
||||
throw $this->createNotFoundException("User '".$username."' not found");
|
||||
|
||||
$this->member = $query->getSingleResult();
|
||||
}
|
||||
else
|
||||
trigger_error("Container cannot determine member information");
|
||||
}
|
||||
|
||||
|
||||
private function getMember()
|
||||
{
|
||||
return $this->member;
|
||||
}
|
||||
|
||||
public function navbarAction()
|
||||
{
|
||||
// The security layer will intercept this request
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/", name="_member")
|
||||
* @Template()
|
||||
*/
|
||||
public function indexAction()
|
||||
{
|
||||
$username = $this->getUser()->getUsername();
|
||||
|
||||
|
||||
return array('name' => $this->getMember()->getFullName());
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/profile/", name="_member_profile")
|
||||
* @Template()
|
||||
*/
|
||||
public function profileAction()
|
||||
{
|
||||
$username = $this->getUser()->getUsername();
|
||||
|
||||
$db = $this->getDoctrine()->getManager();
|
||||
$query = $db->createQuery('
|
||||
SELECT p
|
||||
FROM BodyRep:Profile p
|
||||
WHERE p.username = :username')
|
||||
->setParameter('username', $username)
|
||||
->setMaxResults(1);
|
||||
if (sizeof($query->getResult()) != 1)
|
||||
throw $this->createNotFoundException("User '".$username."' not found");
|
||||
|
||||
$profile = $query->getSingleResult();
|
||||
|
||||
return (array('sFullName' => $profile->getFullName(), 'name' => $this->getMember()->getFullName()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/profile/edit", name="_member_profile_edit")
|
||||
* @Template()
|
||||
*/
|
||||
public function editProfileAction()
|
||||
{
|
||||
$username = $this->getUser()->getUsername();
|
||||
$form = $this->get('form.factory')->create(new Profile(), array('fullname' => $this->getMember()->getFullName()));
|
||||
$error = '';
|
||||
|
||||
return array('form' => $form->createView(), 'error' => '');
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/profile/save", name="_member_profile_save")
|
||||
*/
|
||||
public function saveAction()
|
||||
{
|
||||
$username = $this->getUser()->getUsername();
|
||||
$db = $this->getDoctrine()->getManager();
|
||||
$json = array('result' => 0);
|
||||
|
||||
$form = $this->get('form.factory')->create(new Profile());
|
||||
$request = $this->get('request');
|
||||
|
||||
|
||||
$form->bind($request);
|
||||
$np1 = $request->get('_newpass1');
|
||||
$np2 = $request->get('_newpass2');
|
||||
// if (!empty($np1) && !$np1 != $np2)
|
||||
// $form->get("fullname")->addError(new FormError('Passwords do not match'));
|
||||
|
||||
if ($form->isValid() && sizeof($_POST) > 0)
|
||||
{
|
||||
$json['result'] = 1;
|
||||
if (!empty($np1))
|
||||
{
|
||||
$factory = $this->get('security.encoder_factory');
|
||||
$encoder = $factory->getEncoder($this->getUser());
|
||||
$password = $encoder->encodePassword($np1, $this->getUser()->getSalt());
|
||||
|
||||
$this->member->setPassword($password);
|
||||
}
|
||||
$d = $form->getClientData();
|
||||
$this->getMember()->setFullName($d['fullname']);
|
||||
$db->persist($this->getMember());
|
||||
$db->flush();
|
||||
}
|
||||
|
||||
$resp = new Response (json_encode($json));
|
||||
$resp->headers->set('Content-Type', 'application/json');
|
||||
|
||||
return $resp;
|
||||
}
|
||||
/**
|
||||
* @Route("/search/{param}", name="_member_search", defaults={"param" = 0})
|
||||
* @Template()
|
||||
*/
|
||||
public function searchAction($param='')
|
||||
{
|
||||
|
||||
/*
|
||||
* Integrated suggester response
|
||||
*
|
||||
*/
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
$query = $em->createQuery("SELECT m FROM BodyRep:Member m WHERE m.fullname ILIKE '%$param%'");
|
||||
|
||||
$res = $query->getResult();
|
||||
$resc = sizeof($res);
|
||||
$sugg = array();
|
||||
/*if ($res > 0)
|
||||
{
|
||||
foreach ($res as $member)
|
||||
{
|
||||
$text = preg_replace('/<br[^\>]*>/i', "\n", $member->getFullname());
|
||||
$item['text'] = strip_tags($text);
|
||||
$item['html'] = $text;
|
||||
$item['data'] = array('username' => htmlspecialchars($member->getUsername()));
|
||||
$sugg[] = $item;
|
||||
}
|
||||
}
|
||||
if (!empty($param))
|
||||
{
|
||||
$json = array('result' => 1, 'suggestions' => $sugg);
|
||||
$resp = new Response (json_encode($json));
|
||||
$resp->headers->set('Content-Type', 'text/plain');
|
||||
return $resp;
|
||||
}
|
||||
else*/
|
||||
return array('search' => $res);
|
||||
}
|
||||
}
|
||||
65
symfony/src/BodyRep/Controller/ProfileController.php
Normal file
65
symfony/src/BodyRep/Controller/ProfileController.php
Normal file
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
namespace BodyRep\Controller;
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
||||
use Symfony\Component\Security\Core\SecurityContext;
|
||||
use Symfony\Component\HttpFoundation\RedirectResponse;
|
||||
use JMS\SecurityExtraBundle\Annotation\Secure;
|
||||
|
||||
# Annotations
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
|
||||
|
||||
class ProfileController extends Controller
|
||||
{
|
||||
/**
|
||||
* @Route("/", name="_profile")
|
||||
* @Template()
|
||||
*/
|
||||
public function indexAction($username)
|
||||
{
|
||||
|
||||
if ($this->getUser()->getUsername() == $username)
|
||||
return new RedirectResponse($this->generateUrl('_member_profile'));
|
||||
|
||||
$db = $this->getDoctrine()->getManager();
|
||||
|
||||
$query = $db->createQuery('
|
||||
SELECT p
|
||||
FROM BodyRep:Profile p
|
||||
WHERE p.username = :username')
|
||||
->setParameter('username', $username)
|
||||
->setMaxResults(1);
|
||||
if (sizeof($query->getResult()) != 1)
|
||||
throw $this->createNotFoundException("User '".$username."' not found");
|
||||
|
||||
$profile = $query->getSingleResult();
|
||||
$username = $this->getUser()->getUsername();
|
||||
$db = $this->getDoctrine()->getManager();
|
||||
$query = $db->createQuery('
|
||||
SELECT m
|
||||
FROM BodyRep:Member m
|
||||
WHERE m.username = :username')
|
||||
->setParameter('username', $username)
|
||||
->setMaxResults(1);
|
||||
|
||||
if (sizeof($query->getResult()) != 1)
|
||||
throw $this->createNotFoundException("User '".$username."' not found");
|
||||
|
||||
$member = $query->getSingleResult();
|
||||
|
||||
return (array('sFullName' => $profile->getFullName(), 'name' => $member->getFullName()));
|
||||
|
||||
}
|
||||
/**
|
||||
* @Route("/rep", name="_profile_reputation")
|
||||
* @Template()
|
||||
*/
|
||||
public function reputationAction($username)
|
||||
{
|
||||
return $this->indexAction($username);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
22
symfony/src/BodyRep/DependencyInjection/BodyRepExtension.php
Normal file
22
symfony/src/BodyRep/DependencyInjection/BodyRepExtension.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace BodyRep\DependencyInjection;
|
||||
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
|
||||
#use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
|
||||
#use Symfony\Component\Config\FileLocator;
|
||||
|
||||
class BodyRepExtension extends Extension
|
||||
{
|
||||
public function load(array $configs, ContainerBuilder $container)
|
||||
{
|
||||
#$loader = new YamlFileLoader($container, new FileLocator(__DIR__));
|
||||
#$loader->load('/data/www/br/src/BodyRep/Resources/config/services.yml');
|
||||
}
|
||||
|
||||
public function getAlias()
|
||||
{
|
||||
return 'body_rep';
|
||||
}
|
||||
}
|
||||
115
symfony/src/BodyRep/Entity/Comment.php
Normal file
115
symfony/src/BodyRep/Entity/Comment.php
Normal file
@@ -0,0 +1,115 @@
|
||||
<?php
|
||||
|
||||
namespace BodyRep\Entity;
|
||||
|
||||
use Symfony\Component\Security\Core\User\UserInterface;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
/**
|
||||
* @ORM\Entity
|
||||
* @ORM\Table(name="comments")
|
||||
*/
|
||||
class Comment
|
||||
{
|
||||
/**
|
||||
* @ORM\Id
|
||||
* @ORM\Column(type="integer")
|
||||
* @ORM\GeneratedValue(strategy="AUTO")
|
||||
*/
|
||||
protected $id;
|
||||
|
||||
/**
|
||||
* @ORM\Column(name="author", type="string", length=255)
|
||||
*/
|
||||
protected $author;
|
||||
|
||||
/**
|
||||
* @ORM\Column(name="text", type="string", length=255)
|
||||
*/
|
||||
protected $text;
|
||||
|
||||
/**
|
||||
* @ORM\Column(name="created", type="timestamp")
|
||||
*/
|
||||
protected $created;
|
||||
|
||||
|
||||
/**
|
||||
* Get id
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set author
|
||||
*
|
||||
* @param string $author
|
||||
* @return Comment
|
||||
*/
|
||||
public function setAuthor($author)
|
||||
{
|
||||
$this->author = $author;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get author
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getAuthor()
|
||||
{
|
||||
return $this->author;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set text
|
||||
*
|
||||
* @param string $text
|
||||
* @return Comment
|
||||
*/
|
||||
public function setText($text)
|
||||
{
|
||||
$this->text = $text;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get text
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getText()
|
||||
{
|
||||
return $this->text;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set created
|
||||
*
|
||||
* @param timestamp $created
|
||||
* @return Comment
|
||||
*/
|
||||
public function setCreated(\timestamp $created)
|
||||
{
|
||||
$this->created = $created;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get created
|
||||
*
|
||||
* @return timestamp
|
||||
*/
|
||||
public function getCreated()
|
||||
{
|
||||
return $this->created;
|
||||
}
|
||||
}
|
||||
149
symfony/src/BodyRep/Entity/Member.php
Normal file
149
symfony/src/BodyRep/Entity/Member.php
Normal file
@@ -0,0 +1,149 @@
|
||||
<?php
|
||||
|
||||
namespace BodyRep\Entity;
|
||||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Component\Security\Core\User\UserInterface;
|
||||
|
||||
/**
|
||||
* Bodyrep\Entity\Member
|
||||
*
|
||||
* @ORM\Table(name="member")
|
||||
* @ORM\Entity(repositoryClass="BodyRep\Entity\UserRepository")
|
||||
*/
|
||||
class Member implements UserInterface
|
||||
{
|
||||
/**
|
||||
* @ORM\Column(type="integer")
|
||||
* @ORM\Id
|
||||
* @ORM\GeneratedValue(strategy="AUTO")
|
||||
*/
|
||||
private $id;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="string", length=25, unique=true)
|
||||
*/
|
||||
private $username;
|
||||
|
||||
/**
|
||||
* @var string $fullname
|
||||
*
|
||||
* @ORM\Column(name="fullname", type="string")
|
||||
*/
|
||||
private $fullname;
|
||||
/**
|
||||
* @ORM\Column(type="string", length=32)
|
||||
*/
|
||||
private $salt;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="string", length=40)
|
||||
*/
|
||||
private $password;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="string", length=60, unique=true)
|
||||
*/
|
||||
private $email;
|
||||
|
||||
/**
|
||||
* @ORM\Column(name="active", type="integer")
|
||||
*/
|
||||
private $isActive;
|
||||
|
||||
private $roles;
|
||||
|
||||
public function __construct($username, $password = '', $salt = '', $roles = array())
|
||||
{
|
||||
$this->username = $username;
|
||||
$this->password = $password;
|
||||
$this->salt = $salt;
|
||||
$this->roles = $roles;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function getUsername()
|
||||
{
|
||||
return $this->username;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function getSalt()
|
||||
{
|
||||
return $this->salt;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function getPassword()
|
||||
{
|
||||
return $this->password;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function getRoles()
|
||||
{
|
||||
return array('ROLE_USER');
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function eraseCredentials()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Set fullName
|
||||
*
|
||||
* @param string $fullname
|
||||
* @return Member
|
||||
*/
|
||||
public function setfullname($fullname)
|
||||
{
|
||||
$this->fullname = $fullname;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set password
|
||||
*
|
||||
* @param string $password
|
||||
* @return Member
|
||||
*/
|
||||
public function setPassword($password)
|
||||
{
|
||||
$this->password = $password;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get fullName
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getFullName()
|
||||
{
|
||||
return $this->fullname;
|
||||
}
|
||||
/**
|
||||
* Get fullName
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getLink()
|
||||
{
|
||||
return '/app_dev.php/' . $this->getUsername();
|
||||
}
|
||||
}
|
||||
127
symfony/src/BodyRep/Entity/Profile.php
Normal file
127
symfony/src/BodyRep/Entity/Profile.php
Normal file
@@ -0,0 +1,127 @@
|
||||
<?php
|
||||
|
||||
namespace BodyRep\Entity;
|
||||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Component\Security\Core\User\UserInterface;
|
||||
|
||||
/**
|
||||
* Bodyrep\Entity\Profile
|
||||
*
|
||||
* @ORM\Table(name="member")
|
||||
* @ORM\Entity
|
||||
*/
|
||||
class Profile
|
||||
{
|
||||
/**
|
||||
* @var integer $id
|
||||
*
|
||||
* @ORM\Column(name="id", type="integer")
|
||||
* @ORM\Id
|
||||
* @ORM\GeneratedValue(strategy="AUTO")
|
||||
*/
|
||||
private $id;
|
||||
|
||||
|
||||
/**
|
||||
* @var string $fullname
|
||||
*
|
||||
* @ORM\Column(name="fullname", type="string")
|
||||
*/
|
||||
private $fullname;
|
||||
|
||||
/**
|
||||
* @var string $username
|
||||
*
|
||||
* @ORM\Column(name="username", type="string")
|
||||
*/
|
||||
private $username;
|
||||
|
||||
/**
|
||||
* @var float $currentweight
|
||||
*
|
||||
* @ORM\Column(name="currentweight", type="float")
|
||||
*/
|
||||
private $currentweight;
|
||||
|
||||
|
||||
/**
|
||||
* Get id
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getid()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set fullName
|
||||
*
|
||||
* @param string $fullname
|
||||
* @return Profile
|
||||
*/
|
||||
public function setfullname($fullname)
|
||||
{
|
||||
$this->fullname = $fullname;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get fullName
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getFullName()
|
||||
{
|
||||
return $this->fullname;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set userName
|
||||
*
|
||||
* @param string $username
|
||||
* @return Profile
|
||||
*/
|
||||
public function setUserName($username)
|
||||
{
|
||||
$this->username = $userName;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get userName
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getUserName()
|
||||
{
|
||||
return $this->username;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set currentWeight
|
||||
*
|
||||
* @param float $currentWeight
|
||||
* @return Profile
|
||||
*/
|
||||
public function setCurrentWeight($currentWeight)
|
||||
{
|
||||
$this->currentweight = $currentWeight;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get currentWeight
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
public function getCurrentWeight()
|
||||
{
|
||||
return $this->currentweight;
|
||||
}
|
||||
|
||||
}
|
||||
110
symfony/src/BodyRep/Entity/User.php
Normal file
110
symfony/src/BodyRep/Entity/User.php
Normal file
@@ -0,0 +1,110 @@
|
||||
<?php
|
||||
|
||||
namespace BodyRep\Entity;
|
||||
|
||||
use Symfony\Component\Security\Core\User\UserInterface;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
/**
|
||||
* @ORM\Entity
|
||||
* @ORM\Table(name="member")
|
||||
*/
|
||||
class User implements UserInterface
|
||||
{
|
||||
/**
|
||||
* @ORM\Id
|
||||
* @ORM\Column(type="integer")
|
||||
* @ORM\GeneratedValue(strategy="AUTO")
|
||||
*/
|
||||
protected $id;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="string", length=25, unique=true)
|
||||
*/
|
||||
protected $username;
|
||||
|
||||
/**
|
||||
* @ORM\Column(name="password", type="string", length=255)
|
||||
*/
|
||||
protected $password;
|
||||
|
||||
/**
|
||||
* @ORM\Column(name="salt", type="string", length=255)
|
||||
*/
|
||||
protected $salt;
|
||||
|
||||
protected $roles = array();
|
||||
|
||||
public function getRoles()
|
||||
{
|
||||
return $this->roles;
|
||||
}
|
||||
|
||||
public function getSalt()
|
||||
{
|
||||
return $this->salt;
|
||||
}
|
||||
|
||||
public function getUsername()
|
||||
{
|
||||
return $this->username;
|
||||
}
|
||||
|
||||
public function eraseCredentials()
|
||||
{
|
||||
}
|
||||
|
||||
public function getPassword()
|
||||
{
|
||||
return $this->password;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get id
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set username
|
||||
*
|
||||
* @param string $username
|
||||
* @return User
|
||||
*/
|
||||
public function setUsername($username)
|
||||
{
|
||||
$this->username = $username;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set password
|
||||
*
|
||||
* @param string $password
|
||||
* @return User
|
||||
*/
|
||||
public function setPassword($password)
|
||||
{
|
||||
$this->password = $password;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set salt
|
||||
*
|
||||
* @param string $salt
|
||||
* @return User
|
||||
*/
|
||||
public function setSalt($salt)
|
||||
{
|
||||
$this->salt = $salt;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
15
symfony/src/BodyRep/Entity/UserRepository.php
Normal file
15
symfony/src/BodyRep/Entity/UserRepository.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace BodyRep\Entity;
|
||||
|
||||
use Doctrine\ORM\EntityRepository;
|
||||
|
||||
/**
|
||||
* UserRepository
|
||||
*
|
||||
* This class was generated by the Doctrine ORM. Add your own custom
|
||||
* repository methods below.
|
||||
*/
|
||||
class UserRepository extends EntityRepository
|
||||
{
|
||||
}
|
||||
32
symfony/src/BodyRep/EventListener/CommentListener.php
Normal file
32
symfony/src/BodyRep/EventListener/CommentListener.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
// FooVendor/BarBundle/EventListener/CommentListener.php
|
||||
use FooVendorBarBundleEventCommentEvent;
|
||||
|
||||
class CommentListener
|
||||
{
|
||||
protected $mailer;
|
||||
|
||||
public function __construct(Swift_Mailer $mailer)
|
||||
{
|
||||
$this->mailer = $mailer;
|
||||
}
|
||||
|
||||
public function onCommentEvent(CommentEvent $event)
|
||||
{
|
||||
$post = $event->getPost();
|
||||
$comment = $event->getComment();
|
||||
|
||||
foreach ($post->getSubscribers() as $subscriber) {
|
||||
$message = Swift_Message::newInstance()
|
||||
->setSubject('New comment posted on ' . $post->getTitle())
|
||||
->setFrom('send@example.com')
|
||||
->setTo($subscriber->getEmail())
|
||||
->setBody("Hey, somebody left a new comment on a post you're subscribed to! It says: " . $comment->getBody())
|
||||
;
|
||||
$this->mailer->send($message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
46
symfony/src/BodyRep/EventListener/ControllerListener.php
Normal file
46
symfony/src/BodyRep/EventListener/ControllerListener.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace BodyRep\EventListener;
|
||||
|
||||
use Symfony\Component\EventDispatcher\Event;
|
||||
use Symfony\Component\HttpKernel\HttpKernelInterface;
|
||||
use Symfony\Component\HttpKernel\Event\FilterControllerEvent;
|
||||
use BodyRep\Twig\Extension\TemplateExtension;
|
||||
|
||||
class ControllerListener
|
||||
{
|
||||
protected $extension;
|
||||
|
||||
public function __construct(TemplateExtension $extension)
|
||||
{
|
||||
$this->extension = $extension;
|
||||
}
|
||||
|
||||
public function onKernelController(FilterControllerEvent $event)
|
||||
{
|
||||
|
||||
if (HttpKernelInterface::MASTER_REQUEST === $event->getRequestType()) {
|
||||
$this->extension->setController($event->getController());
|
||||
}
|
||||
}
|
||||
public function preExecute(\Symfony\Component\HttpKernel\Event\GetResponseForControllerResultEvent $event){
|
||||
//result returned by the controller
|
||||
$data = $event->getControllerResult();
|
||||
|
||||
//Get the current route
|
||||
$route = $event->getRequest()->get('_route');
|
||||
|
||||
/* @var $request \Symfony\Component\HttpFoundation\Request */
|
||||
$request = $event->getRequest();
|
||||
$template = $request->get('_template');
|
||||
$route = $request->get('_route');
|
||||
|
||||
if(substr($route,0,7) == 'mobile_'){
|
||||
$newTemplate = str_replace('html.twig','mobile.html.twig',$template);
|
||||
|
||||
//Overwrite original template with the mobile one
|
||||
$response = $this->templating->renderResponse($newTemplate, $data);
|
||||
$event->setResponse($response);
|
||||
}
|
||||
}
|
||||
}
|
||||
20
symfony/src/BodyRep/EventListener/KernelListener.php
Normal file
20
symfony/src/BodyRep/EventListener/KernelListener.php
Normal file
@@ -0,0 +1,20 @@
|
||||
public function preExecute(\Symfony\Component\HttpKernel\Event\GetResponseForControllerResultEvent $event){
|
||||
//result returned by the controller
|
||||
$data = $event->getControllerResult();
|
||||
|
||||
//Get the current route
|
||||
$route = $event->getRequest()->get('_route');
|
||||
|
||||
/* @var $request \Symfony\Component\HttpFoundation\Request */
|
||||
$request = $event->getRequest();
|
||||
$template = $request->get('_template');
|
||||
$route = $request->get('_route');
|
||||
|
||||
if(substr($route,0,7) == 'mobile_'){
|
||||
$newTemplate = str_replace('html.twig','mobile.html.twig',$template);
|
||||
|
||||
//Overwrite original template with the mobile one
|
||||
$response = $this->templating->renderResponse($newTemplate, $data);
|
||||
$event->setResponse($response);
|
||||
}
|
||||
}
|
||||
46
symfony/src/BodyRep/EventListener/LoginListener.php
Normal file
46
symfony/src/BodyRep/EventListener/LoginListener.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace BodyRep\EventListener;
|
||||
|
||||
use Symfony\Component\EventDispatcher\Event;
|
||||
use Symfony\Component\Security\Core\SecurityContext;
|
||||
use Doctrine\Bundle\DoctrineBundle\Registry as Doctrine; // for Symfony 2.1.x
|
||||
// use Symfony\Bundle\DoctrineBundle\Registry as Doctrine; // for Symfony 2.0.x
|
||||
|
||||
/**
|
||||
* Custom login listener.
|
||||
*/
|
||||
class LoginListener
|
||||
{
|
||||
/** @var \Symfony\Component\Security\Core\SecurityContext */
|
||||
private $context;
|
||||
|
||||
/** @var \Doctrine\ORM\EntityManager */
|
||||
private $em;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param SecurityContext $context
|
||||
* @param Doctrine $doctrine
|
||||
*/
|
||||
public function __construct(SecurityContext $context, Doctrine $doctrine)
|
||||
{
|
||||
$this->context = $context;
|
||||
$this->em = $doctrine->getEntityManager();
|
||||
}
|
||||
|
||||
/**
|
||||
* Do the magic.
|
||||
*
|
||||
* @param Event $event
|
||||
*/
|
||||
public function onSecurityInteractiveLogin(Event $event)
|
||||
{
|
||||
$user = $this->context->getToken()->getUser();
|
||||
|
||||
// do all your magic here
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
25
symfony/src/BodyRep/Form/Profile.php
Normal file
25
symfony/src/BodyRep/Form/Profile.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace BodyRep\Form;
|
||||
|
||||
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
|
||||
class Profile extends AbstractType
|
||||
{
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
{
|
||||
$builder->add('fullname', 'text');
|
||||
|
||||
|
||||
//$builder->add('newpass1', 'text');
|
||||
//$builder->add('newpass2', 'text');
|
||||
|
||||
}
|
||||
|
||||
public function getName()
|
||||
{
|
||||
return 'profile';
|
||||
}
|
||||
}
|
||||
17
symfony/src/BodyRep/Resources/config/services.xml
Normal file
17
symfony/src/BodyRep/Resources/config/services.xml
Normal file
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" ?>
|
||||
|
||||
<container xmlns="http://symfony.com/schema/dic/services"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
|
||||
<services>
|
||||
<service id="twig.extension.bodyrep" class="BodyRep\Twig\Extension\TemplateExtension" public="false">
|
||||
<tag name="twig.extension" />
|
||||
<argument type="service" id="twig.loader" />
|
||||
</service>
|
||||
|
||||
<service id="bodyrep.listener" class="BodyRep\EventListener\ControllerListener">
|
||||
<tag name="kernel.event_listener" event="kernel.controller" method="onKernelController" />
|
||||
<argument type="service" id="twig.extension.bodyrep" />
|
||||
</service>
|
||||
</services>
|
||||
</container>
|
||||
34
symfony/src/BodyRep/Resources/views/Auth/login.html.twig
Normal file
34
symfony/src/BodyRep/Resources/views/Auth/login.html.twig
Normal file
@@ -0,0 +1,34 @@
|
||||
{% extends 'BodyRep::layout.html.twig' %}
|
||||
{% block js %}
|
||||
$(document).ready(function()
|
||||
{
|
||||
if($('#username').val().length > 0)
|
||||
$('#password').focus();
|
||||
else
|
||||
$('#username').focus();
|
||||
});
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
|
||||
<h1>Login</h1>
|
||||
|
||||
{% if error %}
|
||||
<div class="error">{{ error.message }}</div>
|
||||
{% endif %}
|
||||
|
||||
<form name='login' action="{{ path("_login_check") }}" method="post" id="login">
|
||||
<div>
|
||||
<label for="username">Username</label>
|
||||
<input type="text" id="username" name="_username" value="{{ last_username }}" />
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label for="password">Password</label>
|
||||
<input type="password" id="password" name="_password" />
|
||||
</div>
|
||||
|
||||
<input type="submit" class="btn btn-primary btn-mini" id='loginbtn' value="LOGIN" />
|
||||
</form>
|
||||
{% endblock %}
|
||||
35
symfony/src/BodyRep/Resources/views/Auth/navbar.html.twig
Normal file
35
symfony/src/BodyRep/Resources/views/Auth/navbar.html.twig
Normal file
@@ -0,0 +1,35 @@
|
||||
<div class="navbar navbar-fixed-top">
|
||||
<div class="navbar-inner">
|
||||
<div class="container-fluid">
|
||||
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</a>
|
||||
<img src="/img/logo-nav.png" class='pull-left' style='padding-right : 5px; margin-top : 10px;' />
|
||||
<a class="brand" href="#">BODY<b>REP</b></a>
|
||||
<div class="btn-group pull-right">
|
||||
<a class="btn dropdown-toggle" data-toggle="dropdown" href="#" style="background : transparent; color : white; text-shadow : none; border : none; box-shadow : 0 0 0 #fff;">
|
||||
<i class="icon-user icon-white"></i> {{name}}
|
||||
<span class="caret" style='border-top-color : white; border-bottom-color : white;'></span>
|
||||
</a>
|
||||
<ul class="dropdown-menu">
|
||||
<li><a href="{{ path('_member_profile') }}">Profile</a></li>
|
||||
<li class="divider"></li>
|
||||
<li><a href="{{ path('_logout') }}">Sign Out</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class='offset2'>
|
||||
<form class="navbar-search pull-left" id='topsearch' action="{{ path('_member_search') }}">
|
||||
<input type="text" class="search-query span4" id="topsearch" style='height : 28px;' placeholder="Search"><span id='msg_topsearch'></span>
|
||||
</form>
|
||||
</div>
|
||||
<a class="btn dropdown-toggle pull-right" data-toggle="dropdown" href="#" style="margin : 0; background : transparent; color : white; text-shadow : none; border : none; box-shadow : 0 0 0 #fff;">
|
||||
<i class='licon-calendar licon-white'></i>
|
||||
</a>
|
||||
<a class="btn dropdown-toggle pull-right" data-toggle="dropdown" href="#" style="margin : 0; background : transparent; color : white; text-shadow : none; border : none; box-shadow : 0 0 0 #fff;">
|
||||
<i class='licon-mail-new licon-white'></i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,9 @@
|
||||
{% extends "BodyRep::layout.html.twig" %}
|
||||
|
||||
{% block title "BodyRep - About Us" %}
|
||||
|
||||
{% block content %}
|
||||
{% include 'BodyRep:Landing:navbar.html.twig' %}
|
||||
|
||||
About
|
||||
{% endblock %}
|
||||
12
symfony/src/BodyRep/Resources/views/Landing/index.html.twig
Normal file
12
symfony/src/BodyRep/Resources/views/Landing/index.html.twig
Normal file
@@ -0,0 +1,12 @@
|
||||
{% extends 'BodyRep::layout.html.twig' %}
|
||||
|
||||
{% block title %}BodyRep - Welcome{% endblock %}
|
||||
|
||||
{% block content_header '' %}
|
||||
|
||||
|
||||
{% block content %}
|
||||
{% include 'BodyRep:Landing:navbar.html.twig' %}
|
||||
|
||||
Landing Page
|
||||
{% endblock %}
|
||||
18
symfony/src/BodyRep/Resources/views/Landing/navbar.html.twig
Normal file
18
symfony/src/BodyRep/Resources/views/Landing/navbar.html.twig
Normal file
@@ -0,0 +1,18 @@
|
||||
<div class="navbar navbar-fixed-top">
|
||||
<div class="navbar-inner">
|
||||
<div class="container-fluid">
|
||||
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</a>
|
||||
<img src="/img/logo-nav.png" class='pull-left' style='padding-right : 5px; margin-top : 10px;' />
|
||||
<a class="brand" href="#">BODY<b>REP</b></a>
|
||||
<div class="btn-group pull-right">
|
||||
<a class="btn " href="{{ path('_member') }}" style="background : transparent; color : white; text-shadow : none; border : none; box-shadow : 0 0 0 #fff;">
|
||||
<i class="icon-user icon-white"></i> Login
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,25 @@
|
||||
{% block content %}
|
||||
|
||||
<h1>Update Profile</h1>
|
||||
|
||||
|
||||
<form action="{{ path('_member_profile_save') }}" method="post" id="profile">
|
||||
<div>
|
||||
{{ form_errors(form) }}
|
||||
</div>
|
||||
<div>
|
||||
<label for="fullname">Name</label>
|
||||
{{ form_row(form.fullname) }}
|
||||
</div>
|
||||
<div> </div>
|
||||
<div>
|
||||
<label for="newpass1">New Password:</label><br />
|
||||
<input type="password" id="newpass1" name="_newpass1" /> <br />
|
||||
<input type="password" id="newpass2" name="_newpass2" />
|
||||
</div>
|
||||
<div> </div>
|
||||
|
||||
{{ form_rest(form) }}
|
||||
<input type="submit" class="btn btn-primary btn-small" value="Save" />
|
||||
</form>
|
||||
{% endblock %}
|
||||
13
symfony/src/BodyRep/Resources/views/Member/index.html.twig
Normal file
13
symfony/src/BodyRep/Resources/views/Member/index.html.twig
Normal file
@@ -0,0 +1,13 @@
|
||||
{% extends "BodyRep:Member:layout.html.twig" %}
|
||||
|
||||
{% block title "Hello " ~ name %}
|
||||
|
||||
{% block content %}
|
||||
{% include 'BodyRep:Auth:navbar.html.twig' %}
|
||||
<div class='row-fluid'>
|
||||
<h1>Member landing page</h1>
|
||||
|
||||
<h3>{{name}}</h3>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
{% extends 'BodyRep::layout.html.twig' %}
|
||||
|
||||
|
||||
{% block content_header '' %}
|
||||
25
symfony/src/BodyRep/Resources/views/Member/login.html.twig
Normal file
25
symfony/src/BodyRep/Resources/views/Member/login.html.twig
Normal file
@@ -0,0 +1,25 @@
|
||||
{% extends 'BodyRep::layout.html.twig' %}
|
||||
|
||||
{% block content %}
|
||||
{% include 'BodyRep:Landing:navbar.html.twig' %}
|
||||
|
||||
<h1>Login</h1>
|
||||
|
||||
{% if error %}
|
||||
<div class="error">{{ error.message }}</div>
|
||||
{% endif %}
|
||||
|
||||
<form action="{{ path("_security_check") }}" method="post" id="login">
|
||||
<div>
|
||||
<label for="username">Username</label>
|
||||
<input type="text" id="username" name="_username" value="{{ last_username }}" />
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label for="password">Password</label>
|
||||
<input type="password" id="password" name="_password" />
|
||||
</div>
|
||||
|
||||
<input type="submit" class="btn btn-primary btn-mini" value="LOGIN" />
|
||||
</form>
|
||||
{% endblock %}
|
||||
35
symfony/src/BodyRep/Resources/views/Member/navbar.html.twig
Normal file
35
symfony/src/BodyRep/Resources/views/Member/navbar.html.twig
Normal file
@@ -0,0 +1,35 @@
|
||||
<div class="navbar navbar-fixed-top">
|
||||
<div class="navbar-inner">
|
||||
<div class="container-fluid">
|
||||
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</a>
|
||||
<img src="/img/logo-nav.png" class='pull-left' style='padding-right : 5px; margin-top : 10px;' />
|
||||
<a class="brand" href="#">BODY<b>REP</b></a>
|
||||
<div class="btn-group pull-right">
|
||||
<a class="btn dropdown-toggle" data-toggle="dropdown" href="#" style="background : transparent; color : white; text-shadow : none; border : none; box-shadow : 0 0 0 #fff;">
|
||||
<i class="icon-user icon-white"></i> {{name}}
|
||||
<span class="caret" style='border-top-color : white; border-bottom-color : white;'></span>
|
||||
</a>
|
||||
<ul class="dropdown-menu">
|
||||
<li><a href="{{ path('_member_profile') }}">Profile</a></li>
|
||||
<li class="divider"></li>
|
||||
<li><a href="{{ path('_logout') }}">Sign Out</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class='offset2'>
|
||||
<form class="navbar-search pull-left" id='topsearch' action="{{ path('_member_search') }}">
|
||||
<input type="text" class="search-query span4" id="topsearch" style='height : 28px;' placeholder="Search"><span id='msg_topsearch'></span>
|
||||
</form>
|
||||
</div>
|
||||
<a class="btn dropdown-toggle pull-right" data-toggle="dropdown" href="#" style="margin : 0; background : transparent; color : white; text-shadow : none; border : none; box-shadow : 0 0 0 #fff;">
|
||||
<i class='licon-calendar licon-white'></i>
|
||||
</a>
|
||||
<a class="btn dropdown-toggle pull-right" data-toggle="dropdown" href="#" style="margin : 0; background : transparent; color : white; text-shadow : none; border : none; box-shadow : 0 0 0 #fff;">
|
||||
<i class='licon-mail-new licon-white'></i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
313
symfony/src/BodyRep/Resources/views/Member/profile.html.twig
Normal file
313
symfony/src/BodyRep/Resources/views/Member/profile.html.twig
Normal file
@@ -0,0 +1,313 @@
|
||||
{% extends 'BodyRep::layout.html.twig' %}
|
||||
|
||||
{% block title %}BodyRep{% endblock %}
|
||||
|
||||
{% block content_header '' %}
|
||||
|
||||
{% block content %}
|
||||
{% include 'BodyRep:Auth:navbar.html.twig' %}
|
||||
|
||||
<div class="row-fluid">
|
||||
<div class="span2">
|
||||
<div class="well sidebar-nav">
|
||||
<ul class="nav nav-list">
|
||||
<li class="nav-header">Profile</li>
|
||||
<li class="active"><a href="#">Body Stats</a></li>
|
||||
<li><a href="#">Body Reputation</a></li>
|
||||
<li><a href="#">Challenges</a></li>
|
||||
<li class="nav-header">Workouts</li>
|
||||
<li class="nav-header">Meals</li>
|
||||
<li class="nav-header">Community</li>
|
||||
<li class="nav-header">Learning</li>
|
||||
<li class="nav-header">Apps</li>
|
||||
<li class="nav-header">Shopping</li>
|
||||
</ul>
|
||||
</div><!--/.well -->
|
||||
</div><!--/span-->
|
||||
<div class="span6" id='mcnt'>
|
||||
<div class="row-fluid">
|
||||
<h2 class="pull-left">{{ sFullName }}</h2>
|
||||
<a class="pull-right btn btn-primary btn-mini" id='edprf' href="#"><i class="icon-cog icon-white"></i> Edit Profile</a>
|
||||
</div>
|
||||
<div class="row-fluid" style='font-size : 12px;'>
|
||||
<i class="icon-signal"></i><span> Weight: 100kg ( <div class='arrowup'></div> 0)</span>
|
||||
<span>Bodyfat: 20% ( <div class='arrowup'></div> 2)</span>
|
||||
<span>Measurements: 400cm ( <div class='arrowup'></div> 15)</span>
|
||||
</div>
|
||||
<div class="row-fluid" style='font-size : 12px;'>
|
||||
<i class="icon-home"></i><span> Lives in </span><a>Calgary, Alberta</a>
|
||||
<i class="icon-signal"></i><span> Trains at </span><a>Talisman Center,Fitness First</a>
|
||||
<i class="icon-signal"></i><span> Hobbies: </span><a>Skiing,</a><span> and </span><a>(5) other</a><span> ...</span>
|
||||
<i class="icon-signal"></i><span> Professionals: </span><a>Heath Spence</a><span>,</span><a>Steve Baudo</a><a> see more...</a>
|
||||
</div>
|
||||
<hr />
|
||||
<div class="row-fluid">
|
||||
<h5 class="pull-left">Filters:</h5>
|
||||
<div class="pull-left">
|
||||
<div class="block_type_small redbg redbd pull-left">
|
||||
<i class="icon-user icon-white"></i>
|
||||
</div>
|
||||
<div class="block_type_small bluebg bluebd pull-left">
|
||||
<i class="icon-wrench icon-white"></i>
|
||||
</div>
|
||||
<div class="block_type_small orangebg orangebd pull-left">
|
||||
<i class="icon-magnet icon-white"></i>
|
||||
</div>
|
||||
<div class="block_type_small tealbg tealbd pull-left">
|
||||
<i class="icon-heart icon-white"></i>
|
||||
</div>
|
||||
<div class="block_type_small purplebg purplebd pull-left">
|
||||
<i class="icon-th icon-white"></i>
|
||||
</div>
|
||||
<div class="block_type_small greenbg greenbd pull-left">
|
||||
<i class="icon-book icon-white"></i>
|
||||
</div>
|
||||
<div class="block_type_small graybg graybd pull-left">
|
||||
<i class="icon-file icon-white"></i>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="stats">
|
||||
<div class="comment_block">
|
||||
<div class="block_types">
|
||||
<div class="block_type redbd">
|
||||
<i class="gicon-magnet"></i>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tnc-blurb">
|
||||
<i class="icon-signal"></i>
|
||||
565
|
||||
</div>
|
||||
<div class="basic-comment">
|
||||
<b>Breakfast:</b><span> 30g Oats, 1x Banana, 5x Egg Whites</span>
|
||||
</div>
|
||||
<div class="like-comment-time">
|
||||
<i class="icon-thumbs-up"></i>
|
||||
<i class="icon-comment"></i>
|
||||
<span>14 minutes ago</span>
|
||||
</div>
|
||||
<div class="user-sub-comment">
|
||||
<div class='sub-avatar user1'></div>
|
||||
<a>Brian Goff</a>
|
||||
<p>Good to see you're keeping up the good work mate. Keep us posted ;)</p>
|
||||
<div class="like-comment-time">
|
||||
<i class="icon-thumbs-up"></i>
|
||||
<i class="icon-comment"></i>
|
||||
<span>April 3 at 2:05pm</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="user-sub-comment">
|
||||
<div class='sub-avatar user2'></div>
|
||||
<a>Alex Zborowski</a>
|
||||
<p>Well it's not easy but you do your best every day and you judge every action.</p>
|
||||
<div class="like-comment-time">
|
||||
<i class="icon-thumbs-up"></i>
|
||||
<i class="icon-comment"></i>
|
||||
<span>April 3 at 2:05pm</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="stats">
|
||||
<div class="comment_block">
|
||||
<div class="block_types">
|
||||
<div class="block_type greenbd">
|
||||
<i class="gicon-search"></i>
|
||||
</div>
|
||||
<div class="block_type orangebd">
|
||||
<i class="gicon-screen"></i>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tnc-blurb">
|
||||
<i class="icon-time"></i>
|
||||
45
|
||||
<i class="icon-signal"></i>
|
||||
900
|
||||
</div>
|
||||
<div class="basic-comment">
|
||||
Workout at <a>Talisman Center</a> with <a>Brian Goff</a>
|
||||
</div>
|
||||
<div class="like-comment-time">
|
||||
<i class="icon-thumbs-up"></i>
|
||||
<i class="icon-comment"></i>
|
||||
<span>37 minutes ago</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="stats">
|
||||
<div class="comment_block">
|
||||
<div class="block_types">
|
||||
<div class="block_type greenbd">
|
||||
<i class="gicon-search"></i>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tnc-blurb">
|
||||
<i class="icon-time"></i>
|
||||
90
|
||||
<i class="icon-signal"></i>
|
||||
720
|
||||
</div>
|
||||
<div class="basic-comment">
|
||||
Workout at <a>Talisman Center</a>
|
||||
</div>
|
||||
<div class="like-comment-time">
|
||||
<i class="icon-thumbs-up"></i>
|
||||
<i class="icon-comment"></i>
|
||||
<span>April 4 at 7:00pm</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="stats">
|
||||
<div class="comment_block">
|
||||
<div class="block_types">
|
||||
<div class="block_type bluebd">
|
||||
<i class="gicon-profile"></i>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tnc-blurb">
|
||||
</div>
|
||||
<div class="basic-comment">
|
||||
You commented on <a>Brian Goff's workout</a>
|
||||
</div>
|
||||
<div class="like-comment-time">
|
||||
<i class="icon-thumbs-up"></i>
|
||||
<i class="icon-comment"></i>
|
||||
<span>April 4 at 6:30pm</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="stats">
|
||||
<div class="comment_block">
|
||||
<div class="block_types">
|
||||
<div class="block_type purplebd">
|
||||
<i class="gicon-profile"></i>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tnc-blurb">
|
||||
</div>
|
||||
<div class="basic-comment">
|
||||
Your read <a>"Fatigue Recovery & Supercompensation Theory"</a>
|
||||
</div>
|
||||
<div class="like-comment-time">
|
||||
<i class="icon-thumbs-up"></i>
|
||||
<i class="icon-comment"></i>
|
||||
<span>April 2 at 8:00am</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="stats">
|
||||
<div class="comment_block">
|
||||
<div class="block_types">
|
||||
<div class="block_type greenbd">
|
||||
<i class="gicon-search"></i>
|
||||
</div>
|
||||
<div class="block_type orangebd">
|
||||
<i class="gicon-screen"></i>
|
||||
</div>
|
||||
<div class="block_type tealbd">
|
||||
<i class="gicon-line"></i>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tnc-blurb">
|
||||
<i class="icon-time"></i>
|
||||
30
|
||||
<i class="icon-signal"></i>
|
||||
450
|
||||
</div>
|
||||
<div class="basic-comment">
|
||||
<a>Workout</a> using <a>Runtracker</a> with <a>Brian Goff</a>
|
||||
</div>
|
||||
<div class="like-comment-time">
|
||||
<i class="icon-thumbs-up"></i>
|
||||
<i class="icon-comment"></i>
|
||||
<span>April 2 at 6:00am</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="stats">
|
||||
<div class="comment_block">
|
||||
<div class="block_types">
|
||||
<div class="block_type orangebd">
|
||||
<i class="gicon-screen"></i>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="user-comment">
|
||||
<div class='avatar user1'></div>
|
||||
<a>Brian Goff</a>
|
||||
<p>Hey "mate"! Want to train at the <a>Talisman</a> again tonight?</p>
|
||||
</div>
|
||||
<div class="like-comment-time">
|
||||
<i class="icon-thumbs-up"></i>
|
||||
<i class="icon-comment"></i>
|
||||
<span>April 3 at 2:00pm</span>
|
||||
</div>
|
||||
|
||||
<div class="user-sub-comment">
|
||||
<div class='sub-avatar user2'></div>
|
||||
<a>Alex Zborowski</a>
|
||||
<p>Sorry Brian, working on the BodyREP pitch tonight.</p>
|
||||
<div class="like-comment-time">
|
||||
<i class="icon-thumbs-up"></i>
|
||||
<i class="icon-comment"></i>
|
||||
<span>April 3 at 2:05pm</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="user-sub-comment">
|
||||
<div class='sub-avatar user1'></div>
|
||||
<a>Brian Goff</a>
|
||||
<p>No worries "mate", maybe next time.</p>
|
||||
<div class="like-comment-time">
|
||||
<i class="icon-thumbs-up"></i>
|
||||
<i class="icon-comment"></i>
|
||||
<span>April 3 at 2:07pm</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="span4">
|
||||
<div class="hero-unit">
|
||||
<h1>Hello, world!</h1>
|
||||
<p>This is a template for a simple marketing or informational website. It includes a large callout called the hero unit and three supporting pieces of content. Use it as a starting point to create something more unique.</p>
|
||||
<p><a class="btn btn-primary btn-large">Learn more »</a></p>
|
||||
</div>
|
||||
<div class="row-fluid">
|
||||
<div class="span4">
|
||||
<h2>Heading</h2>
|
||||
<p>Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui. </p>
|
||||
<p><a class="btn" href="#">View details »</a></p>
|
||||
</div><!--/span-->
|
||||
<div class="span4">
|
||||
<h2>Heading</h2>
|
||||
<p>Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui. </p>
|
||||
<p><a class="btn" href="#">View details »</a></p>
|
||||
</div><!--/span-->
|
||||
<div class="span4">
|
||||
<h2>Heading</h2>
|
||||
<p>Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui. </p>
|
||||
<p><a class="btn" href="#">View details »</a></p>
|
||||
</div><!--/span-->
|
||||
</div><!--/row-->
|
||||
<div class="row-fluid">
|
||||
<div class="span4">
|
||||
<h2>Heading</h2>
|
||||
<p>Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui. </p>
|
||||
<p><a class="btn" href="#">View details »</a></p>
|
||||
</div><!--/span-->
|
||||
<div class="span4">
|
||||
<h2>Heading</h2>
|
||||
<p>Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui. </p>
|
||||
<p><a class="btn" href="#">View details »</a></p>
|
||||
</div><!--/span-->
|
||||
<div class="span4">
|
||||
<h2>Heading</h2>
|
||||
<p>Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui. </p>
|
||||
<p><a class="btn" href="#">View details »</a></p>
|
||||
</div><!--/span-->
|
||||
</div><!--/row-->
|
||||
</div><!--/span-->
|
||||
</div><!--/row-->
|
||||
{% endblock %}
|
||||
15
symfony/src/BodyRep/Resources/views/Member/search.html.twig
Normal file
15
symfony/src/BodyRep/Resources/views/Member/search.html.twig
Normal file
@@ -0,0 +1,15 @@
|
||||
|
||||
|
||||
{% block content %}
|
||||
|
||||
<h1>Search Results</h1>
|
||||
{% for result in search %}
|
||||
<li>
|
||||
<a href="{{ result.getLink() }}">
|
||||
{{ result.getFullName() }}
|
||||
</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
|
||||
{% endblock %}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
{% for comment in comments %}
|
||||
<div class="user-sub-comment">
|
||||
<div class='sub-avatar user1'></div>
|
||||
<a>{{ comment.author }}</a>
|
||||
<p>{{ comment.text }} </p>
|
||||
<div class="like-comment-time">
|
||||
{{ comment.thumbs }}
|
||||
<i class="icon-comment"></i>
|
||||
<span>{{ comment.dateHuman }} </span>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
319
symfony/src/BodyRep/Resources/views/Profile/index.html.twig
Normal file
319
symfony/src/BodyRep/Resources/views/Profile/index.html.twig
Normal file
@@ -0,0 +1,319 @@
|
||||
{% extends 'BodyRep::layout.html.twig' %}
|
||||
|
||||
{% block title %}BodyRep{% endblock %}
|
||||
{% block documentReady %}
|
||||
$('#rep').live('click', function() {
|
||||
$.get('{{ path("_profile_reputation", { 'username': app.request.get('username') }) }}', {}, function (data) {
|
||||
$('#mcnt').html(data);
|
||||
});
|
||||
});
|
||||
{% endblock %}
|
||||
|
||||
{% block content_header '' %}
|
||||
|
||||
{% block content %}
|
||||
{% include 'BodyRep:Auth:navbar.html.twig' %}
|
||||
|
||||
<div class="row-fluid">
|
||||
<div class="span2">
|
||||
<div class="well sidebar-nav">
|
||||
<ul class="nav nav-list">
|
||||
<li class="nav-header">Profile</li>
|
||||
<li class="active"><a href="#">Body Stats</a></li>
|
||||
<li><a href="#" id='rep'>Body Reputation</a></li>
|
||||
<li><a href="#">Challenges</a></li>
|
||||
<li class="nav-header">Workouts</li>
|
||||
<li class="nav-header">Meals</li>
|
||||
<li class="nav-header">Community</li>
|
||||
<li class="nav-header">Learning</li>
|
||||
<li class="nav-header">Apps</li>
|
||||
<li class="nav-header">Shopping</li>
|
||||
</ul>
|
||||
</div><!--/.well -->
|
||||
</div><!--/span-->
|
||||
<div class="span6" id='mcnt'>
|
||||
<div class="row-fluid">
|
||||
<h2 class="pull-left">{{ sFullName }}</h2>
|
||||
</div>
|
||||
<div class="row-fluid" style='font-size : 12px;'>
|
||||
<i class="icon-signal"></i><span> Weight: 100kg ( <div class='arrowup'></div> 0)</span>
|
||||
<span>Bodyfat: 20% ( <div class='arrowup'></div> 2)</span>
|
||||
<span>Measurements: 400cm ( <div class='arrowup'></div> 15)</span>
|
||||
</div>
|
||||
<div class="row-fluid" style='font-size : 12px;'>
|
||||
<i class="icon-home"></i><span> Lives in </span><a>Calgary, Alberta</a>
|
||||
<i class="icon-signal"></i><span> Trains at </span><a>Talisman Center,Fitness First</a>
|
||||
<i class="icon-signal"></i><span> Hobbies: </span><a>Skiing,</a><span> and </span><a>(5) other</a><span> ...</span>
|
||||
<i class="icon-signal"></i><span> Professionals: </span><a>Heath Spence</a><span>,</span><a>Steve Baudo</a><a> see more...</a>
|
||||
</div>
|
||||
<hr />
|
||||
<div class="row-fluid">
|
||||
<h5 class="pull-left">Filters:</h5>
|
||||
<div class="pull-left">
|
||||
<div class="block_type_small redbg redbd pull-left">
|
||||
<i class="icon-user icon-white"></i>
|
||||
</div>
|
||||
<div class="block_type_small bluebg bluebd pull-left">
|
||||
<i class="icon-wrench icon-white"></i>
|
||||
</div>
|
||||
<div class="block_type_small orangebg orangebd pull-left">
|
||||
<i class="icon-magnet icon-white"></i>
|
||||
</div>
|
||||
<div class="block_type_small tealbg tealbd pull-left">
|
||||
<i class="icon-heart icon-white"></i>
|
||||
</div>
|
||||
<div class="block_type_small purplebg purplebd pull-left">
|
||||
<i class="icon-th icon-white"></i>
|
||||
</div>
|
||||
<div class="block_type_small greenbg greenbd pull-left">
|
||||
<i class="icon-book icon-white"></i>
|
||||
</div>
|
||||
<div class="block_type_small graybg graybd pull-left">
|
||||
<i class="icon-file icon-white"></i>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="stats">
|
||||
<div class="comment_block">
|
||||
<div class="block_types">
|
||||
<div class="block_type redbd">
|
||||
<i class="gicon-magnet"></i>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tnc-blurb">
|
||||
<i class="icon-signal"></i>
|
||||
565
|
||||
</div>
|
||||
<div class="basic-comment">
|
||||
<b>Breakfast:</b><span> 30g Oats, 1x Banana, 5x Egg Whites</span>
|
||||
</div>
|
||||
<div class="like-comment-time">
|
||||
<i class="icon-thumbs-up"></i>
|
||||
<i class="icon-comment"></i>
|
||||
<span>14 minutes ago</span>
|
||||
</div>
|
||||
<div class="user-sub-comment">
|
||||
<div class='sub-avatar user1'></div>
|
||||
<a>Brian Goff</a>
|
||||
<p>Good to see you're keeping up the good work mate. Keep us posted ;)</p>
|
||||
<div class="like-comment-time">
|
||||
<i class="icon-thumbs-up"></i>
|
||||
<i class="icon-comment"></i>
|
||||
<span>April 3 at 2:05pm</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="user-sub-comment">
|
||||
<div class='sub-avatar user2'></div>
|
||||
<a>Alex Zborowski</a>
|
||||
<p>Well it's not easy but you do your best every day and you judge every action.</p>
|
||||
<div class="like-comment-time">
|
||||
<i class="icon-thumbs-up"></i>
|
||||
<i class="icon-comment"></i>
|
||||
<span>April 3 at 2:05pm</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="stats">
|
||||
<div class="comment_block">
|
||||
<div class="block_types">
|
||||
<div class="block_type greenbd">
|
||||
<i class="gicon-search"></i>
|
||||
</div>
|
||||
<div class="block_type orangebd">
|
||||
<i class="gicon-screen"></i>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tnc-blurb">
|
||||
<i class="icon-time"></i>
|
||||
45
|
||||
<i class="icon-signal"></i>
|
||||
900
|
||||
</div>
|
||||
<div class="basic-comment">
|
||||
Workout at <a>Talisman Center</a> with <a>Brian Goff</a>
|
||||
</div>
|
||||
<div class="like-comment-time">
|
||||
<i class="icon-thumbs-up"></i>
|
||||
<i class="icon-comment"></i>
|
||||
<span>37 minutes ago</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="stats">
|
||||
<div class="comment_block">
|
||||
<div class="block_types">
|
||||
<div class="block_type greenbd">
|
||||
<i class="gicon-search"></i>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tnc-blurb">
|
||||
<i class="icon-time"></i>
|
||||
90
|
||||
<i class="icon-signal"></i>
|
||||
720
|
||||
</div>
|
||||
<div class="basic-comment">
|
||||
Workout at <a>Talisman Center</a>
|
||||
</div>
|
||||
<div class="like-comment-time">
|
||||
<i class="icon-thumbs-up"></i>
|
||||
<i class="icon-comment"></i>
|
||||
<span>April 4 at 7:00pm</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="stats">
|
||||
<div class="comment_block">
|
||||
<div class="block_types">
|
||||
<div class="block_type bluebd">
|
||||
<i class="gicon-profile"></i>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tnc-blurb">
|
||||
</div>
|
||||
<div class="basic-comment">
|
||||
You commented on <a>Brian Goff's workout</a>
|
||||
</div>
|
||||
<div class="like-comment-time">
|
||||
<i class="icon-thumbs-up"></i>
|
||||
<i class="icon-comment"></i>
|
||||
<span>April 4 at 6:30pm</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="stats">
|
||||
<div class="comment_block">
|
||||
<div class="block_types">
|
||||
<div class="block_type purplebd">
|
||||
<i class="gicon-profile"></i>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tnc-blurb">
|
||||
</div>
|
||||
<div class="basic-comment">
|
||||
Your read <a>"Fatigue Recovery & Supercompensation Theory"</a>
|
||||
</div>
|
||||
<div class="like-comment-time">
|
||||
<i class="icon-thumbs-up"></i>
|
||||
<i class="icon-comment"></i>
|
||||
<span>April 2 at 8:00am</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="stats">
|
||||
<div class="comment_block">
|
||||
<div class="block_types">
|
||||
<div class="block_type greenbd">
|
||||
<i class="gicon-search"></i>
|
||||
</div>
|
||||
<div class="block_type orangebd">
|
||||
<i class="gicon-screen"></i>
|
||||
</div>
|
||||
<div class="block_type tealbd">
|
||||
<i class="gicon-line"></i>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tnc-blurb">
|
||||
<i class="icon-time"></i>
|
||||
30
|
||||
<i class="icon-signal"></i>
|
||||
450
|
||||
</div>
|
||||
<div class="basic-comment">
|
||||
<a>Workout</a> using <a>Runtracker</a> with <a>Brian Goff</a>
|
||||
</div>
|
||||
<div class="like-comment-time">
|
||||
<i class="icon-thumbs-up"></i>
|
||||
<i class="icon-comment"></i>
|
||||
<span>April 2 at 6:00am</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="stats">
|
||||
<div class="comment_block">
|
||||
<div class="block_types">
|
||||
<div class="block_type orangebd">
|
||||
<i class="gicon-screen"></i>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="user-comment">
|
||||
<div class='avatar user1'></div>
|
||||
<a>Brian Goff</a>
|
||||
<p>Hey "mate"! Want to train at the <a>Talisman</a> again tonight?</p>
|
||||
</div>
|
||||
<div class="like-comment-time">
|
||||
<i class="icon-thumbs-up"></i>
|
||||
<i class="icon-comment"></i>
|
||||
<span>April 3 at 2:00pm</span>
|
||||
</div>
|
||||
|
||||
<div class="user-sub-comment">
|
||||
<div class='sub-avatar user2'></div>
|
||||
<a>Alex Zborowski</a>
|
||||
<p>Sorry Brian, working on the BodyREP pitch tonight.</p>
|
||||
<div class="like-comment-time">
|
||||
<i class="icon-thumbs-up"></i>
|
||||
<i class="icon-comment"></i>
|
||||
<span>April 3 at 2:05pm</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="user-sub-comment">
|
||||
<div class='sub-avatar user1'></div>
|
||||
<a>Brian Goff</a>
|
||||
<p>No worries "mate", maybe next time.</p>
|
||||
<div class="like-comment-time">
|
||||
<i class="icon-thumbs-up"></i>
|
||||
<i class="icon-comment"></i>
|
||||
<span>April 3 at 2:07pm</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="span4">
|
||||
<div class="hero-unit">
|
||||
<h1>Hello, world!</h1>
|
||||
<p>This is a template for a simple marketing or informational website. It includes a large callout called the hero unit and three supporting pieces of content. Use it as a starting point to create something more unique.</p>
|
||||
<p><a class="btn btn-primary btn-large">Learn more »</a></p>
|
||||
</div>
|
||||
<div class="row-fluid">
|
||||
<div class="span4">
|
||||
<h2>Heading</h2>
|
||||
<p>Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui. </p>
|
||||
<p><a class="btn" href="#">View details »</a></p>
|
||||
</div><!--/span-->
|
||||
<div class="span4">
|
||||
<h2>Heading</h2>
|
||||
<p>Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui. </p>
|
||||
<p><a class="btn" href="#">View details »</a></p>
|
||||
</div><!--/span-->
|
||||
<div class="span4">
|
||||
<h2>Heading</h2>
|
||||
<p>Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui. </p>
|
||||
<p><a class="btn" href="#">View details »</a></p>
|
||||
</div><!--/span-->
|
||||
</div><!--/row-->
|
||||
<div class="row-fluid">
|
||||
<div class="span4">
|
||||
<h2>Heading</h2>
|
||||
<p>Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui. </p>
|
||||
<p><a class="btn" href="#">View details »</a></p>
|
||||
</div><!--/span-->
|
||||
<div class="span4">
|
||||
<h2>Heading</h2>
|
||||
<p>Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui. </p>
|
||||
<p><a class="btn" href="#">View details »</a></p>
|
||||
</div><!--/span-->
|
||||
<div class="span4">
|
||||
<h2>Heading</h2>
|
||||
<p>Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui. </p>
|
||||
<p><a class="btn" href="#">View details »</a></p>
|
||||
</div><!--/span-->
|
||||
</div><!--/row-->
|
||||
</div><!--/span-->
|
||||
</div><!--/row-->
|
||||
{% endblock %}
|
||||
@@ -0,0 +1,10 @@
|
||||
{% block js %}
|
||||
{% endblock %}
|
||||
|
||||
{% block content_header '' %}
|
||||
|
||||
{% block content %}
|
||||
<div class="row-fluid">
|
||||
Reputation page
|
||||
</div>
|
||||
{% endblock %}
|
||||
68
symfony/src/BodyRep/Resources/views/layout.html.twig
Normal file
68
symfony/src/BodyRep/Resources/views/layout.html.twig
Normal file
@@ -0,0 +1,68 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta name="description" content="">
|
||||
<meta name="author" content="">
|
||||
|
||||
<title>{% block title %}BodyRep{% endblock %}</title>
|
||||
<link rel="stylesheet" href="{{ asset('css/bootstrap.css') }}" media="all" />
|
||||
<style type="text/css">
|
||||
body {
|
||||
padding-top: 60px;
|
||||
padding-bottom: 40px;
|
||||
}
|
||||
.sidebar-nav {
|
||||
padding: 9px 0;
|
||||
}
|
||||
</style>
|
||||
<link rel="stylesheet" href="{{ asset('css/bootstrap-responsive.css') }}" />
|
||||
<link rel="stylesheet" href="{{ asset('css/site.css') }}" />
|
||||
<link rel="stylesheet" href="{{ asset('css/chosen.css') }}" />
|
||||
{% block javascripts %}
|
||||
<script type="text/javascript" src="{{ asset('js/LAB.js') }}"></script>
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
var loadb;
|
||||
$LAB.script('https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js')
|
||||
.script('//ajax.googleapis.com/ajax/libs/jqueryui/1.8.23/jquery-ui.min.js')
|
||||
.script("{{ asset('js/application.js') }}")
|
||||
.script("{{ asset('js/jquery.chosen.min.js') }}")
|
||||
.script("{{ asset('js/bootstrap.js') }}").wait(function() {
|
||||
|
||||
{% block documentReady %}
|
||||
|
||||
{% endblock %}
|
||||
clearTimeout(loadb);
|
||||
$('#loadmast').hide();
|
||||
$('#mast').removeClass('hidden');
|
||||
});
|
||||
|
||||
</script>
|
||||
{% endblock %}
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id='mast' class='hidden'>
|
||||
<div class="container-fluid symfony-content">
|
||||
|
||||
{% block content %}
|
||||
|
||||
|
||||
{% endblock %}
|
||||
|
||||
<hr>
|
||||
|
||||
<footer>
|
||||
<p>© BodyRep 2012</p>
|
||||
</footer>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div id='loadmast'><img align="absmiddle" style="margin-left: 10px; margin-bottom: 3px;" src="/img/progress.gif"> Loading</div>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
47
symfony/src/BodyRep/Tests/Controller/AuthControllerTest.php
Normal file
47
symfony/src/BodyRep/Tests/Controller/AuthControllerTest.php
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
namespace Bodyrep\Tests\Controller;
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpFoundation\File\File;
|
||||
|
||||
class AuthControllerTest extends WebTestCase
|
||||
{
|
||||
public function testIndex()
|
||||
{
|
||||
$client = static::createClient();
|
||||
$client->followRedirects(true);
|
||||
$crawler = $client->request('GET', '/u/login');
|
||||
|
||||
$this->assertTrue($crawler->filter('html:contains("Username")')->count() > 0);
|
||||
}
|
||||
|
||||
public function testLogin()
|
||||
{
|
||||
$client = static::createClient();
|
||||
$client->followRedirects(true);
|
||||
$crawler = $client->request('GET', '/u/login');
|
||||
|
||||
|
||||
$form = $crawler->selectButton('loginbtn')->form();
|
||||
$crawler = $client->submit($form, array(
|
||||
'_username' => 'alexl',
|
||||
'_password' => 'd559ko54'
|
||||
));
|
||||
|
||||
$this->assertTrue($crawler->filter('html:contains("Member")')->count() > 0);
|
||||
}
|
||||
|
||||
public function testLogout()
|
||||
{
|
||||
$client = static::createClient();
|
||||
$client->followRedirects(true);
|
||||
|
||||
$crawler = $client->request('GET', '/u/logout');
|
||||
|
||||
$this->assertTrue($crawler->filter('html:contains("Landing")')->count() > 0);
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace Bodyrep\Tests\Controller;
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
||||
|
||||
class LandingControllerTest extends WebTestCase
|
||||
{
|
||||
public function testIndex()
|
||||
{
|
||||
$client = static::createClient();
|
||||
|
||||
$crawler = $client->request('GET', '/');
|
||||
|
||||
$this->assertTrue($crawler->filter('html:contains("Landing Page")')->count() > 0);
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace Bodyrep\Tests\Controller;
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
class MemberControllerTest extends WebTestCase
|
||||
{
|
||||
private $authcrawler;
|
||||
private $authclient;
|
||||
|
||||
function __construct()
|
||||
{
|
||||
$this->authclient = static::createClient();
|
||||
$this->authclient->followRedirects(true);
|
||||
$this->authcrawler = $this->authclient->request('GET', '/u/login');
|
||||
|
||||
|
||||
$form = $this->authcrawler->selectButton('loginbtn')->form();
|
||||
$this->authcrawler = $this->authclient->submit($form, array(
|
||||
'_username' => 'alexl',
|
||||
'_password' => 'd559ko54'
|
||||
));
|
||||
|
||||
}
|
||||
|
||||
public function testIndex()
|
||||
{
|
||||
$this->assertTrue($this->authcrawler->filter('html:contains("Member landing")')->count() > 0);
|
||||
|
||||
}
|
||||
|
||||
public function testEditProfile()
|
||||
{
|
||||
|
||||
|
||||
$this->authcrawler = $this->authclient->request('GET', '/m/profile');
|
||||
|
||||
$this->assertTrue($this->authcrawler->filter('html:contains("Edit Profile")')->count() > 0);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
namespace Bodyrep\Tests\Controller;
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
class ProfileControllerTest extends WebTestCase
|
||||
{
|
||||
public function testProfile()
|
||||
{
|
||||
$client = static::createClient();
|
||||
$client->followRedirects(true);
|
||||
$crawler = $client->request('GET', '/u/login');
|
||||
|
||||
|
||||
$form = $crawler->selectButton('loginbtn')->form();
|
||||
$crawler = $client->submit($form, array(
|
||||
'_username' => 'alexl',
|
||||
'_password' => 'd559ko54'
|
||||
));
|
||||
|
||||
|
||||
$crawler = $client->request('GET', '/alexl');
|
||||
|
||||
$this->assertTrue($crawler->filter('html:contains("Alex")')->count() > 0);
|
||||
|
||||
}
|
||||
|
||||
public function testEditProfile()
|
||||
{
|
||||
$client = static::createClient();
|
||||
$client->followRedirects(true);
|
||||
$crawler = $client->request('GET', '/u/login');
|
||||
|
||||
|
||||
$form = $crawler->selectButton('loginbtn')->form();
|
||||
$crawler = $client->submit($form, array(
|
||||
'_username' => 'alexl',
|
||||
'_password' => 'd559ko54'
|
||||
));
|
||||
|
||||
|
||||
$crawler = $client->request('GET', '/alexl');
|
||||
|
||||
$this->assertTrue($crawler->filter('html:contains("Alex")')->count() > 0);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
33
symfony/src/BodyRep/Twig/Extension/TemplateExtension.php
Normal file
33
symfony/src/BodyRep/Twig/Extension/TemplateExtension.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace BodyRep\Twig\Extension;
|
||||
|
||||
use Symfony\Component\HttpKernel\KernelInterface;
|
||||
use Symfony\Bundle\TwigBundle\Loader\FilesystemLoader;
|
||||
use CG\Core\ClassUtils;
|
||||
|
||||
class TemplateExtension extends \Twig_Extension
|
||||
{
|
||||
protected $loader;
|
||||
protected $controller;
|
||||
|
||||
public function __construct(FilesystemLoader $loader)
|
||||
{
|
||||
$this->loader = $loader;
|
||||
}
|
||||
|
||||
public function setController($controller)
|
||||
{
|
||||
$this->controller = $controller;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the name of the extension.
|
||||
*
|
||||
* @return string The extension name
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return 'demo';
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user