Joomla Platform  13.1
Documentation des API du framework Joomla Platform
 Tout Classes Espaces de nommage Fichiers Fonctions Variables Pages
Référence de la classe JTableContent
+ Graphe d'héritage de JTableContent:
+ Graphe de collaboration de JTableContent:

Liste de tous les membres

Fonctions membres publiques

 __construct (JDatabaseDriver $db)
 bind ($array, $ignore= '')
 check ()
 store ($updateNulls=false)
 publish ($pks=null, $state=1, $userId=0)
- Fonctions membres publiques inherited from JTable
 __construct ($table, $key, JDatabaseDriver $db)
 attachObserver (JObserverInterface $observer)
 getObserverOfClass ($observerClass)
 getFields ()
 appendPrimaryKeys ($query, $pk=null)
 getTableName ()
 getKeyName ($multiple=false)
 getDbo ()
 setDBO (JDatabaseDriver $db)
 setRules ($input)
 getRules ()
 reset ()
 load ($keys=null, $reset=true)
 save ($src, $orderingFilter= '', $ignore= '')
 delete ($pk=null)
 checkOut ($userId, $pk=null)
 checkIn ($pk=null)
 hasPrimaryKey ()
 hit ($pk=null)
 isCheckedOut ($with=0, $against=null)
 getNextOrder ($where= '')
 getPrimaryKey (array $keys=array())
 reorder ($where= '')
 move ($delta, $where= '')
- Fonctions membres publiques inherited from JObject
 __construct ($properties=null)
 __toString ()
 def ($property, $default=null)
 get ($property, $default=null)
 getProperties ($public=true)
 getError ($i=null, $toString=true)
 getErrors ()
 set ($property, $value=null)
 setProperties ($properties)
 setError ($error)

Fonctions membres protégées

 _getAssetName ()
 _getAssetTitle ()
 _getAssetParentId (JTable $table=null, $id=null)
- Fonctions membres protégées inherited from JTable
 _lock ()
 _unlock ()

Additional Inherited Members

- Fonctions membres publiques statiques inherited from JTable
static getInstance ($type, $prefix= 'JTable', $config=array())
static addIncludePath ($path=null)
- Attributs protégés inherited from JTable
 $_tbl = ''
 $_tbl_key = ''
 $_tbl_keys = array()
 $_db
 $_trackAssets = false
 $_rules
 $_locked = false
 $_autoincrement = true
 $_observers
- Attributs protégés inherited from JObject
 $_errors = array()

Description détaillée

Définition à la ligne 20 du fichier content.php.


Documentation des constructeurs et destructeur

JTableContent::__construct ( JDatabaseDriver  $db)

Constructor

Paramètres:
JDatabaseDriver$dbA database connector object
Depuis:
11.1

Définition à la ligne 29 du fichier content.php.

{
parent::__construct('#__content', 'id', $db);
/*
* This is left here for reference:
*
* This would set up the tags observer in $this from here (so not entirely decoupled):
* JTableObserverTags::createObserver($this, array('typeAlias' => 'com_content.article'));
*
* But this makes the relation between content and tags completely external to Content as JTable is observable:
* So we are doing this only once in libraries/cms.php:
* JObserverFactory::addObserverClassToClass('JTableObserverTags', 'JTableContent', array('typeAlias' => 'com_content.article'));
*/
}

Documentation des fonctions membres

JTableContent::_getAssetName ( )
protected

Method to compute the default name of the asset. The default name is in the form table_name.id where id is the value of the primary key of the table.

Renvoie:
string
Depuis:
11.1

Réimplémentée à partir de JTable.

Définition à la ligne 54 du fichier content.php.

{
return 'com_content.article.' . (int) $this->$k;
}
JTableContent::_getAssetParentId ( JTable  $table = null,
  $id = null 
)
protected

Method to get the parent asset id for the record

Paramètres:
JTable$tableA JTable object (optional) for the asset parent
integer$idThe id (optional) of the content.
Renvoie:
integer
Depuis:
11.1

Réimplémentée à partir de JTable.

Définition à la ligne 83 du fichier content.php.

