Public Member Functions | Data Fields

ilCalInterface Class Reference

Interface_class. More...

Public Member Functions

 ilCalInterface ($ilias, $nb="")
 showLocator ($tpl, $lng, $app)
 showLocator($tpl, $lng, $app) genarate the locater for ilias3
 getUId ()
 read UserID public
 getLang ()
 read current language, the user selected public
 getSkin ()
 read current skin-name, the user selected public
 getStyle ()
 read current style(-sheet)-name, the user selected public
 getStyleFname ()
 read current style(-sheet)-name including path, the user selected public
 getGroupIds ()
 read GroupIDs of the current UserID (stub) public
 getIliasDbName ()
 Returns the Ilias-Databasename.
 getCscwDbName ()
 Returns the CSCW-Databasename.
 getMysqlHostName ()
 Returns the mysql-Host for database-access.
 getMysqlUserName ()
 Returns the mysql-Username for database-access.
 getMysqlPass ()
 Returns the mysql-Password for database-access.
 getAllUserId ()
 Returns the userID which stands for 'all Users'.
 getrelCSCWDir ()
 Returns the relative path where cscw is located.
 getFrameDec ()
 Returns the string for the menue is the DP runs in no-frames modus.
 getUserGroups ($userId)
 Returns all groups which are owned by the user.
 getOtherMembers ($groupId, $userId)
 Returns all user-ID's which are in the given group ($groupId) except the given $userId.
 getMemberGroups ($userId)
 Returns all groups where the user is member in.
 getGroupName ($groupId)
 Fetches the name of a group according to its group_ID from the database.
 getNumOfMembers ($group_id)
 Returns number of members in the Group with $group_id.
 getDpDBHandler ()
 Returns dte Dtateplane DB handler fo database conectivity.
 setNames ()
 check wether current MySQL server is version 4.1.x or higher

Data Fields

 $ilias
 The following Variables do not need to be kept up to date manually.
 $iliasRootDir
 ilias-root-directory (including the whole path beginning from system-root!) @ var string @ access private
 $modulDir
 ilias module directory (up to the ilias root dir) @ var string @ access private
 $relCSCWDir
 relative path of the cscw dir @ var string @ access private
 $dbaseIlias
 $dbaseCscw
 $host
 $mysqlUser
 $mysqlPass
 $allUserId
 $usingFrames
 $uId
 $uPrefs
 $templPath
 $skinPath
 $pBuf
 $GroupIds
 $sock = FALSE
 Constructor fetch userspecific data from ilias and store them in local variables public.

Detailed Description

Interface_class.

a wrapper class for userdata of ilias to provide access to userinformation for the dateplaner

Author:
Frank Gruemmert <gruemmert@feuerwelt.de>
Version:
Id:
class.ilCalInterface.php 14927 2007-10-08 13:49:58Z smeyer

Definition at line 35 of file class.ilCalInterface.php.


Member Function Documentation

ilCalInterface::getAllUserId (  ) 

Returns the userID which stands for 'all Users'.

Returns:
array

Definition at line 468 of file class.ilCalInterface.php.

        {
                return $this->allUserId; 
        }//end function

ilCalInterface::getCscwDbName (  ) 

Returns the CSCW-Databasename.

Returns:
array

Definition at line 432 of file class.ilCalInterface.php.

        {
                return $this->dbaseCscw; 
        }//end function

ilCalInterface::getDpDBHandler (  ) 

Returns dte Dtateplane DB handler fo database conectivity.

Returns:

Definition at line 665 of file class.ilCalInterface.php.

                                   {
                
                $dbase_ilias    = $this->getIliasDbName();              //Get all constants from the interface
                $dbase_cscw             = $this->getCscwDbName();               //                              /
                $host                   = $this->getMysqlHostName();    //                      /
                $user                   = $this->getMysqlUserName();    //              /
                $pass                   = $this->getMysqlPass();                //      /
                $alluser_id             = $this->getAllUserId();                //      
                $dlI                    = @mysql_connect ($host, $user, $pass); //Connect to database

                if (isset($dlI))
                {
                        if (mysql_select_db ($dbase_ilias, $dlI) == false)      //Select the database
                        {
                                mysql_close ($dlI);
                                $dlI = false;
                        }
                }
                
                $this->setNames();

                Return $dlI ;
        }// end func

ilCalInterface::getFrameDec (  ) 

Returns the string for the menue is the DP runs in no-frames modus.

Returns:
String

Definition at line 486 of file class.ilCalInterface.php.

        {
                switch($this->usingFrames) {
                        case 1 :
                                $uptext = "";
                                break;
                        case 0 :
                                $uptext = ereg_replace ('HREF="', 'HREF="../../', $this->upText);
                                $uptext = ereg_replace ('SRC="', 'SRC="../../', $uptext);
                                $uptext = ereg_replace ('= "images/navbar/', '= "../../images/navbar/', $uptext);
                                break;
                        case -1:
                                // not now implemented in Ilias3 and Ilias2
                                break;
                        default :
                                $uptext = "";
                }
                //$uptext = htmlspecialchars($uptext);
                return $uptext;
        }//end function 

ilCalInterface::getGroupIds (  ) 

read GroupIDs of the current UserID (stub) public

Parameters:
@return array of integers

Definition at line 395 of file class.ilCalInterface.php.

        {
                global $ilUser;

                // Everything is done here
                return ilUtil::_getObjectsByOperations(array('grp','crs'),'read',$ilUser->getId(),-1);


                #$IliasArryGroups       = ilUtil::GetObjectsByOperations ("grp", "read", False,False);
                #$IliasArryGroups = array_merge($IliasArryGroups,ilUtil::GetObjectsByOperations ("crs", "read", False,False));


                if($IliasArryGroups[0]!="") {
                
                        $i = 0;
                        foreach ($IliasArryGroups as $Row){
                                $groupContainer = $Row[ref_id];
                                $groups[$i]=$groupContainer ;
                        $i++;
                        }
                }
                return $groups; 
        }//end function

ilCalInterface::getGroupName ( groupId  ) 

Fetches the name of a group according to its group_ID from the database.

Parameters:
int group_IDs
Returns:
string

Definition at line 600 of file class.ilCalInterface.php.

        {
                global $ilObjDataCache,$ilUser;

                return $ilObjDataCache->lookupTitle($ilObjDataCache->lookupObjId($groupId));

                        
                #$IliasArryGroups       = ilUtil::GetObjectsByOperations ("grp", "read", False,False);
                #$IliasArryGroups = array_merge($IliasArryGroups,ilUtil::GetObjectsByOperations("crs", "read", False,False));

                $IliasArryGroups = ilUtil::_getObjectsByOperations(array('grp','crs'),'read',$ilUser->getId(),-1);

                if($IliasArryGroups[0]!="") {
                        $i = 0;
                        foreach ($IliasArryGroups as $Row){
                                $groupContainer = $Row[ref_id];
                                $groups[$i][id]=$groupContainer ;
                        $groups[$i][title]=$Row[title] ;
                        $i++;
                        }
                }

                if($groups) {
                        foreach ($groups as $Row ){
                                $groupContainer = $Row[id];
                                if ($groupId == $groupContainer ){
                                        $groupname = $Row[title] ;
                                }
                }
                }
                return $groupname;
        }//end function

ilCalInterface::getIliasDbName (  ) 

Returns the Ilias-Databasename.

Returns:
array

Definition at line 423 of file class.ilCalInterface.php.

        {
                return $this->dbaseIlias; 
        }//end function

ilCalInterface::getLang (  ) 

read current language, the user selected public

Parameters:
@return string

Definition at line 351 of file class.ilCalInterface.php.

        {
                return $this->uPrefs["language"];
        }//end function

ilCalInterface::getMemberGroups ( userId  ) 

Returns all groups where the user is member in.

Parameters:
int user_ID
Returns:
array

Definition at line 589 of file class.ilCalInterface.php.

Referenced by Database::getDates(), Database::getFullDayDates(), Database::getFullDayRotationDates(), and Database::getRotationDates().

        {
                $GroupIds                               = ilCalInterface::getGroupIds();
                return $GroupIds;
        }//end function

Here is the caller graph for this function:

ilCalInterface::getMysqlHostName (  ) 

Returns the mysql-Host for database-access.

Returns:
array

Definition at line 441 of file class.ilCalInterface.php.

        {
                return $this->host; 
        }//end function

ilCalInterface::getMysqlPass (  ) 

Returns the mysql-Password for database-access.

Returns:
array

Definition at line 459 of file class.ilCalInterface.php.

        {
                return $this->mysqlPass; 
        }//end function

ilCalInterface::getMysqlUserName (  ) 

Returns the mysql-Username for database-access.

Returns:
array

Definition at line 450 of file class.ilCalInterface.php.

        {
                return $this->mysqlUser; 
        }//end function

ilCalInterface::getNumOfMembers ( group_id  ) 

Returns number of members in the Group with $group_id.

