Example #1
0
 function profile()
 {
     $id = $_GET['id'];
     $user = new User();
     $user->id = $id;
     $user->getUsername();
     //show error if user does not exist
     if (!isset($user->username)) {
         header('Location: ' . BASE_PATH . 'error/404');
         die;
     }
     $user->createFromIDFull($id);
     $email = $user->getEmail();
     $user->subscriptions = $user->getSubscriptions();
     if ($this->_user['id']) {
         $current_user = new User();
         $current_user->createFromID($this->_user['id']);
         $current_user->subscriptions = $current_user->getSubscriptions();
         $this->set('isFollowing', $current_user->isFollowing('user', $id));
     } else {
         $this->set('isFollowing', 0);
     }
     $this->set('profile', $user);
     $this->set('email', $email);
     $this->set('login_user', $this->_user['id']);
     $this->set('page_title', "SlideWiki User - " . $user->username);
     $this->set('page_description', $user->description);
     $this->set('page_additional_footer', '<p><a href="user/alldecks/' . $user->id . '">( "' . $user->username . '"  plain decks )</a></p>');
 }
Example #2
0
echo CHtml::encode("{$user->first_name} {$user->last_name}");
?>
" class="meta_image" />
                                </div>
                                
                                <h1><?php 
echo CHtml::encode($user->first_name . ' ' . $user->last_name);
?>
</h1>
                                
                                <div class="pull-right" style="margin-top:-5px;">
                                    <?php 
if (!Yii::app()->user->isGuest) {
    ?>
                                        <?php 
    if (User::isFollowing($user->user_id)) {
        ?>
                                            <a class="btn btn-primary" href="<?php 
        echo $this->createUrl('site/unfollow', array('id' => $user->user_id));
        ?>
"><i class="icon-group"></i> <?php 
        echo Yii::t('yii', 'Unfollow');
        ?>
</a>
                                        <?php 
    } else {
        ?>
                                            <a class="btn btn-success" href="<?php 
        echo $this->createUrl('site/follow', array('id' => $user->user_id));
        ?>
"><i class="icon-group"></i> <?php 
Example #3
0
 function playSync()
 {
     if (isset($_GET['short'])) {
         $u = new Url();
         $link = $u->get_short_url($_GET['short']);
         if (preg_match('/deck\\/(?P<digit>\\d+)/', $link, $matches)) {
             $tmp = $matches[1];
             $deckid = $tmp;
             $deck = new Deck();
             $deck->createFromID($deckid);
         } else {
             die('No deck is determined!');
         }
         if (preg_match('/sid\\/(?P<digit>\\d+)/', $link, $matches)) {
             $tmp = $matches[1];
             $sid = $tmp;
         } else {
             $sid = 0;
         }
         if (preg_match('/style\\/(?P<digit>\\d+)/', $link, $matches)) {
             $tmp = $matches[1];
             $style = $tmp;
         } else {
             $style = $deck->default_theme;
         }
         if (preg_match('/transition\\/(?P<digit>\\d+)/', $link, $matches)) {
             $tmp = $matches[1];
             $transition = $tmp;
         } else {
             $transition = $deck->default_transition;
         }
     } else {
         $deckid = $_GET['deck'];
         $deck = new Deck();
         $deck->createFromID($deckid);
         $sid = isset($_GET['sid']) ? $_GET['sid'] : 0;
         $style = isset($_GET['style']) ? $_GET['style'] : $deck->default_theme;
         $transition = isset($_GET['transition']) ? $_GET['transition'] : $deck->default_transition;
     }
     $this->_template->disableHeader();
     $this->_template->disableFooter();
     //show error if deck does not exist
     if (!isset($deck->deck_id)) {
         header('Location: ' . BASE_PATH . 'error/404');
         die;
     }
     $current_user = new User();
     $current_user->createFromID($this->getCurrentUserID());
     $slides = $deck->getSlidesLite(1);
     $all_slides = array();
     foreach ($slides as $i => $slide) {
         $all_slides[] = "tree-" . $slide->deck->id . "-slide-" . $slide->id . "-" . $slide->position . "-" . $i . "-view";
     }
     $deck->slides = $slides;
     $deck->is_followed_by_current_user = $current_user->isFollowing('deck', $deckid);
     $scaling = isset($_GET['scaling']) ? $_GET['scaling'] : 1;
     $this->set('style', $style);
     $this->set('transition', $transition);
     $this->set('scaling', $scaling);
     $this->set('deckObject', $deck);
     $this->set('sid', $sid);
     $this->set('all_slides', json_encode($all_slides));
 }
Example #4
0
    ?>

            <!-- Show actionables to logged in users who are not the current user -->
            <div class="actionables">
                <?php 
    if (Yii::app()->user->isGuest) {
        ?>
                    <?php 
        echo CHtml::link('Login to follow ' . $user->name, $this->createUrl('site/login'), array('class' => 'btn btn-primary'));
        ?>
                        <br /><br />
                <?php 
    } else {
        ?>
                    <?php 
        if (!User::isFollowing($id)) {
            ?>
                        <?php 
            echo CHtml::link('Follow This User', $this->createUrl('user/follow/', array('id' => $id)), array('class' => 'btn btn-success'));
            ?>
                    <?php 
        } else {
            ?>
                        <?php 
            echo CHtml::link('Stop Following This User', $this->createUrl('user/unfollow/', array('id' => $id)), array('class' => 'btn btn-danger'));
            ?>
                    <?php 
        }
        ?>
                <?php 
    }