Public Member Functions

ilContainer Class Reference

Class ilContainer. More...

Inheritance diagram for ilContainer:
Collaboration diagram for ilContainer:

Public Member Functions

 ilObjContainer ($a_id=0, $a_call_by_reference=true)
 Constructor public.
 createContainerDirectory ()
 Create directory for the container.
 getContainerDirectory ()
 Get the container directory.
 _getContainerDirectory ($a_id)
 Get the container directory.
 getBigIconPath ()
 Get path for big icon.
 getSmallIconPath ()
 Get path for small icon.
 getTinyIconPath ()
 Get path for tiny icon.
 _lookupContainerSetting ($a_id, $a_keyword)
 Lookup a container setting.
 _writeContainerSetting ($a_id, $a_keyword, $a_value)
 _lookupIconPath ($a_id, $a_size="big")
 lookup icon path
 saveIcons ($a_big_icon, $a_small_icon, $a_tiny_icon)
 save container icons
 removeBigIcon ()
 remove big icon
 removeSmallIcon ()
 remove small icon
 removeTinyIcon ()
 remove tiny icon
 getFirstColumn ()
 Get right column.
 cloneAllObject ($session_id, $client_id, $new_type, $ref_id, $clone_source, $options)
 clone all objects according to this container

Detailed Description

Class ilContainer.

Base class for all container objects (categories, courses, groups)

Author:
Alex Killing <alex.killing@gmx.de>
Version:
Id:
class.ilContainer.php 15541 2007-12-11 19:13:00Z rkuester

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


Member Function Documentation

ilContainer::_getContainerDirectory ( a_id  ) 

Get the container directory.

Returns:
string container directory

Definition at line 85 of file class.ilContainer.php.

References ilUtil::getWebspaceDir().

Referenced by ilObject::_getIcon(), _lookupIconPath(), and getContainerDirectory().

        {
                return ilUtil::getWebspaceDir()."/container_data/obj_".$a_id;
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilContainer::_lookupContainerSetting ( a_id,
a_keyword 
)

Lookup a container setting.

Parameters:
int container id
string setting keyword
Returns:
string setting value

Definition at line 128 of file class.ilContainer.php.

Referenced by ilObject::_getIcon(), _lookupIconPath(), ilObjAdvancedEditingGUI::clearCategoryPageObject(), ilContainerGUI::editPageContentObject(), getFirstColumn(), ilContainerGUI::renderItemList(), ilContainerGUI::savePageContentObject(), and ilObjAdvancedEditingGUI::undoLastCategoryChangeObject().

        {
                global $ilDB;
                
                $q = "SELECT * FROM container_settings WHERE ".
                                " id = ".$ilDB->quote($a_id)." AND ".
                                " keyword = ".$ilDB->quote($a_keyword);
                $set = $ilDB->query($q);
                $rec = $set->fetchRow(DB_FETCHMODE_ASSOC);
                
                return $rec["value"];
        }

Here is the caller graph for this function:

ilContainer::_lookupIconPath ( a_id,
a_size = "big" 
)

lookup icon path

Parameters:
int $a_id container object id
string $a_size "big" | "small"

Definition at line 159 of file class.ilContainer.php.

References $file_name, _getContainerDirectory(), and _lookupContainerSetting().

Referenced by ilPDSelectedItemsBlockGUI::addParentRow(), ilPDSelectedItemsBlockGUI::addStandardRow(), ilContainerGUI::addStandardRow(), getBigIconPath(), ilAdministrationExplorer::getImage(), getSmallIconPath(), getTinyIconPath(), ilUtil::getTypeIconPath(), and ilContainerGUI::setTitleAndDescription().

        {
                if ($a_size == "")
                {
                        $a_size = "big";
                }
                
                $size = $a_size;
                
                if (ilContainer::_lookupContainerSetting($a_id, "icon_".$size))
                {
                        $cont_dir = ilContainer::_getContainerDirectory($a_id);
                        $file_name = $cont_dir."/icon_".$a_size.".gif";

                        if (is_file($file_name))
                        {
                                return $file_name;
                        }
                }
                
                return "";
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilContainer::_writeContainerSetting ( a_id,
a_keyword,
a_value 
)

Definition at line 141 of file class.ilContainer.php.

Referenced by removeBigIcon(), removeSmallIcon(), removeTinyIcon(), saveIcons(), and ilContainerGUI::savePageContentObject().

        {
                global $ilDB;
                
                $q = "REPLACE INTO container_settings (id, keyword, value) VALUES".
                        " (".$ilDB->quote($a_id).", ".
                        $ilDB->quote($a_keyword).", ".
                        $ilDB->quote($a_value).")";

                $ilDB->query($q);
        }

Here is the caller graph for this function:

ilContainer::cloneAllObject ( session_id,
client_id,
new_type,
ref_id,
clone_source,
options 
)

clone all objects according to this container

Parameters:
string $session_id
string $client_id
string $new_type
int $ref_id
int $clone_source
array $options
Returns:
new refid if clone has finished or parameter ref id if cloning is still in progress

Definition at line 320 of file class.ilContainer.php.

References $client_id, $ilErr, $ilLog, ilObject::$ref_id, $res, ilCopyWizardOptions::_allocateCopyId(), ilCopyWizardOptions::_getInstance(), ilCopyWizardOptions::_isFinished(), duplicate_session(), and ilClone().

        {
                global $ilLog;
                
                include_once('classes/class.ilLink.php');
                include_once('Services/CopyWizard/classes/class.ilCopyWizardOptions.php');
                
                global $ilAccess,$ilErr,$rbacsystem,$tree,$ilUser;
                        
                // Save wizard options
                $copy_id = ilCopyWizardOptions::_allocateCopyId();
                $wizard_options = ilCopyWizardOptions::_getInstance($copy_id);
                $wizard_options->saveOwner($ilUser->getId());
                $wizard_options->saveRoot($clone_source);
                        
                // add entry for source container
                $wizard_options->initContainer($clone_source, $ref_id);
                
                foreach($options as $source_id => $option)
                {
                        $wizard_options->addEntry($source_id,$option);
                }
                $wizard_options->read();
                $wizard_options->storeTree($clone_source);
                
                // Duplicate session to avoid logout problems with backgrounded SOAP calls
                $new_session_id = duplicate_session($session_id); 
                
                // Start cloning process using soap call
                include_once 'Services/WebServices/SOAP/classes/class.ilSoapClient.php';

                $soap_client = new ilSoapClient();
                $soap_client->setTimeout(30);
                $soap_client->setResponseTimeout(30);
                $soap_client->enableWSDL(true);

                $ilLog->write(__METHOD__.': Trying to call Soap client...');
                if($soap_client->init())
                {
                        $ilLog->write(__METHOD__.': Calling soap clone method...');
                        $res = $soap_client->call('ilClone',array($new_session_id.'::'.$client_id, $copy_id));
                }
                else
                {
                        $ilLog->write(__METHOD__.': SOAP call failed. Calling clone method manually. ');
                        $wizard_options->disableSOAP();
                        $wizard_options->read();                        
                        include_once('./webservice/soap/include/inc.soap_functions.php');
                        $res = ilClone($new_session_id.'::'.$client_id, $copy_id);
                }
                                
                // Check if copy is in progress
                if(ilCopyWizardOptions::_isFinished($copy_id))
                {
                        return $res;
                }
                else
                {
                        return $ref_id;
                }       
        }

Here is the call graph for this function:

ilContainer::createContainerDirectory (  ) 

Create directory for the container.

It is <webspace_dir>/container_data.

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

References ilObject::getId(), ilUtil::getWebspaceDir(), and ilUtil::makeDir().

Referenced by saveIcons().

        {
                $webspace_dir = ilUtil::getWebspaceDir();
                $cont_dir = $webspace_dir."/container_data";
                if (!is_dir($cont_dir))
                {
                        ilUtil::makeDir($cont_dir);
                }
                $obj_dir = $cont_dir."/obj_".$this->getId();
                if (!is_dir($obj_dir))
                {
                        ilUtil::makeDir($obj_dir);
                }
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilContainer::getBigIconPath (  ) 

Get path for big icon.

Returns:
string icon path

Definition at line 95 of file class.ilContainer.php.

References _lookupIconPath(), and ilObject::getId().

        {
                return ilContainer::_lookupIconPath($this->getId(), "big");
        }

Here is the call graph for this function:

ilContainer::getContainerDirectory (  ) 

Get the container directory.

Returns:
string container directory

Definition at line 75 of file class.ilContainer.php.

References _getContainerDirectory(), and ilObject::getId().

Referenced by removeBigIcon(), removeSmallIcon(), removeTinyIcon(), and saveIcons().

        {
                return $this->_getContainerDirectory($this->getId());
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilContainer::getFirstColumn (  ) 

Get right column.

Returns:
object column object

Definition at line 296 of file class.ilContainer.php.

References _lookupContainerSetting(), and ilObject::getId().

        {
                $col_id = ilContainer::_lookupContainerSetting($this->getId(), "first_column");
                if ($col_id > 0)
                {
                        include_once("./Services/Blocks/class.ilBlockColumn.php");
                        $block_column = new ilBlockColumn($col_id);
                        return $block_column;
                }
                return false;
        }

Here is the call graph for this function:

ilContainer::getSmallIconPath (  ) 

Get path for small icon.

Returns:
string icon path

Definition at line 105 of file class.ilContainer.php.

References _lookupIconPath(), and ilObject::getId().

        {
                return ilContainer::_lookupIconPath($this->getId(), "small");
        }

Here is the call graph for this function:

ilContainer::getTinyIconPath (  ) 

Get path for tiny icon.

Returns:
string icon path

Definition at line 115 of file class.ilContainer.php.

References _lookupIconPath(), and ilObject::getId().

        {
                return ilContainer::_lookupIconPath($this->getId(), "tiny");
        }

Here is the call graph for this function:

ilContainer::ilObjContainer ( a_id = 0,
a_call_by_reference = true 
)

Constructor public.

Parameters:
integer reference_id or object_id
boolean treat the id as reference_id (true) or object_id (false)

Definition at line 46 of file class.ilContainer.php.

References ilObject::ilObject().

Referenced by ilObjFolder::ilObjFolder().

        {
                $this->ilObject($a_id, $a_call_by_reference);
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilContainer::removeBigIcon (  ) 

remove big icon

Definition at line 261 of file class.ilContainer.php.

References _writeContainerSetting(), getContainerDirectory(), and ilObject::getId().

        {
                $cont_dir = $this->getContainerDirectory();
                $big_file_name = $cont_dir."/icon_big.gif";
                @unlink($big_file_name);
                ilContainer::_writeContainerSetting($this->getId(), "icon_big", 0);
        }

Here is the call graph for this function:

ilContainer::removeSmallIcon (  ) 

remove small icon

Definition at line 272 of file class.ilContainer.php.

References _writeContainerSetting(), getContainerDirectory(), and ilObject::getId().

        {
                $cont_dir = $this->getContainerDirectory();
                $small_file_name = $cont_dir."/icon_small.gif";
                @unlink($small_file_name);
                ilContainer::_writeContainerSetting($this->getId(), "icon_small", 0);
        }

Here is the call graph for this function:

ilContainer::removeTinyIcon (  ) 

remove tiny icon

Definition at line 283 of file class.ilContainer.php.

References _writeContainerSetting(), getContainerDirectory(), and ilObject::getId().

        {
                $cont_dir = $this->getContainerDirectory();
                $tiny_file_name = $cont_dir."/icon_tiny.gif";
                @unlink($tiny_file_name);
                ilContainer::_writeContainerSetting($this->getId(), "icon_tiny", 0);
        }

Here is the call graph for this function:

ilContainer::saveIcons ( a_big_icon,
a_small_icon,
a_tiny_icon 
)

save container icons

Definition at line 185 of file class.ilContainer.php.

References $cmd, _writeContainerSetting(), createContainerDirectory(), ilUtil::escapeShellArg(), getContainerDirectory(), ilUtil::getConvertCmd(), and ilObject::getId().

        {
                global $ilDB;
                
                $this->createContainerDirectory();
                $cont_dir = $this->getContainerDirectory();
                
                // save big icon
                $big_geom = $this->ilias->getSetting("custom_icon_big_width")."x".
                        $this->ilias->getSetting("custom_icon_big_height");
                $big_file_name = $cont_dir."/icon_big.gif";

                if (is_file($a_big_icon["tmp_name"]))
                {
                        $a_big_icon["tmp_name"] = ilUtil::escapeShellArg($a_big_icon["tmp_name"]);
                        $big_file_name = ilUtil::escapeShellArg($big_file_name);
                        $cmd = ilUtil::getConvertCmd()." ".$a_big_icon["tmp_name"]."[0] -geometry $big_geom GIF:$big_file_name";
                        system($cmd);
                }

                if (is_file($cont_dir."/icon_big.gif"))
                {
                        ilContainer::_writeContainerSetting($this->getId(), "icon_big", 1);
                }
                else
                {
                        ilContainer::_writeContainerSetting($this->getId(), "icon_big", 0);
                }
        
                // save small icon
                $small_geom = $this->ilias->getSetting("custom_icon_small_width")."x".
                        $this->ilias->getSetting("custom_icon_small_height");
                $small_file_name = $cont_dir."/icon_small.gif";

                if (is_file($a_small_icon["tmp_name"]))
                {
                        $a_small_icon["tmp_name"] = ilUtil::escapeShellArg($a_small_icon["tmp_name"]);
                        $small_file_name = ilUtil::escapeShellArg($small_file_name);
                        $cmd = ilUtil::getConvertCmd()." ".$a_small_icon["tmp_name"]."[0] -geometry $small_geom GIF:$small_file_name";
                        system($cmd);
                }
                if (is_file($cont_dir."/icon_small.gif"))
                {
                        ilContainer::_writeContainerSetting($this->getId(), "icon_small", 1);
                }
                else
                {
                        ilContainer::_writeContainerSetting($this->getId(), "icon_small", 0);
                }

                // save tiny icon
                $tiny_geom = $this->ilias->getSetting("custom_icon_tiny_width")."x".
                        $this->ilias->getSetting("custom_icon_tiny_height");
                $tiny_file_name = $cont_dir."/icon_tiny.gif";

                if (is_file($a_tiny_icon["tmp_name"]))
                {
                        $a_tiny_icon["tmp_name"] = ilUtil::escapeShellArg($a_tiny_icon["tmp_name"]);
                        $tiny_file_name = ilUtil::escapeShellArg($tiny_file_name);
                        $cmd = ilUtil::getConvertCmd()." ".$a_tiny_icon["tmp_name"]."[0] -geometry $tiny_geom GIF:$tiny_file_name";
                        system($cmd);
                }
                if (is_file($cont_dir."/icon_tiny.gif"))
                {
                        ilContainer::_writeContainerSetting($this->getId(), "icon_tiny", 1);
                }
                else
                {
                        ilContainer::_writeContainerSetting($this->getId(), "icon_tiny", 0);
                }

        }

Here is the call graph for this function:


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