Esempio n. 1
0
 /**
  * 
  * @param type $updateIds
  * @return type
  */
 public static function getUpdatesTags($updateIds)
 {
     if (is_numeric($updateIds)) {
         return self::getUpdateTags($updateIds);
     } else {
         if (empty($updateIds) || !is_array($updateIds)) {
             return [];
         }
     }
     $stmt = CW::$app->db->executeQuery("SELECT t.name, t.id, ut.update_id FROM tags t JOIN update_tags ut ON t.id = ut.tag_id WHERE ut.update_id IN (" . ArrayHelper::getArrayToString($updateIds, ',') . ")");
     $result = $stmt->fetchAll(\PDO::FETCH_ASSOC);
     $r = [];
     foreach ($result as $item) {
         $item['url'] = UrlManager::to(['site/search', 'term' => $item['name']]);
         $item['name'] = htmlspecialchars($item['name']);
         if (!isset($r[$item['update_id']])) {
             $r[$item['update_id']] = [$item];
         } else {
             $r[$item['update_id']][] = $item;
         }
     }
     return $r;
 }
Esempio n. 2
0
 public static function getUpdateUrl($updateId, $categoryName = null)
 {
     return '' !== trim($categoryName) ? UrlManager::to(['update/view', 'id' => $updateId, 'category' => $categoryName], true) : UrlManager::to(['update/view', 'id' => $updateId], true);
 }
Esempio n. 3
0
"><a class="user-act-link" href="<?php 
    echo UrlManager::to(['user/view', 'id' => $model['id'], 'type' => 'posted']);
    ?>
">Posted</a></li>
        <li class="user-act-opt <?php 
    echo CW::$app->request->get('type') === Update::ACTIVITY_TYPE_UPVOTE_STR ? 'user-act-selected' : '';
    ?>
"><a class="user-act-link" href="<?php 
    echo UrlManager::to(['user/view', 'id' => $model['id'], 'type' => 'upvoted']);
    ?>
">Upvoted</a></li>
        <li class="user-act-opt <?php 
    echo CW::$app->request->get('type') === Update::ACTIVITY_TYPE_COMMENT_STR ? 'user-act-selected' : '';
    ?>
"><a class="user-act-link" href="<?php 
    echo UrlManager::to(['user/view', 'id' => $model['id'], 'type' => 'commented']);
    ?>
">Commented</a></li>
    </ul>
</div>

<div class="page-no-popular">
    <div style="width: 1200px;
        position: relative;
        margin: auto;">
        <div id="no-results-found" class="hidden" style="width: 200px; margin: auto;">
            <h3>No updates found.</h3>
        </div>
        <div id="updates-cont" class="msr-cont">
            
        </div>
Esempio n. 4
0
    echo htmlspecialchars($category);
    ?>
            </h2>
            <div class="category-types">
                <a  class="updates-type <?php 
    echo \models\Update::TYPE_TRENDING === $type ? 'updates-type-selected' : '';
    ?>
" href="<?php 
    echo UrlManager::to(['site/index', 'type' => 'trending', 'category' => $category]);
    ?>
">trending</a>
                <a class="updates-type <?php 
    echo \models\Update::TYPE_FRESH === $type || !in_array($type, [\models\Update::TYPE_FRESH, \models\Update::TYPE_TRENDING]) ? 'updates-type-selected' : '';
    ?>
" href="<?php 
    echo UrlManager::to(['site/index', 'type' => 'fresh', 'category' => $category]);
    ?>
">fresh</a>
            </div>
        </div>
    </div>
<?php 
}
?>
<div class="page-no-popular">
    <div style="width: 1200px;position: relative;margin: auto;">
        <div id="no-results-found" class="hidden" style="width: 200px; margin: auto;">
            <h3>No updates found.</h3>
        </div>
        <div id="updates-cont" class="msr-cont"></div>
        <div id="loading">
Esempio n. 5
0
 public static function getProfileUrl($userId)
 {
     return \components\UrlManager::to(['user/view', 'id' => $userId]);
 }
Esempio n. 6
0
            </li>
            <li class="category-item">
                <a id="logout-btn" class="header-user-menu-item header-menu-link" href="#">logout</a>
            </li>
        </ul>
    </div>
    <?php 
} else {
    ?>
    <div class="header-user-option-cont">
        <a href="<?php 
    echo UrlManager::to(['site/signUp']);
    ?>
" class="header-btn"> sign up </a>
        <a href="<?php 
    echo UrlManager::to(['site/login']);
    ?>
" class="header-btn"> login </a>
    </div>
    <?php 
}
?>
</div>
<div class="page-container">
    <?php 
echo $content;
?>
</div>
</body>
</html>
Esempio n. 7
0
<?php

use components\web\widgets\Form;
$this->title = 'Sign up - ' . \CW::$app->params['siteName'];
?>
<div class="start-page">
    <?php 
