Public Member Functions | Data Fields

ilRoleDesktopItem Class Reference

Public Member Functions

 ilRoleDesktopItem ($a_role_id)
 Constructor public.
 getRoleId ()
 setRoleId ($a_role_id)
 add ($a_item_id, $a_item_type)
 delete ($a_role_item_id)
 deleteAll ()
 isAssigned ($a_item_ref_id)
 getItem ($a_role_item_id)
 getAll ()
 __assign ($a_item_id, $a_item_type)

Data Fields

 $db
 $role_id

Detailed Description

Definition at line 38 of file class.ilRoleDesktopItem.php.


Member Function Documentation

ilRoleDesktopItem::__assign ( a_item_id,
a_item_type 
)

Definition at line 154 of file class.ilRoleDesktopItem.php.

References $rbacreview, $tmp_user, $user_id, and ilObjectFactory::getInstanceByObjId().

Referenced by add().

        {
                global $rbacreview;

                foreach($rbacreview->assignedUsers($this->getRoleId()) as $user_id)
                {
                        if(is_object($tmp_user = ilObjectFactory::getInstanceByObjId($user_id,false)))
                        {
                                if(!$tmp_user->isDesktopItem($a_item_id,$a_item_type))
                                {
                                        $tmp_user->addDesktopItem($a_item_id,$a_item_type);
                                }
                        }
                }
                return true;
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilRoleDesktopItem::add ( a_item_id,
a_item_type 
)

Definition at line 64 of file class.ilRoleDesktopItem.php.

References $query, and __assign().

        {
                if($a_item_type and $a_item_id)
                {
                        $query = "INSERT INTO role_desktop_items ".
                                "SET role_id = '".$this->getRoleId()."', ".
                                "item_id = '".$a_item_id."', ".
                                "item_type = '".$a_item_type."'";

                        $this->db->query($query);

                        $this->__assign($a_item_id,$a_item_type);
                        
                        return true;
                }
                return false;
        }

Here is the call graph for this function:

ilRoleDesktopItem::delete ( a_role_item_id  ) 

Definition at line 81 of file class.ilRoleDesktopItem.php.

References $query.

        {
                $query = "DELETE FROM role_desktop_items ".
                        "WHERE role_item_id = '".$a_role_item_id."'";

                $this->db->query($query);

                return true;
        }

ilRoleDesktopItem::deleteAll (  ) 

Definition at line 91 of file class.ilRoleDesktopItem.php.

References $query.

        {
                $query = "DELETE FROM role_desktop_items ".
                        "WHERE role_id = '".$this->getRoleId()."'";

                $this->db->query($query);

                return true;
        }

ilRoleDesktopItem::getAll (  ) 

Definition at line 130 of file class.ilRoleDesktopItem.php.

References $query, $res, $row, and $tree.

        {
                global $tree;

                $query = "SELECT * FROM role_desktop_items ".
                        "WHERE role_id = '".$this->getRoleId()."'";

                $res = $this->db->query($query);
                while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
                {
                        // TODO this check must be modified for non tree objects
                        if(!$tree->isInTree($row->item_id))
                        {
                                $this->delete($row->role_item_id);
                                continue;
                        }
                        $items[$row->role_item_id]['item_id'] = $row->item_id;
                        $items[$row->role_item_id]['item_type'] = $row->item_type;
                }

                return $items ? $items : array();
        }

ilRoleDesktopItem::getItem ( a_role_item_id  ) 

Definition at line 112 of file class.ilRoleDesktopItem.php.

References $query, $res, and $row.

        {
                $query = "SELECT * FROM role_desktop_items ".
                        "WHERE role_id = '".$this->getRoleId()."' ".
                        "AND role_item_id = '".$a_role_item_id."'";

                $res = $this->db->query($query);
                while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
                {
                        $item['item_id'] = $row->item_id;
                        $item['item_type'] = $row->item_type;
                }

                return $item ? $item : array();
        }

ilRoleDesktopItem::getRoleId (  ) 

Definition at line 55 of file class.ilRoleDesktopItem.php.

        {
                return $this->role_id;
        }

ilRoleDesktopItem::ilRoleDesktopItem ( a_role_id  ) 

Constructor public.

Definition at line 47 of file class.ilRoleDesktopItem.php.

        {
                global $ilDB;

                $this->db =& $ilDB;
                $this->role_id = $a_role_id;
        }

ilRoleDesktopItem::isAssigned ( a_item_ref_id  ) 

Definition at line 101 of file class.ilRoleDesktopItem.php.

References $query, and $res.

        {
                $query = "SELECT * FROM role_desktop_items ".
                        "WHERE role_id = '".$this->getRoleId()."' ".
                        "AND item_id = '".$a_item_ref_id."'";

                $res = $this->db->query($query);

                return $res->numRows() ? true : false;
        }

ilRoleDesktopItem::setRoleId ( a_role_id  ) 

Definition at line 59 of file class.ilRoleDesktopItem.php.

        {
                $this->role_id = $a_role_id;
        }


Field Documentation

ilRoleDesktopItem::$db

Definition at line 40 of file class.ilRoleDesktopItem.php.

ilRoleDesktopItem::$role_id

Definition at line 41 of file class.ilRoleDesktopItem.php.


The documentation for this class was generated from the following file: