use Kronolith_Driver_Resource::listResources instead.
}
/* Get list of resources for select list, and remove those we already added */
-$allResources = Kronolith_Resource::listResources();
+$allResources = Kronolith::getDriver('Resource')->listResources();
foreach (array_keys($resources) as $id) {
unset($allResources[$id]);
}
/**
* Return a list of Kronolith_Resources
*
- * This method will likely be a moving target as group resources are
- * fleshed out.
+ * Right now, all users have PERMS_READ, but only system admins have
+ * PERMS_EDIT | PERMS_DELETE
*
+ * @param int $perms A PERMS_* constant.
* @param array $filter A hash of field/values to filter on.
*/
- public function listResources($filter = array())
+ public function listResources($perms = PERMS_READ, $filter = array())
{
+ if (($perms & (PERMS_EDIT | PERMS_DELETE)) && !Horde_Auth::isAdmin()) {
+ return array();
+ }
+
$query = 'SELECT resource_id, resource_name, resource_calendar, resource_category, resource_description, resource_response_type, resource_type, resource_members FROM kronolith_resources';
if (count($filter)) {
$clause = ' WHERE ';
{
parent::Horde_Form($vars, _("Create Resource"));
- $resources = Kronolith_Resource::listResources(PERMS_READ, array('type' => 'Single'));
+ $resources = Kronolith::getDriver('Resource')->listResources(PERMS_READ, array('type' => 'Single'));
$enum = array();
foreach ($resources as $resource) {
$enum[$resource->getId()] = htmlspecialchars($resource->get('name'));
$this->_resource = &$resource;
parent::Horde_Form($vars, sprintf(_("Edit %s"), $resource->get('name')));
- $resources = Kronolith_Resource::listResources(PERMS_READ, array('type' => 'Single'));
+ $resources = Kronolith::getDriver('Resource')->listResources(PERMS_READ, array('type' => 'Single'));
$enum = array();
foreach ($resources as $r) {
$enum[$r->getId()] = htmlspecialchars($r->get('name'));
}
/**
- * Return a list of resources that the current user has access to at the
- * specified permission level. Right now, all users have PERMS_READ, but
- * only system admins have PERMS_EDIT | PERMS_DELETE
- *
- * @return array of Kronolith_Resource objects
- */
- static public function listResources($perms = PERMS_READ, $params = array())
- {
- if (($perms & (PERMS_EDIT | PERMS_DELETE)) && !Horde_Auth::isAdmin()) {
- return array();
- }
-
- // Query kronolith_resource table for all(?) available resources?
- // maybe by 'type' or 'name'? type would be arbitrary?
- $driver = Kronolith::getDriver('Resource');
- return $driver->listResources($params);
- }
-
- /**
* Determine if the provided calendar id represents a resource's calendar.
*
* @param string $calendar The calendar identifier to check.
$edit_url_base = Horde::applicationUrl('resources/groups/edit.php');
$edit_img = Horde::img('edit.png', _("Edit"), null, $registry->getImageDir('horde'));
-$resources = Kronolith_Resource::listResources(PERMS_EDIT, array('type' => 'Group'));
+$resources = Kronolith::getDriver('Resource')->listResources(PERMS_EDIT, array('type' => 'Group'));
//$display_url_base = Horde::applicationUrl('month.php', true, -1);
$delete_url_base = Horde::applicationUrl('resources/groups/delete.php');
$delete_img = Horde::img('delete.png', _("Delete"), null, $registry->getImageDir('horde'));
}
$edit_url_base = Horde::applicationUrl('resources/edit.php');
$edit_img = Horde::img('edit.png', _("Edit"), null, $registry->getImageDir('horde'));
-$resources = Kronolith_Resource::listResources(PERMS_READ, array('type' => 'Single'));
+$resources = Kronolith::getDriver('Resource')->listResources(PERMS_READ, array('type' => 'Single'));
$display_url_base = Horde::applicationUrl('month.php', true, -1);
$delete_url_base = Horde::applicationUrl('resources/delete.php');
$delete_img = Horde::img('delete.png', _("Delete"), null, $registry->getImageDir('horde'));