Exemple #1
0
 function process($params, $options)
 {
     $seoKey = Util::getArrayKey($params, "category_id");
     $collectionDao = new \com\indigloo\sc\dao\Collection();
     $zmember = $collectionDao->uizmemberOnSeoKey(Nest::ui_category(), $seoKey);
     if (is_null($zmember) || !isset($zmember["ui_code"])) {
         $controller = new \com\indigloo\sc\controller\Http404();
         $controller->process();
         exit;
     }
     $code = $zmember["ui_code"];
     $catName = $zmember["name"];
     $postDao = new \com\indigloo\sc\dao\Post();
     $qparams = Url::getRequestQueryParams();
     $gpage = Url::tryQueryParam("gpage");
     $gpage = empty($gpage) ? "1" : $gpage;
     $pageSize = Config::getInstance()->get_value("search.page.items");
     $paginator = new Pagination($qparams, $pageSize);
     $postDBRows = $postDao->getPagedOnCategory($paginator, $code);
     $pageHeader = $catName;
     $pageBaseUrl = "/category/{$seoKey}";
     $pageTitle = SeoData::getPageTitleWithNumber($gpage, $catName);
     $metaKeywords = SeoData::getMetaKeywords($catName);
     $metaDescription = SeoData::getMetaDescriptionWithNumber($gpage, $catName);
     $file = APP_WEB_DIR . '/view/tiles-page.php';
     include $file;
 }
Exemple #2
0
 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;
 }
Exemple #3
0
 function spewFeatured($params, $options)
 {
     $collectionDao = new \com\indigloo\sc\dao\Collection();
     $groupDao = new \com\indigloo\sc\dao\Group();
     $row = $collectionDao->glget(Nest::fgroups());
     $feature_slug = empty($row) ? "" : $row["t_value"];
     $groups = $groupDao->slugToGroupsMap($feature_slug);
     $title = "Featured groups";
     $file = APP_WEB_DIR . "/view/group/cards.php";
     include $file;
 }
Exemple #4
0
    case 2:
        $sortVariable = "likes";
        break;
    case 3:
        $sortVariable = "comments";
        break;
    case 4:
        $sortVariable = "posts";
        break;
    case 5:
        $sortVariable = "followings";
        break;
    default:
        $sortVariable = "followers";
}
$zsetKey = Nest::score("user", $sortVariable);
$members = $redis->getPagedZSet($zsetKey, $paginator);
$count = 0;
$scores = array();
$ids = array();
if (sizeof($members) >= 2) {
    // odd one is login_id
    // next one is score.
    for ($i = 1; $i < sizeof($members); $i++) {
        if ($i % 2 != 0) {
            $loginId = $members[$i - 1];
            array_push($ids, $loginId);
            $scores[$loginId] = isset($members[$i]) ? $members[$i] : 0;
        }
    }
}
Exemple #5
0
<?php

include 'sc-app.inc';
include APP_WEB_DIR . '/inc/header.inc';
use com\indigloo\sc\util\Nest;
//public data
//do not put user role check here
set_exception_handler('webgloo_ajax_exception_handler');
$groupDao = new \com\indigloo\sc\dao\Group();
$collectionDao = new \com\indigloo\sc\dao\Collection();
$row = $collectionDao->glget(Nest::fgroups());
$feature_slug = empty($row) ? "" : $row["t_value"];
$fgroups = $groupDao->slugToGroupsMap($feature_slug);
$html = \com\indigloo\sc\html\Group::getCloud($fgroups);
echo $html;
Exemple #6
0
 function set($loginId, $data)
 {
     $key = Nest::preference("user", $loginId);
     mysql\Collection::glset($key, $data);
 }
Exemple #7
0
 function getPostFeeds($itemId, $limit)
 {
     $key = Nest::feeds("post", $itemId);
     return $this->getList($key, $limit);
 }
Exemple #8
0
    $gWeb = \com\indigloo\core\Web::getInstance();
    $fvalues = array();
    $fUrl = \com\indigloo\Url::tryFormUrl("fUrl");
    try {
        $fhandler = new Form\Handler("web-form-1", $_POST);
        $fvalues = $fhandler->getValues();
        if ($fhandler->hasErrors()) {
            throw new UIException($fhandler->getErrors());
        }
        $group_slug = "";
        $slugs = Util::tryArrayKey($fvalues, "g");
        if (!is_null($slugs)) {
            //remove duplicate entries
            $slugs = array_unique($slugs);
            //input - new groups are names / old ones are slugs
            $slugs = array_map(array("\\com\\indigloo\\util\\StringUtil", "convertNameToKey"), $slugs);
            //db slugs are space separated for sphinx indexing
            $group_slug = implode(Constants::SPACE, $slugs);
        }
        $collectionDao = new \com\indigloo\sc\dao\Collection();
        $collectionDao->glset(Nest::fgroups(), $group_slug);
        //success
        $gWeb->store(Constants::FORM_MESSAGES, array("featured groups list updated!"));
        header("Location: " . $fUrl);
    } catch (UIException $ex) {
        $gWeb->store(Constants::STICKY_MAP, $fvalues);
        $gWeb->store(Constants::FORM_ERRORS, $ex->getMessages());
        header("Location: " . $fUrl);
        exit(1);
    }
}
Exemple #9
0
$sortVariable = "likes";
$pageSize = 25;
$paginator = new \com\indigloo\ui\Pagination($qparams, $pageSize);
$baseURI = "/monitor/analytic/posts.php";
$postDao = new \com\indigloo\sc\dao\Post();
switch ($tab) {
    case 1:
        $sortVariable = "likes";
        break;
    case 2:
        $sortVariable = "comments";
        break;
    default:
        $sortVariable = "likes";
}
$zsetKey = Nest::score("post", $sortVariable);
$members = $redis->getPagedZSet($zsetKey, $paginator);
$count = 0;
$scores = array();
$ids = array();
if (sizeof($members) >= 2) {
    for ($i = 1; $i < sizeof($members); $i++) {
        // odd ones are members
        // evens are scores
        if ($i % 2 != 0) {
            $itemId = $members[$i - 1];
            $postId = PseudoId::decode($itemId);
            array_push($ids, $postId);
            //score is next one
            $scores[$itemId] = isset($members[$i]) ? $members[$i] : 0;
        }
Exemple #10
0
Fichier : edit.php Projet : rjha/sc
                    <?php 
FormMessage::render();
?>
                </div>

                <div class="span6">
                    
                    <form  id="web-form1"  name="web-form1" action="/qa/form/edit.php" enctype="multipart/form-data"  method="POST">  
                        <table class="form-table">
                           <tr>
                                <td> <label>Category</label>

                                <?php 
$options = array('name' => 'category', 'default' => $postDBRow['cat_code'], 'empty' => true);
$collectionDao = new \com\indigloo\sc\dao\Collection();
$catRows = $collectionDao->uizmembers(\com\indigloo\sc\util\Nest::ui_category());
echo \com\indigloo\ui\SelectBox::render($catRows, $options);
?>
                                </td>
                            </tr>

                            <tr>
                                <td>
                                    <label>Details*&nbsp;(max 512 chars)</label>
                                    <textarea  id="description" maxlength="512" name="description" class="required h130 w500" cols="50" rows="4" ><?php 
echo $sticky->get('description', $postDBRow['description']);
?>
</textarea>
                                    <br>
                                   <span id="description_counter"></span>
                                </td>
Exemple #11
0
$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());
    $gWeb->store(Constants::STICKY_MAP, $fvalues);
    $message = "Error: something went wrong with database operation";
    $gWeb->store(Constants::FORM_ERRORS, array($message));