本文整理汇总了PHP中ItemList类的典型用法代码示例。如果您正苦于以下问题:PHP ItemList类的具体用法?PHP ItemList怎么用?PHP ItemList使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ItemList类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: toListLinks
public function toListLinks($collection, $key, $route, ...$route_params)
{
$list = new ItemList($collection, $key);
$list->setRoute($route);
$list->setRouteParams($route_params);
return (string) $list->links();
}
开发者ID:ngangchill,项目名称:templater,代码行数:7,代码来源:Format.php
示例2: PageHome
function PageHome(&$skeleton)
{
$articles = Entities::retrieveGroupedEntities(ARTICLES);
$itemlist = new ItemList($skeleton);
$itemlist->setBorders(array('top' => '-', 'bottom' => '-', 'left' => '+', 'right' => '+'));
$ascii_article = new Article($skeleton, current($articles));
$skeleton->addWidget($ascii_article);
$count = 0;
while ($article = next($articles)) {
++$count;
$text = "";
$text .= "[url=";
$text .= Common::urlFor('view_article', array('token' => $article->getToken())) . ']';
$text .= "[b]" . $article->getCategory() . "[/b]";
$text .= "/" . $article->getTitle() . '[/url]';
$text .= " (" . $article->getDate() . ")";
if ($count < count($articles) - 1) {
$text .= "\n";
}
$itemlist->setText($text);
}
if ($count > 0) {
$skeleton->addWidget($itemlist);
}
}
开发者ID:aimxhaisse,项目名称:kenavo,代码行数:25,代码来源:PageHome.php
示例3: test
function test()
{
global $apiContext;
// IncludeConfig('paypal/bootstrap.php');
$payer = new Payer();
$payer->setPaymentMethod("paypal");
$item1 = new Item();
$item1->setName('Ground Coffee 40 oz')->setCurrency('USD')->setQuantity(1)->setPrice(7.5);
$item2 = new Item();
$item2->setName('Granola bars')->setCurrency('USD')->setQuantity(5)->setPrice(2);
$itemList = new ItemList();
$itemList->setItems(array($item1, $item2));
$details = new Details();
$details->setShipping(1.2)->setTax(1.3)->setSubtotal(17.5);
$amount = new Amount();
$amount->setCurrency("USD")->setTotal(20)->setDetails($details);
$transaction = new Transaction();
$transaction->setAmount($amount)->setItemList($itemList)->setDescription("Payment description")->setInvoiceNumber(uniqid());
$baseUrl = getBaseUrl();
$redirectUrls = new RedirectUrls();
$redirectUrls->setReturnUrl("{$baseUrl}/donate.php/execute_payment_test?success=true")->setCancelUrl("{$baseUrl}/donate.php/execute_payment_test?success=false");
$payment = new Payment();
$payment->setIntent("sale")->setPayer($payer)->setRedirectUrls($redirectUrls)->setTransactions(array($transaction));
$request = clone $payment;
try {
$payment->create($apiContext);
} catch (Exception $ex) {
ResultPrinter::printError("Created Payment Using PayPal. Please visit the URL to Approve.", "Payment", null, $request, $ex);
exit(1);
}
$approvalUrl = $payment->getApprovalLink();
ResultPrinter::printResult("Created Payment Using PayPal. Please visit the URL to Approve.", "Payment", "<a href='{$approvalUrl}' >{$approvalUrl}</a>", $request, $payment);
return $payment;
}
开发者ID:kayecandy,项目名称:secudev,代码行数:34,代码来源:donate.php
示例4: PageStat
function PageStat(&$skeleton)
{
$itemlist = new ItemList($skeleton);
$db = Stat::loadDb();
$itemlist->setBorders(array('top' => '-', 'bottom' => '-', 'left' => '+', 'right' => '+'));
$itemlist->setText("Number of page viewed: " . $db['total_pages']);
$skeleton->addWidget($itemlist);
}
开发者ID:aimxhaisse,项目名称:kenavo,代码行数:8,代码来源:PageStat.php
示例5: fromArray
/**
* @static
*
* @param array $items
*
* @return \Math\StatIndex\ItemList
*/
public static function fromArray(array $items)
{
$list = new ItemList();
foreach ($items as $name => $item) {
$importance = isset($item['importance']) ? floatval($item['importance']) : 1.0;
$list->addItem(new Item((string) $name, $item['value'], $item['quantity'], $importance));
}
return $list;
}
开发者ID:jmcastagnetto,项目名称:Math_StatIndex,代码行数:16,代码来源:ItemList.php
示例6: testVolumeUtilisation
function testVolumeUtilisation()
{
$box = new TestBox('Box', 10, 10, 10, 10, 10, 10, 10, 10);
$item = new TestItem('Item', 5, 10, 10, 10);
$boxItems = new ItemList();
$boxItems->insert($item);
$packedBox = new PackedBox($box, $boxItems, 1, 2, 3, 4);
self::assertEquals(50, $packedBox->getVolumeUtilisation());
}
开发者ID:adallaway,项目名称:BoxPacker,代码行数:9,代码来源:PackedBoxTest.php
示例7: testWeightVariance
function testWeightVariance()
{
$box = new TestBox('Box', 10, 10, 10, 10, 10, 10, 10, 10);
$item = new TestItem('Item', 5, 10, 10, 10, true);
$boxItems = new ItemList();
$boxItems->insert($item);
$packedBox = new PackedBox($box, $boxItems, 1, 2, 3, 4);
$packedBoxList = new PackedBoxList();
$packedBoxList->insert($packedBox);
self::assertEquals(0, $packedBoxList->getWeightVariance());
}
开发者ID:dvdoug,项目名称:boxpacker,代码行数:11,代码来源:PackedBoxListTest.php
示例8: setCurrentAndReferenceData
/**
* @param \Math\StatIndex\ItemList $current
* @param \Math\StatIndex\ItemList $reference
*
* @return bool
* @throws \Math\StatIndex\StatIndexException
*/
public function setCurrentAndReferenceData(ItemList $current, ItemList $reference)
{
// validate lists
$sizeCheck = $current->size() === $reference->size();
$diff = array_diff($current->getItemsNames(), $reference->getItemsNames());
$namesCheck = empty($diff);
$this->_validData = $sizeCheck && $namesCheck;
$this->validData();
// raise an exception if something is amiss
$this->_indexes = array();
$this->_currList = $current;
$this->_itemNames = $current->getItemsNames();
$this->_refList = $reference;
return $this->_validData;
}
开发者ID:jmcastagnetto,项目名称:Math_StatIndex,代码行数:22,代码来源:Index.php
示例9: SearchArticles
function SearchArticles($pattern, $skeleton)
{
$matches = 0;
$articles = Entities::retrieveGroupedEntities(ARTICLES);
$itemlist = new ItemList($skeleton);
foreach ($articles as $article) {
if (stristr($article->getContent(), $pattern)) {
++$matches;
$link = Common::urlFor('view_article', array('token' => $article->getToken()));
$itemlist->setText('<a href="' . $link . '">' . $article->getTitle() . '</a>');
}
}
$skeleton->addWidget($itemlist);
return $matches;
}
开发者ID:aimxhaisse,项目名称:kenavo,代码行数:15,代码来源:PageSearch.php
示例10: __exp__getFeedContent
function __exp__getFeedContent($cid)
{
$cid = sanitize($cid, RSS_SANITIZER_NUMERIC);
ob_start();
rss_require('cls/items.php');
$readItems = new ItemList();
$readItems->populate(" not(i.unread & " . RSS_MODE_UNREAD_STATE . ") and i.cid= {$cid}", "", 0, 2, ITEM_SORT_HINT_READ);
$readItems->setTitle(__('Recent items'));
$readItems->setRenderOptions(IL_TITLE_NO_ESCAPE);
foreach ($readItems->feeds[0]->items as $item) {
$item->render();
}
$c = ob_get_contents();
ob_end_clean();
return "{$cid}|@|{$c}";
}
开发者ID:nerdling,项目名称:gregarius,代码行数:16,代码来源:ajax.php
示例11: testWeightRedistribution
public function testWeightRedistribution()
{
$box = new TestBox('Box', 370, 375, 60, 140, 364, 374, 40, 3000);
$boxList = new BoxList();
$boxList->insert($box);
$item1 = new TestItem('Item #1', 230, 330, 6, 320, true);
$item2 = new TestItem('Item #2', 210, 297, 5, 187, true);
$item3 = new TestItem('Item #3', 210, 297, 11, 674, true);
$item4 = new TestItem('Item #4', 210, 297, 3, 82, true);
$item5 = new TestItem('Item #5', 206, 295, 4, 217, true);
$box1Items = new ItemList();
$box1Items->insert(clone $item1);
$box1Items->insert(clone $item1);
$box1Items->insert(clone $item1);
$box1Items->insert(clone $item1);
$box1Items->insert(clone $item1);
$box1Items->insert(clone $item1);
$box1Items->insert(clone $item5);
$box2Items = new ItemList();
$box2Items->insert(clone $item3);
$box2Items->insert(clone $item1);
$box2Items->insert(clone $item1);
$box2Items->insert(clone $item1);
$box2Items->insert(clone $item1);
$box2Items->insert(clone $item2);
$box3Items = new ItemList();
$box3Items->insert(clone $item5);
$box3Items->insert(clone $item4);
$packedBox1 = new PackedBox($box, $box1Items, 0, 0, 0, 0);
$packedBox2 = new PackedBox($box, $box2Items, 0, 0, 0, 0);
$packedBox3 = new PackedBox($box, $box3Items, 0, 0, 0, 0);
$packedBoxList = new PackedBoxList();
$packedBoxList->insert($packedBox1);
$packedBoxList->insert($packedBox2);
$packedBoxList->insert($packedBox3);
$redistributor = new WeightRedistributor($boxList);
$packedBoxes = $redistributor->redistributeWeight($packedBoxList);
$packedItemCount = 0;
foreach (clone $packedBoxes as $packedBox) {
$packedItemCount += $packedBox->getItems()->count();
}
self::assertEquals(3070, (int) $packedBoxes->getWeightVariance());
}
开发者ID:dvdoug,项目名称:boxpacker,代码行数:43,代码来源:WeightRedistributorTest.php
示例12: getCMSFields
public function getCMSFields()
{
$fields = parent::getCMSFields();
$field = DropdownField::create('ItemListID', 'Item list to display', ItemList::get()->map()->toArray())->setEmptyString('--choose list--');
$fields->addFieldToTab('Root.Main', $field, 'Content');
if ($this->hasField('TemplateID')) {
$fields->addFieldToTab('Root.Main', $df = DropdownField::create('TemplateID', 'Template for rendering items', UserTemplate::get()->map()->toArray()), 'Content');
$df->setEmptyString('--template--');
}
return $fields;
}
开发者ID:helpfulrobot,项目名称:silverstripe-australia-frontend-objects,代码行数:11,代码来源:ItemListPage.php
示例13: generateContent
protected function generateContent()
{
// add conditional js
$this->addJS('?data=weight-presets.gems.enchants.itemsets&locale=' . User::$localeId . '&t=' . $_SESSION['dataKey']);
if (!$this->compareString) {
return;
}
$sets = explode(';', $this->compareString);
$items = $outSet = [];
foreach ($sets as $set) {
$itemSting = explode(':', $set);
$outString = [];
foreach ($itemSting as $substring) {
$params = explode('.', $substring);
$items[] = (int) $params[0];
while (sizeof($params) < 7) {
$params[] = 0;
}
$outString[] = $params;
}
$outSet[] = $outString;
}
$this->summary = $outSet;
$iList = new ItemList(array(['i.id', $items]));
$data = $iList->getListviewData(ITEMINFO_SUBITEMS | ITEMINFO_JSON);
foreach ($iList->iterate() as $itemId => $__) {
if (empty($data[$itemId])) {
continue;
}
$this->cmpItems[] = [$itemId, $iList->getField('name', true), $iList->getField('quality'), $iList->getField('iconString'), $data[$itemId]];
}
}
开发者ID:Carbenium,项目名称:aowow,代码行数:32,代码来源:compare.php
示例14: availablePlugins
/**
* Display the list of available plugins on the file system
*/
public function availablePlugins()
{
$plugins = Plugin::getAll(false, true);
$api = new HawkApi();
try {
$updates = $api->getPluginsAvailableUpdates(array_map(function ($plugin) {
return $plugin->getDefinition('version');
}, $plugins));
} catch (\Hawk\HawkApiException $e) {
$updates = array();
}
$list = new ItemList(array('id' => 'available-plugins-list', 'reference' => 'name', 'action' => App::router()->getUri('plugins-list'), 'data' => $plugins, 'controls' => array(array('icon' => 'plus', 'class' => 'btn-success', 'label' => Lang::get($this->_plugin . '.new-plugin-btn'), 'href' => App::router()->getUri('create-plugin'), 'target' => 'dialog')), 'fields' => array('controls' => array('display' => function ($value, $field, $plugin) use($updates) {
$buttons = array();
$installer = $plugin->getInstallerInstance();
if (!$plugin->isInstalled()) {
// the plugin is not installed
$buttons = array(ButtonInput::create(array('title' => Lang::get($this->_plugin . '.install-plugin-button'), 'icon' => 'upload', 'class' => 'install-plugin', 'href' => App::router()->getUri('install-plugin', array('plugin' => $plugin->getName())))), !$plugin->isMandatoryDependency() ? ButtonInput::create(array('title' => Lang::get($this->_plugin . '.delete-plugin-button'), 'icon' => 'trash', 'class' => 'btn-danger delete-plugin', 'href' => App::router()->getUri('delete-plugin', array('plugin' => $plugin->getName())))) : '');
$status = Lang::get($this->_plugin . '.plugin-uninstalled-status');
} else {
if (!$plugin->isActive()) {
// The plugin is installed but not activated
$buttons = array(ButtonInput::create(array('title' => Lang::get($this->_plugin . '.activate-plugin-button'), 'class' => 'btn-success activate-plugin', 'icon' => 'check', 'href' => App::router()->getUri('activate-plugin', array('plugin' => $plugin->getName())))), method_exists($installer, 'settings') ? ButtonInput::create(array('icon' => 'cogs', 'title' => Lang::get($this->_plugin . '.plugin-settings-button'), 'href' => App::router()->getUri('plugin-settings', array('plugin' => $plugin->getName())), 'target' => 'dialog', 'class' => 'btn-info')) : '', !$plugin->isMandatoryDependency() ? ButtonInput::create(array('title' => Lang::get($this->_plugin . '.uninstall-plugin-button'), 'class' => 'btn-danger uninstall-plugin', 'icon' => 'chain-broken', 'href' => App::router()->getUri('uninstall-plugin', array('plugin' => $plugin->getName())))) : '');
$status = Lang::get($this->_plugin . '.plugin-inactive-status');
} else {
// The plugin is installed and active
$buttons = array(method_exists($installer, 'settings') ? ButtonInput::create(array('icon' => 'cogs', 'title' => Lang::get($this->_plugin . '.plugin-settings-button'), 'href' => App::router()->getUri('plugin-settings', array('plugin' => $plugin->getName())), 'target' => 'dialog', 'class' => 'btn-info')) : '', ButtonInput::create(array('title' => Lang::get($this->_plugin . '.deactivate-plugin-button'), 'class' => 'btn-warning deactivate-plugin', 'icon' => 'ban', 'href' => App::router()->getUri('deactivate-plugin', array('plugin' => $plugin->getName())))));
$status = Lang::get($this->_plugin . '.plugin-active-status');
}
}
if (isset($updates[$plugin->getName()])) {
array_unshift($buttons, ButtonInput::create(array('icon' => 'refresh', 'class' => 'btn-info update-plugin', 'title' => Lang::get($this->_plugin . '.update-plugin-button'), 'href' => App::router()->getUri('update-plugin', array('plugin' => $plugin->getName())))));
}
return View::make(Plugin::current()->getView('plugin-list-controls.tpl'), array('plugin' => $plugin, 'status' => $status, 'buttons' => $buttons));
}, 'label' => Lang::get($this->_plugin . '.plugins-list-controls-label'), 'search' => false, 'sort' => false), 'description' => array('search' => false, 'sort' => false, 'label' => Lang::get($this->_plugin . '.plugins-list-description-label'), 'display' => function ($value, $field, $plugin) {
return View::make(Plugin::current()->getView("plugin-list-description.tpl"), $plugin->getDefinition());
}))));
return $list->display();
}
开发者ID:elvyrra,项目名称:hawk,代码行数:41,代码来源:PluginController.php
示例15: testCompare
function testCompare()
{
$box1 = new TestItem('Small', 20, 20, 2, 100, true);
$box2 = new TestItem('Large', 200, 200, 20, 1000, true);
$box3 = new TestItem('Medium', 100, 100, 10, 500, true);
$list = new ItemList();
$list->insert($box1);
$list->insert($box2);
$list->insert($box3);
$sorted = [];
while (!$list->isEmpty()) {
$sorted[] = $list->extract();
}
self::assertEquals(array($box2, $box3, $box1), $sorted);
}
开发者ID:dvdoug,项目名称:boxpacker,代码行数:15,代码来源:ItemListTest.php
示例16: generateContent
//.........这里部分代码省略.........
}
if ($this->difficulties[1] == $id) {
if (!$this->difficulties[2] && !$this->difficulties[3]) {
$d['modes']['mode'] |= 0x1;
} else {
$d['modes']['mode'] |= 0x10;
}
}
if ($this->difficulties[2] == $id) {
// b0100000
$d['modes']['mode'] |= 0x20;
}
if ($this->difficulties[3] == $id) {
// b1000000
$d['modes']['mode'] |= 0x40;
}
}
}
if (!$saSpells->hasSetFields(['skillLines'])) {
$saH = "\$['skill']";
}
$this->lvTabs[] = array('file' => 'spell', 'data' => $data, 'params' => array('id' => 'see-also', 'name' => '$LANG.tab_seealso', 'visibleCols' => "\$['level']", 'extraCols' => isset($saE) ? $saE : null, 'hiddenCols' => isset($saH) ? $saH : null));
$this->extendGlobalData($saSpells->getJSGlobals(GLOBALINFO_SELF | GLOBALINFO_RELATED));
}
// tab: used by - itemset
$conditions = array('OR', ['spell1', $this->subject->id], ['spell2', $this->subject->id], ['spell3', $this->subject->id], ['spell4', $this->subject->id], ['spell5', $this->subject->id], ['spell6', $this->subject->id], ['spell7', $this->subject->id], ['spell8', $this->subject->id]);
$ubSets = new ItemsetList($conditions);
if (!$ubSets->error) {
$this->lvTabs[] = array('file' => 'itemset', 'data' => $ubSets->getListviewData(), 'params' => array('id' => 'used-by-itemset', 'name' => '$LANG.tab_usedby'));
$this->extendGlobalData($ubSets->getJSGlobals(GLOBALINFO_SELF | GLOBALINFO_RELATED));
}
// tab: used by - item
$conditions = array('OR', ['AND', ['spellTrigger1', 6, '!'], ['spellId1', $this->subject->id]], ['AND', ['spellTrigger2', 6, '!'], ['spellId2', $this->subject->id]], ['AND', ['spellTrigger3', 6, '!'], ['spellId3', $this->subject->id]], ['AND', ['spellTrigger4', 6, '!'], ['spellId4', $this->subject->id]], ['AND', ['spellTrigger5', 6, '!'], ['spellId5', $this->subject->id]]);
$ubItems = new ItemList($conditions);
if (!$ubItems->error) {
$this->lvTabs[] = array('file' => 'item', 'data' => $ubItems->getListviewData(), 'params' => array('id' => 'used-by-item', 'name' => '$LANG.tab_usedby'));
$this->extendGlobalData($ubItems->getJSGlobals(GLOBALINFO_SELF));
}
// tab: used by - object
$conditions = array('OR', ['onUseSpell', $this->subject->id], ['onSuccessSpell', $this->subject->id], ['auraSpell', $this->subject->id], ['triggeredSpell', $this->subject->id]);
$ubObjects = new GameObjectList($conditions);
if (!$ubObjects->error) {
$this->lvTabs[] = array('file' => 'object', 'data' => $ubObjects->getListviewData(), 'params' => array('id' => 'used-by-object', 'name' => '$LANG.tab_usedby'));
$this->extendGlobalData($ubObjects->getJSGlobals());
}
// tab: criteria of
$conditions = array(['ac.type', [ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET2, ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL, ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL2, ACHIEVEMENT_CRITERIA_TYPE_LEARN_SPELL]], ['ac.value1', $this->typeId]);
$coAchievemnts = new AchievementList($conditions);
if (!$coAchievemnts->error) {
$this->lvTabs[] = array('file' => 'achievement', 'data' => $coAchievemnts->getListviewData(), 'params' => array('id' => 'criteria-of', 'name' => '$LANG.tab_criteriaof'));
$this->extendGlobalData($coAchievemnts->getJSGlobals(GLOBALINFO_SELF | GLOBALINFO_RELATED));
}
// tab: contains
// spell_loot_template & skill_extra_item_template
$extraItem = DB::World()->selectRow('SELECT * FROM skill_extra_item_template WHERE spellid = ?d', $this->subject->id);
$spellLoot = new Loot();
if ($spellLoot->getByContainer(LOOT_SPELL, $this->subject->id) || $extraItem) {
$this->extendGlobalData($spellLoot->jsGlobals);
$lv = $spellLoot->getResult();
$extraCols = $spellLoot->extraCols;
$extraCols[] = 'Listview.extraCols.percent';
if ($extraItem && $this->subject->canCreateItem()) {
$foo = $this->subject->relItems->getListviewData();
for ($i = 1; $i < 4; $i++) {
if (($bar = $this->subject->getField('effect' . $i . 'CreateItemId')) && isset($foo[$bar])) {
$lv[$bar] = $foo[$bar];
开发者ID:Niknox,项目名称:aowow,代码行数:67,代码来源:spell.php
示例17: getLocks
public static function getLocks($lockId, $interactive = false)
{
$locks = [];
$lock = DB::Aowow()->selectRow('SELECT * FROM ?_lock WHERE id = ?d', $lockId);
if (!$lock) {
return $locks;
}
for ($i = 1; $i <= 5; $i++) {
$prop = $lock['properties' . $i];
$rank = $lock['reqSkill' . $i];
$name = '';
if ($lock['type' . $i] == 1) {
$name = ItemList::getName($prop);
if (!$name) {
continue;
}
if ($interactive) {
$name = '<a class="q1" href="?item=' . $prop . '">' . $name . '</a>';
}
} else {
if ($lock['type' . $i] == 2) {
// exclude unusual stuff
if (!in_array($prop, [1, 2, 3, 4, 9, 16, 20])) {
continue;
}
$name = self::spell('lockType', $prop);
if (!$name) {
continue;
}
if ($interactive) {
$skill = 0;
switch ($prop) {
case 1:
$skill = 633;
break;
// Lockpicking
// Lockpicking
case 2:
$skill = 182;
break;
// Herbing
// Herbing
case 3:
$skill = 186;
break;
// Mining
// Mining
case 20:
$skill = 773;
break;
// Scribing
}
if ($skill) {
$name = '<a href="?skill=' . $skill . '">' . $name . '</a>';
}
}
if ($rank > 0) {
$name .= ' (' . $rank . ')';
}
} else {
continue;
}
}
$locks[$lock['type' . $i] == 1 ? $prop : -$prop] = sprintf(self::game('requires'), $name);
}
return $locks;
}
开发者ID:saqar,项目名称:aowow,代码行数:67,代码来源:lang.class.php
示例18: trim
# more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA or visit
# http://www.gnu.org/licenses/gpl.html
#
###############################################################################
# E-mail: mbonetti at gmail dot com
# Web page: http://gregarius.net/
#
###############################################################################
require_once 'init.php';
$a = trim(sanitize($_REQUEST['author'], RSS_SANITIZER_WORDS));
$sql = "select distinct(author) from " . getTable('item') . " where author like '%{$a}'";
list($ra) = rss_fetch_row(rss_query($sql));
if (!$ra) {
rss_404();
exit;
}
$t = ucfirst(__('items')) . " " . __(' by ') . " " . $ra;
$GLOBALS['rss']->header = new Header($t);
$GLOBALS['rss']->feedList = new FeedList(false);
$authorItems = new ItemList();
$sqlWhere = " i.author like '%{$a}' ";
$numItems = getConfig('rss.output.frontpage.numitems');
$authorItems->populate($sqlWhere, "", 0, $numItems);
$authorItems->setTitle($t);
$authorItems->setRenderOptions(IL_NO_COLLAPSE | IL_TITLE_NO_ESCAPE);
$GLOBALS['rss']->appendContentObject($authorItems);
$GLOBALS['rss']->renderWithTemplate('index.php', 'items');
开发者ID:jphpsf,项目名称:gregarius,代码行数:31,代码来源:author.php
示例19: generateContent
protected function generateContent()
{
/****************/
/* Main Content */
/****************/
$this->headIcons = [$this->subject->getField('iconString')];
$this->redButtons = array(BUTTON_WOWHEAD => true, BUTTON_LINKS => true);
if ($_ = $this->subject->getField('description', true)) {
$this->extraText = $_;
}
/**************/
/* Extra Tabs */
/**************/
if (in_array($this->cat, [-5, 9, 11])) {
// tab: recipes [spells] (crafted)
$condition = array(['OR', ['s.reagent1', 0, '>'], ['s.reagent2', 0, '>'], ['s.reagent3', 0, '>'], ['s.reagent4', 0, '>'], ['s.reagent5', 0, '>'], ['s.reagent6', 0, '>'], ['s.reagent7', 0, '>'], ['s.reagent8', 0, '>']], ['OR', ['s.skillLine1', $this->typeId], ['AND', ['s.skillLine1', 0, '>'], ['s.skillLine2OrMask', $this->typeId]]], CFG_SQL_LIMIT_NONE);
$recipes = new SpellList($condition);
// also relevant for 3
if (!$recipes->error) {
$this->extendGlobalData($recipes->getJSGlobals(GLOBALINFO_SELF | GLOBALINFO_RELATED));
$this->lvTabs[] = array('file' => 'spell', 'data' => $recipes->getListviewData(), 'params' => array('id' => 'recipes', 'name' => '$LANG.tab_recipes', 'visibleCols' => "\$['reagents', 'source']", 'note' => sprintf(Util::$filterResultString, '?spells=' . $this->cat . '.' . $this->typeId . '&filter=cr=20;crs=1;crv=0')));
}
// tab: recipe Items [items] (Books)
$filterRecipe = [null, 165, 197, 202, 164, 185, 171, 129, 333, 356, 755, 773, 186, 182];
$conditions = array(['requiredSkill', $this->typeId], ['class', ITEM_CLASS_RECIPE], CFG_SQL_LIMIT_NONE);
$recipeItems = new ItemList($conditions);
if (!$recipeItems->error) {
$this->extendGlobalData($recipeItems->getJSGlobals(GLOBALINFO_SELF));
if ($_ = array_search($this->typeId, $filterRecipe)) {
$_ = sprintf(Util::$filterResultString, "?items=9." . $_);
}
$this->lvTabs[] = array('file' => 'item', 'data' => $recipeItems->getListviewData(), 'params' => array('id' => 'recipe-items', 'name' => '$LANG.tab_recipeitems', 'note' => $_));
}
// tab: crafted items [items]
$filterItem = [null, 171, 164, 185, 333, 202, 129, 755, 165, 186, 197, null, null, 356, 182, 773];
$created = [];
foreach ($recipes->iterate() as $__) {
if ($idx = $recipes->canCreateItem()) {
foreach ($idx as $i) {
$created[] = $recipes->getField('effect' . $i . 'CreateItemId');
}
}
}
if ($created) {
$created = new ItemList(array(['i.id', $created], CFG_SQL_LIMIT_NONE));
if (!$created->error) {
$this->extendGlobalData($created->getJSGlobals(GLOBALINFO_SELF));
if ($_ = array_search($this->typeId, $filterItem)) {
$_ = sprintf(Util::$filterResultString, "?items&filter=cr=86;crs=" . $_ . ";crv=0");
}
$this->lvTabs[] = array('file' => 'item', 'data' => $created->getListviewData(), 'params' => array('id' => 'crafted-items', 'name' => '$LANG.tab_crafteditems', 'note' => $_));
}
}
// tab: required by [item]
$conditions = array(['requiredSkill', $this->typeId], ['class', ITEM_CLASS_RECIPE, '!'], CFG_SQL_LIMIT_NONE);
$reqBy = new ItemList($conditions);
if (!$reqBy->error) {
$this->extendGlobalData($reqBy->getJSGlobals(GLOBALINFO_SELF));
if ($_ = array_search($this->typeId, $filterItem)) {
$_ = sprintf(Util::$filterResultString, "?items&filter=cr=99:168;crs=" . $_ . ":2;crv=0:0");
}
$this->lvTabs[] = array('file' => 'item', 'data' => $reqBy->getListviewData(), 'params' => array('id' => 'required-by', 'name' => '$LANG.tab_requiredby', 'note' => $_));
}
// tab: required by [itemset]
$conditions = array(['skillId', $this->typeId], CFG_SQL_LIMIT_NONE);
$reqBy = new ItemsetList($conditions);
if (!$reqBy->error) {
$this->extendGlobalData($reqBy->getJSGlobals(GLOBALINFO_SELF));
$this->lvTabs[] = array('file' => 'itemset', 'data' => $reqBy->getListviewData(), 'params' => array('id' => 'required-by-set', 'name' => '$LANG.tab_requiredby'));
}
}
// tab: spells [spells] (exclude first tab)
$reqClass = 0x0;
$reqRace = 0x0;
$condition = array(['AND', ['s.reagent1', 0], ['s.reagent2', 0], ['s.reagent3', 0], ['s.reagent4', 0], ['s.reagent5', 0], ['s.reagent6', 0], ['s.reagent7', 0], ['s.reagent8', 0]], ['OR', ['s.skillLine1', $this->typeId], ['AND', ['s.skillLine1', 0, '>'], ['s.skillLine2OrMask', $this->typeId]]], CFG_SQL_LIMIT_NONE);
foreach (Util::$skillLineMask as $line1 => $sets) {
foreach ($sets as $idx => $set) {
if ($set[1] == $this->typeId) {
$condition[1][] = array('AND', ['s.skillLine1', $line1], ['s.skillLine2OrMask', 1 << $idx, '&']);
break 2;
}
}
}
$spells = new SpellList($condition);
if (!$spells->error) {
foreach ($spells->iterate() as $__) {
$reqClass |= $spells->getField('reqClassMask');
$reqRace |= $spells->getField('reqRaceMask');
}
$this->extendGlobalData($spells->getJSGlobals(GLOBALINFO_SELF));
$lv = array('file' => 'spell', 'data' => $spells->getListviewData(), 'params' => ['visibleCols' => "\$['source']"]);
switch ($this->cat) {
case -4:
$lv['params']['note'] = sprintf(Util::$filterResultString, '?spells=-4');
break;
case 7:
if ($this->typeId != 769) {
// Internal
$lv['params']['note'] = sprintf(Util::$filterResultString, '?spells=' . $this->cat . '.' . (log($reqClass, 2) + 1) . '.' . $this->typeId);
}
//.........这里部分代码省略.........
开发者ID:Carbenium,项目名称:aowow,代码行数:101,代码来源:skill.php
示例20: search
/**
* Search themes on the remote platform
*/
public function search()
{
$api = new HawkApi();
$search = App::request()->getParams('search');
// Search themes on the API
try {
$themes = $api->searchThemes($search);
} catch (\Hawk\HawkApiException $e) {
$themes = array();
}
// Remove the plugins already downloaded on the application
foreach ($themes as &$theme) {
$installed = Theme::get($theme['name']);
$theme['installed'] = $installed !== null;
if ($installed) {
$theme['currentVersion'] = $installed->getDefinition('version');
}
}
$list = new ItemList(array('id' => 'search-themes-list', 'data' => $themes, 'resultTpl' => Plugin::current()->getView('theme-search-list.tpl'), 'fields' => array()));
if ($list->isRefreshing()) {
return $list->display();
} else {
$this->addCss(Plugin::current()->getCssUrl('themes.less'));
$this->addJavaScript(Plugin::current()->getJsUrl('themes.js'));
return LeftSidebarTab::make(array('page' => array('content' => $list->display()), 'sidebar' => array('widgets' => array(new SearchThemeWidget())), 'icon' => 'picture-o', 'title' => Lang::get($this->_plugin . '.search-theme-result-title', array('search' => $search))));
}
}
开发者ID:elvyrra,项目名称:hawk,代码行数:30,代码来源:ThemeController.php
注:本文中的ItemList类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论