<?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>
*/ 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>
<?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); ?> <?php
<?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>
My Friends (<?php echo $friNumber; ?> ) </h1> </div> <div class="panel-body"> <div class="user-list"> <?php if (empty($friends)) { echo '<div> 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 : "";
/** * 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); }
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
?> <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 ' '; } $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 } ?>