Example #1
0
 public function actionAdmin()
 {
     // delete comment request
     if (Rays::isPost()) {
         if (isset($_POST['checked_comments'])) {
             $commentIds = $_POST['checked_comments'];
             foreach ($commentIds as $id) {
                 if (!is_numeric($id)) {
                     return;
                 } else {
                     $comment = new Comment();
                     $comment->id = $id;
                     $comment->delete();
                 }
             }
         }
     }
     $curPage = $this->getPage("page");
     $pageSize = $this->getPageSize('pagesize', 10);
     $count = Comment::find()->count();
     $comments = Comment::find()->join("user")->join("topic")->order_desc("id")->range(($curPage - 1) * $pageSize, $pageSize);
     $pager = new RPager('page', $count, $pageSize, RHtml::siteUrl('comment/admin'), $curPage);
     $this->layout = 'admin';
     $this->setHeaderTitle("Comments administration");
     $data = array('count' => $count, 'comments' => $comments, 'pager' => $pager->showPager());
     $this->render('admin', $data, false);
 }
Example #2
0
 public function delete($assignment = [])
 {
     $table = Rays::app()->getDBPrefix() . GroupUser::$table;
     if (is_numeric($this->groupId) && is_numeric($this->userId)) {
         $sql = "DELETE FROM " . $table . " WHERE {$table}." . GroupUser::$mapping['groupId'] . "={$this->groupId} AND {$table}." . GroupUser::$mapping['userId'] . " = {$this->userId}";
         Data::executeSQL($sql);
     }
 }
Example #3
0
 public function getPageSize($key, $default = BaseController::DEFAULT_PAGE_SIZE)
 {
     $size = Rays::getParam($key, $default);
     if (!is_numeric($size) || $size < 1) {
         $size = DEFAULT_PAGE_SIZE;
     }
     return $size;
 }
Example #4
0
 public static function getConnection()
 {
     if (self::$connection == null) {
         $dbConfig = Rays::app()->getDbConfig();
         self::$connection = mysql_connect($dbConfig['host'], $dbConfig['user'], $dbConfig['password']) or die(mysql_error());
         mysql_select_db($dbConfig['db_name']) or die(mysql_error());
         mysql_query("set names " . $dbConfig['charset']) or die(mysql_error());
     }
     return self::$connection;
 }
Example #5
0
 /**
  * Category administration
  */
 public function actionAdmin()
 {
     $data = array();
     if (Rays::isPost()) {
         if (isset($_POST['sub_items'])) {
             $items = $_POST['sub_items'];
             if (is_array($items)) {
                 foreach ($items as $item) {
                     if (!is_numeric($item)) {
                         return;
                     } else {
                         $cat = Category::get($item);
                         if ($cat->pid == 0) {
                             continue;
                         }
                         $cat->delete();
                     }
                 }
             }
         }
         if (isset($_POST['cat-name']) && isset($_POST['parent-id'])) {
             $name = trim($_POST['cat-name']);
             $pid = $_POST['parent-id'];
             if (is_numeric($pid)) {
                 if ($name == '') {
                     $this->flash('error', 'Category name cannot be blank.');
                 } else {
                     $result = Category::get($pid);
                     if ($result != null) {
                         $newCat = new Category();
                         $newCat->name = RHtml::encode(trim($name));
                         $newCat->pid = $pid;
                         $newCat->save();
                         $this->flash('message', 'Category ' . $name . " was created successfully.");
                     } else {
                         $this->flash('error', 'Parent category not exists.');
                     }
                 }
             }
         }
     }
     $data['categories'] = Category::find()->all();
     $this->layout = 'admin';
     $this->setHeaderTitle('Category administration');
     $this->render('admin', $data, false);
 }
Example #6
0
 public function actionException(Exception $e)
 {
     if (Rays::isAjax()) {
         print $e;
         exit;
     }
     $this->layout = 'error';
     switch ($e->getCode()) {
         case 404:
             $this->render('404', ['message' => $e->getMessage()]);
             Rays::log('Page not found! (' . $e->getMessage() . ')', "warning", "system");
             break;
         default:
             if (Rays::app()->isDebug()) {
                 print $e;
             } else {
                 $this->render("exception", ['code' => $e->getCode(), 'message' => $e->getMessage()]);
             }
     }
     Rays::logger()->flush();
 }
