Source for file form.php
Documentation is available at form.php
* @subpackage com_content
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
// Base this model on the backend version.
require_once JPATH_ADMINISTRATOR.
'/components/com_content/models/article.php';
* Content Component Article Model
* @subpackage com_content
* Model typeAlias string. Used for version history.
* Method to auto-populate the model state.
* Note. Calling getState in this method will result in recursion.
// Load state from the request.
$pk =
$app->input->getInt('a_id');
$this->setState('article.catid', $app->input->getInt('catid'));
$return =
$app->input->get('return', null, 'base64');
$params =
$app->getParams();
$this->setState('layout', $app->input->get('layout'));
* Method to get article data.
* @param integer $itemId The id of the article.
* @return mixed Content item data object on success, false on failure.
public function getItem($itemId =
null)
$itemId = (int)
(!empty($itemId)) ?
$itemId :
$this->getState('article.id');
// Attempt to load the row.
$return =
$table->load($itemId);
// Check for a table object error.
if ($return ===
false &&
$table->getError())
$properties =
$table->getProperties(1);
// Convert attrib field to Registry.
$value->params->loadString($value->attribs);
// Compute selected asset permissions.
$userId =
$user->get('id');
$asset =
'com_content.article.' .
$value->id;
// Check general edit permission first.
if ($user->authorise('core.edit', $asset))
$value->params->set('access-edit', true);
// Now check if edit.own is available.
elseif (!empty($userId) &&
$user->authorise('core.edit.own', $asset))
// Check for a valid user and that they are the owner.
if ($userId ==
$value->created_by)
$value->params->set('access-edit', true);
// Check edit state permission.
$value->params->set('access-change', $user->authorise('core.edit.state', $asset));
$catId = (int)
$this->getState('article.catid');
$value->params->set('access-change', $user->authorise('core.edit.state', 'com_content.category.' .
$catId));
$value->params->set('access-change', $user->authorise('core.edit.state', 'com_content'));
$value->articletext =
$value->introtext;
if (!empty($value->fulltext))
$value->articletext .=
'<hr id="system-readmore" />' .
$value->fulltext;
// Convert the metadata field to an array.
$registry->loadString($value->metadata);
$value->metadata =
$registry->toArray();
$value->tags->getTagIds($value->id, 'com_content.article');
$value->metadata['tags'] =
$value->tags;
* @return string The return URL.
* Method to save the form data.
* @param array $data The form data.
* @return boolean True on success.
public function save($data)
// Associations are not edited in frontend ATM so we have to inherit them
foreach ($associations as $tag =>
$associated)
$associations[$tag] = (int)
$associated->id;
$data['associations'] =
$associations;
return parent::save($data);
Documentation generated on Tue, 19 Nov 2013 15:03:41 +0100 by phpDocumentor 1.4.3