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


PHP Piwik_DataTable::addRowFromArray方法代码示例

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


在下文中一共展示了Piwik_DataTable::addRowFromArray方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testConsoleSimple

 /**
  *  test with a row without child
  *
  * @group Core
  * @group DataTable
  * @group DataTable_Renderer
  * @group DataTable_Renderer_Console
  */
 public function testConsoleSimple()
 {
     $table = new Piwik_DataTable();
     $table->addRowFromArray(array(Piwik_DataTable_Row::COLUMNS => array('visits' => 245, 'visitors' => 245), Piwik_DataTable_Row::METADATA => array('logo' => 'test.png')));
     $expected = "- 1 ['visits' => 245, 'visitors' => 245] ['logo' => 'test.png'] [idsubtable = ]<br />\n";
     $render = new Piwik_DataTable_Renderer_Console();
     $render->setTable($table);
     $rendered = $render->render();
     $this->assertEquals($expected, $rendered);
 }
开发者ID:nnnnathann,项目名称:piwik,代码行数:18,代码来源:ConsoleTest.php

示例2: getCleanedVisitorsFromDetails

 private static function getCleanedVisitorsFromDetails($visitorDetails)
 {
     $table = new Piwik_DataTable();
     foreach ($visitorDetails as $visitorDetail) {
         self::cleanVisitorDetails($visitorDetail);
         $visitor = new Piwik_Live_Visitor($visitorDetail);
         $visitorDetailsArray = $visitor->getAllVisitorDetails();
         $dateTimeVisit = Piwik_Date::factory($visitorDetailsArray['firstActionTimestamp']);
         //TODO TO FIX
         $visitorDetailsArray['serverDatePretty'] = $dateTimeVisit->getLocalized('%shortDay% %day% %shortMonth%');
         $visitorDetailsArray['serverTimePretty'] = $dateTimeVisit->getLocalized('%time%');
         $table->addRowFromArray(array(Piwik_DataTable_Row::COLUMNS => $visitorDetailsArray));
     }
     return $table;
 }
开发者ID:klando,项目名称:pgpiwik,代码行数:15,代码来源:API.php