Example #7
0
 public function actionUploadImage()
 {
     $fileTag = 'upload';
     $user = Rays::user();
     if (isset($_FILES[$fileTag])) {
         $path = Rays::app()->getBaseDir() . "/files/userfiles/u_" . $user->id . "/";
         if (!file_exists($path)) {
             mkdir($path);
         }
         $file = $path . $_FILES[$fileTag]['name'];
         $name = $_FILES[$fileTag]['name'];
         $extension = RUpload::get_extension($_FILES[$fileTag]['name']);
         if (file_exists($file)) {
             $count = 0;
             while (true) {
                 $_name = RUpload::get_name($name) . '_' . $count . $extension;
                 $_file = $path . $_name;
                 if (!file_exists($_file)) {
                     $name = $_name;
                     break;
                 }
                 $count++;
             }
         }
         $upload = new RUpload(array("file_name" => $name, "upload_path" => $path));
         $upload->upload($fileTag);
         if ($upload->error != '') {
             echo $upload->error;
             //$this->flash("error", $upload->error);
         } else {
             // success
             $uri = "files/userfiles/u_" . $user->id . "/" . $upload->file_name;
             echo $uri;
         }
     }
     exit;
 }
Example #8
0
 public function run()
 {
     $params = $this->getParams();
     $groupId = $params[0];
     if (!is_numeric($groupId)) {
         $this->getController()->page404();
         return;
     }
     if (($group = Group::get($groupId)) !== null) {
         if (Rays::isPost()) {
             // remove members request
             if (isset($_POST['selected_members'])) {
                 $ids = $_POST['selected_members'];
                 if (is_array($ids)) {
                     $flag = true;
                     foreach ($ids as $id) {
                         if (!is_numeric($id) || $id == $group->creator) {
                             $flag = false;
                             break;
                         }
                     }
                     if ($flag) {
                         GroupUser::removeUsers($groupId, $ids);
                     }
                 }
             }
         }
         $group->category = Category::get($group->categoryId);
         $members = Group::getMembers($group->id);
         $this->getController()->setHeaderTitle("Members in " . $group->name);
         $this->getController()->render('members', array('members' => $members, 'manager' => User::get($group->creator), 'group' => $group, 'memberCount' => count($members), 'topicCount' => Group::countTopics($groupId)), false);
     } else {
         $this->getController()->page404();
         return;
     }
 }
Example #9
0
 public function actionPlus()
 {
     if (Rays::isAjax()) {
         $result = ["result" => false];
         if (isset($_POST['plusId']) && isset($_POST['plusType'])) {
             if (is_numeric($_POST['plusId'])) {
                 $plusId = $_POST['plusId'];
                 $userId = 0;
                 if (Rays::isLogin()) {
                     $userId = Rays::user()->id;
                 }
                 $host = Rays::app()->request()->getUserHostAddress();
                 switch ($_POST['plusType']) {
                     case Topic::ENTITY_TYPE:
                         if (Topic::get($plusId) !== null) {
                             $plus = new RatingPlus(Topic::ENTITY_TYPE, $plusId, $userId, $host);
                             if ($plus->rate()) {
                                 $result = ["result" => true, "counter" => $plus->getCounter()->value];
                             }
                         }
                         break;
                     case Group::ENTITY_TYPE:
                         if (Group::get($plusId) !== null) {
                             $plus = new RatingPlus(Group::ENTITY_TYPE, $plusId, $userId, $host);
                             if ($plus->rate()) {
                                 $result = ["result" => true, "counter" => $plus->getCounter()->value];
                             }
                         }
                         break;
                 }
             }
         }
         echo json_encode($result);
         exit;
     }
 }