{
$assetId = null;
// This is a article under a category.
if ($this->catid)
{
// Build the query to get the asset id for the parent category.
$query = $this->_db->getQuery(true)
->select($this->_db->quoteName('asset_id'))
->from($this->_db->quoteName('#__categories'))
->where($this->_db->quoteName('id') . ' = ' . (int) $this->catid);
// Get the asset id from the database.
$this->_db->setQuery($query);
if ($result = $this->_db->loadResult())
{
$assetId = (int) $result;
}
}
// Return the asset id.
if ($assetId)
{
return $assetId;
}
else
{
return parent::_getAssetParentId($table, $id);
}
}
JTableContent::_getAssetTitle ( )
protected

Method to return the title to use for the asset table.

Renvoie:
string
Depuis:
11.1

Réimplémentée à partir de JTable.

Définition à la ligne 68 du fichier content.php.

{
return $this->title;
}
JTableContent::bind (   $array,
  $ignore = '' 
)

Overloaded bind function

Paramètres:
array$arrayNamed array
mixed$ignoreAn optional array or space separated list of properties to ignore while binding.
Renvoie:
mixed Null if operation was satisfactory, otherwise returns an error string
Voir également:
JTable::bind()
Depuis:
11.1

Réimplémentée à partir de JTable.

Définition à la ligne 128 du fichier content.php.

Références JRegistry\loadArray().

{
// Search for the {readmore} tag and split the text up accordingly.
if (isset($array['articletext']))
{
$pattern = '#<hr\s+id=("|\')system-readmore("|\')\s*\/*>#i';
$tagPos = preg_match($pattern, $array['articletext']);
if ($tagPos == 0)
{
$this->introtext = $array['articletext'];
$this->fulltext = '';
}
else
{
list ($this->introtext, $this->fulltext) = preg_split($pattern, $array['articletext'], 2);
}
}
if (isset($array['attribs']) && is_array($array['attribs']))
{
$registry = new JRegistry;
$registry->loadArray($array['attribs']);
$array['attribs'] = (string) $registry;
}
if (isset($array['metadata']) && is_array($array['metadata']))
{
$registry = new JRegistry;
$registry->loadArray($array['metadata']);
$array['metadata'] = (string) $registry;
}
// Bind the rules.
if (isset($array['rules']) && is_array($array['rules']))
{
$rules = new JAccessRules($array['rules']);
$this->setRules($rules);
}
return parent::bind($array, $ignore);
}

+ Voici le graphe d'appel pour cette fonction :

JTableContent::check ( )

Overloaded check function

Renvoie:
boolean True on success, false on failure
Voir également:
JTable::check()
Depuis:
11.1

Réimplémentée à partir de JTable.

Définition à la ligne 179 du fichier content.php.

Références JText\_(), JFactory\getDate(), JString\str_ireplace(), et JApplication\stringURLSafe().

{
if (trim($this->title) == '')
{
$this->setError(JText::_('COM_CONTENT_WARNING_PROVIDE_VALID_NAME'));
return false;
}
if (trim($this->alias) == '')
{
$this->alias = $this->title;
}
$this->alias = JApplication::stringURLSafe($this->alias);
if (trim(str_replace('-', '', $this->alias)) == '')
{
$this->alias = JFactory::getDate()->format('Y-m-d-H-i-s');
}
if (trim(str_replace('&nbsp;', '', $this->fulltext)) == '')
{
$this->fulltext = '';
}
// Check the publish down date is not earlier than publish up.
if ($this->publish_down > $this->_db->getNullDate() && $this->publish_down < $this->publish_up)
{
// Swap the dates.
$temp = $this->publish_up;
$this->publish_up = $this->publish_down;
$this->publish_down = $temp;
}
// Clean up keywords -- eliminate extra spaces between phrases
// and cr (\r) and lf (\n) characters from string
if (!empty($this->metakey))
{
// Only process if not empty
// Array of characters to remove
$bad_characters = array("\n", "\r", "\"", "<", ">");
// Remove bad characters
$after_clean = JString::str_ireplace($bad_characters, "", $this->metakey);
// Create array using commas as delimiter
$keys = explode(',', $after_clean);
$clean_keys = array();
foreach ($keys as $key)
{
if (trim($key))
{
// Ignore blank keywords
$clean_keys[] = trim($key);
}
}
// Put array back together delimited by ", "
$this->metakey = implode(", ", $clean_keys);
}
return true;
}

