示例#1
0
 public function actionNew($type)
 {
     $model = new Razz();
     $model->scenario = 'create';
     if ($type == 'any') {
         $model->type = $model::ANYONE;
     }
     if ($type == 'some') {
         $model->type = $model::SOMEONE;
     }
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         if ($model->type == 1 && !$model->fb_friend) {
             $this->redirect(['/razz/vote-on-challenges', 't' => 'some']);
         }
         if ($model->fb_friend) {
             $Razz = Yii::$app->request->post('Razz', null);
             if ($Razz['fileName'] != "") {
                 $linkToImg = \common\helpers\Ziggeo::getPreview($Razz['fileName']);
             } else {
                 $linkToImg = $model->preview;
             }
             $twitter = new \common\helpers\Twitter();
             $userModel = new \frontend\models\User();
             $userName = ucfirst($userModel->getFullname(Yii::$app->user->id));
             $recipientNick = $model->screen_name;
             $linkToRazzd = Url::base(true) . "/razz/respond/" . $model->id;
             $text = "@{$recipientNick} You have been Razzd by {$userName}: '{$model->title}' {$linkToRazzd}";
             $r = $twitter->tweet($text, ['image' => $linkToImg]);
             if ($twitter->hasErrors()) {
                 // Error
             } else {
                 if (isset($r['id'])) {
                     // Success
                 }
             }
             $this->redirect(['/razz/vote-on-challenges', 't' => 'some']);
             /*
              * Facebook
             $client = Yii::$app->authClientCollection->getClient('facebook');
             $host = 'http://' . $_SERVER['HTTP_HOST'];
             $this->redirect('http://www.facebook.com/dialog/send?app_id=' . $client->clientId . '&to=' . $model->fb_friend . '&link=' . $host . '/razz/respond?hash=' . $model->hash . '&redirect_uri=' . $host . '/razz/vote-on-challenges?t=some');
             */
         }
         if ($model->type == 2) {
             $this->redirect(['/razz/vote-on-challenges', 't' => 'any']);
         }
     } else {
         //print_r($model->getErrors());
         //exit();
     }
     return $this->render('new', ['model' => $model]);
 }
示例#2
0
文件: item.php 项目: babagay/razzd
">
            <div class="visual-sections">
                <div class="visual-section">
                    <div class="title-visual-sections razee-title clearfix">
                        <span class="pos-left"><?php 
        echo Html::encode($obj['title']);
        ?>
</span>
                        <span  class="pos-right">By: <?php 
        echo Html::a($obj['name1'], ['/user/profile/show', 'id' => $obj['uid']]);
        ?>
</span>
                    </div> <!--.title-visual-sections -->
                    <div class="visual-person">
                        <?php 
        echo ZiggeoHelper::getImage($obj['id'], $obj['stream'], $obj['stream_preview'], false, "");
        ?>
                    </div>
                    <div class="info-person text-center">
                    <?php 
        $respondLink = "<a href=\"/razz/respond/" . $obj['id'] . "\" class=\"icon icon-right icon-big icon-info-person\">RESPOND</a>";
        if (isset($nonLinkable)) {
            if ($nonLinkable === true) {
                $respondLink = "";
            }
        }
        if (!$obj['responder_uid'] || isset($profile) && $obj['responder_uid'] == $profile->id) {
            echo $respondLink;
        }
        ?>
                    </div><!-- info-person  -->
示例#3
0
文件: view.php 项目: babagay/razzd
    }
    ?>
                            </ul>
                            <span class="title"><?php 
    echo Html::a($object['name1'] . ' <span class="r1">(' . $object['my_votes'] . ')</span>', ['/user/profile/show', 'id' => $object['uid']]);
    ?>
</span>

                        </div>
                        <!-- info-person  -->
                    </div>
                    <!-- visual-section  -->
                    <div class="visual-section">
                        <div class="visual-person">
                            <?php 
    echo ZiggeoHelper::getImage($object['id'], $object['responder_stream'], $object['responder_stream_preview'], true, "video-preview", true);
    ?>
                        </div>
                        <div class="info-person" id="r2">
                            <ul class="vote-info">
                                <li><span class="vote-info-txt <?php 
    if ($object['my_votes'] == $object['responder_votes']) {
        if ($object['my_votes'] == 0) {
            echo "empty";
        }
    }
    ?>
">
                                        <?php 
    if ($object['my_votes'] < $object['responder_votes']) {
        echo 'WINNING :)';