本文整理汇总了PHP中SocialTable类的典型用法代码示例。如果您正苦于以下问题:PHP SocialTable类的具体用法?PHP SocialTable怎么用?PHP SocialTable使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SocialTable类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: store
public function store($updateNulls = false)
{
if (!$this->created) {
$this->created = FD::get('Date', 'now', false)->toMySQL();
}
return parent::store();
}
示例2: store
public function store($updateNulls = false)
{
if (empty($this->ordering)) {
$this->ordering = $this->getNextOrder('type = ' . FD::db()->quote($this->type) . ' AND parent_uid = ' . FD::db()->quote($this->parent_uid));
}
parent::store($updateNulls);
}
示例3: delete
/**
* Overrides the delete function
*
* @since 1.0
* @access public
* @return bool
*/
public function delete($pk = null)
{
$state = parent::delete();
// Delete any items that are related to this stream
$stream = FD::stream();
$stream->delete($this->id, 'feeds');
return $state;
}
示例4: store
public function store($updateNulls = false)
{
if (empty($this->value) && !empty($this->title)) {
$this->value = JString::strtolower(JString::str_ireplace(' ', '', $this->title));
}
if (empty($this->title) && !empty($this->value)) {
$this->title = JString::ucfirst($this->value);
}
return parent::store($updateNulls);
}
示例5: load
/**
* Override parent's load implementation
*
* @since 1.0
* @access public
* @param int The unique row id.
* @param bool True to reset the default values before loading the new row.
*
* @author Mark Lee <mark@stackideas.com>
*/
public function load($key = null, $reset = true)
{
$state = parent::load($key, $reset);
// @rule: We want to see which steps the user has already walked through.
if (empty($this->step_access)) {
$this->step_access = array();
}
if (!empty($this->step_access) && is_string($this->step_access)) {
$this->step_access = explode(',', $this->step_access);
}
return $state;
}
示例6: load
public function load($uid = null, $userId = null, $type = SOCIAL_STREAM_HIDE_TYPE_STREAM)
{
if (empty($uid) || empty($userId)) {
return false;
}
$db = FD::db();
$query = 'select `id` from `#__social_stream_hide`';
$query .= ' where `user_id` = ' . $db->Quote($userId);
$query .= ' and `uid` = ' . $db->Quote($uid);
$query .= ' and `type` = ' . $db->Quote($type);
$db->setQuery($query);
$id = $db->loadResult();
return parent::load($id);
}
示例7: 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);
}
示例8: 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;
}
示例9: store
public function store($updateNulls = false)
{
if (empty($this->ordering)) {
$this->ordering = $this->getNextOrder('type = ' . FD::db()->quote($this->type) . ' AND parent_uid = ' . FD::db()->quote($this->parent_uid));
}
if (empty($this->uid)) {
$db = FD::db();
$sql = $db->sql();
$sql->raw("SELECT MAX(`uid`) FROM `#__social_regions` WHERE `type` = " . $db->q($this->type));
$db->setQuery($sql);
$result = (int) $db->loadResult();
$this->uid = $result + 1;
}
parent::store($updateNulls);
}
示例10: store
public function store($updateNulls = false)
{
$now = FD::date();
// Set created to now by default
if (empty($this->created)) {
$this->created = $now->toSql();
}
// Set expired to 1 day later by default
if (empty($this->expired)) {
$this->expired = FD::date($now->toUnix() + 24 * 60 * 60)->toSql();
}
if (is_array($this->value) || is_object($this->value)) {
$this->value = FD::json()->encode($this->value);
}
return parent::store($updateNulls);
}
示例11: 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);
}
示例12: load
/**
* Override parent's load implementation
*
* @since 1.0
* @access public
* @param int The unique row id.
* @param bool True to reset the default values before loading the new row.
*
* @author Mark Lee <mark@stackideas.com>
*/
public function load($key = null, $reset = true)
{
$state = parent::load($key, $reset);
// If state is false, then we create the session here
if (!$state) {
$session = JFactory::getSession();
$this->session_id = $session->getId();
$this->created = FD::date()->toSql();
$state = $this->store();
}
// @rule: We want to see which steps the user has already walked through.
if (empty($this->step_access)) {
$this->step_access = array();
}
if (!empty($this->step_access) && is_string($this->step_access)) {
$this->step_access = explode(',', $this->step_access);
}
return $state;
}
示例13: 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;
}
示例14: __construct
public function __construct($db)
{
parent::__construct('#__social_subscriptions', 'id', $db);
}
示例15: store
/**
* Override's parent's behavior of store.
*
* @since 1.0
* @access public
* @param string
* @return
*/
public function store($updateNulls = false)
{
$state = parent::store();
return $state;
}