Rune V. Sjøen rvsjoen

View gist:8174290
1 2 3 4 5 6 7 8 9 10
class Item extends AppModel
{
public $recursive = -1;
public $actsAs = array('Containable');
public $hasMany = array(
'Review' => array(
'ClassName' => 'Review',
'foreignKey' => 'item_id'
)
View gist:3177753
1 2 3
sudo pear install --alldeps phpunit/PHPUnit
sudo pear install phpunit/PHPUnit_MockObject
sudo pear install phpunit/DBUnit
View gist:3091586
1 2 3 4 5 6 7 8 9
<?php defined('_JEXEC') or die;
 
jimport('joomla.application.component.view');
 
abstract class HelloWorldViewBase extends JView {
public function __construct($config = array()) {
parent::__construct($config);
// Using addTemplatePath will give this a high priority, so we push instead
array_push($this->_path['template'], JPATH_COMPONENT . '/views/base/tmpl');
View gist:3091083
1 2 3 4 5 6 7 8 9 10
<?php
 
class DonkeyController extends JController
{
public function doshit()
{
$model = $this->getModel();
$model->setState('foo', 'bar');
$model->foo = 'bar';
$this->setRedirect('index.php?option=com_donkey&view=shit');
View gist:3077007
1 2 3 4 5 6 7 8 9 10
+-- administrator // This is where the administrator application lives
¦ +-- cache
¦ +-- components // Components specific to administrator
¦ +-- help // Help files for administrator
¦ +-- includes
¦ +-- language // Administrator language files
¦ +-- manifests // Installation manifests
¦ +-- modules // Administrator modules
¦ +-- templates // Administrator templates
+-- cache
View gist:3068346
1 2 3 4 5 6 7 8 9 10
<?php
 
foreach ($form->getFieldsets() as $group => $fieldset) {
foreach ($form->getFieldset($group) as $field) {
$form->removeField($field->fieldname); // This will remove only the fields outside <fields> elements
// $form->removeField($field->fieldname, $group); // This will remove only the fields inside the <fields> element
}
}
 
?>
View gist:3049903
1 2 3 4 5 6 7 8 9 10
class ... extends JControllerForm
{
public function save($key = null, $urlVar = null)
{
$result = parent::save($key, $urlVar);
$model = $this->getModel();
$state = $model->getState();
if($result){
$link = JRoute::_($this->getRedirectToItem().'&id='.$state->get('item.id'), false);
$this->setRedirect($link);
View gist:3048920
1 2 3 4 5 6 7 8 9 10
<script>
function destroyLessCache(pathToCss) { // e.g. '/css/' or '/stylesheets/'
if (!window.localStorage || !less || less.env !== 'development') {
// return;
}
var host = window.location.host;
var protocol = window.location.protocol;
var keyPrefix = protocol + '//' + host + pathToCss;
for (var key in window.localStorage) {
if (key.indexOf(keyPrefix) === 0) {
View gist:3048787
1 2 3 4 5 6 7 8 9 10
<?php
 
class BaseController extends JControllerForm
{
public function delete()
{
// Do shit
$this->setRedirect(JRoute::_($this->getRedirectToList(), false));
}
View default.php
1 2 3 4 5 6 7
<form method="post" action="index.php" id="adminForm">
<div id="toolbar-box"><?php echo $this->toolbar->render(); ?></div>
<input type="hidden" name="option" value="com_foo" />
<input type="hidden" name="task" value="" />
<input type="hidden" name="id" value="<?php echo $this->item->id; ?>" />
<?php echo JHtml::_('form.token'); ?>
</form>
Something went wrong with that request. Please try again.