function execute(&$controller, &$request, &$user) { $account = $request->getParameter('account'); $request->setAttribute('account', $account); $count = $request->hasParameter('count') ? $request->getParameter('count') : 16; $callback = $request->hasParameter('callback') ? $request->getParameter('callback') : false; $request->setAttribute('callback', $callback); $raw = $request->hasParameter('raw') ? true : false; $request->setAttribute('raw', $raw); $member = DB_DataObject::factory('member'); $member->get('account', $account); $site = DB_DataObject::factory('site'); $site->get('member_id', $member->id); $feed = array(); $feed['uri'] = SCRIPT_PATH . "{$member->account}/"; $feed['title'] = $site->title; $feed['description'] = $site->description; $feed['author'] = $member->account; $entries = EntryUtils::get_entries_by_account($account, $count); foreach ($entries as $key => $entry) { $entry['tags'] = TagUtils::get_tags_by_entry_id($entry['id']); $entries[$key] = $entry; } $feed = $feed + $entries; $request->setAttribute('feed', $feed); $request->setAttribute('entries', $entries); return VIEW_SUCCESS; }
function execute(&$controller, &$request, &$user) { $tags = TagUtils::get_hot_tags(20); $cloud = new TagCloud(); foreach ($tags as $tag) { $cloud->add($tag['name'], SCRIPT_PATH . 'tag/' . urlencode($tag['name']), $tag['cnt']); } $request->setAttribute('tag_cloud', $cloud->htmlAndCSS()); return VIEW_SUCCESS; }
private function createGeneralContentForEmptyResult($valueToSearch) { $mainTag = new Div(); $mainTag->addStyleClass("empty_search_result"); $emptySearchResultLabel = new Div(); $emptySearchResultLabel->addStyleClasses(["empty_search_result_label", "f-16"]); $mainTag->addChild($emptySearchResultLabel->addChild(Labels::prefillMessage([$valueToSearch], Labels::EMPTY_SEARCH_RESULT))); TagUtils::createShadow($mainTag); return $mainTag; }
function execute(&$controller, &$request, &$user) { $account = $request->getParameter('account'); $tags = TagUtils::get_tags_by_account($account); $cloud = new TagCloud(); foreach ($tags as $tag) { $cloud->add($tag['name'], SCRIPT_PATH . $account . '/tag/' . urlencode($tag['name']), $tag['cnt']); } $request->setAttribute('tag_cloud', $cloud->htmlAndCSS()); return VIEW_SUCCESS; }
function execute(&$controller, &$request, &$user) { $member = DB_DataObject::factory('member'); $member->get('account', $request->getParameter('account')); $request->setAttribute('member', $member); $account = $request->getParameter('account'); $entry_id = $request->getParameter('entry_id'); $entry = EntryUtils::get_by_account_and_id($account, $entry_id); $entry['tags'] = TagUtils::get_tags_by_entry_id($entry_id); $request->setAttribute('entry', $entry); return VIEW_SUCCESS; }
function execute(&$controller, &$request, &$user) { $this->attrs['title'] = 'Plnet > ' . msg('tags'); $tag = $request->hasParameter('tag') ? $request->getParameter('tag') : null; if ($tag) { $entries = EntryUtils::get_entries_by_tagname($tag); foreach ($entries as $key => $entry) { $entry['tags'] = TagUtils::get_tags_by_entry_id($entry['id']); } $request->setAttribute('pager', ActionUtils::pager($entries)); $request->setAttribute('tag', $tag); } return VIEW_INDEX; }
public function AdminPage() { /*if (AuthManager::isCurrentUserAuthenticate()) {*/ if (1) { $mainTag = new Html(); $head = new Head(); $head->addChild("\n <title>Admin page</title>\n <meta http-equiv='Content-Type' content='text/html; charset=UTF-8'>\n <link rel='shortcut icon' href='images/system/favicon.ico' type='image/x-icon'/>\n <link rel='stylesheet' type='text/css' href='/src/front/style/style-less.css'/>\n <script type='text/javascript' src='/src/front/js/fixies.js'></script>\n <script type='text/javascript' src='/src/front/js/ext/jquery.js'></script>\n <script type='text/javascript' src='/src/front/js/v-utils.js'></script>\n <script type='text/javascript' src='/src/front/js/admin.js'></script>\n "); $body = new Body(); $body->addChild($this->getPreparedDom()); echo TagUtils::buildHtml($mainTag->addChildList([$head, $body]), new Num(0)); } else { $mainTag = $this->getPreAuthPage(); echo TagUtils::buildHtml($mainTag, new Num(0)); } }
public static function buildHtml($tag, Num &$depth) { try { $tabs = ""; //implode("", array_fill(0, $depth->_inc()->getNum(), " ")); $html = ""; if ($tag instanceof Tag) { $beginTag = "{$tabs}<" . $tag->getTagName(); $tagContent = ""; $endTag = "{$tabs}</" . $tag->getTagName() . ">"; $id = ""; $class = ""; $attributes = ""; if (!Utils::isNullOrEmptyString($tag->getId())) { $id = TagLabels::ID . "='" . $tag->getId() . "'"; } if (count($tag->getClassList()) > 0) { $class = TagLabels::_CLASS . "='"; for ($index = 0, $max = count($tag->getClassList()); $index < $max; $index++) { $class .= $tag->getClassList()[$index] . " "; } $class .= "'"; } if (count($tag->getAttributeList()) > 0) { foreach ($tag->getAttributeList() as $key => $value) { $attributes .= " {$key}=\"{$value}\" "; } } $beginTag .= " " . $id . " " . $class . " " . $attributes . " >"; if (!$tag instanceof SingleTag) { for ($index = 0, $max = count($tag->getChildList()); $index < $max; $index++) { $tagContent .= TagUtils::buildHtml($tag->getChildList()[$index], $depth); $depth->_dec(); } $html = $beginTag . $tagContent . $endTag; } else { $html = $beginTag; } } else { if (is_string($tag) || is_numeric($tag)) { return $tag; } } } catch (Exception $e) { log::info("Caught exception: ', {$e->getMessage}()"); } return $html; }
function execute(&$controller, &$request, &$user) { $account = $request->getParameter('account'); $request->setAttribute('account', $account); $count = $request->hasParameter('count') ? $request->getParameter('count') : 16; $callback = $request->hasParameter('callback') ? $request->getParameter('callback') : false; $request->setAttribute('callback', $callback); $raw = $request->hasParameter('raw') ? true : false; $request->setAttribute('raw', $raw); $entries = EntryUtils::get_entries_by_account($account, $count); foreach ($entries as $key => $entry) { $entry['tags'] = TagUtils::get_tags_by_entry_id($entry['id']); $entry['src'] = $entry['uri']; $entry['uri'] = SCRIPT_PATH . "{$account}/{$entry['id']}"; $entries[$key] = $entry; } $haj =& new HTML_AJAX_JSON(); $request->setAttribute('entries', $haj->encode($entries)); return VIEW_SUCCESS; }
public function saveInTags(DatabaseInterface $db, NodeRef $originNodeRef, $recordid, $inPartials = 'fields', array $inTags, $restrictedPartials = '') { if (empty($recordid)) { throw new Exception('Cannot save in tags without recordid'); } TagUtils::validateTags($inTags); $originalRestrictedPartials = $restrictedPartials; $restrictedPartials = PartialUtils::unserializeInPartials($restrictedPartials); if ($restrictedPartials == 'all' || ($x = array_search('all', $restrictedPartials)) !== false) { return false; } // $originNodeRef = $node->getNodeRef(); // $outtable = $this->NodeDBMeta->getOutTagsTable($originNodeRef); $intable = $this->NodeDBMeta->getInTagsTable($originNodeRef); $tableid = $this->NodeDBMeta->getPrimaryKey($originNodeRef); // $now = $this->DateFactory->newStorageDate(); // $schema = $originNodeRef->getElement()->getSchema(); $tagsToDelete = array(); $tagsToUpdate = array(); // remove duplicates from tags foreach ($inTags as $o => $tag) { if ($originNodeRef->getElement()->hasTagDef($tag->getTagRole())) { $tagDef = $originNodeRef->getElement()->getSchema()->getTagDef($tag->getTagRole()); } else { $externalElement = $this->ElementService->getBySlug($tag->getTagElement()); $tagDef = $externalElement->getSchema()->getTagDef($tag->getTagRole()); } $tag->MatchPartial = TagUtils::determineMatchPartial($tagDef, $originNodeRef->getSlug()); $this->Logger->debug('MATCH PARTIAL for [' . $tag->toString() . '] is [' . $tag->MatchPartial->toString() . ']'); if (!$tagDef->isSortable()) { $tag->TagSortOrder = 0; } else { $tag->ShouldMatchSort = true; } foreach ($inTags as $i => $dtag) { if ($o != $i && $tag->matchExact($dtag)) { // error_log("REMOVING DUPE ".$dtag->toString()); unset($inTags[$o]); } } foreach ($restrictedPartials as $partial) { if ($this->TagsHelper->matchPartial($partial, $tag)) { unset($inTags[$o]); } } } $currentInTags = $this->findTags('in', $db, $originNodeRef, $recordid, $inPartials, true, false, $originalRestrictedPartials, $resolveLinkedRecords = false); TagUtils::validateTags($currentInTags, 'in'); foreach ($currentInTags as $k => $tag) { //if($tag->getTagOutID() == false) throw new Exception('Cannot save in tags without TagOutIDs for current tags'); $foundThisTag = false; foreach ($inTags as $k2 => $dtag) { // Get a list of fields that differ between the current tag and the tag to be saved $tagDiff = $tag->diff($dtag, $dtag->ShouldMatchSort); if (empty($tagDiff)) { // remove it from inTags, since it exists already unset($inTags[$k2]); $foundThisTag = true; break; } elseif (count($tagDiff) == 1 && $tagDiff[0] == 'TagSortOrder') { // If the only difference between the tags is sort order, we don't // want to remove the tag and then add it back. Just do an update. // Save the tag to run through updates later. $tag->setTagSortOrder($dtag->getTagSortOrder()); $tagsToUpdate[] = $tag; // Remove it from intags because we don't want it added again unset($inTags[$k2]); $foundThisTag = true; break; } } if (!$foundThisTag) { $tagsToDelete[] = $tag; } } if (empty($tagsToDelete) && empty($inTags) && empty($tagsToUpdate)) { return false; } foreach ($tagsToDelete as $tag) { $this->Logger->debug("Delete {$tag->getTagDirection()} tag: {$tag->toString()}"); // delete corresponding out tag $outElement = $this->ElementService->getBySlug($tag->getTagElement()); $outNodeRef = new NodeRef($outElement, $tag->getTagSlug()); $outtable = $this->NodeDBMeta->getOutTagsTable($outNodeRef); $outtableid = $this->NodeDBMeta->getPrimaryKey($outNodeRef); try { $outrecordid = $this->getRecordIDFromNodeRef($outNodeRef); } catch (NodeException $ne) { continue; } $affectedRows = $this->getConnectionForWrite($outNodeRef)->write("\n DELETE FROM {$db->quoteIdentifier($outtable)} WHERE\n {$outtableid} = {$db->quote($outrecordid)} AND\n ElementID = {$db->quote($originNodeRef->getElement()->getElementID())} AND\n Slug = {$db->quote($originNodeRef->getSlug())} AND\n Role = {$db->quote($tag->getTagRole())} AND\n Value = {$db->quote($tag->getTagValue())}", DatabaseInterface::AFFECTED_ROWS); if ($affectedRows > 0) { $this->NodeEvents->fireTagEvents('outtags', 'remove', $outNodeRef, $originNodeRef, $tag); } $affectedRows = $db->deleteRecord($db->quoteIdentifier($intable), "TagID = {$db->quote($tag['TagID'])}"); if ($affectedRows > 0) { $this->NodeEvents->fireTagEvents('intags', 'remove', $originNodeRef, $outNodeRef, $tag); } } // Tags that only have their sort order changed, do an update on both sides of the tag and fire an sortOrder.edit // event for the side of the tag that is ordered. foreach ($tagsToUpdate as $tag) { $this->Logger->debug("Update {$tag->getTagDirection()} tag: {$tag->toString()}"); // update corresponding out tag $outNodeRef = $tag->TagLinkNodeRef; $outtable = $this->NodeDBMeta->getOutTagsTable($outNodeRef); $outtableid = $this->NodeDBMeta->getPrimaryKey($outNodeRef); try { $outrecordid = $this->getRecordIDFromNodeRef($outNodeRef); } catch (NodeException $ne) { continue; } $updateArray = array('SortOrder' => $tag->getTagSortOrder()); $affectedRows = $db->updateRecord($db->quoteIdentifier($outtable), $updateArray, "{$outtableid} = {$db->quote($outrecordid)} AND\n ElementID = {$db->quote($originNodeRef->getElement()->getElementID())} AND\n Slug = {$db->quote($originNodeRef->getSlug())} AND\n Role = {$db->quote($tag->getTagRole())} AND\n Value = {$db->quote($tag->getTagValue())}"); $affectedRows = $db->updateRecord($db->quoteIdentifier($intable), $updateArray, "TagID = {$db->quote($tag['TagID'])}"); if ($affectedRows > 0) { $this->NodeEvents->fireTagEvents('intags', 'sortOrder.edit', $originNodeRef, $outNodeRef, $tag); } } if (!empty($inTags)) { foreach ($inTags as $inTag) { // if($inTag->getTagSectionID() != 0) // throw new NodeException('Cannot save in tags coming from a section'); $externalElement = $this->ElementService->getBySlug($inTag->getTagElement()); $externalNodeRef = new NodeRef($externalElement, $inTag->getTagSlug()); try { $externalRecordID = $this->getRecordIDFromNodeRef($externalNodeRef); } catch (NodeException $ne) { continue; } if ('' . $externalNodeRef == '' . $originNodeRef) { continue; } $this->Logger->debug("Add {$inTag->getTagDirection()} tag: {$inTag->toString()}"); //$inTagPartial = new TagPartial($inTag); $db = $this->getConnectionForWrite($externalNodeRef); $newTag = new Tag($originNodeRef->getElement()->getSlug(), $originNodeRef->getSlug(), $inTag->getTagRole(), $inTag->getTagValue(), $inTag->getTagValueDisplay()); $newTag->setTagSortOrder($inTag->getTagSortOrder()); // match partial is used to guarantee that only 1 outbound link exists for that element or element/value combo $this->saveOutTags($db, $externalNodeRef, $externalRecordID, $inTag->getMatchPartial()->toString(), array($newTag)); } } return true; }
public static function getCompactItemView($name, $images, $itemId, $pageNumber, $num, $key, $valueToSearch, $type, $trimName, $isHighLightElement) { $blackOut = new Div(); $blackOut->addStyleClasses(["blackout", "catalog_item_button_container"]); $blackOut->addAttributes(["itemscope" => "", "itemtype" => "http://data-vocabulary.org/Product"]); $mainDiv = new Div(); $blackOut->addChild($mainDiv); TagUtils::createShadow($mainDiv); $mainDiv->addStyleClasses(["simple_item_compact", $isHighLightElement ? Constants::HIGH_LIGHT_ELEMENT : ""]); $imagesContainer = new Div(); $imagesContainer->addStyleClass("catalog_img_container"); $mainDiv->addChild($imagesContainer); $index = 0; foreach ($images as $image) { if ($index == 1) { break; } $imgView = new Img(); $imgView->addAttributes(array("src" => addslashes($image), "alt" => $name, TagLabels::ON_CLICK => "openSimpleImg(arguments[0])")); $imagesContainer->addChild($imgView); $index++; } if ($type == 'HARD') { $url = URLBuilder::getCatalogLinkForSingleItem($pageNumber, $num, $itemId, array(UrlParameters::KEY => $key, UrlParameters::SEARCH_VALUE => $valueToSearch)); $mainDiv->addStyleClass("cursor_pointer"); $link = TagUtils::createNote($trimName, ""); $blackOut->addChild($link); $blackOut->addChild(self::getItemButton($url)); } elseif ($type == 'SIMPLE') { $text = TagUtils::createNote($trimName, ""); $blackOut->addChild($text); } return $blackOut; }
public function getHtml() { return TagUtils::buildHtml($this, new Num(0)); }
public function removeInTagInternal(Tag $tag) { $this->fields['InTags'] = TagUtils::deleteTags($this->fields['InTags'], $tag, true); }
private function renderGalleryItemWithSingleItem($data) { $mainDiv = new Div(); $mainDiv->addStyleClasses(["main_page_item", "blackout", "catalog_item_button_container"]); $container = new Div(); $container->addStyleClass("main_page_item_sub"); $urlToItem = URLBuilder::getItemLinkForComplexType("", $data[DB::TABLE_GOODS__KEY_ITEM], 1, 48); $itemImagePath = ''; $itemName = $data[DB::TABLE_GOODS__NAME]; $images = FileUtils::getFilesByPrefixByDescription(Constants::DEFAULT_ROOT_CATALOG_PATH . DIRECTORY_SEPARATOR . $data[DB::TABLE_GOODS__KEY_ITEM] . DIRECTORY_SEPARATOR, Constants::MEDIUM_IMAGE, 'jpg'); if ($images[0] == '') { $itemImagePath = FileUtils::getCapImage(Labels::CAP_IMAGE_FOR_CLOTHING); } else { $itemImagePath = $images[0]; } $singleItemView = new Div(); $singleItemView->addStyleClasses(["main_page_item_sub_single"]); $imgView = new Img(); $noteView = null; $imgView->addAttribute("src", $itemImagePath); if ($data[DB::TABLE_GOODS__GOD_TYPE] == "HARD") { $singleItemView->addStyleClass("cursor_pointer"); $noteView = TagUtils::createNote($itemName, ""); } else { $noteView = TagUtils::createNote($itemName, ""); } $noteView->addStyleClasses(["f-15"]); $container->addChildList([$singleItemView, $noteView, Item::getItemButton($urlToItem)]); $singleItemView->addChild($imgView); return $mainDiv->addChild($container); }
function execute(&$controller, &$request, &$user) { $account = $request->getParameter('account'); $year = $request->hasParameter('year') ? $request->getParameter('year') : null; $month = $request->hasParameter('month') ? $request->getParameter('month') : null; $q = $request->hasParameter('q') ? $request->getParameter('q') : null; $tag = $request->hasParameter('tag') ? $request->getParameter('tag') : null; $source_id = $request->hasParameter('source_id') ? $request->getParameter('source_id') : null; $category_id = $request->hasParameter('category_id') ? $request->getParameter('category_id') : null; $format = $request->hasParameter('format') ? $request->getParameter('format') : 'html'; $page = $request->hasParameter('page') ? $request->getParameter('page') : 1; $per_page = $format == 'html' ? PLNET_ENTRIES_PER_PAGE : PLNET_FEED_NUMBER; $start = ($page - 1) * PLNET_ENTRIES_PER_PAGE; $channel = array(); $site = SiteUtils::get_by_account($account); $member = MemberUtils::get_by_account($account); switch (true) { case $year && $month: $t = "Archive: {$year}年{$month}月"; $channel['title'] = $site['title'] . " {$t}"; $channel['link'] = SCRIPT_PATH . "{$account}/{$year}/{$month}/"; $channel['description'] = $site['description']; $rss1 = "{$channel['link']}rss"; $request->setAttribute('entries_title', "{$t} <a href=\"{$rss1}\"><img class=\"favicon\" src=\"images/feed_icon.gif\" /></a>"); $entries = EntryUtils::get_entries_by_account_and_year_month($account, $year, $month, $per_page, $start); $entries_count = EntryUtils::get_entries_count_by_account_and_year_month($account, $year, $month); $path = "/{$account}/{$year}/{$month}/"; break; case $q: $t = "Search: {$q}"; $channel['title'] = $site['title'] . " {$t}"; $channel['link'] = SCRIPT_PATH . "{$account}/search/{$q}"; $channel['description'] = $site['description']; $rss1 = "{$channel['link']}rss"; $request->setAttribute('entries_title', $t . " <a href=\"{$rss1}\"><img class=\"favicon\" " . "src=\"images/feed_icon.gif\" /></a>"); $entries = EntryUtils::get_entries_by_account_and_query($account, $q, $per_page, $start); $entries_count = EntryUtils::get_entries_count_by_account_and_query($account, $q); $path = "/{$account}/search/{$q}"; break; case $tag: $t = "Tag: {$tag}"; $channel['title'] = $site['title'] . " {$t}"; $channel['link'] = SCRIPT_PATH . "{$account}/tag/{$tag}"; $channel['description'] = $site['description']; $rss1 = "{$channel['link']}rss"; $request->setAttribute('entries_title', "Tag: {$tag} <a href=\"{$SCRIPT_PATH}tag/{$tag}\" " . "title=\"Plnet Tag: {$tag}\">[all]</a> <a href=\"{$rss1}\">" . "<img class=\"favicon\" src=\"images/feed_icon.gif\" /></a> "); $entries = EntryUtils::get_entries_by_account_and_tagname($account, $tag, $per_page, $start); $entries_count = EntryUtils::get_entries_count_by_account_and_tagname($account, $tag); $path = "/{$account}/tag/{$tag}"; break; case $source_id: $feed = FeedUtils::get_feed_by_id($source_id); $t = "Source: {$feed['title']}"; $channel['title'] = $site['title'] . " {$t}"; $request->setAttribute('feed_title', $feed['title']); $channel['link'] = SCRIPT_PATH . "{$account}/source/{$source_id}/"; $channel['description'] = $site['description']; $rss1 = "{$channel['link']}rss"; $entries_title = "Source: <a href=\"{$feed['link']} \">" . "{$feed['title']}</a> <a href=\"{$rss1}\"><img class=\"favicon\" " . "src=\"images/feed_icon.gif\" /></a>"; $request->setAttribute('entries_title', $entries_title); $entries = EntryUtils::get_entries_by_account_feed_id($account, $source_id, $per_page, $start); $entries_count = EntryUtils::get_entries_count_by_account_feed_id($account, $source_id); $path = "/{$account}/source/{$source_id}"; break; case $category_id: $content_category = ContentCategoryUtils::get($category_id); $entries_title = msg('category') . ": " . msg($content_category['name']); $request->setAttribute('entries_title', $entries_title); $entries = EntryUtils::find_by_member_id_and_category_id($member['id'], $category_id, $per_page, $start); $entries_count = EntryUtils::find_count_by_member_id_and_category_id($member['id'], $category_id); $path = "/{$account}/category/{$category_id}"; break; default: $channel['title'] = $site['title']; $channel['link'] = SCRIPT_PATH . "{$account}/"; $channel['description'] = $site['description']; $entries = EntryUtils::get_entries_by_account($account, $per_page, $start); $entries_count = EntryUtils::get_entries_count_by_account($account); $path = "/{$account}/"; break; } // tags foreach ($entries as $key => $entry) { $entries[$key]['link'] = SCRIPT_PATH . "{$account}/{$entry['id']}"; $entries[$key]['formated_date'] = date(msg('entry date format'), $entry['date']); $tags = TagUtils::get_tags_by_entry_id($entry['id']); if (count($tags) > 0) { foreach ($tags as $tag) { $entries[$key]['tags'][] = $tag['name']; } } } switch ($format) { case 'rss10': $channel['uri'] = $channel['link'] . 'rss'; $writer =& new FeedWriter(); $writer->setChannel($channel); $writer->setItems($entries); $writer->display($format); return VIEW_NONE; case 'rss20': $channel['uri'] = $channel['link'] . 'rss2'; $writer =& new FeedWriter(); $writer->setChannel($channel); $writer->setItems($entries); $writer->display($format); return VIEW_NONE; case 'html': default: $request->setAttribute('entries', $entries); $request->setAttribute('pager', Utils::pager($page, $entries_count, $path)); return VIEW_SUCCESS; } }
private function getImageDescription($description) { $mainTag = new Div(); $mainTag->addStyleClass("description"); $descriptionArray = Utils::getDescriptionArray($description); /* $headerDOM = new Div(); $headerDOM->addStyleClasses(["header", "f-20"]); $headerDOM->addChild("Детали"); $mainTag->addChild($headerDOM);*/ function filter($val) { return strlen($val) != 0; } //main_description if (strlen($descriptionArray[DescriptionKeys::$keys[Constants::DEFAULT_ITEM_DESCRIPTION_KEY]]) != 0) { $value = $descriptionArray[DescriptionKeys::$keys[Constants::DEFAULT_ITEM_DESCRIPTION_KEY]]; $valueArray = array_filter(explode(";", $value), "filter"); $valueDOM = TagUtils::createList($valueArray); $valueDOM->addStyleClasses(["description_value", "description_main_info", "f-15"]); $textDOM = new Div(); $mainTag->addChild($textDOM->addChild($valueDOM)); unset($descriptionArray[DescriptionKeys::$keys[Constants::DEFAULT_ITEM_DESCRIPTION_KEY]]); } //others fields $odd = true; foreach ($descriptionArray as $key => $value) { if (!is_null($value) && strlen(trim($value)) > 0) { $valueArray = array_filter(explode(";", $value), "filter"); $valueArray = Utils::arrayAppendToItem($valueArray, "<br>"); $value = join("", $valueArray); $keyDOM = new Div(); $keyDOM->addStyleClasses(["description_key", "f-15"]); $keyDOM->addChild($key); $valueDOM = new Div(); $valueDOM->addStyleClasses(["description_value", "f-15"]); $valueDOM->addChild($value); $textDOM = new Div(); $textDOM->addStyleClass("good_description_" . ($odd ? "odd" : "even")); $mainTag->addChild($textDOM->addChildList([$keyDOM, $valueDOM])); $odd = !$odd; } } return $mainTag; }
public function removeInTag(NodeRef $nodeRef, Tag $tag) { $this->NodeEvents->fireNodeEvents(__FUNCTION__, '', $nodeRef, $tag); $id = $tag->getTagRole(); $schema = $nodeRef->getElement()->getSchema(); $tagDef = $schema->getTagDef($id); $tag = TagUtils::filterTagAgainstDef($tag, $tagDef); // retrieve the DB connection and table from DataSourceManager $db = $this->getConnectionForWrite($nodeRef); $id = $this->getRecordIDFromNodeRef($nodeRef); $matchPartial = $tag->getMatchPartial(); $matchPartial->TagSlug = $tag->getTagSlug(); // save the tags $this->NodeTagsDAO->saveInTags($db, $nodeRef, $id, $matchPartial->toString(), array()); }