Example #10
0
 public function actionFind()
 {
     $this->layout = 'user';
     $page = $this->getPage("page");
     $pageSize = $this->getPageSize("pagesize", 24);
     $searchStr = '';
     if (Rays::isPost()) {
         $searchStr = $_POST['searchstr'];
     } else {
         if (isset($_GET['search'])) {
             $searchStr = $_GET['search'];
         }
     }
     $query = User::find();
     if ($name = trim($searchStr)) {
         $names = preg_split("/[\\s]+/", $name);
         foreach ($names as $key) {
             $query = $query->like("name", $key);
         }
     }
     $count = $query->count();
     $users = $query->range(($page - 1) * $pageSize, $pageSize);
     $url = RHtml::siteUrl('user/find' . ($searchStr != '') ? '?search=' . urlencode($searchStr) : "");
     $pager = new RPager('page', $count, $pageSize, $url, $page);
     $this->setHeaderTitle("Find User");
     $this->render("find", ['users' => $users, 'searchstr' => $searchStr, 'pager' => $pager->showPager()], false);
 }
Example #11
0
        <div class="col-xs-6 col-sm-3 sidebar-offcanvas" id="sidebar" role="navigation"> -->

            <?php 
// $self->module("new_users",array('id'=>'new_users','name'=>"New Users"));
?>

       <!-- </div>--><!--/span-->


    </div>

    <hr>

    <footer>
        <p><?php 
echo "© Copyright " . Rays::app()->getName() . " 2013, All Rights Reserved.";
?>
</p>
    </footer>

</div>
<!--/.container-->

<!-- Placed at the end of the document so the pages load faster -->
<?php 
// link custom script files
echo RHtml::linkScriptArray(Rays::app()->client()->script);
?>
</body>

</html>
Example #12
0
echo RForm::input(array('id' => 'ads-title', 'name' => 'ads-title', 'class' => 'form-control', 'placeholder' => 'Ads title'), isset($form['ads-title']) ? $form : (isset($edit) ? $ad->title : $form));
?>

        <br/>

        <?php 
echo RForm::label('Ads content', 'ads-content');
?>
        <?php 
$self->module('ckeditor', array('editorId' => 'ads-content', 'name' => 'ads-content', 'data' => isset($form['ads-content']) ? $form['ads-content'] : (isset($edit) ? $ad->content : '')));
?>

        <br/>

        <?php 
echo RForm::label('Paid price (' . Rays::user()->getWallet()->money . " " . Wallet::COIN_NAME . " in your wallet)", 'paid-price');
?>
        <div class="input-group">
            <?php 
echo RForm::input(array_merge(array('id' => 'paid-price', 'name' => 'paid-price', 'class' => 'form-control'), isset($edit) ? ['readonly' => true] : []), isset($form['paid-price']) ? $form : (isset($edit) ? $ad->paidPrice : $form));
?>
            <span class="input-group-addon"><?php 
echo Wallet::COIN_NAME;
?>
</span>
        </div>

        <br/>

        <?php 
echo RForm::input(array('type' => 'submit', 'class' => 'btn btn-sm btn-primary', 'value' => isset($edit) ? 'Save' : 'Send Ads application'));
Example #13
0
<?php

/**
 * Group detail page
 * @author: Raysmond
 */
?>
<div class="panel panel-default">
    <div class="panel-heading">
        <div class="heading-actions" style="float: right;">
            <?php 
if ($isManager || Rays::isLogin() && Rays::user()->isAdmin()) {
    echo RHtml::linkAction('group', "Edit", 'edit', $group->id, array('class' => 'btn btn-xs btn-success'));
    echo '&nbsp;';
    echo RHtml::linkAction('group', "Invite", 'invite', $group->id, array('class' => 'btn btn-xs btn-info'));
    echo '&nbsp;';
}
if (!$hasJoined) {
    echo RHtml::linkAction('group', 'Join', 'join', $group->id, array('class' => 'btn btn-xs btn-success'));
    echo '&nbsp;';
} else {
    echo RHtml::linkAction('group', 'Quit', 'exit', $group->id, array('class' => 'btn btn-xs btn-danger', 'onclick' => 'return confirm(\'Are you sure to quit the group? This operation cannot be undone!\')'));
}
?>
        </div>
        <h1 class="panel-title"><?php 
