当前位置: 首页>>代码示例>>PHP>>正文


PHP ItemList类代码示例

本文整理汇总了PHP中ItemList的典型用法代码示例。如果您正苦于以下问题:PHP ItemList类的具体用法?PHP ItemList怎么用?PHP ItemList使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了ItemList类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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


注:本文中的ItemList类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。