Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion core/components/com_courses/admin/controllers/assets.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,17 @@ public function displayTask()
$tbl = new Tables\Asset($this->database);
// print_r($this->view->filters);

// A scope id of 0 here means "every scope", but the table now reads a
// zero as "match nothing", so drop the key instead of passing it.
$where = $this->view->filters;

if (empty($where['asset_scope_id']))
{
unset($where['asset_scope_id']);
}

$rows = $tbl->find(array(
'w' => $this->view->filters
'w' => $where
));

// print_r($rows);
Expand Down
2 changes: 1 addition & 1 deletion core/components/com_courses/models/section.php
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ public function access($action='view', $item='section')
if (!isset($this->_permissions))
{
$this->_permissions = Permissions::getInstance();
$this->_permissions->set('offering_id', $this->get('id'));
$this->_permissions->set('offering_id', $this->get('offering_id'));
$this->_permissions->set('section_id', $this->get('id'));
}
return $this->_permissions->access($action, $item);
Expand Down
3 changes: 2 additions & 1 deletion core/components/com_courses/tables/asset.group.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,8 @@ private function _buildQuery($filters=array())

$where = array();

if (isset($filters['unit_id']) && $filters['unit_id'])
// A unit_id of 0 must match no groups rather than dropping the clause
if (isset($filters['unit_id']))
{
$where[] = "cag.unit_id=" . $this->_db->quote($filters['unit_id']);
}
Expand Down
3 changes: 2 additions & 1 deletion core/components/com_courses/tables/asset.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,8 @@ private function _buildQuery($filters=array())
{
$where[] = "ca.id=" . $this->_db->quote((int) $filters['asset_id']);
}
if (!empty($filters['asset_scope_id']))
// A scope id of 0 must match no assets rather than dropping the clause
if (isset($filters['asset_scope_id']))
{
$where[] = "cag.id=" . $this->_db->quote((int) $filters['asset_scope_id']);
}
Expand Down
4 changes: 3 additions & 1 deletion core/components/com_courses/tables/unit.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,9 @@ private function _buildQuery($filters=array())

$where = array();

if (isset($filters['offering_id']) && $filters['offering_id'])
// Note the deliberate lack of a truthiness test: an offering_id of 0
// has to match no units, not every unit in the table.
if (isset($filters['offering_id']))
{
$where[] = "cu.offering_id=" . $this->_db->quote($filters['offering_id']);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
</div>
</div>
<div class="tool-files-available">
<?php $files = $toolAsset ? $toolAsset->files($asset) : array(); ?>
<?php $files = ($toolAsset && method_exists($toolAsset, 'files')) ? $toolAsset->files($asset) : array(); ?>
<?php if (!empty($files)) : ?>
<ul class="tool-files-list">
<?php foreach ($files as $file) : ?>
Expand Down