示例3: testGeneral

 /**
  * General tests that tries to test the normal behaviour of DataTable
  * 
  * We create some tables, add rows, some of the rows link to sub tables
  * 
  * Then we serialize everything, and we check that the unserialize give the same object back
  * 
  * @group Core
  * @group DataTable
  */
 public function testGeneral()
 {
     /*
      * create some fake tables to make sure that the serialized array of the first TABLE
      * does not take in consideration those tables
      */
     $useless1 = new Piwik_DataTable();
     $useless1->addRowFromArray(array(Piwik_DataTable_Row::COLUMNS => array(13)));
     /*
      * end fake tables
      */
     /*
      * MAIN TABLE
      */
     $table = new Piwik_DataTable();
     $subtable = new Piwik_DataTable();
     $idtable = $table->getId();
     $idsubtable = $subtable->getId();
     /*
      * create some fake tables to make sure that the serialized array of the first TABLE
      * does not take in consideration those tables
      * -> we check that the DataTable_Manager is not impacting DataTable 
      */
     $useless2 = new Piwik_DataTable();
     $useless1->addRowFromArray(array(Piwik_DataTable_Row::COLUMNS => array(8487)));
     $useless3 = new Piwik_DataTable();
     $useless3->addRowFromArray(array(Piwik_DataTable_Row::COLUMNS => array(8487)));
     /*
      * end fake tables
      */
     $row = array(Piwik_DataTable_Row::COLUMNS => array(0 => 1554, 1 => 42, 2 => 657, 3 => 155744), Piwik_DataTable_Row::METADATA => array('logo' => 'test.png'));
     $row = new Piwik_DataTable_Row($row);
     $table->addRow($row);
     $table->addRowFromArray(array(Piwik_DataTable_Row::COLUMNS => array(0 => 1554, 1 => 42), Piwik_DataTable_Row::METADATA => array('url' => 'piwik.org')));
     $table->addRowFromArray(array(Piwik_DataTable_Row::COLUMNS => array(0 => 787877888787.0), Piwik_DataTable_Row::METADATA => array('url' => 'OUPLA ADDED'), Piwik_DataTable_Row::DATATABLE_ASSOCIATED => $subtable));
     /*
      * SUB TABLE
      */
     $row = array(Piwik_DataTable_Row::COLUMNS => array(0 => 1554), Piwik_DataTable_Row::METADATA => array('searchengine' => 'google'));
     $subtable->addRowFromArray($row);
     $row = array(Piwik_DataTable_Row::COLUMNS => array(0 => 84894), Piwik_DataTable_Row::METADATA => array('searchengine' => 'yahoo'));
     $subtable->addRowFromArray($row);
     $row = array(Piwik_DataTable_Row::COLUMNS => array(0 => 4898978989.0), Piwik_DataTable_Row::METADATA => array('searchengine' => 'ask'));
     $subtable->addRowFromArray($row);
     /*
      * SUB SUB TABLE
      */
     $subsubtable = new Piwik_DataTable();
     $subsubtable->addRowFromArray(array(Piwik_DataTable_Row::COLUMNS => array(245), Piwik_DataTable_Row::METADATA => array('yes' => 'subsubmetadata1')));
     $subsubtable->addRowFromArray(array(Piwik_DataTable_Row::COLUMNS => array(13), Piwik_DataTable_Row::METADATA => array('yes' => 'subsubmetadata2')));
     $row = array(Piwik_DataTable_Row::COLUMNS => array(0 => 666666666666666.0), Piwik_DataTable_Row::METADATA => array('url' => 'NEW ROW ADDED'), Piwik_DataTable_Row::DATATABLE_ASSOCIATED => $subsubtable);
     $subtable->addRowFromArray($row);
     $idsubsubtable = $subsubtable->getId();
     $serialized = $table->getSerialized();
     $this->assertEquals(array_keys($serialized), array($idsubsubtable, $idsubtable, 0));
     // In the next test we compare an unserialized datatable with its original instance.
     // The unserialized datatable rows will have positive DATATABLE_ASSOCIATED ids.
     // Positive DATATABLE_ASSOCIATED ids mean that the associated sub-datatables are not loaded in memory.
     // In this case, this is NOT true: we know that the sub-datatable is loaded in memory.
     // HOWEVER, because of datatable id conflicts happening in the datatable manager, it is not yet
     // possible to know, after unserializing a datatable, if its sub-datatables are loaded in memory.
     $expectedTableRows = array();
     foreach ($table->getRows() as $currentRow) {
         $expectedTableRow = clone $currentRow;
         $currentRowAssociatedDatatableId = $currentRow->c[Piwik_DataTable_Row::DATATABLE_ASSOCIATED];
         if ($currentRowAssociatedDatatableId != null) {
             // making DATATABLE_ASSOCIATED ids positive
             $expectedTableRow->c[Piwik_DataTable_Row::DATATABLE_ASSOCIATED] = -1 * $currentRowAssociatedDatatableId;
         }
         $expectedTableRows[] = $expectedTableRow;
     }
     $tableAfter = new Piwik_DataTable();
     $tableAfter->addRowsFromSerializedArray($serialized[0]);
     $this->assertEquals($expectedTableRows, $tableAfter->getRows());
     $subsubtableAfter = new Piwik_DataTable();
     $subsubtableAfter->addRowsFromSerializedArray($serialized[$idsubsubtable]);
     $this->assertEquals($subsubtable->getRows(), $subsubtableAfter->getRows());
     $this->assertEquals($table, Piwik_DataTable_Manager::getInstance()->getTable($idtable));
     $this->assertEquals($subsubtable, Piwik_DataTable_Manager::getInstance()->getTable($idsubsubtable));
 }
开发者ID:nnnnathann,项目名称:piwik,代码行数:90,代码来源:DataTableTest.php

