The item id e.g. a chapter id
@param string $idref
@param string $linear
4753
public function addToSpine($idref, $linear = 'yes')
    {
        $itemref = $this->spine->appendChild($this->createElement('itemref'));
        $itemref->setAttribute('idref', $idref);
        $itemref->setAttribute('linear', 'yes');

        return $itemref;
    }
35715
public function &getItemByID($id)
    {
        if ( ! $count = parent::count()) {
            return false;
        }
        /** @var \Colibri\Database\Model $itemClass */
        $itemClass = static::$itemClass;
        /** @noinspection PhpUndefinedVariableInspection */
        $PKfn = $itemClass::$PKFieldName[0];
        for ($i = 0; $i < $count; $i++) {
            if (isset($this->items[$i]->$PKfn) && $this->items[$i]->$PKfn == $id) {
                return $this->items[$i];
            }
        }

        return false;
    }
851377
public function add_refs($item, array $ids) {
        $this->validate_item($item);
        foreach ($ids as $id) {
            $this->refs[$item][$id] = true;
        }
    }
985592
private function _getSiteIdsFromTree( MShop_Locale_Item_Site_Interface $item )
	{
		$list = array( $item->getId() );

		foreach( $item->getChildren() as $child ) {
			$list = array_merge( $list, $this->_getSiteIdsFromTree( $child ) );
		}

		return $list;
	}
1195940
@Override
	public Link linkToItemResource(Class<?> entity, Object id) {
		return linkFor(entity).slash(id).withSelfRel();
	}
414504
public function loadItem($ident, StorableInterface $item = null)
    {
        $key = $this->model()->key();

        return $this->loadItemFromKey($key, $ident, $item);
    }
8335
public function getByRef($sRef, $aData = [])
    {
        if (empty($aData['where'])) {
            $aData['where'] = [];
        }

        $aData['where'][] = [$this->sTableAlias . '.ref', $sRef];

        $aEmails = $this->getAll(null, null, $aData);

        return !empty($aEmails) ? reset($aEmails) : false;
    }
576883
public function getListId(string $listId = null): ?string
    {
        return ($listId == null) ? $this->listId : $listId;
    }
323716
function renderItemsByFolderId(id) {
        resourceDetail.hide();
        resourcesList.show();
        folderId = id;
        urls["getResources"] = urls["getResources"] || getURL("getResources");
        var options = {
            url: urls["getResources"] + '/' + id,
            data: {mode: "exclusive"},
            success: function (data) {
                resourcesList.html(data);

                renderActionButtons();
                var items = resourcesList.find("li");
                items.click(handleItemClick);
            }
        };
        Rocket.ajax(options);
    }
80169
public function trackLink($sRef, $iLinkId)
    {
        $oEmail = $this->getByRef($sRef);

        if ($oEmail) {

            //  Get the link which was clicked
            $oDb = Factory::service('Database');
            $oDb->select('id, url');
            $oDb->where('email_id', $oEmail->id);
            $oDb->where('id', $iLinkId);
            $oLink = $oDb->get(NAILS_DB_PREFIX . 'email_archive_link')->row();

            if ($oLink) {

                //  Update the read count and a add a track data point
                $oDb->set('link_click_count', 'link_click_count+1', false);
                $oDb->where('id', $oEmail->id);
                $oDb->update($this->sTable);

                //  Add a link trackback
                $oDb->set('created', 'NOW()', false);
                $oDb->set('email_id', $oEmail->id);
                $oDb->set('link_id', $oLink->id);

                if (activeUser('id')) {
                    $oDb->set('user_id', activeUser('id'));
                }

                $oDb->insert(NAILS_DB_PREFIX . 'email_archive_track_link');

                //  Return the URL to go to
                return $oLink->url;

            } else {
                return false;
            }
        }

        return false;
    }
1264456
private function findIdNotFormated($id, &$yAlreadySet, &$realNameId) {
        $tofind = $id;

        while (strlen($tofind) >= 2) {
            if ($this->idExists($tofind, $yAlreadySet, $realNameId)) {
                return $tofind;
            } else {
                $tofind = substr($tofind, 0, -1);
            }
        }

        if ($this->allowsUnknownIdentifier === false) {
            throw new CINParseException('gs1128', 'Error in formatting, can\'t find an identifier.');
        }

        return false;
    }
674964
private function _addTocSubEntry($depth, $level, $title, $identifier, &$list)
    {
        if (!isset($list['sub']))
            $list['sub'] = array();
        $offset = count($list['sub']);
        if ($depth === 1) {
            $list['sub'][$offset] = array(
                'id' => $identifier,
                'value' => $title
            );
            return;
        }
        $offset--;
        if (!isset($list['sub'][$offset]))
            $list['sub'][$offset] = array();
        $this->_addTocSubEntry($depth - 1, $level, $title, $identifier, $list['sub'][$offset]);
    }
203274
protected function _doc_ids($el, $force_array = true)
    {
        if ($el instanceof self) {
            $el = $el->ids;
        }

        if ($force_array) {
            if (is_int($el)) {
                $el = array($el => $this->doc()->ids[$el]);
            }

            if (!is_array($el)) {
                throw new \Exception(__CLASS__ . '->' . __FUNCTION__ . ': not Array!');
            }

        }
        return $el;
    }
736881
function byIdRef(id, ref) {
      var cmp = this.byId(id).lookupReferenceHolder(false).lookupReference(ref);
      if (!cmp) {
        throw new Error('Component not found for container id: ' + id + ', reference: ' + ref);
      }
      return cmp;
    }
