/** * Update the session and return the template * * @param $mode (type string) 'add', 'ban' or 'remove' * 'add' => add article to the book * 'ban' => ban article from the proposals * 'remove' => remove article from the book * 'addNum' => (type int) add the first $param articles to the collection * 'addVal' => (type float) add all propossals to the collection with * a value higher then $param * @param $param (type string) name of the article to be added, banned or removed * or a number of articles to add or a value (1 - 1.5) all articles with a * higher value will be added to the collection * @return the template for the wikipage */ private static function getCollectionSuggestTemplate($mode, $param) { global $wgCollectionMaxSuggestions; switch ($mode) { case 'add': SpecialCollection::addArticleFromName(NS_MAIN, $param); self::unban($param); break; case 'ban': $_SESSION['wsCollectionSuggestBan'][] = $param; break; case 'remove': SpecialCollection::removeArticleFromName(NS_MAIN, $param); $_SESSION['wsCollectionSuggestBan'][] = $param; break; case 'removeonly': // remove w/out banning (for undo) SpecialCollection::removeArticleFromName(NS_MAIN, $param); break; case 'unban': // for undo self::unban($param); break; } $template = new CollectionSuggestTemplate(); $proposals = new Proposals($_SESSION['wsCollection'], $_SESSION['wsCollectionSuggestBan'], $_SESSION['wsCollectionSuggestProp']); if ($mode == 'addAll') { self::addArticlesFromName($param, $proposals); } $template->set('collection', $_SESSION['wsCollection']); $template->set('proposals', $proposals->getProposals($wgCollectionMaxSuggestions)); $template->set('hasbans', $proposals->hasBans()); $template->set('num_pages', CollectionSession::countArticles()); $_SESSION['wsCollectionSuggestProp'] = $proposals->getLinkList(); return $template; }
function wfAjaxCollectionRemoveArticle($namespace = 0, $title = '', $oldid = '') { SpecialCollection::removeArticleFromName($namespace, $title, $oldid); return wfAjaxCollectionGetItemList(); }