示例4: array

 /**
  * General tests that tries to test the normal behaviour of DataTable
  * 
  * We create some tables, add rows, some of the rows link to sub tables
  * 
  * Then we serialize everything, and we check that the unserialize give the same object back
  */
 function test_general()
 {
     /*
      * create some fake tables to make sure that the serialized array of the first TABLE
      * does not take in consideration those tables
      */
     $useless1 = new Piwik_DataTable();
     $useless1->addRowFromArray(array(Piwik_DataTable_Row::COLUMNS => array(13)));
     /*
      * end fake tables
      */
     /*
      * MAIN TABLE
      */
     $table = new Piwik_DataTable();
     $subtable = new Piwik_DataTable();
     $idtable = $table->getId();
     $idsubtable = $subtable->getId();
     /*
      * create some fake tables to make sure that the serialized array of the first TABLE
      * does not take in consideration those tables
      * -> we check that the DataTable_Manager is not impacting DataTable 
      */
     $useless2 = new Piwik_DataTable();
     $useless1->addRowFromArray(array(Piwik_DataTable_Row::COLUMNS => array(8487)));
     $useless3 = new Piwik_DataTable();
     $useless3->addRowFromArray(array(Piwik_DataTable_Row::COLUMNS => array(8487)));
     /*
      * end fake tables
      */
     $row = array(Piwik_DataTable_Row::COLUMNS => array(0 => 1554, 1 => 42, 2 => 657, 3 => 155744), Piwik_DataTable_Row::METADATA => array('logo' => 'test.png'));
     $row = new Piwik_DataTable_Row($row);
     $table->addRow($row);
     $table->addRowFromArray(array(Piwik_DataTable_Row::COLUMNS => array(0 => 1554, 1 => 42), Piwik_DataTable_Row::METADATA => array('url' => 'piwik.org')));
     $table->addRowFromArray(array(Piwik_DataTable_Row::COLUMNS => array(0 => 787877888787), Piwik_DataTable_Row::METADATA => array('url' => 'OUPLA ADDED'), Piwik_DataTable_Row::DATATABLE_ASSOCIATED => $subtable));
     /*
      * SUB TABLE
      */
     $row = array(Piwik_DataTable_Row::COLUMNS => array(0 => 1554), Piwik_DataTable_Row::METADATA => array('searchengine' => 'google'));
     $subtable->addRowFromArray($row);
     $row = array(Piwik_DataTable_Row::COLUMNS => array(0 => 84894), Piwik_DataTable_Row::METADATA => array('searchengine' => 'yahoo'));
     $subtable->addRowFromArray($row);
     $row = array(Piwik_DataTable_Row::COLUMNS => array(0 => 4898978989), Piwik_DataTable_Row::METADATA => array('searchengine' => 'ask'));
     $subtable->addRowFromArray($row);
     /*
      * SUB SUB TABLE
      */
     $subsubtable = new Piwik_DataTable();
     $subsubtable->addRowFromArray(array(Piwik_DataTable_Row::COLUMNS => array(245), Piwik_DataTable_Row::METADATA => array('yes' => 'subsubmetadata1')));
     $subsubtable->addRowFromArray(array(Piwik_DataTable_Row::COLUMNS => array(13), Piwik_DataTable_Row::METADATA => array('yes' => 'subsubmetadata2')));
     $row = array(Piwik_DataTable_Row::COLUMNS => array(0 => 666666666666666), Piwik_DataTable_Row::METADATA => array('url' => 'NEW ROW ADDED'), Piwik_DataTable_Row::DATATABLE_ASSOCIATED => $subsubtable);
     $subtable->addRowFromArray($row);
     $idsubsubtable = $subsubtable->getId();
     $serialized = $table->getSerialized();
     $this->assertEqual(array_keys($serialized), array($idsubsubtable, $idsubtable, 0));
     $tableAfter = new Piwik_DataTable();
     $tableAfter->addRowsFromSerializedArray($serialized[0]);
     $this->assertEqual($table->getRows(), $tableAfter->getRows());
     $subsubtableAfter = new Piwik_DataTable();
     $subsubtableAfter->addRowsFromSerializedArray($serialized[$idsubsubtable]);
     $this->assertEqual($subsubtable->getRows(), $subsubtableAfter->getRows());
     $this->assertEqual($table, Piwik_DataTable_Manager::getInstance()->getTable($idtable));
     $this->assertEqual($subsubtable, Piwik_DataTable_Manager::getInstance()->getTable($idsubsubtable));
 }
开发者ID:0h546f6f78696342756e4e59,项目名称:piwik,代码行数:71,代码来源:DataTable.test.php

示例5: getCleanedVisitorsFromDetails


