| Previous CloneSet | Next CloneSet | Back to Main Report |
| Clone Mass | Clones in CloneSet | Parameter Count | Clone Similarity | Syntax Category [Sequence Length] |
|---|---|---|---|---|
| 62 | 3 | 1 | 0.998 | class_member_list[2] |
| Clone Abstraction | Parameter Bindings |
| Clone Instance (Click to see clone) | Line Count | Source Line | Source File |
|---|---|---|---|
| 1 | 62 | 156 | administrator/components/com_categories/models/category.php |
| 2 | 61 | 354 | administrator/components/com_content/models/article.php |
| 3 | 62 | 206 | administrator/components/com_menus/models/item.php |
| ||||
/**
* Method to checkin a row.
*
* @param integer $pk The numeric id of a row
* @return boolean False on failure or error, true otherwise.
*/
public
function checkin($pk= NULL) {
// Initialize variables.
$pk= (!empty($pk))
? $pk
: (int) $this->getState('category.id');
// Only attempt to check the row in if it exists.
if ($pk)
{
$user= &JFactory::getUser();
// Get an instance of the row to checkin.
$table= &$this->getTable();
if (!$table->load($pk)) {
$this->setError($table->getError());
return FALSE;
}
// Check if this is the user having previously checked out the row.
if ($table->checked_out > 0
&& $table->checked_out != $user->get('id')) {
$this->setError(JText::_('JError_Checkin_user_mismatch'));
return FALSE;
}
// Attempt to check the row in.
if (!$table->checkin($pk)) {
$this->setError($table->getError());
return FALSE;
}
}
return TRUE;
}
/**
* Method to check-out a row for editing.
*
* @param int $pk The numeric id of the row to check-out.
*
* @return boolean False on failure or error, true otherwise.
*/
public
function checkout($pk= NULL) {
// Initialize variables.
$pk= (!empty($pk))
? $pk
: (int) $this->getState('category.id');
// Only attempt to check the row in if it exists.
if ($pk)
{
// Get a row instance.
$table= &$this->getTable();
// Get the current user object.
$user= &JFactory::getUser();
// Attempt to check the row out.
if (!$table->checkout($user->get('id'), $pk)) {
$this->setError($table->getError());
return FALSE;
}
}
return TRUE;
}
|
| ||||
/**
* Method to checkin a row.
*
* @param integer $pk The numeric id of a row
* @return boolean False on failure or error, true otherwise.
*/
public
function checkin($pk= NULL) {
// Initialize variables.
$pk= (!empty($pk))
? $pk
: (int) $this->getState('article.id');
// Only attempt to check the row in if it exists.
if ($pk)
{
$user= &JFactory::getUser();
// Get an instance of the row to checkin.
$table= &$this->getTable();
if (!$table->load($pk)) {
$this->setError($table->getError());
return FALSE;
}
// Check if this is the user having previously checked out the row.
if ($table->checked_out > 0
&& $table->checked_out != $user->get('id')) {
$this->setError(JText::_('JError_Checkin_user_mismatch'));
return FALSE;
}
// Attempt to check the row in.
if (!$table->checkin($pk)) {
$this->setError($table->getError());
return FALSE;
}
}
return TRUE;
}
/**
* Method to check-out a row for editing.
*
* @param int $pk The numeric id of the row to check-out.
* @return boolean False on failure or error, true otherwise.
*/
public
function checkout($pk= NULL) {
// Initialize variables.
$pk= (!empty($pk))
? $pk
: (int) $this->getState('article.id');
// Only attempt to check the row in if it exists.
if ($pk)
{
// Get a row instance.
$table= &$this->getTable();
// Get the current user object.
$user= &JFactory::getUser();
// Attempt to check the row out.
if (!$table->checkout($user->get('id'), $pk)) {
$this->setError($table->getError());
return FALSE;
}
}
return TRUE;
}
|
| ||||
/**
* Method to checkin a row.
*
* @param integer $pk The numeric id of a row
* @return boolean False on failure or error, true otherwise.
*/
public
function checkin($pk= NULL) {
// Initialize variables.
$pk= (!empty($pk))
? $pk
: (int) $this->getState('item.id');
// Only attempt to check the row in if it exists.
if ($pk)
{
$user= &JFactory::getUser();
// Get an instance of the row to checkin.
$table= &$this->getTable();
if (!$table->load($pk)) {
$this->setError($table->getError());
return FALSE;
}
// Check if this is the user having previously checked out the row.
if ($table->checked_out > 0
&& $table->checked_out != $user->get('id')) {
$this->setError(JText::_('JError_Checkin_user_mismatch'));
return FALSE;
}
// Attempt to check the row in.
if (!$table->checkin($pk)) {
$this->setError($table->getError());
return FALSE;
}
}
return TRUE;
}
/**
* Method to check-out a row for editing.
*
* @param int $pk The numeric id of the row to check-out.
*
* @return boolean False on failure or error, true otherwise.
*/
public
function checkout($pk= NULL) {
// Initialize variables.
$pk= (!empty($pk))
? $pk
: (int) $this->getState('item.id');
// Only attempt to check the row in if it exists.
if ($pk)
{
// Get a row instance.
$table= &$this->getTable();
// Get the current user object.
$user= &JFactory::getUser();
// Attempt to check the row out.
if (!$table->checkout($user->get('id'), $pk)) {
$this->setError($table->getError());
return FALSE;
}
}
return TRUE;
}
|
| |||
/**
* Method to checkin a row.
*
* @param integer $pk The numeric id of a row
* @return boolean False on failure or error, true otherwise.
*/
public
function checkin($pk=NULL) {
// Initialize variables.
$pk=(!empty($pk))
? $pk
: (int) $this->getState( [[#variable51f9b440]]);
// Only attempt to check the row in if it exists.
if ($pk) {
$user= &JFactory::getUser();
// Get an instance of the row to checkin.
$table= &$this->getTable();
if (!$table->load($pk)) {
$this->setError($table->getError());
return FALSE;
}
// Check if this is the user having previously checked out the row.
if ($table->checked_out >0
&& $table->checked_out != $user->get('id')) {
$this->setError(JText::_('JError_Checkin_user_mismatch'));
return FALSE;
}
// Attempt to check the row in.
if (!$table->checkin($pk)) {
$this->setError($table->getError());
return FALSE;
}
}
return TRUE;
}
/**
* Method to check-out a row for editing.
*
* @param int $pk The numeric id of the row to check-out.
*
* @return boolean False on failure or error, true otherwise.
*/
/**
* Method to check-out a row for editing.
*
* @param int $pk The numeric id of the row to check-out.
* @return boolean False on failure or error, true otherwise.
*/
public
function checkout($pk=NULL) {
// Initialize variables.
$pk=(!empty($pk))
? $pk
: (int) $this->getState( [[#variable51f9b440]]);
// Only attempt to check the row in if it exists.
if ($pk) {
// Get a row instance.
$table= &$this->getTable();
// Get the current user object.
$user= &JFactory::getUser();
// Attempt to check the row out.
if (!$table->checkout($user->get('id'),$pk)) {
$this->setError($table->getError());
return FALSE;
}
}
return TRUE;
}
|
| CloneAbstraction |
| Parameter Index | Clone Instance | Parameter Name | Value |
|---|---|---|---|
| 1 | 1 | [[#51f9b440]] | 'category.id' |
| 1 | 2 | [[#51f9b440]] | 'article.id' |
| 1 | 3 | [[#51f9b440]] | 'item.id' |