Example #1
0
 public function get($itemsToGet = 10000, $offset = 0)
 {
     $items = array();
     $r = parent::get($itemsToGet, intval($offset));
     foreach ($r as $row) {
         $ag = GatheringItem::getByID($row['gaiID']);
         if (is_object($ag)) {
             $items[] = $ag;
         }
     }
     return $items;
 }
 public function getGatheringItems()
 {
     $db = Loader::db();
     $r = $db->Execute('select gaiID from GatheringItems where gaID = ?', array($this->gaID));
     $list = array();
     while ($row = $r->FetchRow()) {
         $item = GatheringItem::getByID($row['gaiID']);
         if (is_object($item)) {
             $list[] = $item;
         }
     }
     return $list;
 }
Example #3
0
 public static function getListByItem($mixed)
 {
     $ags = GatheringDataSource::getByHandle('twitter');
     return GatheringItem::getListByKey($ags, $mixed->get_link());
 }
Example #4
0
<?php

defined('C5_EXECUTE') or die("Access Denied.");
$nh = Loader::helper('validation/numbers');
$form = Loader::helper('form');
$gaiID = intval($_REQUEST['gaiID']);
$gatTypeID = intval($_REQUEST['gatTypeID']);
$type = GatheringItemTemplateType::getByID($gatTypeID);
$nh = Loader::helper('validation/numbers');
$item = GatheringItem::getByID($gaiID);
if (is_object($item) && is_object($type)) {
    $gathering = $item->getGatheringObject();
    $agp = new Permissions($gathering);
    if ($agp->canEditGatheringItems() && Loader::helper('validation/token')->validate('edit_gathering_item_template', $_REQUEST['token'])) {
        $reloadItemTile = false;
        if ($type->getGatheringItemTemplateTypeHandle() == 'tile') {
            $reloadItemTile = true;
        }
        if ($_POST['task'] == 'update_item_template') {
            $template = GatheringItemTemplate::getByID($_POST['gatID']);
            $item->setGatheringItemTemplate($type, $template);
            if ($reloadItemTile) {
                $item->render($type);
            }
            exit;
        }
        $assignments = GatheringItemFeatureAssignment::getList($item);
        $features = array();
        foreach ($assignments as $as) {
            $f = $as->getFeatureObject();
            if (is_object($f)) {
Example #5
0
 public function duplicate(Gathering $gathering)
 {
     $db = Database::connection();
     $gaID = $gathering->getGatheringID();
     $db->Execute('insert into GatheringItems (gaID, gasID, gaiDateTimeCreated, gaiPublicDateTime, gaiTitle, gaiKey, gaiSlotWidth, gaiSlotHeight, gaiBatchTimestamp, gaiBatchDisplayOrder)
                     values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)', array($gaID, $this->getGatheringDataSourceID(), $this->gaiDateTimeCreated, $this->gaiPublicDateTime, $this->gaiTitle, $this->gaiKey, $this->gaiSlotWidth, $this->gaiSlotHeight, $this->gaiBatchTimestamp, $this->gaiBatchDisplayOrder));
     $this->loadGatheringItemTemplates();
     $gaiID = $db->Insert_ID();
     foreach ($this->templates as $gatTypeID => $gatID) {
         $db->Execute('insert into GatheringItemSelectedTemplates (gaiID, gatTypeID, gatID) values (?, ?, ?)', array($gaiID, $gatTypeID, $gatID));
     }
     $item = GatheringItem::getByID($gaiID);
     $assignments = GatheringItemFeatureAssignment::getList($this);
     foreach ($assignments as $as) {
         $item->copyFeatureAssignment($as);
     }
     return $item;
 }
Example #6
0
                    if (!$sh) {
                        $sh = 1;
                    }
                    $agi->setGatheringItemSlotWidth($sw);
                    $agi->setGatheringItemSlotHeight($sh);
                    break;
                case 'update_display_order':
                    $displayOrder = 0;
                    $batch = time();
                    foreach ($_POST['gaiID'] as $gaiID) {
                        $agi = GatheringItem::getByID($gaiID);
                        $agi->setGatheringItemBatchTimestamp($batch);
                        $agi->setGatheringItemBatchDisplayOrder($displayOrder);
                        ++$displayOrder;
                    }
                    break;
                case 'move_to_new_gathering':
                    $item = GatheringItem::getByID($_POST['gaiID']);
                    $item->moveToNewGathering($gathering);
                    $il = new GatheringItemList($gathering);
                    $il->sortByDateDescending();
                    $il->setItemsPerPage($_POST['itemsPerPage']);
                    $c = Page::getByID($_POST['cID'], 'RECENT');
                    if (is_object($c) && !$c->isError()) {
                        Loader::element('gathering/display', array('gathering' => $gathering, 'list' => $il, 'c' => $c));
                    }
                    break;
            }
        }
    }
}
Example #7
0
<?php

defined('C5_EXECUTE') or die("Access Denied.");
$nh = Loader::helper('validation/numbers');
if ($_POST['gaID'] && $nh->integer($_POST['gaID'])) {
    $gathering = Gathering::getByID($_POST['gaID']);
    if (is_object($gathering) && Loader::helper('validation/token')->validate('update_gathering_items', $_POST['editToken'])) {
        $showTileControls = $_POST['showTileControls'] && Loader::helper('validation/token')->validate('update_gathering_items', $_POST['editToken']);
        $item = GatheringItem::getByID($_POST['newerThan']);
        if (is_object($item) && $item->getGatheringID() == $gathering->getGatheringID()) {
            $gathering->generateGatheringItems();
            $list = new GatheringItemList($gathering);
            $list->sortByDateAscending();
            // we sort by date ascending so we can get the ones closest to the last one we've seen, so in case we have to keep refreshing we can do so.
            $list->setItemsPerPage($_REQUEST['itemsPerPage']);
            $list->filterByPublicDate($item->getGatheringItemPublicDateTime(), '>');
            $items = $list->getPage();
            foreach ($items as $item) {
                Loader::element('gathering/tile', array("item" => $item, 'showTileControls' => $showTileControls));
            }
        }
    }
}