| 1 |
<?php |
| 2 |
/** |
| 3 |
* |
| 4 |
*/ |
| 5 |
|
| 6 |
/** |
| 7 |
* |
| 8 |
*/ |
| 9 |
class CJT_Models_Block_Parameters_Form_Parameters |
| 10 |
extends CJT_Models_Block_Parameters_Base_Parameters { |
| 11 |
|
| 12 |
/** |
| 13 |
* put your comment there... |
| 14 |
* |
| 15 |
* @param mixed $blockId |
| 16 |
* @return CJT_Models_Block_Parameters_Form_Parameters |
| 17 |
*/ |
| 18 |
public function __construct($blockId) { |
| 19 |
// Parent procedure! |
| 20 |
parent::__construct($blockId); |
| 21 |
// Read all values. |
| 22 |
$this->assignValues(); |
| 23 |
} |
| 24 |
|
| 25 |
/** |
| 26 |
* put your comment there... |
| 27 |
* |
| 28 |
*/ |
| 29 |
protected function assignValues() { |
| 30 |
// Initialize. |
| 31 |
$driver = cssJSToolbox::getInstance()->getDBDriver(); |
| 32 |
// For every parameter assign the values. |
| 33 |
foreach ($this->getParams() as $param) { |
| 34 |
// Query all values. |
| 35 |
$recset = $driver->select("SELECT * |
| 36 |
FROM #__cjtoolbox_parameter_typedef |
| 37 |
WHERE parameterId = {$param->getId()}", ARRAY_A); |
| 38 |
foreach ($recset as $valueRow) { |
| 39 |
$param->addValue(new CJT_Models_Block_Parameters_Form_Value($valueRow)); |
| 40 |
} |
| 41 |
} |
| 42 |
return $this; |
| 43 |
} |
| 44 |
|
| 45 |
/** |
| 46 |
* put your comment there... |
| 47 |
* |
| 48 |
* @param mixed $row |
| 49 |
*/ |
| 50 |
public function createModelObject($row) { |
| 51 |
return new CJT_Models_Block_Parameters_Form_Parameter($row); |
| 52 |
} |
| 53 |
|
| 54 |
/** |
| 55 |
* put your comment there... |
| 56 |
* |
| 57 |
*/ |
| 58 |
protected function getQuery() { |
| 59 |
$query = "SELECT p.*, pe.renderer, pe.description, pe.helpText, g.id groupId, g.name groupName, g.description groupDescription |
| 60 |
FROM #__cjtoolbox_parameters p LEFT JOIN #__cjtoolbox_blocks b ON p.blockId = b.id |
| 61 |
LEFT JOIN #__cjtoolbox_form_group_parameters pe ON pe.parameterId = p.id |
| 62 |
LEFT JOIN #__cjtoolbox_form_groups g ON pe.groupId = g.id |
| 63 |
WHERE b.id = {$this->blockId} |
| 64 |
ORDER by id ASC;"; |
| 65 |
return $query; |
| 66 |
} |
| 67 |
|
| 68 |
} // End class. |
| 69 |
|