+ Voici le graphe d'appel pour cette fonction :

JTableContent::publish (   $pks = null,
  $state = 1,
  $userId = 0 
)

Method to set the publishing state for a row or list of rows in the database table. The method respects checked out rows by other users and will attempt to checkin rows that it can after adjustments are made.

Paramètres:
mixed$pksAn optional array of primary key values to update. If not set the instance property value is used.
integer$stateThe publishing state. eg. [0 = unpublished, 1 = published]
integer$userIdThe user id of the user performing the operation.
Renvoie:
boolean True on success.
Depuis:
11.1

Réimplémentée à partir de JTable.

Définition à la ligne 307 du fichier content.php.

Références JText\_(), et JArrayHelper\toInteger().

{
// Sanitize input.
$userId = (int) $userId;
$state = (int) $state;
// If there are no primary keys set check to see if the instance key is set.
if (empty($pks))
{
if ($this->$k)
{
$pks = array($this->$k);
}
// Nothing to set publishing state on, return false.
else
{
$this->setError(JText::_('JLIB_DATABASE_ERROR_NO_ROWS_SELECTED'));
return false;
}
}
// Build the WHERE clause for the primary keys.
$where = $k . '=' . implode(' OR ' . $k . '=', $pks);
// Determine if there is checkin support for the table.
if (!property_exists($this, 'checked_out') || !property_exists($this, 'checked_out_time'))
{
$checkin = '';
}
else
{
$checkin = ' AND (checked_out = 0 OR checked_out = ' . (int) $userId . ')';
}
// Update the publishing state for rows with the given primary keys.
$query = $this->_db->getQuery(true)
->update($this->_db->quoteName($this->_tbl))
->set($this->_db->quoteName('state') . ' = ' . (int) $state)
->where('(' . $where . ')' . $checkin);
$this->_db->setQuery($query);
try
{
$this->_db->execute();
}
catch (RuntimeException $e)
{
$this->setError($e->getMessage());
return false;
}
// If checkin is supported and all rows were adjusted, check them in.
if ($checkin && (count($pks) == $this->_db->getAffectedRows()))
{
// Checkin the rows.
foreach ($pks as $pk)
{
$this->checkin($pk);
}
}
// If the JTable instance value is in the list of primary keys that were set, set the instance.
if (in_array($this->$k, $pks))
{
$this->state = $state;
}
$this->setError('');
return true;
}

+ Voici le graphe d'appel pour cette fonction :

JTableContent::store (   $updateNulls = false)

Overrides JTable::store to set modified data and user id.

Paramètres:
boolean$updateNullsTrue to update fields even if they are null.
Renvoie:
boolean True on success.
Depuis:
11.1

Réimplémentée à partir de JTable.

Définition à la ligne 255 du fichier content.php.

Références JText\_(), JFactory\getDate(), JTable\getInstance(), et JFactory\getUser().

{
$date = JFactory::getDate();
$user = JFactory::getUser();
if ($this->id)
{
// Existing item
$this->modified = $date->toSql();
$this->modified_by = $user->get('id');
}
else
{
// New article. An article created and created_by field can be set by the user,
// so we don't touch either of these if they are set.
if (!(int) $this->created)
{
$this->created = $date->toSql();
}
if (empty($this->created_by))
{
$this->created_by = $user->get('id');
}
}
// Verify that the alias is unique
$table = JTable::getInstance('Content', 'JTable');
if ($table->load(array('alias' => $this->alias, 'catid' => $this->catid)) && ($table->id != $this->id || $this->id == 0))
{
$this->setError(JText::_('JLIB_DATABASE_ERROR_ARTICLE_UNIQUE_ALIAS'));
return false;
}
return parent::store($updateNulls);
}

+ Voici le graphe d'appel pour cette fonction :


La documentation de cette classe a été générée à partir du fichier suivant :