Parameters:
$group_id (int)
Returns:
int

Definition at line 638 of file class.ilCalInterface.php.

Referenced by Database::delDate(), and Database::discardChangedDate().

        {
                $tmp_obj =& ilObjectFactory::getInstanceByRefId($group_id);

                switch($tmp_obj->getType())
                {
                        case 'grp':
                                return count($tmp_obj->getGroupMemberIds());

                        case 'crs':
                                $tmp_obj->initCourseMemberObject();

                                return count($tmp_obj->members_obj->getParticipants()); 
                }

                #//gain access to ilias-variables
                #include_once("./classes/class.ilObjGroup.php");
                #$group = new ilObjGroup($group_id);
                #$members = $group->getGroupMemberIds($group_id);
                #return count($members);

        }//end function

Here is the caller graph for this function:

ilCalInterface::getOtherMembers ( groupId,
userId 
)

Returns all user-ID's which are in the given group ($groupId) except the given $userId.

Parameters:
int group_ID
int user_ID
Returns:
array

Definition at line 547 of file class.ilCalInterface.php.

Referenced by Database::addDate(), Database::delDate(), Database::getGroupDates(), Database::getGroupRotationDates(), and Database::updateDate().

        {
                $tmp_obj =& ilObjectFactory::getInstanceByRefId($groupId);

                switch($tmp_obj->getType())
                {
                        case 'grp':
                                $members = $tmp_obj->getGroupMemberIds($groupId);
                                break;

                        case 'crs':
                                $tmp_obj->initCourseMemberObject();

                                $members = $tmp_obj->members_obj->getParticipants();
                                break;
                }                               



                //gain access to ilias-variables
                #include_once("./classes/class.ilObjGroup.php");
                #$group = new ilObjGroup($groupId);
                #$members = $group->getGroupMemberIds($groupId);

                if($members[0] == $userId and count($members) == 1) {
                        $members = FALSE;
                }elseif ($userId != "-1") {
                        array_unshift ($members, $userId);
                        $members = array_unique ($members);
                        $members = array_reverse ($members);
                        array_pop ($members);
                }
                return $members;
        }//end function

Here is the caller graph for this function:

ilCalInterface::getrelCSCWDir (  ) 

Returns the relative path where cscw is located.

Returns:
String

Definition at line 477 of file class.ilCalInterface.php.

        {
                return $this->relCSCWDir;       
        }//end function

ilCalInterface::getSkin (  ) 

read current skin-name, the user selected public

Parameters:
@return string

Definition at line 362 of file class.ilCalInterface.php.

        {
                return $this->uPrefs["skin"];
        }//end function

ilCalInterface::getStyle (  ) 

read current style(-sheet)-name, the user selected public

Parameters:
@return string

Definition at line 373 of file class.ilCalInterface.php.

        {
                return $this->uPrefs["style"]; 
        }//end function

ilCalInterface::getStyleFname (  ) 

read current style(-sheet)-name including path, the user selected public

Parameters:
@return string

Definition at line 384 of file class.ilCalInterface.php.

        {
                return ilUtil::getStyleSheetLocation();
        }//end function

ilCalInterface::getUId (  ) 

read UserID public

Parameters:
@return integer

Definition at line 340 of file class.ilCalInterface.php.

        {
                return $this->uId;
        }//end function

ilCalInterface::getUserGroups ( userId  ) 

Returns all groups which are owned by the user.

Parameters:
int user_ID
Returns:
array

Definition at line 512 of file class.ilCalInterface.php.

        {
                global $ilObjDataCache,$ilUser;
        
                #$IliasArryGroups       = ilUtil::GetObjectsByOperations ("grp", "read", False,False);
                #$IliasArryGroups = array_merge($IliasArryGroups,ilUtil::GetObjectsByOperations ("crs", "read", False,False));

                $counter = 0;
                foreach(ilUtil::_getObjectsByOperations(array('grp','crs'),'read',$ilUser->getId(),-1) as $ref_id)
                {
                        $groups[$counter][0] = $ref_id;
                        $groups[$counter][1] = $ilObjDataCache->lookupTitle($ilObjDataCache->lookupObjId($ref_id));
                        ++$counter;
                }
                return $groups;

                if($IliasArryGroups[0]!="") {
                        $i = 0;
                        foreach (@$IliasArryGroups as $Row){
                        $groupContainer = $Row[ref_id];
                    $groups[$i][0]=$groupContainer ;
                        $groups[$i][1]=$Row[title] ;
                        $i++;
                        }           
                }
                return $groups;
        }//end function

