Esempio n. 1
0
File: Activity.php Progetto: rjha/sc
 function getGlobalFeeds($limit)
 {
     return $this->getList(Nest::global_feeds(), $limit);
 }
Esempio n. 2
0
File: delete.php Progetto: rjha/sc
$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));