if ($success) {
    ?>
    <div class="success">
        <i class="fa fa-check-circle"></i>
        <span class="success-msg">You have successfully signed up! <a class="success-link" href="<?php 
    echo \components\UrlManager::to(['site/login']);
    ?>
">Click here</a> login.</span>
    </div>
    <?php 
} else {
    ?>
    <h2 class="header-title">Sign up</h2>
    <div class="start-page-cont">
    <?php 
    $form = Form::widget(['options' => ['template' => '
                        <div class="inp-opt-cont">
                            <div>{label}</div>
                            <div class="inp-cont">{input}</div>
                            <div class="inp-cont-error">{error}</div>
                        </div>
                    ']]);
    $form->input('email', $model, 'email', ['attrs' => ['class' => 'form-inp', 'autocomplete' => 'off']])->input('text', $model, 'username', ['attrs' => ['class' => 'form-inp', 'autocomplete' => 'off']])->input('password', $model, 'password', ['attrs' => ['class' => 'form-inp']]);
    ?>
Esempio n. 8
0
</a>
            <p class="posted-from-ago"><?php 
    echo $update['postedAgo'];
    ?>
</p>
        </div>
    </div>
    <?php 
    if (!empty($update['tags'])) {
        ?>
    <div style="padding: 10px 0px;">
        <?php 
        foreach ($update['tags'] as $tag) {
            ?>
        <a class="link" href="<?php 
            echo \components\UrlManager::to(['site/search', 'term' => $tag['name']]);
            ?>
">#<?php 
            echo htmlspecialchars($tag['name']);
            ?>
</a>
        <?php 
        }
        ?>
    </div>
    <?php 
    }
    ?>
    <div id='update-buttons' style="height: 24px; position: relative;">
        <a id="upvotes" class="btn" style="vertical-align: middle; line-height: 24px;">points <?php 
    echo $update['upvotes'];
Esempio n. 9
0
><a class="edit-opt-link" href="<?php 
echo UrlManager::to(['user/settings', 't' => User::SETTINGS_PROFILE]);
?>
">Profile</a></li>
            <li <?php 
echo $settingType === User::SETTINGS_PICTURE ? 'class="setting-selected"' : '';
?>
><a class="edit-opt-link" href="<?php 
echo UrlManager::to(['user/settings', 't' => User::SETTINGS_PICTURE]);
?>
">Picture</a></li>
            <li <?php 
echo $settingType === User::SETTINGS_PASSWORD ? 'class="setting-selected"' : '';
?>
><a class="edit-opt-link" href="<?php 
echo UrlManager::to(['user/settings', 't' => User::SETTINGS_PASSWORD]);
?>
">Password</a></li>
        </ul>
    </div>
    <div style="margin : 10px; float: left; width : 400px">
        <?php 
if ($success) {
    ?>
        <div class="success" style="margin-top: 65px;">
            <i class="fa fa-check-circle"></i>
            <span class="success-msg">Profile successfully updated.</span>
        </div>
        <?php 
} else {
    ?>
Esempio n. 10
0
                e.stopPropagation();
                e.preventDefault();
            }
        });
})

</script>

<div class="create-update-cont">
    <?php 
if ($success) {
    ?>
    <div class="success">
        <i class="fa fa-check-circle"></i>
        <span class="success-msg"> Update successfully created. <a class="success-link" href="<?php 
    echo \components\UrlManager::to(['update/view', 'id' => $model->newUpdateId]);
    ?>
">Click here</a> to view update.</span>
    </div>
    <?php 
} else {
    ?>
    <h1> Create Update </h1>
    <div style="padding: 15px;" class="start-page-cont">
    <form id="f1" method="post" enctype="multipart/form-data" accept="image/*">
        <div class="field-sep">
            <div>
                <span> Title: </span>
            </div>
            <div>
                <textarea class="textarea" id="title" name="<?php 
Esempio n. 11
0
 public function doLogout()
 {
     CW::$app->user->isLogged();
     CW::$app->user->logout();
     $this->redirect(\components\UrlManager::to(['site/index']));
 }
Esempio n. 12
0
<?php

use Components\Constants;
use Components\UrlManager;
use NewsProvider\NewsProviderFactory;
$config = (include '../config.php');
spl_autoload_register(function ($class) {
    list($namespace, $className) = explode('\\', $class);
    $str = '../src/' . $namespace . DIRECTORY_SEPARATOR . $className . '.php';
    //    var_dump($str);
    include $str;
});
if (!in_array($config['news_provider'], NewsProviderFactory::getAvailableProviders())) {
    exit('ololo');
}
try {
    $urlManager = new UrlManager();
    $provider = NewsProviderFactory::getNewsProvider($config);
    $crud = new \Components\Crud($provider);
    $action = $urlManager->getAction();
    if (strtoupper($_SERVER['REQUEST_METHOD']) == Constants::REQUEST_METHOD_POST) {
        echo json_encode($crud->{$action}());
    } else {
        include 'html/header.php';
        echo $crud->index();
        include 'html/footer.php';
    }
} catch (\Exception $e) {
    echo json_encode(['result' => false, 'message' => $e->getMessage()]);
}
Esempio n. 13
0
$term = null !== $term ? trim($term) : $term;
$this->title = 'Search updates - ' . \CW::$app->params['siteName'];
?>
<script>
$(function() {
    App.update.category = '<?php 
echo CW::$app->request->get('category');
?>
';

    App.update.Loader({
        updatesCont : document.getElementById('updates-cont'),
        loadingEle  : document.getElementById('loading'),
        noResultEle : document.getElementById('no-results-found'),
        url : <?php 
echo json_encode(\components\UrlManager::to(['site/ajaxSearch']));
?>
,
        ajaxData : {
            term : <?php 
echo json_encode(\CW::$app->request->get('term'));
?>
,
            category : '<?php 
echo CW::$app->request->get('category');
?>
'
        }
    })
        .load();
});