本文整理汇总了PHP中ArrayUtils::pluck方法的典型用法代码示例。如果您正苦于以下问题:PHP ArrayUtils::pluck方法的具体用法?PHP ArrayUtils::pluck怎么用?PHP ArrayUtils::pluck使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ArrayUtils
的用法示例。
在下文中一共展示了ArrayUtils::pluck方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: buildDashboard
public function buildDashboard()
{
$this->setDashboardTitle("Stock Dashboard");
$this->setActionPath("/static/transfer/build/tour/motherboard_stock_action.php");
$kpi = new KPIGroupComponent('kpi');
$kpi->setDimensions(12, 2);
$kpi->setCaption('Units stock by Category');
$Units = $this->get_units(true);
foreach ($Units as $key => $value) {
$kpi->addKPI($value['id'], array('caption' => $value['CategoryName'], 'value' => $value['Quantity'], 'numberSuffix' => ' units', 'numberHumanize' => true));
}
$this->addComponent($kpi);
$table = new TableComponent('table');
$table->setCaption("List of Item in Stock");
$table->setDimensions(6, 5);
$stock = $this->get_stock();
$table->addColumn('id', 'Product Id');
$table->addColumn('name', 'Product Name');
$table->addColumn('category', 'Category');
$table->addColumn('price', 'Price', array("numberPrefix" => "\$", "dataType" => "number"));
$table->addColumn('stock', 'Stock');
$table->addMultipleRows($this->PolulateData($stock));
$this->addComponent($table);
$c12 = new FormComponent('filter');
$c12->setDimensions(6, 5);
$c12->setCaption('Filter items in stock');
$category = $this->get_category();
$c12->addSelectField('category', 'Select Category', array_merge(['no selection'], ArrayUtils::pluck($category, 'CategoryName')));
$c12->addTextField('contains', 'Product Name Contains');
$c12->addNumericRangeField('stock', 'Units In Stock', array(0, 100));
$this->addComponent($c12);
$c12->onApplyClick(array($table), 'handleApply', $this);
}
示例2: get_cities
public function get_cities($source, $target, $params)
{
$cityDataQuery = $this->pdo->prepare("SELECT SUM(amount) as total_amount, city FROM Payments NATURAL JOIN Customers where Customers.state = :paymentState GROUP BY city;");
$cityDataQuery->execute(array('paymentState' => $params['label']));
$cityData = $cityDataQuery->fetchAll(PDO::FETCH_ASSOC);
$source->clearChart();
$source->setLabels(ArrayUtils::pluck($cityData, 'city'));
$source->addSeries("sales", "Sales", ArrayUtils::pluck($cityData, "total_amount"), array('numberPrefix' => "\$"));
}
示例3: handleArtistChartClick
public function handleArtistChartClick($source, $target, $params)
{
$artistName = $params['label'];
$topAlbumsChart = $this->getComponentByID("c2");
$top_albums = $this->getTopAlbums($artistName);
$topAlbumsChart->setCaption("Top 5 albums by " . $artistName);
$topAlbumsChart->clearChart();
$topAlbumsChart->setLabels(ArrayUtils::pluck($top_albums, "Title"));
$topAlbumsChart->addSeries('top_albums', "Top Albums", ArrayUtils::pluck($top_albums, "total_sales"));
}
示例4: get_daywise
public function get_daywise($source, $target, $params)
{
$month = array_search($params['label'], $this->monthName);
$daywiseQuery = $this->pdo->prepare("SELECT SUM(UnitPrice * Quantity) as total_amount, strftime('%d', OrderDate) as payment_day FROM 'Order' as o, 'OrderDetail' as od where o.Id = od.OrderId and strftime('%Y', OrderDate)=:paymentYear and strftime('%m', OrderDate)=:paymentMonth GROUP BY payment_day;");
$daywiseQuery->execute(array('paymentYear' => $params['drillLabelList'][0], 'paymentMonth' => $month));
$daywise = $daywiseQuery->fetchAll(PDO::FETCH_ASSOC);
$source->clearChart();
$source->setLabels(ArrayUtils::pluck($daywise, 'payment_day'));
$totalSalesArr = ArrayUtils::pluck($daywise, "total_amount");
$source->addSeries("sales", "Sales", $totalSalesArr, array('numberPrefix' => "\$"));
$totalSales = 0;
foreach ($totalSalesArr as $key => $value) {
$totalSales += $value;
}
$source->addComponentKPI("sales", array("caption" => "Total Sales", "value" => $totalSales, "numberPrefix" => "\$", "numberHumanize" => true));
$source->addComponentKPI("second", array("caption" => "Revenue", "value" => $totalSales, "numberPrefix" => "\$", "numberHumanize" => true));
}
示例5: handleForm
public function handleForm($source, $target, $params)
{
$Date = $source->getInputValue('datebtw');
$dateStartArray = date_parse($Date[0]);
$dateEndArray = date_parse($Date[1]);
$dailySales = $this->getComponentByID("c1");
$item = $this->getComponentByID("c3");
$chart = $this->getComponentByID("pie_chart");
$hour = $this->getComponentByID("c4");
$dateStartString = $dateStartArray['year'] . '-' . $dateStartArray['month'] . '-' . $dateStartArray['day'];
$dateEndString = $dateEndArray['year'] . '-' . $dateEndArray['month'] . '-' . $dateEndArray['day'];
$dailySalesData = $this->getDailySales($dateStartString, $dateEndString);
$dailySales->setLabels(ArrayUtils::pluck($dailySalesData, "tarih2"));
$dailySales->addSeries('food', "Food", ArrayUtils::pluck($dailySalesData, "cikis"), array("numberHumanize" => true));
$dailySalesFoodData = $this->getDailySalesFood($dateStartString, $dateEndString);
$dailySales->addSeries('covers', "Covers", ArrayUtils::pluck($dailySalesFoodData, "cikis"), array("numberHumanize" => true, "yAxis" => "covers"));
$itemCategories = $this->getItemCategories($dateStartString, $dateEndString);
$item->setLabels(ArrayUtils::pluck($itemCategories, "grupadi"));
$item->addSeries('items', "Items", ArrayUtils::pluck($itemCategories, "cikis"), array("numberHumanize" => true));
$clerkData = $this->getClerkSales($dateStartString, $dateEndString);
$chart->setLabels(ArrayUtils::pluck($clerkData, "garson"));
$chart->setPieValues(ArrayUtils::pluck($clerkData, "cikis"));
$hourlySales = $this->getHourlySales($dateStartString, $dateEndString);
$hour->setLabels(ArrayUtils::pluck($hourlySales, "SAAT"));
$hour->addSeries('items', "Items", ArrayUtils::pluck($hourlySales, "CIKIS"), array("numberHumanize" => true));
}