Exemplo n.º 1
0
Arquivo: Popular.php Projeto: rjha/sc
 function process($params, $options)
 {
     $qparams = Url::getRequestQueryParams();
     $gpage = Url::tryQueryParam("gpage");
     $gpage = empty($gpage) ? "1" : $gpage;
     $redis = new redis\Activity();
     $pageSize = Config::getInstance()->get_value("main.page.items");
     $paginator = new \com\indigloo\ui\Pagination($qparams, $pageSize);
     $zsetKey = Nest::score("post", "likes");
     $members = $redis->getPagedZSet($zsetKey, $paginator);
     //first one is id, second one is score
     $count = 0;
     $scores = array();
     $ids = array();
     for ($i = 1; $i < sizeof($members); $i++) {
         if ($i % 2 == 0) {
             array_push($scores, $members[$i - 1]);
         } else {
             $itemId = $members[$i - 1];
             $postId = PseudoId::decode($itemId);
             array_push($ids, $postId);
         }
     }
     //get post rows using ids
     $postDao = new \com\indigloo\sc\dao\Post();
     $postDBRows = $postDao->getOnSearchIds($ids);
     $pageHeader = 'Most popular';
     $pageBaseUrl = '/pub/popular';
     $pageTitle = SeoData::getPageTitleWithNumber($gpage, "popular items");
     $metaKeywords = SeoData::getHomeMetaKeywords();
     $metaDescription = SeoData::getMetaDescriptionWithNumber($gpage, "popular items");
     $file = APP_WEB_DIR . '/view/tiles-page.php';
     include $file;
 }
Exemplo n.º 2
0
Arquivo: users.php Projeto: rjha/sc
<?php

//sc/monitor/analytic/users.php
include 'sc-app.inc';
include APP_WEB_DIR . '/inc/header.inc';
include APP_WEB_DIR . '/inc/role/admin.inc';
use com\indigloo\Util;
use com\indigloo\Url;
use com\indigloo\Configuration as Config;
use com\indigloo\ui\Filter;
use com\indigloo\sc\redis;
use com\indigloo\sc\util\Nest;
use com\indigloo\sc\util\PseudoId;
$qparams = Url::getRequestQueryParams();
$redis = new redis\Activity();
$tab = isset($qparams["tab"]) ? $qparams["tab"] : 1;
settype($tab, "integer");
$sortVariable = "followers";
$pageSize = 25;
$paginator = new \com\indigloo\ui\Pagination($qparams, $pageSize);
$baseURI = "/monitor/analytic/users.php";
$userDao = new \com\indigloo\sc\dao\User();
switch ($tab) {
    case 1:
        $sortVariable = "followers";
        break;
    case 2:
        $sortVariable = "likes";
        break;
    case 3:
        $sortVariable = "comments";
Exemplo n.º 3
0
Arquivo: delete.php Projeto: rjha/sc
use com\indigloo\sc\redis;
// submitting via javascript
// removed button value check
$gWeb = \com\indigloo\core\Web::getInstance();
$fvalues = array();
$fUrl = \com\indigloo\Url::tryFormUrl("fUrl");
try {
    $fhandler = new Form\Handler("delete-form", $_POST);
    $fhandler->addRule("items", "items", array('required' => 1, 'rawData' => 1));
    $fvalues = $fhandler->getValues();
    if ($fhandler->hasErrors()) {
        throw new UIException($fhandler->getErrors());
    }
    $items_json = $fvalues["items"];
    $items = json_decode($items_json);
    $redisObj = new redis\Activity();
    foreach ($items as $item) {
        //delete this item from global feed
        $redisObj->lrem(Nest::global_feeds(), $item);
    }
    $message = sprintf("success! selected items have been deleted");
    $gWeb->store(Constants::FORM_MESSAGES, array($message));
    header("Location: " . $fUrl);
} catch (UIException $ex) {
    $gWeb->store(Constants::STICKY_MAP, $fvalues);
    $gWeb->store(Constants::FORM_ERRORS, $ex->getMessages());
    header("Location: " . $fUrl);
    exit(1);
} catch (DBException $ex) {
    Logger::getInstance()->error($ex->getMessage());
    Logger::getInstance()->backtrace($ex->getTrace());