ilCalInterface::ilCalInterface ( ilias,
nb = "" 
)

Definition at line 183 of file class.ilCalInterface.php.

        {
                
                global $tpl;
                //include manual edited variables
                include ('.'.DATEPLANER_ROOT_DIR.'/config/conf.dateplaner.php');
    
                /*generate a copy of the ilias object*/
                $this->ilias            = $ilias;
    
                $this->modulDir         = $modulDir;
                $this->relCSCWDir       = $relCSCWDir;  
                
                define("ALLUSERID", $allUserId); /* All USER ID */

                
                //gain access to ilias-variables
                if($dbaseIlias != "-1") {$this->dbaseIlias=$dbaseIlias;}else {$this->dbaseIlias =$this->ilias->ini->readVariable("db", "name");}
                if($dbaseCscw != "-1")  {$this->dbaseCscw=$dbaseCscw;}  else {$this->dbaseCscw  =$this->ilias->ini->readVariable("db", "name");}
                if($host != "-1")               {$this->host=$host;}                    else {$this->host               =$this->ilias->ini->readVariable("db", "host");}
                if($mysqlUser != "-1")  {$this->mysqlUser=$mysqlUser;}  else {$this->mysqlUser  =$this->ilias->ini->readVariable("db", "user");}
                if($mysqlPass != "-1")  {$this->mysqlPass=$mysqlPass;}  else {$this->mysqlPass  =$this->ilias->ini->readVariable("db", "pass");}
    
                $this->sock = @mysql_connect ($this->host, $this->mysqlUser, $this->mysqlPass);
                //connect to database
                if ($this->sock)
                {
                        if (mysql_select_db ($this->dbaseCscw, $this->sock) == FALSE)
                        {
                                mysql_close ($this->sock);
                                $this->sock = FALSE;
                        }
                }
                
                $this->setNames();
    
                //gain further access to ilias-variables
                $this->uId                                      = $ilias->account->getId();
                $this->uPrefs["language"]       = $ilias->account->getPref("language");
                $this->uPrefs["skin"]           = $ilias->account->getPref("skin");
                $this->uPrefs["style"]          = $ilias->account->getPref("style");
                $this->GroupIds                         = $this->getGroupIds();


                $this->upText                           = "";   //menue string not developed in ilias3

                //$this->tpl            =& $tpl;
                //$this->__showLocator();


        }//end Constructor

ilCalInterface::setNames (  ) 

check wether current MySQL server is version 4.1.x or higher

NOTE: Three sourcecodes use this or a similar handling:

Definition at line 697 of file class.ilCalInterface.php.

        {
                $version = mysql_get_server_info();
                $version = explode(".", $version);
                if ((int)$version[0] >= 5 ||
                        ((int)$version[0] == 4 && (int)$version[1] >= 1))
                {
                        mysql_query("SET NAMES utf8");
                        mysql_query("SET SESSION SQL_MODE = ''");
                }
        }

ilCalInterface::showLocator ( tpl,
lng,
app 
)

showLocator($tpl, $lng, $app) genarate the locater for ilias3

WORKAROUND: shows also tabs and sub tabs public

Parameters:
@return integer