//.........这里部分代码省略.........
			$ecommerceDetails = Piwik_FetchAll($sql, array($idvisit));

			foreach($ecommerceDetails as &$ecommerceDetail)
			{
				if($ecommerceDetail['type'] == Piwik_Archive::LABEL_ECOMMERCE_CART)
				{
					unset($ecommerceDetail['orderId']);
					unset($ecommerceDetail['revenueSubTotal']);
					unset($ecommerceDetail['revenueTax']);
					unset($ecommerceDetail['revenueShipping']);
					unset($ecommerceDetail['revenueDiscount']);
				}
			
				// 25.00 => 25
				foreach($ecommerceDetail as $column => $value)
				{
					if(strpos($column, 'revenue') !== false)
					{
						if($value == round($value))
						{
							$ecommerceDetail[$column] = round($value);
						}
					}
				}
			}
			
			$actions = array_merge($actionDetails, $goalDetails, $ecommerceDetails);
			
			usort($actions, array($this, 'sortByServerTime'));
			
			$visitorDetailsArray['actionDetails'] = $actions;   
			// Convert datetimes to the site timezone
			foreach($visitorDetailsArray['actionDetails'] as &$details)
			{
				switch($details['type'])
				{
					case 'goal':
						$details['icon'] = 'themes/default/images/goal.png';
					break;
					case Piwik_Archive::LABEL_ECOMMERCE_ORDER:
					case Piwik_Archive::LABEL_ECOMMERCE_CART:
						$details['icon'] = 'themes/default/images/'.$details['type'].'.gif';
					break;
					case Piwik_Tracker_Action_Interface::TYPE_DOWNLOAD:
						$details['type'] = 'download';
						$details['icon'] = 'themes/default/images/download.png';
					break;
					case Piwik_Tracker_Action_Interface::TYPE_OUTLINK:
						$details['type'] = 'outlink';
						$details['icon'] = 'themes/default/images/link.gif';
					break;
					default:
						$details['type'] = 'action';
						$details['icon'] = null;
					break;
				}
				$dateTimeVisit = Piwik_Date::factory($details['serverTimePretty'], $timezone);
				$details['serverTimePretty'] = $dateTimeVisit->getLocalized('%shortDay% %day% %shortMonth% %time%'); 
			}
			$visitorDetailsArray['goalConversions'] = count($goalDetails);
			
			// Enrich ecommerce carts/orders with the list of products 
			usort($ecommerceDetails, array($this, 'sortByServerTime'));
			foreach($ecommerceDetails as $key => &$ecommerceConversion)
			{
				$sql = "SELECT 
							log_action_sku.name as itemSKU,
							log_action_name.name as itemName,
							log_action_category.name as itemCategory,
							".Piwik_ArchiveProcessing_Day::getSqlRevenue('price')." as price,
							quantity as quantity
						FROM ".Piwik_Common::prefixTable('log_conversion_item')."
							INNER JOIN " .Piwik_Common::prefixTable('log_action')." AS log_action_sku
							ON  idaction_sku = log_action_sku.idaction
							LEFT JOIN " .Piwik_Common::prefixTable('log_action')." AS log_action_name
							ON  idaction_name = log_action_name.idaction
							LEFT JOIN " .Piwik_Common::prefixTable('log_action')." AS log_action_category
							ON idaction_category = log_action_category.idaction
						WHERE idvisit = ? 
							AND idorder = ?
							AND deleted = 0
				";
				$bind = array($idvisit, isset($ecommerceConversion['orderId']) ? $ecommerceConversion['orderId'] : Piwik_Tracker_GoalManager::ITEM_IDORDER_ABANDONED_CART);
				
				$itemsDetails = Piwik_FetchAll($sql, $bind);
			
				foreach($itemsDetails as &$detail)
				{
					if($detail['price'] == round($detail['price']))
					{
						$detail['price'] = round($detail['price']);
					}
				}
				$ecommerceConversion['itemDetails'] = $itemsDetails;
			}
			
			$table->addRowFromArray( array(Piwik_DataTable_Row::COLUMNS => $visitorDetailsArray));
		}
		return $table;
	}
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:101,代码来源:API.php

示例6: getCleanedVisitorsFromDetails

 private function getCleanedVisitorsFromDetails($visitorDetails)
 {
     $table = new Piwik_DataTable();
     foreach ($visitorDetails as $visitorDetail) {
         $this->cleanVisitorDetails($visitorDetail);
         $visitor = new Piwik_Live_Visitor($visitorDetail);
         // $visitorDetail must contain the match_atribute
         $visitorDetailsArray = $visitor->getAllVisitorDetails();
         //			$visitorDetailsArray['goalIcon'] = "themes/default/images/goal.png";
         $dateTimeVisit = Piwik_Date::factory($visitorDetailsArray['firstActionTimestamp']);
         //TODO TO FIX
         $visitorDetailsArray['serverDatePretty'] = $dateTimeVisit->getLocalized('%shortDay% %day% %shortMonth%');
         $visitorDetailsArray['serverTimePretty'] = $dateTimeVisit->getLocalized('%time%');
         // get Detail - 100 single SQL Statements - Performance Issue
         $idvisit = $visitorDetailsArray['idVisit'];
         $sql = "SELECT DISTINCT `" . Piwik::prefixTable('log_action') . "`.`name` AS pageUrl\n\t\t\t\tFROM `" . Piwik::prefixTable('log_link_visit_action') . "`\n\t\t\t\t\tINNER JOIN `" . Piwik::prefixTable('log_action') . "` ON  `" . Piwik::prefixTable('log_link_visit_action') . "`.`idaction_url` = `" . Piwik::prefixTable('log_action') . "`.`idaction`\n\t\t\t\tWHERE `" . Piwik::prefixTable('log_link_visit_action') . "`.`idvisit` = {$idvisit};\n\t\t\t\t ";
         $visitorDetailsArray['actionDetails'] = Piwik_FetchAll($sql);
         $sql = "SELECT DISTINCT `" . Piwik::prefixTable('log_action') . "`.`name` AS pageUrl\n\t\t\t\tFROM `" . Piwik::prefixTable('log_link_visit_action') . "`\n\t\t\t\t\tINNER JOIN `" . Piwik::prefixTable('log_action') . "` ON  `" . Piwik::prefixTable('log_link_visit_action') . "`.`idaction_name` = `" . Piwik::prefixTable('log_action') . "`.`idaction`\n\t\t\t\tWHERE `" . Piwik::prefixTable('log_link_visit_action') . "`.`idvisit` = {$idvisit};\n\t\t\t\t ";
         $visitorDetailsArray['actionDetailsTitle'] = Piwik_FetchAll($sql);
         $table->addRowFromArray(array(Piwik_DataTable_Row::COLUMNS => $visitorDetailsArray));
     }
     return $table;
 }
开发者ID:Doluci,项目名称:tomatocart,代码行数:23,代码来源:API.php

示例7: getCleanedVisitorsFromDetails

 /**
  * For an array of visits, query the list of pages for this visit 
  * as well as make the data human readable
  */
 private function getCleanedVisitorsFromDetails($visitorDetails, $idSite)
 {
     $table = new Piwik_DataTable();
     $site = new Piwik_Site($idSite);
     $timezone = $site->getTimezone();
     foreach ($visitorDetails as $visitorDetail) {
         $this->cleanVisitorDetails($visitorDetail, $idSite);
         $visitor = new Piwik_Live_Visitor($visitorDetail);
         $visitorDetailsArray = $visitor->getAllVisitorDetails();
         $visitorDetailsArray['siteCurrency'] = $site->getCurrency();
         $visitorDetailsArray['serverTimestamp'] = $visitorDetailsArray['lastActionTimestamp'];
         $dateTimeVisit = Piwik_Date::factory($visitorDetailsArray['lastActionTimestamp'], $timezone);
         $visitorDetailsArray['serverTimePretty'] = $dateTimeVisit->getLocalized('%time%');
         $visitorDetailsArray['serverDatePretty'] = $dateTimeVisit->getLocalized('%shortDay% %day% %shortMonth%');
         $dateTimeVisitFirstAction = Piwik_Date::factory($visitorDetailsArray['firstActionTimestamp'], $timezone);
         $visitorDetailsArray['serverDatePrettyFirstAction'] = $dateTimeVisitFirstAction->getLocalized('%shortDay% %day% %shortMonth%');
         $visitorDetailsArray['serverTimePrettyFirstAction'] = $dateTimeVisitFirstAction->getLocalized('%time%');
         $idvisit = $visitorDetailsArray['idVisit'];
         // The second join is a LEFT join to allow returning records that don't have a matching page title
         // eg. Downloads, Outlinks. For these, idaction_name is set to 0
         $sql = "\n\t\t\t\tSELECT\n\t\t\t\t\tlog_action.type as type,\n\t\t\t\t\tlog_action.name AS url,\n\t\t\t\t\tlog_action_title.name AS pageTitle,\n\t\t\t\t\tlog_action.idaction AS pageIdAction,\n\t\t\t\t\tlog_link_visit_action.idlink_va AS pageId,\n\t\t\t\t\tlog_link_visit_action.server_time as serverTimePretty\n\t\t\t\tFROM " . Piwik_Common::prefixTable('log_link_visit_action') . " AS log_link_visit_action\n\t\t\t\t\tINNER JOIN " . Piwik_Common::prefixTable('log_action') . " AS log_action\n\t\t\t\t\tON  log_link_visit_action.idaction_url = log_action.idaction\n\t\t\t\t\tLEFT JOIN " . Piwik_Common::prefixTable('log_action') . " AS log_action_title\n\t\t\t\t\tON  log_link_visit_action.idaction_name = log_action_title.idaction\n\t\t\t\tWHERE log_link_visit_action.idvisit = ?\n\t\t\t\t ";
         $actionDetails = Piwik_FetchAll($sql, array($idvisit));
         // If the visitor converted a goal, we shall select all Goals
         $sql = "\n\t\t\t\tSELECT \n\t\t\t\t\t\t'goal' as type,\n\t\t\t\t\t\tgoal.name as goalName,\n\t\t\t\t\t\tgoal.revenue as revenue,\n\t\t\t\t\t\tlog_conversion.idlink_va as goalPageId,\n\t\t\t\t\t\tlog_conversion.server_time as serverTimePretty,\n\t\t\t\t\t\tlog_conversion.url as url\n\t\t\t\tFROM " . Piwik_Common::prefixTable('log_conversion') . " AS log_conversion\n\t\t\t\tLEFT JOIN " . Piwik_Common::prefixTable('goal') . " AS goal \n\t\t\t\t\tON (goal.idsite = log_conversion.idsite\n\t\t\t\t\t\tAND  \n\t\t\t\t\t\tgoal.idgoal = log_conversion.idgoal)\n\t\t\t\t\tAND goal.deleted = 0\n\t\t\t\tWHERE log_conversion.idvisit = ?\n\t\t\t";
         $goalDetails = Piwik_FetchAll($sql, array($idvisit));
         $actions = array_merge($actionDetails, $goalDetails);
         usort($actions, array($this, 'sortByServerTime'));
         $visitorDetailsArray['actionDetails'] = $actions;
         // Convert datetimes to the site timezone
         foreach ($visitorDetailsArray['actionDetails'] as &$details) {
             switch ($details['type']) {
                 case 'goal':
                     break;
                 case Piwik_Tracker_Action_Interface::TYPE_DOWNLOAD:
                     $details['type'] = 'download';
                     break;
                 case Piwik_Tracker_Action_Interface::TYPE_OUTLINK:
                     $details['type'] = 'outlink';
                     break;
                 default:
                     $details['type'] = 'action';
                     break;
             }
             $dateTimeVisit = Piwik_Date::factory($details['serverTimePretty'], $timezone);
             $details['serverTimePretty'] = $dateTimeVisit->getLocalized('%shortDay% %day% %shortMonth% %time%');
         }
         $visitorDetailsArray['goalConversions'] = count($goalDetails);
         $table->addRowFromArray(array(Piwik_DataTable_Row::COLUMNS => $visitorDetailsArray));
     }
     return $table;
 }
开发者ID:Gninety,项目名称:Microweber,代码行数:55,代码来源:API.php

示例8: getCleanedVisitorsFromDetails

	static private function getCleanedVisitorsFromDetails($visitorDetails)
	{
		$table = new Piwik_DataTable();
		foreach($visitorDetails as $visitorDetail)
		{
			self::cleanVisitorDetails($visitorDetail);
			$visitor = new Piwik_Live_Visitor($visitorDetail);
			$visitorDetailsArray = $visitor->getAllVisitorDetails();
			$dateTimeVisit = Piwik_Date::factory($visitorDetailsArray['firstActionTimestamp']);
			//TODO TO FIX
			$visitorDetailsArray['serverDatePretty'] = $dateTimeVisit->getLocalized('%shortDay% %day% %shortMonth%');
			$visitorDetailsArray['serverTimePretty'] = $dateTimeVisit->getLocalized('%time%');
			
			// get Detail
			$idvisit = $visitorDetailsArray['idVisit'];
			$sql = "SELECT DISTINCT`" .Piwik::prefixTable('log_action')."`.`name` AS pageUrl
				FROM `" .Piwik::prefixTable('log_visit')."`
					INNER JOIN `" .Piwik::prefixTable('log_link_visit_action')."` ON `" .Piwik::prefixTable('log_visit')."`.`idvisit` =  `" .Piwik::prefixTable('log_link_visit_action')."`.`idvisit`
					INNER JOIN `" .Piwik::prefixTable('log_action')."` ON  `" .Piwik::prefixTable('log_link_visit_action')."`.`idaction_url` = `" .Piwik::prefixTable('log_action')."`.`idaction`
				WHERE `" .Piwik::prefixTable('log_visit')."`.`idvisit` = $idvisit;
				 ";
			
			$visitorDetailsArray['actionDetails'] = Piwik_FetchAll($sql);
			
			$table->addRowFromArray( array(Piwik_DataTable_Row::COLUMNS => $visitorDetailsArray));
		}
		return $table;
	}
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:28,代码来源:API.php


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