116045
public function AddArticleIdToViewHistory($iArticleId)
    {
        if (is_null($this->aArticleViewHistory)) {
            $this->GetArticleViewHistory();
        }
        $iMaxQueueLength = 100;
        $shop = $this->getShopService()->getActiveShop();
        if ($shop->fieldDataExtranetUserShopArticleHistoryMaxArticleCount < $iMaxQueueLength && $shop->fieldDataExtranetUserShopArticleHistoryMaxArticleCount > 0) {
            $iMaxQueueLength = $shop->fieldDataExtranetUserShopArticleHistoryMaxArticleCount;
        }

        // check if the item being pushed is already in the end of the queue
        // if the item is on the queue, then we want to move it to the front
        reset($this->aArticleViewHistory);
        $item = null;
        $iKey = null;
        foreach (array_keys($this->aArticleViewHistory) as $histKey) {
            if (is_null($iKey) && $this->aArticleViewHistory[$histKey]['shop_article_id'] === $iArticleId) {
                $item = $this->aArticleViewHistory[$histKey];
                $iKey = $histKey;
                break;
            }
        }

        if (!is_null($iKey)) {
            unset($this->aArticleViewHistory[$iKey]);
            $item['datecreated'] = date('Y-m-d H:i:s');
            $itemObject = TdbDataExtranetUserShopArticleHistory::GetNewInstance($item);
            if (!is_null($this->id) && $this->IsLoggedIn()) {
                $itemObject->Save();
            }
            array_unshift($this->aArticleViewHistory, $item);
        } else {
            $itemObject = TdbDataExtranetUserShopArticleHistory::GetNewInstance();
            $aData = array('shop_article_id' => $iArticleId, 'datecreated' => date('Y-m-d H:i:s'), 'data_extranet_user_id' => $this->id);
            $itemObject->LoadFromRow($aData);
            if (!is_null($this->id) && $this->IsLoggedIn()) {
                $itemObject->Save();
            }
            array_unshift($this->aArticleViewHistory, $itemObject->sqlData);
        }

        // if the list is full, remove last item
        if (count($this->aArticleViewHistory) > $iMaxQueueLength) {
            array_pop($this->aArticleViewHistory);
        }

        // if the user is logged in, we need to make sure the list does not go over the limit set in the shop config
        if (!is_null($this->id) && $this->IsLoggedIn()) {
            if ($shop->fieldDataExtranetUserShopArticleHistoryMaxArticleCount > 0) {
                TdbDataExtranetUserShopArticleHistoryList::ReducedListForUser($shop->fieldDataExtranetUserShopArticleHistoryMaxArticleCount, $this->id);
            }
        }

        // save list to cookie for users not signed in
        if (SHOP_ALLOW_SAVING_ARTICLE_HISTORY_IN_COOKIE && !$this->IsLoggedIn()) {
            if (0 !== $shop->fieldDataExtranetUserShopArticleHistoryMaxCookieSize) {
                reset($this->aArticleViewHistory);
                $aHistory = array();
                foreach (array_keys($this->aArticleViewHistory) as $iHistKey) {
                    $aHistory[] = $this->aArticleViewHistory[$iHistKey];
                }
                $sHistory = json_encode($aHistory);
                $sHistory = base64_encode($sHistory);
                $dByteLength = mb_strlen($sHistory, '8bit');
                $dKByteLength = $dByteLength / 1024;

                if ($dKByteLength > $shop->fieldDataExtranetUserShopArticleHistoryMaxCookieSize) {
                    if (is_array($this->aArticleViewHistory)) {
                        array_pop($this->aArticleViewHistory);
                    }
                    reset($this->aArticleViewHistory);
                    foreach (array_keys($this->aArticleViewHistory) as $iHistKey) {
                        $aHistory[] = $this->aArticleViewHistory[$iHistKey];
                    }
                    $sHistory = json_encode($aHistory);
                    $sHistory = base64_encode($sHistory);
                    $dByteLength = mb_strlen($sHistory, '8bit');
                    $dKByteLength = $dByteLength / 1024;
                }
            }
            $aHistory = array();
            reset($this->aArticleViewHistory);
            foreach (array_keys($this->aArticleViewHistory) as $iHistKey) {
                $aHistory[] = $this->aArticleViewHistory[$iHistKey];
            }
            $sHistory = json_encode($aHistory);
            $sHistory = base64_encode($sHistory);
            $iLifeTime = 31536000; // 1 year
            if ($iLifeTime > CHAMELEON_MAX_COOKIE_LIFETIME) {
                $iLifeTime = CHAMELEON_MAX_COOKIE_LIFETIME;
            }
            $expireTime = $iLifeTime + time();
            $domain = TCMSSmartURLData::GetActive()->sOriginalDomainName;
            // drop 'www' subdomain
            if ('www.' == substr($domain, 0, 4)) {
                $domain = substr($domain, 4);
            }
            setcookie(TdbDataExtranetUser::COOKIE_NAME_HISTORY, $sHistory, $expireTime, '/', '.'.$domain, false, true);
        }
    }
78445
function IDBIndex(store, indexProperties) {
        this.objectStore = store;
        this.name = indexProperties.columnName;
        this.keyPath = indexProperties.keyPath;
        this.multiEntry = indexProperties.optionalParams && indexProperties.optionalParams.multiEntry;
        this.unique = indexProperties.optionalParams && indexProperties.optionalParams.unique;
        this.__deleted = !!indexProperties.__deleted;
    }
1066332
static function eznodeHref( $nodeID, $showPath )
    {
        if ( $showPath == 'true' )
        {
            $node = eZContentObjectTreeNode::fetch( $nodeID, false, false );
            $href = $node ? 'eznode://' . $node['path_identification_string'] : 'eznode://' . $nodeID;
        }
        else
        {
            $href = 'eznode://' . $nodeID;
        }

        return $href;
    }