Definition at line 244 of file class.ilCalInterface.php.

        {
                global $ilias, $ilTabs, $ilMainMenu;
                
                $tpl = new ilTemplate("tpl.calendar_header.html", true, true);
                
                
                // main menu
                /*
                require_once "./classes/class.ilMainMenuGUI.php";
                $menu = new ilMainMenuGUI("_top");
                $menu->setActive("desktop");
                $menu->setTemplate($tpl);
                $menu->addMenuBlock("MAINMENU", "navigation");
                $menu->setTemplateVars();*/
                
                $ilMainMenu->setActive("desktop");
                $tpl->setVariable("MAINMENU", $ilMainMenu->getHTML());
                
                //tabs
/*
                $tpl->setCurrentBlock("locator_item");
                //$tpl->setVariable("LINK_ITEM", "ilias.php?baseClass=ilPersonalDesktopGUI");
                //$tpl->setVariable("LINK_TARGET",
                //      ilFrameTargetInfo::_getFrame("MainContent"));
                //$tpl->setVariable("ITEM",$lng->txt("personal_desktop"));
                //$tpl->parseCurrentBlock();

                $tpl->touchBlock("locator_separator_prefix");
                $tpl->setCurrentBlock("locator_item");
                $tpl->setVariable("LINK_ITEM","./dateplaner.php");
                $tpl->setVariable("LINK_TARGET",
                        ilFrameTargetInfo::_getFrame("MainContent"));
                $tpl->setVariable("ITEM",$lng->txt("dateplaner"));
                $tpl->parseCurrentBlock();

                
//              $tpl->touchBlock("locator_separator_prefix");
//              $tpl->setCurrentBlock("locator_item");
//              $tpl->setVariable("LINK_ITEM","./dateplaner.php?app=".$app);
                //$tpl->setVariable("LINK_TARGET","bottom");
//              $tpl->setVariable("ITEM",$lng->txt("app_".$app));
//              $tpl->parseCurrentBlock();

                $tpl->setCurrentBlock("locator");
                $tpl->setVariable("TXT_LOCATOR",$lng->txt("locator"));
                $tpl->parseCurrentBlock();
*/
                $tpl->setCurrentBlock("header_image");
                $tpl->setVariable("IMG_HEADER", ilUtil::getImagePath("icon_pd_b.gif"));
                $tpl->parseCurrentBlock();

                
                $tpl->setVariable("HEADER", $lng->txt("personal_desktop"));
                
                // set tabs
                include ("./include/inc.personaldesktop_buttons.php");
                
                // set sub tabs
                include_once("classes/class.ilTabsGUI.php");
                $tab_gui = new ilTabsGUI();
                #$tab_gui->setSubTabs();
                
                $apps = array("inbox", "list", "day", "week", "month", "properties");
                foreach($apps as $app)
                {
                        $active = ($app == $_GET["app"] ||
                                ($_GET["app"] == "" && $app == "inbox"))
                                ? true
                                : false;
                        switch($app)
                        {
                                case "inbox": $txt_key = "inbox"; break;
                                case "list": $txt_key = "Listbox_long"; break;
                                case "day": $txt_key = "Day_long"; break;
                                case "week": $txt_key = "Week_long"; break;
                                case "month": $txt_key = "Month_long"; break;
                                case "properties": $txt_key = "properties"; break;
                        }
                        $tab_gui->addSubTabTarget($txt_key, "dateplaner.php?app=".$app.
                                                                         "&amp;timestamp=".$GET_["timestamp"],
                                                                         "", "", "", $active);
                }
                
                $tpl->setVariable("SUB_TABS", $tab_gui->getSubTabHTML());
                
                return $tpl->get();
        }


Field Documentation

ilCalInterface::$allUserId

Definition at line 116 of file class.ilCalInterface.php.

ilCalInterface::$dbaseCscw

Definition at line 88 of file class.ilCalInterface.php.

ilCalInterface::$dbaseIlias

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

ilCalInterface::$GroupIds

Definition at line 172 of file class.ilCalInterface.php.

ilCalInterface::$host

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

ilCalInterface::$ilias

The following Variables do not need to be kept up to date manually.

This versions should autodetect the needed values automatically. The needed values are read within the Constructor from "/config/conf.dateplaner.php" into teh module dir. Therefore all Values should be edited in conf.dateplaner.php. private copy of the ilias object @ var object @ access private

Definition at line 51 of file class.ilCalInterface.php.

ilCalInterface::$iliasRootDir

ilias-root-directory (including the whole path beginning from system-root!) @ var string @ access private

Definition at line 58 of file class.ilCalInterface.php.

ilCalInterface::$modulDir

ilias module directory (up to the ilias root dir) @ var string @ access private

Definition at line 65 of file class.ilCalInterface.php.

ilCalInterface::$mysqlPass

Definition at line 109 of file class.ilCalInterface.php.

ilCalInterface::$mysqlUser

Definition at line 102 of file class.ilCalInterface.php.

ilCalInterface::$pBuf

Definition at line 165 of file class.ilCalInterface.php.

ilCalInterface::$relCSCWDir

relative path of the cscw dir @ var string @ access private

Definition at line 73 of file class.ilCalInterface.php.

ilCalInterface::$skinPath

Definition at line 158 of file class.ilCalInterface.php.

ilCalInterface::$sock = FALSE

Constructor fetch userspecific data from ilias and store them in local variables public.

Definition at line 180 of file class.ilCalInterface.php.

ilCalInterface::$templPath

Definition at line 151 of file class.ilCalInterface.php.

ilCalInterface::$uId

Definition at line 137 of file class.ilCalInterface.php.

ilCalInterface::$uPrefs

Definition at line 144 of file class.ilCalInterface.php.

ilCalInterface::$usingFrames

Definition at line 126 of file class.ilCalInterface.php.


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