echo $group->name;
?>
</h1>
    </div>
    <div class="panel-body">
Example #14
0
 /**
  * Recommend groups to users
  * @access: administrator
  */
 public function actionRecommend()
 {
     if (Rays::isAjax()) {
         $action = Rays::getParam('action', null);
         if ($action) {
             $name = Rays::getParam('name', null);
             $query = Group::find();
             $queryUser = User::find();
             $like = array();
             if (isset($name) && $name != '') {
                 $names = explode(' ', $name);
                 foreach ($names as $val) {
                     $query = $query->like("name", $val);
                     $queryUser = $queryUser->like("name", $val);
                 }
             }
             switch ($action) {
                 case "search_groups":
                     $groups = $query->range(0, 20);
                     $results = array();
                     foreach ($groups as $item) {
                         $result['id'] = $item->id;
                         $result['name'] = $item->name;
                         $result['link'] = RHtml::siteUrl('group/detail/' . $item->id);
                         $result['picture'] = $item->picture;
                         $results[] = $result;
                     }
                     echo json_encode($results);
                     exit;
                     break;
                 case "search_users":
                     $users = $queryUser->range(0, 20);
                     $results = array();
                     foreach ($users as $item) {
                         $result['id'] = $item->id;
                         $result['name'] = $item->name;
                         $result['link'] = RHtml::siteUrl('user/view/' . $item->id);
                         $result['picture'] = $item->picture;
                         $results[] = $result;
                     }
                     echo json_encode($results);
                     exit;
                     break;
                 default:
             }
         }
     }
     if (Rays::isPost()) {
         if (isset($_POST['selected_recommend_groups']) && isset($_POST['selected_recommend_users'])) {
             $groups = $_POST['selected_recommend_groups'];
             $users = $_POST['selected_recommend_users'];
             $words = $_POST['recommend-words'];
             Group::recommendGroups($groups, $users, $words);
             $this->flash('message', 'Send group recommendations successfully.');
         }
     }
     $this->layout = 'admin';
     $data = array();
     $this->setHeaderTitle("Groups recommendation");
     $this->render('recommend', $data, false);
 }
Example #15
0
</h3>
        </div>
        <div class="panel-body">
            <?php 
if ($message->type->name == 'system') {
    echo "From: 系统消息";
} else {
    $sender = null;
    if ($message->type->name == "user" || $message->type->name == "private") {
        $sender = User::get($message->senderId);
        echo "From: " . RHtml::linkAction('user', $sender->name, 'view', $sender->id);
    } else {
        if ($message->type->name == "group") {
            $sender = Group::get($message->senderId);
            echo "From: " . RHtml::linkAction('group', $sender->name, 'detail', $sender->id);
        } else {
            echo "From: Unknown";
        }
    }
}
echo '&nbsp;&nbsp;Delivery time: ' . $message->sendTime;
echo '&nbsp;&nbsp;Status: ' . ($message->status == 0 ? "unread" : "read");
echo "<br/>";
echo '<p>' . RHtml::decode($message->content) . '</p>';
if ($message->status == Message::STATUS_UNREAD && $message->receiverId == Rays::user()->id) {
    echo RHtml::linkAction('message', "Mark read", 'read', $message->id, array('class' => 'btn btn-sm btn-success'));
}
?>
        </div>
    </div>
</div>
Example #16
0
 public function actionHitAd()
 {
     if (Rays::isAjax()) {
         $adId = (int) $_POST['adId'];
         $ad = Ads::get($adId);
         if ($ad !== null) {
             (new Counter())->increaseCounter($adId, Ads::ENTITY_TYPE);
             //Ad访问计数器
             /** TODO 刷广告访问监测机制 */
             $user = User::get($ad->userId);
             if ($user !== null) {
                 $wallet = $user->getWallet();
                 //访问一次挣一元钱
                 $wallet->addMoney(1);
             }
         }
     }
 }
