Beispiel #1
0
        <?php 
echo RForm::label("Region", 'region');
echo RForm::input(array('id' => 'region', 'name' => 'region', 'class' => 'form-control', 'value' => $user->region, 'placeholder' => "region"));
echo RForm::label("Mobile", 'mobile');
echo RForm::input(array('id' => 'mobile', 'name' => 'mobile', 'class' => 'form-control', 'value' => $user->mobile, 'placeholder' => "Mobile"));
echo RForm::label("QQ", 'qq');
echo RForm::input(array('id' => 'qq', 'name' => 'qq', 'class' => 'form-control', 'value' => $user->qq, 'placeholder' => "QQ"));
echo RForm::label("Weibo", 'weibo');
echo RForm::input(array('id' => 'weibo', 'name' => 'weibo', 'class' => 'form-control', 'value' => $user->weibo, 'placeholder' => "Weibo"));
echo RForm::label("Homepage", 'homepage');
echo RForm::input(array('id' => 'homepage', 'name' => 'homepage', 'class' => 'form-control', 'value' => $user->homepage, 'placeholder' => "Homepage"));
echo RForm::label("Introduction", 'intro');
echo RForm::input(array('id' => 'intro', 'name' => 'intro', 'class' => 'form-control', 'value' => $user->intro, 'placeholder' => "your introduction"));
echo RForm::label("Picture");
echo '<br/>';
if ($user->picture) {
    $picture = RImage::styleSrc($user->picture, User::getPicOptions());
    echo RHtml::image($picture, $user->name, array("width" => '120px', 'class' => 'img-thumbnail'));
}
echo '<br/><br/>';
echo RForm::input(array('type' => 'file', 'name' => 'user_picture', 'accept' => 'image/gif, image/jpeg,image/png'));
echo "<br/>";
echo RForm::input(array('type' => 'submit', 'value' => 'Complete', 'class' => "btn btn-lg btn-primary"));
echo RForm::endForm();
?>
    </div>
</div>


Beispiel #2
0
    <?php 
foreach ($commentTree as $commentItem) {
    ?>
        <div id="comment-item-<?php 
    echo $commentItem['root']->id;
    ?>
" class="row comment-item">

            <!-- user picture -->
            <div class="col-lg-2 user-picture">
                <?php 
    $picture = $commentItem['root']->user->picture;
    if (!isset($picture) || $picture == '') {
        $picture = User::$defaults['picture'];
    }
    $src = RImage::styleSrc($picture, User::getPicOptions());
    ?>
                <?php 
    echo RHtml::image($src, $commentItem['root']->user->name, array('width' => '64px;'));
    ?>
            </div>

            <!-- comment content -->
            <div class="col-lg-10 comment-content">

                <div class="comment-meta">
                    <?php 
    echo RHtml::linkAction('user', $commentItem['root']->user->name, 'view', $commentItem['root']->user->id);
    ?>
                    &nbsp;&nbsp;
                    <?php 
            <p>No groups</p>
        <?php 
}
?>
        <ul>
        <?php 
