本文整理汇总了PHP中SocialTable::bind方法的典型用法代码示例。如果您正苦于以下问题:PHP SocialTable::bind方法的具体用法?PHP SocialTable::bind怎么用?PHP SocialTable::bind使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SocialTable
的用法示例。
在下文中一共展示了SocialTable::bind方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: loadByType
/**
* Allows caller to load a list map using a given id and type.
*
* Example:
* <code>
* <?php
* $table = FD::table();
* $table->loadByType( 42 , SOCIAL_TYPE_USER );
* ?>
* </code>
*
* @since 1.0
* @access public
* @param int The list's id.
* @param int The target id.
* @param string The target type.
* @return boolean
*/
public function loadByType($listId, $targetId, $targetType)
{
$db = FD::db();
$query = 'SELECT * FROM ' . $db->nameQuote($this->_tbl) . ' ' . 'WHERE ' . $db->nameQuote('target_id') . '=' . $db->Quote($targetId) . ' ' . 'AND ' . $db->nameQuote('target_type') . '=' . $db->Quote($targetType) . ' ' . 'AND ' . $db->nameQuote('list_id') . '=' . $db->Quote($listId);
$db->setQuery($query);
$result = $db->loadObject();
if (!$result) {
return false;
}
return parent::bind($result);
}
示例2: loadByUser
/**
* Load a particular record given the user's id.
*
* @since 1.0
* @access public
* @param int The user's id.
*/
public function loadByUser($userId)
{
$db = FD::db();
$query = array();
$query[] = 'SELECT * FROM ' . $db->nameQuote($this->_tbl);
$query[] = 'WHERE ' . $db->nameQuote('user_id') . '=' . $db->Quote($userId);
$query = implode(' ', $query);
$db->setQuery($query);
$result = $db->loadObject();
if (!$result) {
return false;
}
return parent::bind($result);
}
示例3: loadByRelation
public function loadByRelation($creator, $recipient, $type)
{
$db = FD::db();
$query = 'SELECT COUNT(1) AS related,b.* FROM ' . $db->nameQuote('#__social_conversations_participants') . ' AS a ' . 'INNER JOIN ' . $db->nameQuote($this->_tbl) . ' AS b ' . 'ON b.' . $db->nameQuote('id') . ' = a.' . $db->nameQuote('conversation_id') . ' ' . 'WHERE ( ' . 'a.' . $db->nameQuote('user_id') . ' = ' . $db->Quote($creator) . ' ' . 'OR ' . 'a.' . $db->nameQuote('user_id') . ' = ' . $db->Quote($recipient) . ' ' . ') ' . 'AND b.' . $db->nameQuote('type') . ' = ' . $db->Quote($type) . ' ' . 'GROUP BY a.' . $db->nameQuote('conversation_id');
// echo $query;exit;
$db->setQuery($query);
$data = $db->loadObject();
if (!isset($data->related)) {
return false;
}
if ($data->related >= 2) {
return parent::bind($data);
}
return false;
}
示例4: loadByAlertId
public function loadByAlertId($alert_id, $user_id = null)
{
if (is_null($user_id)) {
$user_id = FD::user()->id;
}
$db = FD::db();
$sql = $db->sql();
$sql->select('#__social_alert_map');
$sql->where('alert_id', $alert_id);
$sql->where('user_id', $user_id);
$db->setQuery($sql);
$result = $db->loadObject();
if (!$result) {
return false;
}
return parent::bind($result);
}
示例5: load
public function load($uid = null, $utype = '', $component = 'com_easysocial')
{
if (empty($uid)) {
return false;
}
if ($utype) {
$db = FD::db();
$query = 'select * from ' . $db->nameQuote('#__social_indexer');
$query .= ' where ' . $db->nameQuote('uid') . ' = ' . $db->Quote($uid);
$query .= ' and ' . $db->nameQuote('utype') . ' = ' . $db->Quote($utype);
$query .= ' and ' . $db->nameQuote('component') . ' = ' . $db->Quote($component);
$db->setQuery($query);
$result = $db->loadObject();
if (!$result) {
return false;
}
parent::bind($result);
} else {
parent::load($uid);
}
return true;
}
示例6: bind
/**
* Bind's the stream data
*
* Example:
* <code>
* <?php
* // Load up the library.
* $item = FD::table( 'StreamItem' );
* $item->bind( $data );
*
* </code>
*
* @since 1.0
* @access public
* @param mixed Accepts array, object or SocialStreamTemplate which represents the stream's data.
* @return SocialTableStreamItem Returns the new stream id if success, false otherwise.
*/
public function bind($data, $ignore = array())
{
// Request parent to bind the data.
$state = parent::bind($data, $ignore);
return $state;
}
示例7: loadByUsername
/**
* Tries to find the oauth record given a username
*
* @since 1.0
* @access public
* @param string
* @return
*/
public function loadByUsername($username)
{
$model = FD::model('OAuth');
$row = $model->getRow(array('username' => $username));
if (!$row) {
return false;
}
$state = parent::bind($row);
return $state;
}
示例8: bind
/**
* Override parent's bind method implementation.
*
* @since 1.0
* @access public
* @param Array An array of key / value pairs for the table columns
* @param Array A list of ignored columns. (Optional)
* @return bool True if binded successfully.
*
* @author Mark Lee <mark@stackideas.com>
*/
public function bind($data, $ignore = array())
{
// Request the parent to bind the data.
$state = parent::bind($data, $ignore);
// Try to see if there's any params being set to the property as an array.
if (!is_null($this->params) && is_array($this->params)) {
$registry = FD::get('Registry');
foreach ($this->params as $key => $value) {
$registry->set($key, $value);
}
// Set the params to a proper string.
$this->params = $registry->toString();
}
return $state;
}
示例9: loadByElement
/**
* Loads the application given the `element`, `type` and `group`.
*
* @since 1.0
* @access public
* @param string The unique element name. (E.g: notes )
* @param string The group of the application. (E.g: people or group)
* @param string The unique type of the app. (E.g: apps or fields )
*
* @return bool True on success false otherwise
*
* @author Mark Lee <mark@stackideas.com>
*/
public function loadByElement($element, $group, $type)
{
$db = FD::db();
$query = array();
$query[] = 'SELECT * FROM ' . $db->nameQuote($this->_tbl);
$query[] = 'WHERE ' . $db->nameQuote('element') . '=' . $db->Quote($element);
$query[] = 'AND ' . $db->nameQuote('type') . '=' . $db->Quote($type);
$query[] = 'AND ' . $db->nameQuote('group') . '=' . $db->Quote($group);
$query = implode(' ', $query);
$db->setQuery($query);
$result = $db->loadObject();
if (!$result) {
return false;
}
return parent::bind($result);
}
示例10: bind
/**
* Binds a given array or object in this table's properties.
*
* @since 1.0
* @access public
* @param object|array Data to be binded.
* @param array An optional array or space separated list of properties to ignore while binding.
* @return bool State of storing.
*/
public function bind($data, $ignore = array())
{
$state = parent::bind($data, $ignore);
// @task: If created is not set, we need to set it here.
if (empty($this->created)) {
$this->created = FD::get('Date')->toMySQL();
}
// @task: If created is not set, we need to set it here.
if (empty($this->state)) {
// @TODO: Make this configurable. Default state to be published
$this->state = SOCIAL_FRIENDS_LIST_PUBLISHED;
}
return $state;
}
示例11: bind
public function bind($src, $ignore = array())
{
$state = parent::bind($src, $ignore);
if (!$state) {
return false;
}
$this->extractParams();
return true;
}
示例12: loadByCommand
/**
* Loads the point record given the composite indices.
*
* @since 1.0
* @access public
* @param string The command to lookup for.
* @param string The extension to lookup for.
* @return bool True if exists, false otherwise.
*/
public function loadByCommand($extension, $command)
{
$db = FD::db();
$sql = $db->sql();
$sql->select($this->_tbl);
$sql->where('command', $command);
$sql->where('extension', $extension);
$db->setQuery($query);
$row = $db->loadObject();
if (!$row) {
return false;
}
return parent::bind($row);
}
示例13: load
/**
* Overrides parent's load implementation
*
* @since 1.0
* @access public
*/
public function load($keys = null, $reset = true)
{
if (self::$_cache) {
if (is_array($keys)) {
return parent::load($keys, $reset);
}
if (!isset(self::$_photos[$keys])) {
$state = parent::load($keys);
self::$_photos[$keys] = $this;
return $state;
}
if (is_bool(self::$_photos[$keys])) {
return false;
}
return parent::bind(self::$_photos[$keys]);
} else {
return parent::load($keys, $reset);
}
}
示例14: loadByType
/**
* Override parent's implementation.
*
* @since 1.0
* @access public
* @param string $token The token that is generated.
* @return boolean True if exists, false otherwise.
*/
public function loadByType($uid, $type)
{
$db = FD::db();
$query = 'SELECT * FROM ' . $db->nameQuote($this->_tbl) . ' WHERE ' . $db->nameQuote('uid') . '=' . $db->Quote($uid) . ' AND ' . $db->nameQuote('type') . '=' . $db->Quote($type);
$db->setQuery($query);
$obj = $db->loadObject();
return parent::bind($obj);
}
示例15: bind
/**
* Override parent's store implementation
*
* @since 1.0
* @access public
* @param Array An associative array or object to bind to the JTable instance.
* @param Array An optional array or space separated list of properties to ignore while binding.
*
* @author Mark Lee <mark@stackideas.com>
*/
public function bind($data, $ignore = array())
{
$state = parent::bind($data, $ignore);
if (isset($data->element)) {
$this->element = $data->element;
}
if (isset($data->value)) {
$this->value = $data->value;
}
if (isset($data->value_binary)) {
$this->value_binary = $data->value_binary;
}
return $state;
}