function __exp__getSideContent($what) { ob_start(); switch ($what) { case 'FeedList': $f = new FeedList(false); $f->render(); break; case 'CatList': //rss_require('cls/taglist.php'); //$v = new TagList('channel'); rss_require('cls/categories.php'); $v = new CatList(); $v->render(); break; case 'TagList': rss_require('cls/taglist.php'); $t = new TagList('item'); $t->render(); break; } $c = ob_get_contents(); ob_end_clean(); rss_invalidate_cache(); return $what . "#@#" . $c; }
/** * Assigns variables to the template engine. */ public function assignVariables() { // call assignVariables event EventHandler::fireAction($this, 'assignVariables'); // assign variables WCF::getTPL()->assign(array('isRegistered' => WCF::getUser()->userID > 0, 'canAddContest' => WCF::getUser()->getPermission('user.contest.canAddContest'), 'availableClasses' => $this->classList ? $this->classList->getObjects() : array(), 'availableJurys' => $this->juryList ? $this->juryList->getObjects() : array(), 'availableParticipants' => $this->participantList ? $this->participantList->getObjects() : array(), 'availableSponsors' => $this->sponsorList ? $this->sponsorList->getObjects() : array(), 'availablePrices' => $this->priceList ? $this->priceList->getObjects() : array(), 'availableTags' => MODULE_TAGGING ? $this->tagList->getObjects() : array(), 'latestEntries' => $this->latestEntryList ? $this->latestEntryList->getObjects() : array(), 'latestSolutions' => $this->latestSolutionList ? $this->latestSolutionList->getObjects() : array(), 'advertiseParticipant' => $this->advertiseParticipant, 'advertiseSponsor' => $this->advertiseSponsor, 'advertiseJury' => $this->advertiseJury)); }
/** * @see Page::readData() */ public function readData() { parent::readData(); if ($this->classID) { $class = new ContestClass($this->classID); $val = WCF::getLanguage()->get($class->description); if (!empty($val)) { $this->description[] = $val; } } // read entries $this->entryList->sqlLimit = $this->itemsPerPage; $this->entryList->sqlOffset = ($this->pageNo - 1) * $this->itemsPerPage; $this->entryList->readObjects(); // init todo list require_once WCF_DIR . 'lib/data/contest/crew/todo/ContestCrewTodoList.class.php'; $this->todoList = new ContestCrewTodoList(); $this->todoList->readObjects(); // init sidebar $this->sidebar = new ContestSidebar(); // read tags if (MODULE_TAGGING) { $this->tagList->readObjects(); $this->tags = $this->tagList->getObjects(); } }
public function catpage() { //0-based pagination if ($this->f3->get('PARAMS.number') != '') { $pagenumber = $this->f3->get('PARAMS.number') - 1; } else { $pagenumber = 0; } //number of items $catcount = new Item($this->db); $catcount_number = $catcount->catcountByTok($this->f3->get('PARAMS.tok')); $this->f3->set('catcount_number', $catcount_number); $tgs = new Item($this->db); //$catsall = $tgs->all(); //without pagination $catsall = $tgs->loadpagesByTok($pagenumber * $this->f3->get('itemlimit'), $this->f3->get('itemlimit'), $this->f3->get('PARAMS.tok')); $this->f3->set('items', $catsall); //number of items $this->f3->set('itemcount', $catcount_number); //assigne tags to items $tgs = new TagList($this->db); $tgslst = $tgs->getCatTags($this->f3->get('PARAMS.tok')); $tgsarray = array(); $j = 0; foreach ($tgslst as $i) { $tgsarray[$i['itok']][$j]['tok'] = $i['tok']; $tgsarray[$i['itok']][$j]['url'] = $i['url']; $tgsarray[$i['itok']][$j]['label'] = $i['label']; $j++; } $this->f3->set('tgsarray', $tgsarray); $this->f3->set('tgs', $tgslst); $this->f3->set('header', 'Tag List'); $this->f3->set('view', 'item/list.htm'); $this->f3->set('catmenu', $this->f3->get('PARAMS.tok')); //get category label $tgsl = new Cat($this->db); $tgsl->getById($this->f3->get('PARAMS.tok')); $this->f3->set('label', $this->f3->get('POST.name')); //menu $this->f3->set('topmenu', 'c'); //pagination $this->f3->set('pagecount', ceil($this->f3->get('itemcount') / $this->f3->get('itemlimit'))); $this->f3->set('page', $pagenumber); $this->f3->set('pagemodule', 'c/' . $this->f3->get('PARAMS.tok')); //breadcrumbs $this->f3->set('breadcrumb', array(array("url" => '/c', "name" => "Categories"), array("url" => NULL, "name" => $this->f3->get('POST.name')))); }
/** * Display a wildcard in the back end * @return string */ public function generate() { if (TL_MODE == 'BE') { $objTemplate = new BackendTemplate('be_wildcard'); $objTemplate->wildcard = '### TAGCLOUD ###'; return $objTemplate->parse(); } $this->strTemplate = strlen($this->cloud_template) ? $this->cloud_template : $this->strTemplate; $taglist = new TagList(); $taglist->addNamedClass = $this->tag_named_class; if (strlen($this->tag_tagtable)) { $taglist->tagtable = $this->tag_tagtable; } if (strlen($this->tag_tagfield)) { $taglist->tagfield = $this->tag_tagfield; } if (strlen($this->tag_sourcetables)) { $taglist->fortable = deserialize($this->tag_sourcetables, TRUE); } if (strlen($this->tag_topten_number) && $this->tag_topten_number > 0) { $taglist->topnumber = $this->tag_topten_number; } if (strlen($this->tag_maxtags)) { $taglist->maxtags = $this->tag_maxtags; } if (strlen($this->tag_buckets) && $this->tag_buckets > 0) { $taglist->buckets = $this->tag_buckets; } if (strlen($this->pagesource)) { $taglist->pagesource = deserialize($this->pagesource, TRUE); } $this->arrTags = $taglist->getTagList(); if ($this->tag_topten) { $this->arrTopTenTags = $taglist->getTopTenTagList(); } if (strlen(\Input::get('tag')) && $this->tag_related) { $relatedlist = strlen(\Input::get('related')) ? preg_split("/,/", \Input::get('related')) : array(); $this->arrRelated = $taglist->getRelatedTagList(array_merge(array(\Input::get('tag')), $relatedlist)); } if (count($this->arrTags) < 1) { return ''; } $this->toggleTagCloud(); return parent::generate(); }
public function getTagsAndTaglistForIdAndTable($id, $table, $jumpto) { $pageArr = array(); if (strlen($jumpto)) { $objFoundPage = $this->Database->prepare("SELECT id, alias FROM tl_page WHERE id=?")->limit(1)->execute($jumpto); $pageArr = $objFoundPage->numRows ? $objFoundPage->fetchAssoc() : array(); } if (count($pageArr) == 0) { global $objPage; $pageArr = $objPage->row(); } $tags = $this->getTags($id, $table); $taglist = array(); foreach ($tags as $id => $tag) { $strUrl = ampersand($this->generateFrontendUrl($pageArr, $items . '?tag=' . \System::urlencode($tag))); $tags[$id] = '<a href="' . $strUrl . '">' . specialchars($tag) . '</a>'; $taglist[$id] = array('url' => $tags[$id], 'tag' => $tag, 'class' => \TagList::_getTagNameClass($tag)); } return array('tags' => $tags, 'taglist' => $taglist); }
/** * PUT request, we're using it here to mean 'replace the record with' */ public function update($id) { $v = Validator::make(Input::all(), ['name' => 'required|string', 'questions' => 'array', 'taggable' => 'array']); if ($v->fails()) { return Response::json($v->errors(), 400); } $questionnaire = Questionnaire::find($id); if (is_null($questionnaire)) { return Response::json(['error' => 'no such questionnaire found'], 404); } $questionIds = $questionnaire->questions->lists('id'); Question::destroy($questionIds); if (Input::has('questions')) { foreach (Input::get('questions') as $question) { Question::create(['question' => $question, 'questionnaire_id' => $questionnaire->id]); } } $tagListIds = $questionnaire->tagLists->lists('id'); $questionnaire->tagLists()->detach($tagListIds); if (Input::has('taggable')) { foreach (Input::get('taggable') as $tagList) { $T = TagList::firstOrNew(['name' => $tagList['name']]); $questionnaire->tagLists()->save($T); if (!$T->exists) { // it's a new one! $T->save(); } } } $questionnaire->name = Input::get('name'); $questionnaire->touch(); $questionnaire->push(); // if these are modified they won't be shown... $questionnaire->load('tagLists', 'tagLists.tags', 'questions'); return Response::json($this->reformatTagsAndQuestions($questionnaire), 200); }
<?php require_once(dirname(__FILE__)."/include/config_base.php"); require_once(dirname(__FILE__)."/include/inc_taglist_view.php"); $PageNo = 1; if(isset($_SERVER["QUERY_STRING"])) { $tag = trim($_SERVER["QUERY_STRING"]); $tags = explode('/',$tag); $tag = $tags[1]; if(count($tags)>3) $PageNo = intval($tags[2]); } else { $tag = ''; } $tag = ereg_replace("[\r\n\t\"\\'%\r\n\t]",'',urldecode($tag)); if($tag != addslashes($tag)) $tag = ''; if($tag=='') $dlist = new TagList($tag,'tag.htm'); else $dlist = new TagList($tag,'taglist.htm'); $dlist->Display(); ?>
/** * Creates a new ContestTagList object. * * @param Contest $contest * @param array<integer> $languageIDArray */ public function __construct(Contest $contest = null, $languageIDArray = array()) { parent::__construct(array('de.easy-coding.wcf.contest.entry'), $languageIDArray); $this->contest = $contest; }
/** * Generate the widget and return it as string * @return string */ public function generate() { $taglist = new TagList($this->table); $taglist->maxtags = $this->intMaxTags; $tags = $taglist->getTagList(); $list = '<div class="tags"><ul class="cloud">'; foreach ($tags as $tag) { $list .= '<li class="' . $tag['tag_class'] . '">'; $list .= '<a href="javascript:Tag.selectedTag(\'' . $tag['tag_name'] . '\', \'ctrl_' . $this->strId . '\');" title="' . $tag['tag_name'] . ' (' . $tag['tag_count'] . ')' . '">' . $tag['tag_name'] . '</a>'; $list .= '</li> '; } $list .= '</ul></div>'; $value = !$this->blnSubmitInput ? $this->readTags() : $this->varValue; return $list . sprintf('<input type="text" name="%s" id="ctrl_%s" class="tl_text%s" value="%s"%s onfocus="Backend.getScrollOffset();" />', $this->strName, $this->strId, strlen($this->strClass) ? ' ' . $this->strClass : '', specialchars($value), $this->getAttributes()); }
/** * Creates a new BoardTagList object. * * @param integer $boardID * @param array<integer> $languageIDArray */ public function __construct($boardID, $languageIDArray = array()) { parent::__construct(array('com.woltlab.wbb.thread'), $languageIDArray); $this->boardID = $boardID; }
/** * Could be cleverer here..? We're basically ending up with a BIG list of tags * for the questionnaire, and lots of little lists for the interviews. The questionnaire * *should* be able to follow it's relationships through interviews to tags I reckon? * * @param array $list */ protected function saveTagsToQuestionnaire(array $list) { $TagList = TagList::findOrNew($list['id']); $TagList->name = $TagList->name ? $TagList->name : $list['name']; foreach ($list['tagged'] as $tag) { foreach ($TagList->tags as $Existing) { if ($Existing->name === $tag) { continue 2; // don't duplicate tags } } $TagList->tags()->save(Tag::create(['name' => $tag, 'tag_list_id' => $TagList->id])); } $TagList->save(); }
public function update() { $item = new Item($this->db); if ($this->f3->exists('POST.update')) { $item->edit($this->f3->get('POST.tok')); //get id getIdByTok $getIdByTok = new Item($this->db); $getIdByTok->getIdByTok($this->f3->get('POST.tok')); $iid = $this->f3->get('ID.id'); //del tags $tgs = new Tag2Item($this->db); $tgs->getByItemId($iid); if (count($tgs->getByItemId($iid)) > 0) { foreach ($tgs->getByItemId($iid) as $t) { $itemid = $t['id']; $delti = new Tag2Item($this->db); $delti->delete($itemid); } } //update tags $tags = explode(',', $this->f3->get('POST.tags')); foreach ($tags as $t) { $t = trim($t); if ($t != '') { $this->f3->clear('TAGS'); $ifexists = new Tag($this->db); $ifexists->getByName(strtolower($t)); if ($this->f3->exists('TAGS.id')) { $tid = $this->f3->get('TAGS.id'); } else { //insert new tag $newtag = new Tag($this->db); $newtag->title = strtolower(preg_replace('|[^0-9a-z \\-\\/+]|', '', $t)); $newtag->label = preg_replace('|[^0-9A-Za-z \\-\\/+]|', '', $t); $newtag->url = toUrl($t); //get unique tok $utok = new Tag($this->db); $randtok = rand(100000000, 999999999); while ($utok->tagcountByTok($randtok) > 0) { $randtok = rand(100000000, 999999999); } $newtag->tok = $randtok; $newtag->add(); $tid = $newtag->_id; } //add to Tag2Item $t2i = new Tag2Item($this->db); //insert lastinsertedid $t2i->tid = $tid; $t2i->iid = $iid; $t2i->add(); } } $this->f3->set('COOKIE.message', 'The bookmark has been successfully saved!'); $this->f3->set('COOKIE.messagetype', 'alert-success hide5s'); $this->f3->reroute('/'); } else { $item->getById($this->f3->get('PARAMS.tok')); $this->f3->set('item', $item); $this->f3->set('active', $this->f3->get('PARAMS.tok')); $this->f3->set('page_head', 'Update Item'); //template $this->f3->set('view', 'item/update.htm'); $tgs = new TagList($this->db); $this->f3->set('tgs', $tgs->getitemtags($this->f3->get('POST.tok'))); $this->f3->set('ctrcount', count($tgs->getitemtags($this->f3->get('POST.tok')))); //menu $this->f3->set('topmenu', 'i'); //breadcrumbs $this->f3->set('breadcrumb', array(array("url" => NULL, "name" => "Update bookmark"))); } }
public function tagpage() { //0-based pagination if ($this->f3->get('PARAMS.number') != '') { $pagenumber = $this->f3->get('PARAMS.number') - 1; } else { $pagenumber = 0; } $tgsc = new ItemsTag($this->db); $tgscount = $tgsc->tagcount($this->f3->get('PARAMS.tok')); //load items list $tgs = new ItemsTag($this->db); $tgsitems = $tgs->loadtagpages($this->f3->get('PARAMS.tok'), $pagenumber * $this->f3->get('onetaglimit'), $this->f3->get('onetaglimit')); $this->f3->set('its', $tgsitems); $this->f3->set('header', 'Item List'); //load tags $tgsl = new ItemsTag($this->db); $tgsl->getitems($this->f3->get('PARAMS.tok')); $this->f3->set('label', $this->f3->get('POST.label')); //template $this->f3->set('view', 'tags/items.htm'); //number of items $this->f3->set('onetagcount', $tgscount); //assigne tags to items $tgs = new TagList($this->db); $tgslst = $tgs->gettags(); $tgsarray = array(); $j = 0; foreach ($tgslst as $i) { $tgsarray[$i['itok']][$j]['tok'] = $i['tok']; $tgsarray[$i['itok']][$j]['url'] = $i['url']; $tgsarray[$i['itok']][$j]['label'] = $i['label']; $j++; } $this->f3->set('tgsarray', $tgsarray); $this->f3->set('tgs', $tgslst); //menu $this->f3->set('topmenu', 't'); //pagination $this->f3->set('pagecount', ceil($this->f3->get('onetagcount') / $this->f3->get('onetaglimit'))); $this->f3->set('page', $pagenumber); $this->f3->set('pagemodule', 't/' . $this->f3->get('PARAMS.tok')); //breadcrumbs $this->f3->set('breadcrumb', array(array("url" => "/t", "name" => "Tags"), array("url" => NULL, "name" => $this->f3->get('POST.label')))); }