foreach ($groups as $group) {
    ?>
                <li>
                    <div class="popular-group-picture">
                        <a href="<?php 
    echo RHtml::siteUrl('group/detail/' . $group->id);
    ?>
">
                            <?php 
    echo RHtml::image(RImage::styleSrc($group->picture ?: Group::$defaults['picture'], Group::getPicOptions()), $group->name);
    ?>
                        </a>
                    </div>
                    <div class="popular-group-title">
                        <a href="<?php 
    echo RHtml::siteUrl('group/detail/' . $group->id);
    ?>
">
                            <?php 
    echo $group->name;
    ?>
                        </a>
                    </div>
                    <div class="popular-group-cat">
                        <a href="<?php 
Beispiel #4
0
 */
if (!empty($topics)) {
    ?>
<div class="posts-list">
    <?php 
    $currentUserId = Rays::isLogin() ? Rays::user()->id : 0;
    foreach ($topics as $topic) {
        ?>
        <div class="row topic-item">
            <!-- User picture -->
            <div class="col-lg-2 topic-picture">
                <?php 
        if ($topic->user->picture == '') {
            $topic->user->picture = User::$defaults['picture'];
        }
        $thumbnail = RImage::styleSrc($topic->user->picture, User::getPicOptions());
        ?>
                <a href="<?php 
        echo RHtml::siteUrl("user/view/" . $topic->user->id);
        ?>
" title="<?php 
        echo $topic->user->name;
        ?>
">
                    <?php 
        echo RHtml::image($thumbnail, $topic->user->name, array('width' => '64px'));
        ?>
                </a>

            </div>
Beispiel #5
0
            </thead>
            <tbody>
            <?php 
// That's bad to load user names and category names for each group
// Need to be fixed. It's better to add "join" support in the database models
foreach ($groups as $group) {
    echo '<tr>';
    echo '<td><input name="checked_groups[]" type="checkbox" value="' . $group->id . '" /></td>';
    echo "<td>{$group->id}</td>";
    echo '<td>' . RHtml::linkAction('user', $group->groupCreator->name, 'view', $group->groupCreator->id) . '</td>';
    echo '<td>' . RHtml::linkAction('category', $group->category->name, 'groups', $group->category->id) . '</td>';
    echo '<td>' . RHtml::linkAction('group', $group->name, 'detail', $group->id) . '</td>';
    echo "<td>{$group->memberCount}</td>";
    echo "<td>{$group->createdTime}</td>";
    if (isset($group->picture) && $group->picture != '') {
        $picture = RImage::styleSrc($group->picture, Group::getPicOptions());
        echo '<td>' . RHtml::image($picture, $group->name, array("style" => 'width:64px;')) . '</td>';
    } else {
        echo '<td></td>';
    }
    echo $group->counter->totalCount != null ? "<td>" . $group->counter->totalCount . "</td>" : '<td>0</td>';
    echo $group->rating->value != null ? "<td>" . $group->rating->value . "</td>" : '<td>0</td>';
    echo '</tr>';
}
?>
            </tbody>
        </table>

        <?php 
echo isset($pager) ? $pager : '';
?>
Beispiel #6
0
                    <?php 
// not login
if (!isset($user)) {
    echo "<li>" . RHtml::linkAction("user", "Login", "login", null) . "</li>";
    echo "<li>" . RHtml::linkAction("user", "Register", "register", null) . "</li>";
} else {
    $countMessages = Rays::user()->countUnreadMsgs();
    if ($isAdmin) {
        echo '<li>' . RHtml::linkAction('admin', 'Admin', null, null, array('style' => 'font-weight: bold;')) . "</li>";
    }
    ?>
                        <li class="dropdown">
                            <a href="#" id="account-dropdown" class="dropdown-toggle" data-toggle="dropdown" >
                                <?php 
    $pic = isset($user->picture) && $user->picture != '' ? $user->picture : "public/images/default_pic.png";
    $pic = RImage::styleSrc($pic, User::getPicOptions());
    ?>
                                <?php 
    echo RHtml::image($pic, $user->name, array('class' => 'img-thumbnails'));
    ?>
                                <span class="username"><?php 
    echo $user->name;
    ?>
</span>
                                <?php 
    if ($countMessages != 0) {
        ?>
                                <span class="badge"><?php 
        echo $countMessages;
        ?>
</span>
Beispiel #7
0
            <?php 
    echo RHtml::linkAction('group', $group->name, 'detail', $group->id);
    ?>
        </div>

        <!-- Group picture -->
        <?php 
    if ($group->picture) {
        ?>
            <div class="group-picture">
                <a href="<?php 
        echo RHtml::siteUrl('group/detail/' . $group->id);
        ?>
">
                    <?php 
        echo RHtml::image(RImage::styleSrc($group->picture, Group::getPicOptions()), $group->name);
        ?>
                </a>
            </div>
        <?php 
    }
    ?>

        <!-- Group intro -->
        <div class="item-body">
            <?php 
    $group->intro = strip_tags(RHtml::decode($group->intro));
    if (mb_strlen($group->intro) > 100) {
        echo '<p>' . preg_replace('/&.{0,5}\\.\\.\\.$/', '...', mb_substr($group->intro, 0, rand(60, 150), 'UTF-8') . '...') . '</p>';
    } else {
        echo '<p>' . $group->intro . '</p>';
Beispiel #8
0
            My Friends (<?php 
echo $friNumber;
?>
)
        </h1>
    </div>
    <div class="panel-body">
        <div class="user-list">
        <?php 
if (empty($friends)) {
    echo '<div>&nbsp;&nbsp;You don\'t have any friends yet!</div>';
}
foreach ($friends as $friend) {
    echo '<div class="user-item col-lg-2">';
    $friend->picture = $friend->picture != '' ? $friend->picture : User::$defaults['picture'];
    $picture = RImage::styleSrc($friend->picture, User::getPicOptions());
    echo '<a href="' . RHtml::siteUrl('user/view/' . $friend->id) . '">' . RHtml::image($picture, $friend->name, array("width" => "64px", "height" => "64px")) . '</a>';
    echo '<br/>';
    $name = $friend->name;
    if (mb_strlen($name) > 7) {
        $name = mb_substr($name, 0, 8) . "..";
    }
    echo RHtml::linkAction('user', $name, 'view', $friend->id, array('title' => $friend->name)) . "  ";
    echo '</div>';
}
?>
        </div>
        <div class="clearfix"></div>
        <div>
            <?php 
echo isset($pager) ? $pager : "";
Beispiel #9
0
            break;
        case "weibo":
            echo "Webo: " . RHtml::link($user->name, $user->weibo, $user->weibo) . "<br/>";
            break;
        case "homepage":
            echo "Homepage: " . RHtml::link($user->name, $user->homepage, $user->homepage) . "<br/>";
            break;
        default:
            echo ucfirst($objCol) . ": " . $user->{$objCol} . "<br/>";
            break;
    }
    echo '</li>';
}
$wallet = $user->getWallet();
echo '<li class="list-group-item">Wallet: ' . $wallet->money . ' ' . Wallet::COIN_NAME . '</li>';
?>
            </ul>
        </div>

        <div class="col-lg-4">
            <div style="margin-top: 30px;">
                <?php 
$pic = isset($user->picture) && $user->picture != '' ? $user->picture : "public/images/default_pic.png";
$thumbnail = RImage::styleSrc($user->picture, $user::getPicOptions());
echo RHtml::image($thumbnail, $user->name, array('class' => 'img-thumbnail', 'width' => '200px'));
?>
            </div>
        </div>
    </div>
</div>
Beispiel #10
0
 /**
  * Change user info action
  * @param null $userId
  */
 public function actionEdit($userId = null)
 {
     $userId = null === $userId ? Rays::user()->id : $userId;
     $user = User::get($userId);
     RAssert::not_null($user);
     if (Rays::user()->roleId != Role::ADMINISTRATOR_ID && Rays::user()->id != $userId) {
         $this->flash("error", "You don't have the right to change the user information!");
         $this->redirectAction('user', 'view', $userId);
     }
     $data = array('user' => $user);
     if (Rays::isPost()) {
         $config = array(array('field' => 'username', 'label' => 'User name', 'rules' => 'trim|required|min_length[5]|max_length[20]'));
         // if set password, then go changing password
         if (isset($_POST['password']) && $_POST['password'] != '') {
             array_push($config, array('field' => 'password', 'label' => 'New Password', 'rules' => 'trim|required|min_length[6]|max_length[20]'));
             array_push($config, array('field' => 'password-confirm', 'label' => 'New Password Confirm', 'rules' => 'trim|required|min_length[6]|max_length[20]|equals[password]'));
         }
         $validation = new RValidation($config);
         if ($validation->run()) {
             if (isset($_POST['password']) && $_POST['password'] != '') {
                 // set new password
                 $user->password = md5($_POST['password']);
             }
             $user->name = $_POST['username'];
             foreach (User::$mapping as $objCol => $dbCol) {
                 if (in_array($objCol, ["password", "email", "id", "roleId", "credit", "private"])) {
                     continue;
                 }
                 if (isset($_POST[$objCol])) {
                     $user->{$objCol} = $_POST[$objCol];
                 }
             }
             $user->save();
             $this->flash("message", "Update information successfully.");
             // if picture selected
             if (isset($_FILES['user_picture']) && $_FILES['user_picture']['name'] != '') {
                 $pictureName = "pic_u_" . $user->id . RUpload::get_extension($_FILES['user_picture']['name']);
                 $upload = new RUpload(["file_name" => $pictureName, "upload_path" => Rays::app()->getBaseDir() . "/../" . User::PICTURE_DIR]);
                 $upload->upload('user_picture');
                 if ($upload->error != '') {
                     $this->flash("error", $upload->error);
                 } else {
                     $user->picture = "files/images/users/" . $upload->file_name;
                     $user->save();
                     RImage::updateStyle($user->picture, User::getPicOptions());
                 }
             }
             if (Rays::user()->id == $user->id) {
                 $this->redirectAction("user", "profile");
             } else {
                 $this->redirectAction("user", "view", [$user->id, "profile"]);
             }
         } else {
             $errors = $validation->getErrors();
             $data['validation_errors'] = $errors;
             $data['editForm'] = $_POST;
         }
     }
     $this->layout = 'user';
     $this->setHeaderTitle("Edit profile - " . $user->name);
     $this->render('edit', $data, false);
 }
Beispiel #11
0
if (!empty($posts)) {
    ?>
<div class="posts-list">
    <div id="latest-topics-list">
        <?php 
    $user = Rays::user();
    if ($user->picture == '') {
        $user->picture = User::$defaults['picture'];
    }
    foreach ($posts as $post) {
        ?>
            <div class="row topic-item">
                <div class="col-lg-2 topic-picture">
                    <?php 
        echo RHtml::image(RImage::styleSrc($user->picture, User::getPicOptions()), $user->name, array('width' => '64px'));
        ?>
                </div>
                <div class="col-lg-10 topic-content">
                    <span class="arrow"></span>
                    <div class="inner">
                        <div class="topic-title">
                            <?php 
        echo RHtml::linkAction('post', $post->title, 'view', $post->id);
        ?>
                        </div>
                        <div class="topic-meta">
                            <?php 
        echo RHtml::linkAction('view', $user->name, 'view', $user->id);
        ?>
                            <?php 
Beispiel #12
0
?>
            <b>Members (<?php 
echo count($members);
?>
)</b>
        </div>

        <div class="members-list panel-body">
            <?php 
foreach ($members as $member) {
    ?>
                <div class="members-item" style="float:left;padding: 5px; height: 100px; width: 100px;">
                    <?php 
    $picture = $member->picture ? $member->picture : User::$defaults['picture'];
    echo '<a href="' . RHtml::siteUrl('user/view/' . $member->id) . '">';
    echo RHtml::image(RImage::styleSrc($picture, User::getPicOptions()), $member->name, array('width' => '64px', 'height' => '64px'));
    echo '</a><br/>';
    if ($isManager && $member->id != $manager->id) {
        echo RForm::input(array('type' => 'checkbox', 'value' => $member->id, 'name' => 'selected_members[]'));
        echo '&nbsp;';
    }
    $name = $member->name;
    if (mb_strlen($name) > 7) {
        $name = mb_substr($name, 0, 8) . "..";
    }
    echo RHtml::linkAction('user', $name, 'view', $member->id, array('title' => $member->name));
    ?>
                </div>
            <?php 
}
?>
Beispiel #13
0
 /**
  * Recommend all selected groups to every selected users
  * @param $groups
  * @param $users
  */
 public static function recommendGroups($groups, $users, $words = '')
 {
     foreach ($users as $userId) {
         $html = '<div class="row recommend-groups">';
         $count = 0;
         if (!empty($groups)) {
             foreach ($groups as $groupId) {
                 if ($count % 4 == 0) {
                     if ($count > 0) {
                         $html .= '</div><div class="clearfix" style="margin-top: 15px;"></div>';
                     }
                     $html .= '<div class="row">';
                 }
                 $group = Group::get($groupId);
                 if (null != $group) {
                     $censor = new Censor();
                     $censor = $censor->joinGroupApplication($userId, $group->id);
                     $html .= '<div class="col-lg-3 recommend-group-item" style="padding: 5px;overflow: hidden;">';
                     $picture = isset($group->picture) && $group->picture != '' ? $group->picture : Group::$defaults['picture'];
                     $src = RImage::styleSrc($picture, Group::getPicOptions());
                     $html .= RHtml::image($src, $group->name);
                     $html .= '<br/>' . RHtml::linkAction('group', $group->name, 'detail', $group->id);
                     $html .= '<br/>' . RHtml::linkAction('group', 'Accept', 'accept', $censor->id, array('class' => 'btn btn-xs btn-success'));
                     $html .= '</div>';
                     $count++;
                 }
             }
             $html .= '</div>';
         }
         $html .= '</div>';
         $html .= '<div class="recommend-content">' . RHtml::encode($words) . '</div>';
         Message::sendMessage('system', 0, $userId, 'Groups recommendation', $html, date('Y-m-d H:i:s'));
     }
 }
Beispiel #14
0
$cats = array();
$count = 0;
foreach ($categories as $cat) {
    if ($cat->id == $catId) {
        $index = $count;
    }
    $count++;
    array_push($cats, array('value' => $cat->id, 'text' => $cat->name));
}
echo RForm::select('category', $cats, array($cats[$index]['value']), array('class' => 'form-control'));
echo "<br/>";
echo RForm::label('Group Introduction', 'intro', array());
echo '<br/>';
//echo RForm::textarea(array('class'=>'ckeditor','name'=>'intro','cols'=>'100','rows'=>'15'),
//    isset($group)?RHtml::decode($group->intro):RHtml::decode($form));
$formIntro = isset($form['intro']) ? $form['intro'] : '';
$self->module('ckeditor', array('editorId' => 'intro', 'name' => 'intro', 'data' => isset($group) ? $group->intro : $formIntro));
echo '<br/>';
if (isset($group)) {
    $picture = $group->picture ? $group->picture : Group::$defaults['picture'];
    echo RHtml::image(RImage::styleSrc($picture, Group::getPicOptions()), $group->name, array('class' => 'img-thumbnail', 'width' => '120px'));
}
echo '<br/>';
echo RForm::label('New group picture', 'group_picture');
echo RForm::input(array('type' => 'file', 'name' => 'group_picture', 'accept' => 'image/gif, image/jpeg,image/png'));
echo '<br/>';
echo RForm::input(array('class' => 'btn btn-lg btn-primary', 'type' => 'submit', 'value' => 'Save'));
echo RForm::endForm();
?>
    </div>
</div>