summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 46efe9f)
raw | patch | inline | side by side (parent: 46efe9f)
author | cajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Fri, 22 Jan 2010 14:41:13 +0000 (14:41 +0000) | ||
committer | cajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Fri, 22 Jan 2010 14:41:13 +0000 (14:41 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@15264 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-core/include/class_sortableListing.inc | patch | blob | history |
diff --git a/gosa-core/include/class_sortableListing.inc b/gosa-core/include/class_sortableListing.inc
index 06d817806dd777b8e03ed62e42bf0d15d99deec1..36b44b67cd575778c87964c61898dcdaa0dcd2ac 100644 (file)
<?php
/*
* This code is part of GOsa (http://www.gosa-project.org)
- * Copyright (C) 2003-2008 GONICUS GmbH
+ * Copyright (C) 2003-2010 GONICUS GmbH
*
* ID: $$Id$$
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+define ('LIST_NORMAL', 0);
+define ('LIST_MARKED', 1);
+define ('LIST_DISABLED', 2);
+
class sortableListing {
private $header= null;
private $colspecs= null;
private $data= array();
private $keys= array();
+ private $modes= array();
private $displayData= array();
private $columns= 0;
private $deleteable= false;
private $acl= "";
private $modified= false;
- public function sortableListing($data= array(), $displayData= null, $reorderable= false)
+ public function sortableListing($data= array(), $displayData= null, $modes= null, $reorderable= false)
{
global $config;
// Save data to display
- $this->setListData($data, $displayData);
+ $this->setListData($data, $displayData, $modes);
// Generate instance wide unique ID
$tmp= gettimeofday();
}
- public function setListData($data, $displayData= null)
+ public function setListData($data, $displayData= null, $modes= null)
{
// Save data to display
$this->setData($data);
$displayData[$key]= array($value);
}
}
+ if (!$modes) {
+ $modes= array();
+ foreach ($data as $key => $value) {
+ $modes[$key]= LIST_NORMAL;
+ }
+ }
$this->setDisplayData($displayData);
+ $this->setModes($modes);
}
}
+ private function setModes($modes)
+ {
+ $this->modes= $modes;
+ }
+
+
private function setDisplayData($data)
{
if (!is_array($data)) {
if (strpos($this->acl, 'r') !== false) {
foreach ($this->mapping as $nr => $row) {
$editable= $this->editable?" onclick='$(\"edit_".$this->id."_$nr\").click()'":"";
- $result.= " <tr class='sortableListItem".((($nr&1)||!$this->colorAlternate)?'':'Odd')."' id='item_".$this->id."_$nr'$reorderable>\n";
+
+ $id= "";
+ switch ($this->modes[$row]) {
+ case LIST_DISABLED:
+ $id= " sortableListItemDisabled";
+ $editable= false;
+ break;
+ case LIST_MARKED:
+ $id= " sortableListItemMarked";
+ break;
+ }
+
+ $result.= " <tr class='sortableListItem".((($nr&1)||!$this->colorAlternate)?'':'Odd')."$id' id='item_".$this->id."_$nr'$reorderable>\n";
$first= " style='border:0'";
+
foreach ($this->displayData[$row] as $column) {
$result.= " <td$editable$first>".htmlentities($column)."</td>\n";
$first= "";
}
+
if ($action_width) {
$result.= "<td>".str_replace('%ID', "edit_".$this->id."_$nr", $edit_image).
str_replace('%ID', "del_".$this->id."_$nr", $delete_image)."</td>";
}
+
$result.= " </tr>\n";
}
}