Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <ul class="nav nav-tabs" id="myTabs">
- <li class="active"><a href="#profile" data-url="/Shawili/<?= $profile['username'] ?>/profile/">Profile</a></li>
- <li><a href="#about" data-url="/Shawili/<?= $profile['username'] ?>/about/">About</a></li>
- <li><a href="#wishlist" data-url="/Shawili/<?= $profile['username'] ?>/wishlists/">Wishlists <span class="badge"><?= $profile['wishlists'] ?></span></a></li>
- <li><a href="#following" data-url="">Following <span class="badge"><?= $profile['following'] ?></span></a></li>
- <li><a href="#followers" data-url="">Followers <span class="badge"><?= $profile['followers'] ?></span></a></li>
- </ul>
- <!-- Tab panes -->
- <div class="tab-content">
- <div class="tab-pane active" id="profile">Profile</div>
- <div class="tab-pane" id="about">about</div>
- <div class="tab-pane" id="wishlist">wl</div>
- <div class="tab-pane" id="following">following</div>
- <div class="tab-pane" id="followers">followers</div>
- </div>
- <?php
- if($owner)
- { ?>
- <div class="row">
- <div class="col-md-10 col-md-offset-1">
- <form class="form-horizontal" role="form" method="post">
- <fieldset><legend>Add a wishlist</legend>
- <?php echo $form; ?>
- <div class="form-group">
- <div class="col-sm-offset-2 col-sm-10">
- <button type="submit" class="btn btn-default" name="addwishlist">Add</button>
- </div>
- </div>
- </fieldset>
- </form>
- </div>
- </div>
- <hr />
- <?php
- }
- ?>
- <div class="row">
- <?php
- foreach($wishlists as $wishlist)
- { //Here we display whislists } ?>
- $manager = $this->managers->getManagerOf('Wishlist');
- /**
- * Adding a new wishlist
- */
- if($owner)
- {
- //Creating object. Depends on form validation
- if ($request->postExists('addwishlist'))
- {
- $wishlist = new LibEntitiesWishlist(array(
- 'title' => $request->postData('title'),
- 'comment' => $request->postData('comment'),
- 'user' => $this->app->user()->getUser(),
- ));
- }
- else
- {
- $wishlist = new LibEntitiesWishlist;
- }
- //generating form
- $formBuilder = new LibFormsWishlistForm($wishlist);
- $formBuilder->build();
- $form = $formBuilder->form();
- $formHandler = new LibFormHandler($form, $manager, $request);
- //if form has been validate : add the wishlist and set flash
- if ($formHandler->process('add'))
- {
- $this->app->user()->setFlash('Your wish list has been created !');
- $this->app->httpResponse()->redirect('/Shawili/'.$request->getData('user').'/wishlists/');
- }
- $this->page->addVar('form', $form->createView());
- }
- /**
- * Displaying user's wishlists
- */
- $wishlists = $manager->getWishlists($request->getData('user'), $this->app->user()->getUser());
- $this->page->addVar('wishlists', $wishlists);
- $this->page->addVar('owner', $owner);
- $this->page->addVar('profile', $request->getData('user'));
- $this->page->addVar('cuser', $this->managers->getManagerOf('User')->getUser($this->app->user()->getUser()));
- <script type='text/javascript'>
- $('#myTabs a').click(function (e) {
- e.preventDefault();
- var url = $(this).attr("data-url");
- var href = this.hash;
- var pane = $(this);
- // ajax load from data-url
- $(href).load(url,function(result){
- pane.tab('show');
- });
- });
- // load first tab content
- $('#profile').load($('.active a').attr("data-url"),function(result){
- $('.active a').tab('show');
- });
- </script>
- $("#submit_button_id").click(function(){
- var formdata = $("#form_id").serializeArray();
- $.ajax({
- url: "/submit_url",
- data: formdata,
- success: function(RESPONSE){
- //Your code to modify page content after geting RESPONSE.
- }
- })
- return false; //To prevent page from reloading
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement