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


PHP Database_Result类代码示例

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


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

示例1: newSetting

 /**
  * @param Database_Result $objSettings The information from which to initialize the setting from
  *
  * @return IMetaModelFilterSetting
  */
 protected function newSetting(Database_Result $objSettings)
 {
     $strClass = $GLOBALS['METAMODELS']['filters'][$objSettings->type]['class'];
     // TODO: add factory support here.
     if ($strClass) {
         return new $strClass($this, $objSettings->row());
     }
     return null;
 }
开发者ID:amenk,项目名称:MetaModels-core,代码行数:14,代码来源:MetaModelFilterSettings.php

示例2: __construct

 public function __construct(ORM $model, Database_Result $result)
 {
     // Class attributes
     $this->class_name = get_class($model);
     $this->primary_key = $model->primary_key;
     $this->primary_val = $model->primary_val;
     // Database result
     $this->result = $result->result(TRUE);
 }
开发者ID:Juuro,项目名称:Dreamapp-Website,代码行数:9,代码来源:ORM_Iterator.php

示例3: __construct

 /**
  * Initialize the object
  * @param object
  * @return string
  */
 public function __construct(Database_Result $objElement)
 {
     parent::__construct();
     $this->arrData = $objElement->row();
     $this->space = deserialize($objElement->space);
     $this->cssID = deserialize($objElement->cssID, true);
     $arrHeadline = deserialize($objElement->headline);
     $this->headline = is_array($arrHeadline) ? $arrHeadline['value'] : $arrHeadline;
     $this->hl = is_array($arrHeadline) ? $arrHeadline['unit'] : 'h1';
 }
开发者ID:Juuro,项目名称:Dreamapp-Website,代码行数:15,代码来源:ContentElement.php

示例4: __construct

 /**
  * Initialize the object
  * @param Database_Result
  * @param string
  */
 public function __construct(Database_Result $objModule, $strColumn = 'main')
 {
     parent::__construct();
     $this->arrData = $objModule->row();
     $this->space = deserialize($objModule->space);
     $this->cssID = deserialize($objModule->cssID, true);
     $arrHeadline = deserialize($objModule->headline);
     $this->headline = is_array($arrHeadline) ? $arrHeadline['value'] : $arrHeadline;
     $this->hl = is_array($arrHeadline) ? $arrHeadline['unit'] : 'h1';
     $this->strColumn = $strColumn;
 }
开发者ID:jens-wetzel,项目名称:use2,代码行数:16,代码来源:Module.php

示例5: createStartTag

 /**
  * Create start tag for given end tag and update it
  *
  * @param Database_Result $objEndTag
  */
 public function createStartTag($objEndTag)
 {
     $arrStartTag = $objEndTag->row();
     unset($arrStartTag['id']);
     unset($arrStartTag['sh5_pid']);
     $arrStartTag['sh5_tag'] = 'start';
     $arrStartTag['sorting'] = $objEndTag->sorting - 1;
     // Support GlobalContentelements extension if installed
     if (in_array('GlobalContentelements', $this->Config->getActiveModules())) {
         $arrStartTag['do'] = $this->Input->get('do');
     }
     // Insert start tag
     $objResult = $this->Database->prepare("INSERT INTO tl_content %s")->set($arrStartTag)->execute();
     $intId = $objResult->insertId;
     // Update start tag
     $this->Database->prepare("UPDATE tl_content %s WHERE id = ?")->set(array('sh5_pid' => $intId))->executeUncached($intId);
     // Update end tag
     $this->Database->prepare("UPDATE tl_content %s WHERE id = ?")->set(array('sh5_pid' => $intId))->executeUncached($objEndTag->id);
 }
开发者ID:menatwork,项目名称:semantic_html5,代码行数:24,代码来源:SemanticHTML5Helper.php

示例6: getInstance

 /**
  * Get singleton instance of the class or create new one, if no exists.
  *
  * @param  PDOStatement     $o_set_result   the requested result-set of the last SQL-Statement
  * @return Database_Result                  the instance of the class
  */
 public static function getInstance($o_set_result)
 {
     if (null === self::$instance) {
         self::$instance = new self();
     }
     //set the result-set object and fetch all rows
     self::$instance->set_result_set($o_set_result);
     self::$instance->set_result_rows($o_set_result);
     //return the instance
     return self::$instance;
 }
开发者ID:nedron92,项目名称:logd-oop,代码行数:17,代码来源:result.php

示例7: showAsArray

 /**
  * не используется
  * @param type $result имя ключа массвиа
  * @param type $nameNeededValue имя поля массива
  * @return type
  */
 public function showAsArray(Database_Result $result, $nameNeededValue = null)
 {
     $array = $result->as_array();
     $primaryKey = $this->primary_key();
     $key = 0;
     $result = array();
     foreach ($array as $value) {
         if (empty($primaryKey)) {
             $key++;
         } else {
             $key = $value->{$primaryKey};
         }
         if (empty($nameNeededValue)) {
             $result[$key] = $value->as_array();
         } else {
             $result[$key] = $value->{$nameNeededValue};
         }
     }
     return $result;
 }
开发者ID:seyfer,项目名称:kohana-dynamic-structure,代码行数:26,代码来源:Roles.php

示例8: __construct

 /**
  * Load the relations and optionally process a result set
  * 
  * @param \Database_Result $objResult An optional database result
  */
 public function __construct(\Database_Result $objResult = null)
 {
     parent::__construct();
     $objRelations = new \DcaExtractor(static::$strTable);
     $this->arrRelations = $objRelations->getRelations();
     if ($objResult !== null) {
         $this->arrData = $objResult->row();
         // Look for joined fields
         foreach ($this->arrData as $k => $v) {
             if (strpos($k, '__') !== false) {
                 list($key, $field) = explode('__', $k, 2);
                 // Create the related model
                 if (!isset($this->arrRelated[$key])) {
                     $table = $this->arrRelations[$key]['table'];
                     $strClass = $this->getModelClassFromTable($table);
                     $this->arrRelated[$key] = new $strClass();
                 }
                 $this->arrRelated[$key]->{$field} = $v;
                 unset($this->arrData[$k]);
             }
         }
     }
 }
开发者ID:rikaix,项目名称:core,代码行数:28,代码来源:Model.php

示例9: sendNewsletter

 /**
  * Compile the newsletter and send it
  * @param object
  * @param object
  * @param array
  * @param string
  * @param string
  * @param string
  * @return string
  */
 protected function sendNewsletter(Email $objEmail, Database_Result $objNewsletter, $arrRecipient, $text, $html, $css)
 {
     // Prepare text content
     $objEmail->text = $this->parseSimpleTokens($text, $arrRecipient);
     // Add HTML content
     if (!$objNewsletter->sendText) {
         // Get the mail template
         $objTemplate = new BackendTemplate(strlen($objNewsletter->template) ? $objNewsletter->template : 'mail_default');
         $objTemplate->setData($objNewsletter->row());
         $objTemplate->title = $objNewsletter->subject;
         $objTemplate->body = $this->parseSimpleTokens($html, $arrRecipient);
         $objTemplate->charset = $GLOBALS['TL_CONFIG']['characterSet'];
         $objTemplate->css = $css;
         // Parse template
         $objEmail->html = $objTemplate->parse();
         $objEmail->imageDir = TL_ROOT . '/';
     }
     // Deactivate invalid addresses
     try {
         $objEmail->sendTo($arrRecipient['email']);
     } catch (Swift_RfcComplianceException $e) {
         $_SESSION['REJECTED_RECIPIENTS'][] = $arrRecipient['email'];
     }
     // Rejected recipients
     if (count($objEmail->failures)) {
         $_SESSION['REJECTED_RECIPIENTS'][] = $arrRecipient['email'];
     }
 }
开发者ID:Juuro,项目名称:Dreamapp-Website,代码行数:38,代码来源:Newsletter.php

示例10: setFromRow

 /**
  * Set the current record from a database result row
  * @param Database_Result
  * @param string
  * @param string
  */
 public function setFromRow(Database_Result $resResult, $strTable, $strRefField)
 {
     $this->strTable = $strTable;
     $this->strRefField = $strRefField;
     $this->varRefId = $resResult->{$strRefField};
     $this->resResult = $resResult;
     $this->arrData = $resResult->row();
     $this->blnRecordExists = true;
 }
开发者ID:jens-wetzel,项目名称:use2,代码行数:15,代码来源:Model.php

示例11: clusters_geojson

 /**
  * Generate clustered GEOJSON from incidents
  * 
  * @param ORM_Iterator|Database_Result|array $incidents collection of incidents
  * @param int $category_id
  * @param string $color
  * @param string $icon
  * @return array $json_features geojson features array
  **/
 protected function clusters_geojson($incidents, $category_id, $color, $icon)
 {
     $json_features = array();
     // Extra params for clustering
     // Start date
     $start_date = (isset($_GET['s']) and intval($_GET['s']) > 0) ? intval($_GET['s']) : NULL;
     // End date
     $end_date = (isset($_GET['e']) and intval($_GET['e']) > 0) ? intval($_GET['e']) : NULL;
     // Get Zoom Level
     $zoomLevel = (isset($_GET['z']) and !empty($_GET['z'])) ? (int) $_GET['z'] : 8;
     $distance = (10000000 >> $zoomLevel) / 100000;
     // Get markers array
     if ($incidents instanceof ORM_Iterator) {
         $markers = $incidents->as_array();
     } elseif ($incidents instanceof Database_Result) {
         $markers = $incidents->result_array();
     } else {
         $markers = $incidents;
     }
     $clusters = array();
     // Clustered
     $singles = array();
     // Non Clustered
     // Loop until all markers have been compared
     while (count($markers)) {
         $marker = array_pop($markers);
         $cluster = array();
         // Handle both reports::fetch_incidents() response and actual ORM objects
         $marker->id = isset($marker->incident_id) ? $marker->incident_id : $marker->id;
         if (isset($marker->latitude) and isset($marker->longitude)) {
             $marker_latitude = $marker->latitude;
             $marker_longitude = $marker->longitude;
         } elseif (isset($marker->location) and isset($marker->location->latitude) and isset($marker->location->longitude)) {
             $marker_latitude = $marker->location->latitude;
             $marker_longitude = $marker->location->longitude;
         } else {
             // No location - skip this report
             continue;
         }
         // Compare marker against all remaining markers.
         foreach ($markers as $key => $target) {
             // Handle both reports::fetch_incidents() response and actual ORM objects
             if (isset($target->latitude) and isset($target->longitude)) {
                 $target_latitude = $target->latitude;
                 $target_longitude = $target->longitude;
             } elseif (isset($target->location) and isset($target->location->latitude) and isset($target->location->longitude)) {
                 $target_latitude = $target->location->latitude;
                 $target_longitude = $target->location->longitude;
             } else {
                 // No location - skip this report
                 continue;
             }
             // This function returns the distance between two markers, at a defined zoom level.
             // $pixels = $this->_pixelDistance($marker['latitude'], $marker['longitude'],
             // $target['latitude'], $target['longitude'], $zoomLevel);
             $pixels = abs($marker_longitude - $target_longitude) + abs($marker_latitude - $target_latitude);
             // If two markers are closer than defined distance, remove compareMarker from array and add to cluster.
             if ($pixels < $distance) {
                 unset($markers[$key]);
                 $cluster[] = $target;
             }
         }
         // If a marker was added to cluster, also add the marker we were comparing to.
         if (count($cluster) > 0) {
             $cluster[] = $marker;
             $clusters[] = $cluster;
         } else {
             $singles[] = $marker;
         }
     }
     // Create Json
     foreach ($clusters as $cluster) {
         // Calculate cluster center
         $bounds = $this->calculate_center($cluster);
         $cluster_center = array_values($bounds['center']);
         $southwest = $bounds['sw']['longitude'] . ',' . $bounds['sw']['latitude'];
         $northeast = $bounds['ne']['longitude'] . ',' . $bounds['ne']['latitude'];
         // Number of Items in Cluster
         $cluster_count = count($cluster);
         // Get the time filter
         $time_filter = (!empty($start_date) and !empty($end_date)) ? "&s=" . $start_date . "&e=" . $end_date : "";
         // Build query string for title link, passing through any GET params
         // This allows plugins to extend more easily
         $query = http_build_query(array_merge(array('sw' => $southwest, 'ne' => $northeast), $_GET));
         // Build out the JSON string
         $link = url::site("reports/index/?{$query}");
         $item_name = $this->get_title(Kohana::lang('ui_main.reports_count', $cluster_count), $link);
         $json_item = array();
         $json_item['type'] = 'Feature';
         $json_item['properties'] = array('name' => $item_name, 'link' => $link, 'category' => array($category_id), 'color' => $color, 'icon' => $icon, 'thumb' => '', 'timestamp' => 0, 'count' => $cluster_count);
         $json_item['geometry'] = array('type' => 'Point', 'coordinates' => $cluster_center);
//.........这里部分代码省略.........
开发者ID:niiyatii,项目名称:crowdmap,代码行数:101,代码来源:json.php

示例12: __construct

	public function __construct(array $result, $sql, $as_object = NULL)
	{
		parent::__construct($result, $sql, $as_object);

		// Find the number of rows in the result
		$this->_total_rows = count($result);
	}
开发者ID:nevermlnd,项目名称:cv,代码行数:7,代码来源:cached.php

示例13: __construct

	public function __construct($result, $sql, $as_object)
	{
		parent::__construct($result, $sql, $as_object);

		// Find the number of rows in the result
		$this->_total_rows = mysql_num_rows($result);
	}
开发者ID:nasumi,项目名称:fuel,代码行数:7,代码来源:result.php

示例14: __construct

	public function __construct($result, $sql, $as_object = FALSE, array $params = NULL)
	{
		parent::__construct($result, $sql, $as_object, $params);

		// Find the number of rows in the result
		$this->_total_rows = mysql_num_rows($result);
	}
开发者ID:nevermlnd,项目名称:cv,代码行数:7,代码来源:result.php

示例15: fetchNext

 /**
  * Fetch the next result row and create the model
  * 
  * @return boolean True if there was another row
  */
 protected function fetchNext()
 {
     if ($this->objResult->next() == false) {
         return false;
     }
     $strClass = $this->getModelClassFromTable($this->strTable);
     $this->arrModels[$this->intIndex + 1] = new $strClass($this->objResult);
     return true;
 }
开发者ID:rikaix,项目名称:core,代码行数:14,代码来源:Collection.php


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