Example #17
0
            <?php 
} else {
    foreach ($msgs as $msg) {
        ?>
        <div id="message-item-<?php 
        echo $msg->id;
        ?>
" class="message-item panel panel-info <?php 
        echo $msg->status == Message::STATUS_UNREAD ? "message-unread" : "";
        ?>
">
            <div class="panel-heading">
                <div style="float:right;margin-top: -2px;">
                    <?php 
        if ($msg->receiverId == Rays::user()->id) {
            if (($msg->type->name == "private" || $msg->type->name == "user") && $msg->senderId != Rays::user()->id) {
                echo RHtml::linkAction("message", "", "send", ['private', $msg->senderId], array('title' => 'Reply', "class" => 'glyphicon glyphicon-send'));
                echo '&nbsp;&nbsp;&nbsp;';
            }
            if ($msg->status == Message::STATUS_UNREAD) {
                $url = RHtml::siteUrl("message/read/" . $msg->id);
                ?>
                            <a href="javascript:markStatus('<?php 
                echo $url;
                ?>
',<?php 
                echo $msg->id;
                ?>
)"><span class="glyphicon glyphicon-ok message-read"></span></a>
                            <?php 
            }
Example #18
0
 */
if (isset($validation_errors)) {
    RHtml::showValidationErrors($validation_errors);
}
$form = array();
if (isset($sendForm)) {
    $form = $sendForm;
}
echo RForm::openForm('message/send/' . $type . '/', array('id' => 'messageForm', 'class' => 'form-signin'));
echo RForm::label('To user: '******'receiver', array());
echo '&nbsp;&nbsp;';
$disabled = isset($toUser) ? "disabled" : "enabled";
echo RForm::input(array('id' => 'receiver', 'name' => 'receiver', 'class' => 'form-control', 'placeholder' => 'Receiver'), isset($toUser) ? $toUser->name : $form);
echo '<br/>';
echo RForm::label('Title', 'title', array());
echo RForm::input(array('id' => 'title', 'name' => 'title', 'class' => 'form-control', 'placeholder' => 'Title'), $form);
echo "<br/>";
echo RForm::label('Content', 'content', array());
echo "<br/>";
if (Rays::user()->roleId == Role::ADMINISTRATOR_ID) {
    $self->module('ckeditor', array('editorId' => 'msg-content', 'name' => 'msg-content', 'data' => isset($form['content']) ? $form['content'] : ''));
} else {
    echo RForm::textarea(array('id' => 'msg-content', 'name' => 'msg-content', 'class' => 'form-control', 'cols' => 100, 'rows' => 6, 'placeholder' => 'Content'), $form);
}
echo "<br/>";
echo RForm::input(array('type' => 'hidden', 'value' => $type, 'name' => 'type'), $type);
echo RForm::input(array('type' => 'submit', 'value' => 'Send', 'class' => 'btn btn-lg btn-primary'));
echo RForm::endForm();
?>
    </div>
</div>
Example #19
0
                <a href="javascript:void(0);" title="Members of this group">
                    <span class="glyphicon glyphicon-user"></span> <?php 
    echo $group->memberCount;
    ?>
                </a>
            </div>

            <div class="action action-like">
                <?php 
    $self->module('rating_plus', array('id' => 'rating_plus', 'entityType' => Group::ENTITY_TYPE, 'entityId' => $group->id));
    ?>
            </div>

            <?php 
    if (Rays::isLogin()) {
        if (!GroupUser::isUserInGroup(Rays::user()->id, $group->id)) {
            ?>
                    <div class="action action-right">
                        <?php 
            $url = RHtml::siteUrl('group/join');
            ?>
                        <a href="javascript: joinGroup('<?php 
            echo $url;
            ?>
','<?php 
            echo $group->id;
            ?>
')" title="Join the group"><span class="glyphicon glyphicon-plus"></span></a>
                    </div>
                <?php 
        }
Example #20
0
        <div class="panel panel-default user-login-register-panel">
            <div class="panel-heading"><b>Sign in</b></div>
            <div class="panel-body">
                <?php 
if (isset($validation_errors)) {
    RHtml::showValidationErrors($validation_errors);
}
$form = array();
if (isset($loginForm)) {
    $form = $loginForm;
}
echo RForm::openForm('user/login', array('id' => 'loginForm', 'class' => 'form-signin login-form'));
//echo RForm::label("User name",'username');
echo RForm::hidden('returnURL', Rays::referrerUri() ?: "");
echo RForm::input(array('id' => 'username', 'name' => 'username', 'class' => 'form-control', 'placeholder' => 'User name'), $form);
//echo RForm::label("Password",'password');
echo RForm::input(array('id' => 'password', 'name' => 'password', 'type' => 'password', 'class' => 'form-control', 'placeholder' => 'Password'), $form);
echo RForm::input(array('class' => 'btn btn-primary', 'type' => 'submit', 'value' => 'Login'));
echo RForm::endForm();
?>
            </div>
        </div>



Example #21
0
<?php

/**
 * Index file.
 * @author: Raysmond
 */
$rays = dirname(__FILE__) . '/Rays/Rays/Rays.php';
$config = dirname(__FILE__) . '/Config.php';
require_once $rays;
Rays::newApp($config)->run();
Example #22
0
 public function actionMyFriend()
 {
     $this->layout = 'user';
     $user = Rays::user();
     $friends = new Friend();
     $curPage = $this->getPage("page");
     $pageSize = $this->getPageSize("pagesize", 36);
     list($friends, $count) = $friends->getFriends($user->id, $pageSize, [], ($curPage - 1) * $pageSize);
     $data['count'] = $count;
     $pager = new RPager('page', $count, $pageSize, RHtml::siteUrl('friend/myFriend'), $curPage);
     $data['friends'] = $friends;
     if ($count > $pageSize) {
         $data['pager'] = $pager->showPager();
     }
     $data['friNumber'] = $count;
     return $this->render('my_friend', $data);
 }
Example #23
0
 public function actionDelete($msgId)
 {
     $message = Message::get($msgId);
     if (Rays::isAjax() && $message != null) {
         if (Rays::user()->id != $message->receiverId) {
             echo "Sorry. You don't have the right to delete the message.";
             exit;
         }
         $message->delete();
         echo 'success';
         exit;
     }
     RAssert::not_null($message);
     $user = Rays::user();
     if ($message->receiverId == $user->id || $user->isAdmin()) {
         $message->delete();
     }
     $this->redirect(Rays::referrerUri());
 }
Example #24
0
<?php

/**
 * User view page file.
 * @author: Raysmond
 */
?>

<?php 
Rays::css("/public/css/post.css");
?>
<div class="panel panel-default">
    <div class="panel-body">

        <div class="user-profile-tiny">
            <?php 
echo $self->module('user_panel', array('userId' => $user->id, 'viewUser' => true));
?>
            <div class="navbar-right">
                <?php 
if (isset($canAdd) && $canAdd) {
    echo RHtml::linkAction('friend', '+ Add friend', 'add', $user->id, array('class' => 'btn btn-xs btn-info'));
}
if (isset($canCancel) && $canCancel) {
    echo RHtml::linkAction('message', '+ Send a message', 'send', ['private', $user->id], array('class' => 'btn btn-xs btn-success'));
    echo '&nbsp;&nbsp;';
    echo RHtml::linkAction('friend', '- Cancel friend', 'cancel', $user->id, array('class' => 'btn btn-xs btn-danger'));
}
echo '<div class="clearfix"></div>';
?>
            </div>
Example #25
0
<?php

Rays::css("/public/css/form.css");
?>
        <div class="panel panel-default user-login-register-panel">
            <div class="panel-heading"><b>Register</b></div>
            <div class="panel-body">
            <?php 
if (isset($validation_errors)) {
    RHtml::showValidationErrors($validation_errors);
}
$form = array();
if (isset($registerForm)) {
    $form = $registerForm;
}
echo RForm::openForm('user/register', array('id' => 'registerForm', 'class' => 'form-signin registerForm'));
//echo RForm::label("User name",'username');
echo RForm::input(array('id' => 'username', 'name' => 'username', 'class' => 'form-control', 'placeholder' => 'User name'), $form);
//echo RForm::label("Email",'email');
echo RForm::input(array('id' => 'email', 'name' => 'email', 'class' => 'form-control', 'placeholder' => '*****@*****.**'), $form);
// echo RForm::label("Password",'password');
echo RForm::input(array('id' => 'password', 'name' => 'password', 'type' => 'password', 'class' => 'form-control', 'placeholder' => 'Password'), $form);
// echo RForm::label("Password confirm",'password-confirm');
echo RForm::input(array('id' => 'password-confirm', 'name' => 'password-confirm', 'type' => 'password', 'class' => 'form-control', 'placeholder' => 'Password confirm'), $form);
echo RForm::input(array('class' => 'btn btn-primary', 'type' => 'submit', 'value' => 'Register'));
echo RForm::endForm();
?>
            </div>
        </div>

Example #26
0
>
                        <?php 
echo RHtml::linkAction("post", "Find posts", "find");
?>
                    </li>
                </ul>


                <ul class="nav navbar-nav navbar-right">
                    <?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;
Example #27
0
    ?>
            <a href="<?php 
    echo RHtml::siteUrl('message/view');
    ?>
"><span class="glyphicon glyphicon-envelope"></span> &nbsp; Messages</a>
            <?php 
    echo "</li>";
} else {
    echo '<li ' . ($isMessageUrl ? 'class="active"' : "") . '><a href="' . RHtml::siteUrl('message/view') . '">';
    echo '<span class="glyphicon glyphicon-envelope"></span> &nbsp; ';
    echo 'Messages <span class="badge">' . $count . '</span></a></li>';
}
if ($user->roleId == Role::VIP_ID) {
    ?>
            <li <?php 
    echo Rays::app()->request()->urlMatch(array('ads/view', 'ads/view/*'), $currentUrl) ? 'class="active"' : "";
    ?>
>
                <a href="<?php 
    echo RHtml::siteUrl('ads/view');
    ?>
">
                    <span class="glyphicon glyphicon-euro"></span> &nbsp;
                    Advertisement <span class="badge badge-vip">VIP</span>
                </a>
            </li>
        <?php 
}
?>
    </ul>
</div>
Example #28
0
<?php

/**
 * Posts list view file.
 * This view file only render the posts list. It's useful for partial rendering without the layout,
 * for example: render the result for an Ajax request
 *
 * @author: Raysmond
 */
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;
        ?>
Example #29
0
        echo $id;
        ?>
" );
            var path = "<?php 
        echo $path;
        ?>
";
            CKEDITOR.replace( "<?php 
        echo $id;
        ?>
", {
                //filebrowserBrowseUrl        : path+'/ckfinder/ckfinder.html',
                //filebrowserImageBrowseUrl   : path+'/ckfinder/ckfinder.html?Type=Images',
                //filebrowserFlashBrowseUrl   : path+'/ckfinder/ckfinder.html?Type=Flash',
                filebrowserUploadUrl        : path +'/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Files',
                filebrowserImageUploadUrl   : path +'/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Images'
                //filebrowserFlashUploadUrl   : path + '/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Flash'
            });
        });
    </script>
    <?php 
    }
    ?>
    <?php 
    if (isset($customInitialJs)) {
        Rays::js($customInitialJs);
    }
    ?>

<?php 
}
Example #30
0
        echo '<span class="glyphicon glyphicon-chevron-up"></span>';
    } else {
        echo '<span class="glyphicon glyphicon-chevron-down"></span>';
    }
}
?>
                    </a>
                </th>

                <th><a class="highlight" href="<?php 
echo RHtml::siteUrl("group/admin?orderBy=likes&&order=" . $order);
?>
">
                        Likes <?php 
if (Rays::getParam("orderBy", null) == "likes") {
    if (Rays::getParam("order", "asc") == "asc") {
        echo '<span class="glyphicon glyphicon-chevron-up"></span>';
    } else {
        echo '<span class="glyphicon glyphicon-chevron-down"></span>';
    }
}
?>
                    </a>
                </th>
            </tr>
            </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) {