public function generateAddActions($arrData, $id, Watchlist $objWatchlist)
 {
     global $objPage;
     if ($objPage === null) {
         return;
     }
     if (\Validator::isUuid($id)) {
         $objFile = \FilesModel::findByUuid($id);
     } else {
         $objFile = \FilesModel::findBy('path', $id);
     }
     $objItem = new WatchlistItemModel();
     $objItem->pid = Watchlist::getInstance()->getId();
     $objItem->uuid = $objFile->uuid;
     $objItem->pageID = $objPage->id;
     $objItem->cid = $arrData['id'];
     $objItem->type = $arrData['type'];
     $objT = new \FrontendTemplate('watchlist_add_actions');
     $objT->addHref = ampersand(\Controller::generateFrontendUrl($objPage->row()) . '?act=' . WATCHLIST_ACT_ADD . '&cid=' . $objItem->cid . '&type=' . $objItem->type . '&id=' . $strUuid . '&title=' . urlencode($objItem->getTitle()));
     $objT->addTitle = $GLOBALS['TL_LANG']['WATCHLIST']['addTitle'];
     $objT->addLink = $GLOBALS['TL_LANG']['WATCHLIST']['addLink'];
     $objT->active = $objWatchlist->isInList($strUuid);
     $objT->id = $strUuid;
     return $objT->parse();
 }
 protected function __construct()
 {
     $this->strIp = !\Config::get('disableIpCheck') ? \Environment::get('ip') : '';
     $this->strName = FE_USER_LOGGED_IN ? WATCHLIST_SESSION_FE : WATCHLIST_SESSION_BE;
     $this->strHash = sha1(session_id() . $this->strIp . $this->strName);
     if (($this->objModel = WatchlistModel::findByHashAndName($this->strHash, $this->strName)) === null) {
         $this->objModel = new WatchlistModel();
         $this->objModel->hash = $this->strHash;
         $this->objModel->name = $this->strName;
         $this->objModel->tstamp = time();
         $this->objModel->pid = \FrontendUser::getInstance()->id;
         $this->objModel->sessionID = session_id();
         $this->objModel->ip = $this->strIp;
         $this->objModel->save();
     }
     $objItems = WatchlistItemModel::findBy('pid', $this->objModel->id);
     if ($objItems !== null) {
         while ($objItems->next()) {
             // set key by unique uuid
             $strKey = \String::binToUuid($objItems->uuid);
             $this->arrItems[$strKey] = $objItems->current();
             $this->arrIds[] = $strKey;
         }
     }
 }