copyQuestion.diff
| administrator/components/com_jquarks/models/question.php (working copy) | ||
|---|---|---|
| 88 | 88 |
|
| 89 | 89 |
/** |
| 90 | 90 |
* Get the propositions for the retrieved question |
| 91 |
* |
|
| 91 |
* |
|
| 92 | 92 |
* @return array of propositions |
| 93 | 93 |
*/ |
| 94 | 94 |
function &getPropositions() |
| ... | ... | |
| 103 | 103 |
$this->_db->setQuery($query) ; |
| 104 | 104 |
$this->_propositions = $this->_db->loadObjectList(); |
| 105 | 105 |
} |
| 106 |
|
|
| 106 |
|
|
| 107 | 107 |
return $this->_propositions ; |
| 108 | 108 |
} |
| 109 | 109 |
|
| ... | ... | |
| 215 | 215 |
return false ; |
| 216 | 216 |
} |
| 217 | 217 |
|
| 218 |
$new = 0; |
|
| 218 | 219 |
if ( $data['id'] == 0 ) { // case of a new question get the id of the inserted row
|
| 219 | 220 |
$data['id'] = $this->_id = $this->_db->insertid() ; |
| 221 |
$new = 1; |
|
| 220 | 222 |
} |
| 221 | 223 |
|
| 222 | 224 |
$propNumber = 1 ; |
| 223 | 225 |
|
| 224 | 226 |
while ( array_key_exists('prop'.$propNumber, $data ) ) // while we have propositions
|
| 225 | 227 |
{
|
| 226 |
if (array_key_exists('propid'.$propNumber, $data)) { // existant proposition
|
|
| 228 |
if (array_key_exists('propid'.$propNumber, $data) && !$new) { // existant proposition
|
|
| 227 | 229 |
$propdata['id'] = $data['propid'.$propNumber]; |
| 228 | 230 |
} else { // new proposition
|
| 229 | 231 |
$propdata['id'] = 0 ; |
| ... | ... | |
| 243 | 245 |
|
| 244 | 246 |
if(array_key_exists('propdelete'.$propNumber, $data) ) // the proposition is checked to be deleted
|
| 245 | 247 |
{
|
| 246 |
if (array_key_exists('propid'.$propNumber, $data)) // case of an already existant proposition
|
|
| 248 |
if (array_key_exists('propid'.$propNumber, $data) && !$new) // case of an already existant proposition
|
|
| 247 | 249 |
{
|
| 248 | 250 |
if (!$this->_propositionsTable->delete($propdata['id'])) |
| 249 | 251 |
{
|