Public Member Functions

ilObjiLincClassroomGUI Class Reference

Inheritance diagram for ilObjiLincClassroomGUI:
Collaboration diagram for ilObjiLincClassroomGUI:

Public Member Functions

 ilObjiLincClassroomGUI ($a_icla_id, $a_icrs_id)
 Constructor public.
 assignObject ()
 createObject ()
 create new object form
 saveObject ()
 save object public
 joinObject ()
 editClassroomObject ()
 displayEditForm ($fields)
 display edit form (usually called by editObject)
 getTabs (&$tabs_gui)
 get tabs public
 removeClassroomObject ($a_error=false)
 display deletion confirmation screen only for referenced objects.
 updateClassroomObject ()
 updates class room on ilinc server

Detailed Description

Definition at line 39 of file class.ilObjiLincClassroomGUI.php.


Member Function Documentation

ilObjiLincClassroomGUI::assignObject (  ) 

Reimplemented from ilObjectGUI.

Definition at line 84 of file class.ilObjiLincClassroomGUI.php.

Referenced by ilObjiLincClassroomGUI().

        {
                $this->object = new ilObjiLincClassroom($this->id,$this->parent);
        }

Here is the caller graph for this function:

ilObjiLincClassroomGUI::createObject (  ) 

create new object form

public

Reimplemented from ilObjectGUI.

Definition at line 89 of file class.ilObjiLincClassroomGUI.php.

References $_GET, $_POST, $_SESSION, ilObjectGUI::$data, $id, $rbacsystem, ilUtil::formRadioButton(), formSelect(), ilObjectGUI::getFormAction(), ilObjectGUI::getTargetFrame(), ilUtil::prepareFormOutput(), and ilUtil::stripSlashes().

        {
                global $rbacsystem;

                $new_type = $_POST["new_type"] ? $_POST["new_type"] : $_GET["new_type"];

                // fill in saved values in case of error
                $data = array();
                $data["fields"] = array();
                $data["fields"]["title"] = ilUtil::prepareFormOutput($_SESSION["error_post_vars"]["Fobject"]["title"],true);
                $data["fields"]["desc"] = ilUtil::stripSlashes($_SESSION["error_post_vars"]["Fobject"]["desc"]);
                $data["fields"]["homepage"] = ilUtil::prepareFormOutput($_SESSION["error_post_vars"]["Fobject"]["homepage"],true);
                $data["fields"]["download"] = ilUtil::prepareFormOutput($_SESSION["error_post_vars"]["Fobject"]["download"],true);

                $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.icla_edit.html","ilinc");
                //$this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.obj_edit.html");
                
                $this->tpl->setVariable("TXT_TITLE", $this->lng->txt("title"));
                $this->tpl->setVariable("TITLE", $data["fields"]["title"]);
                $this->tpl->setVariable("TXT_DESC", $this->lng->txt("desc"));
                $this->tpl->setVariable("DESC", $data["fields"]["desc"]);

                // get all docents of course
                $docentlist = $this->object->getDocentList();
                
                $docent_options[0] = $this->lng->txt('please_choose');

                foreach ($docentlist as $id => $data)
                {
                        $docent_options[$id] = $data['fullname'];
                }
                
                $sel_docents = ilUtil::formSelect("0","Fobject[instructoruserid]",$docent_options,false,true);
                
                $this->tpl->setVariable("TXT_DOCENT", $this->lng->txt(ILINC_MEMBER_DOCENT));
                $this->tpl->setVariable("SEL_DOCENT", $sel_docents);
                
                
                $docent = 0; $student = 0;

                if ($ilinc_status == ILINC_MEMBER_DOCENT)
                {
                        $docent = 1;
                }
                elseif ($ilinc_status == ILINC_MEMBER_STUDENT)
                {
                        $student = 1;
                }
                
                $radio1 = ilUtil::formRadioButton(1,"Fobject[alwaysopen]","1");
                $radio2 = ilUtil::formRadioButton(0,"Fobject[alwaysopen]","0");
                
                $this->tpl->setVariable("TXT_ACCESS", $this->lng->txt("access"));
                $this->tpl->setVariable("SEL_ACCESS", $radio1." ".$this->lng->txt("ilinc_classroom_open").$radio2." ".$this->lng->txt("ilinc_classroom_closed"));

                $this->tpl->setVariable("FORMACTION", $this->getFormAction("save","adm_object.php?cmd=gateway&ref_id=".
                                                                                                                                   $_GET["ref_id"]."&new_type=".$new_type));
                $this->tpl->setVariable("TXT_HEADER", $this->lng->txt($new_type."_new"));
                $this->tpl->setVariable("TXT_CANCEL", $this->lng->txt("cancel"));
                $this->tpl->setVariable("TXT_SUBMIT", $this->lng->txt($new_type."_add"));
                $this->tpl->setVariable("CMD_SUBMIT", "save");
                $this->tpl->setVariable("TARGET", $this->getTargetFrame("save"));
                $this->tpl->setVariable("TXT_REQUIRED_FLD", $this->lng->txt("required_field"));
        }

Here is the call graph for this function:

ilObjiLincClassroomGUI::displayEditForm ( fields  ) 

display edit form (usually called by editObject)

private

Parameters:
array $fields key/value pairs of input fields

Reimplemented from ilObjectGUI.

Definition at line 228 of file class.ilObjiLincClassroomGUI.php.

References ilObjectGUI::$data, $fields, $id, ilUtil::formRadioButton(), formSelect(), ilObjectGUI::getFormAction(), and ilObjectGUI::getTargetFrame().

Referenced by editClassroomObject().

        {
                //$this->getTemplateFile("edit");
                $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.icla_edit.html","ilinc");

                foreach ($fields as $key => $val)
                {
                        $this->tpl->setVariable("TXT_".strtoupper($key), $this->lng->txt($key));
                        $this->tpl->setVariable(strtoupper($key), $val);
                        $this->tpl->parseCurrentBlock();
                }

                // get all docents of course
                $docentlist = $this->object->getDocentList();
                
                $docent_options[0] = $this->lng->txt('please_choose');

                foreach ($docentlist as $id => $data)
                {
                        $docent_options[$id] = $data['fullname'];
                }
                
                $sel_docents = ilUtil::formSelect($this->object->getDocentId(),"Fobject[instructoruserid]",$docent_options,false,true);
                
                $this->tpl->setVariable("TXT_DOCENT", $this->lng->txt(ILINC_MEMBER_DOCENT));
                $this->tpl->setVariable("SEL_DOCENT", $sel_docents);
                
                
                $open = 0; $closed = 0;

                if ($this->object->getStatus())
                {
                        $open = 1;
                }
                else
                {
                        $closed = 1;
                }
                
                $radio1 = ilUtil::formRadioButton($open,"Fobject[alwaysopen]","1");
                $radio2 = ilUtil::formRadioButton($closed,"Fobject[alwaysopen]","0");
                
                $this->tpl->setVariable("TXT_ACCESS", $this->lng->txt("access"));
                $this->tpl->setVariable("SEL_ACCESS", $radio1." ".$this->lng->txt("ilinc_classroom_open").$radio2." ".$this->lng->txt("ilinc_classroom_closed"));

                $obj_str = "&class_id=".$this->object->id;

                $this->tpl->setVariable("FORMACTION", $this->getFormAction("update",$this->ctrl->getFormAction($this).$obj_str));
                //$this->tpl->setVariable("FORMACTION", $this->getFormAction("update","adm_object.php?cmd=gateway&ref_id=".$this->ref_id.$obj_str));
                $this->tpl->setVariable("TXT_HEADER", $this->lng->txt($this->object->getType()."_edit"));
                $this->tpl->setVariable("TARGET", $this->getTargetFrame("update"));
                $this->tpl->setVariable("TXT_CANCEL", $this->lng->txt("cancel"));
                $this->tpl->setVariable("TXT_SUBMIT", $this->lng->txt("save"));
                $this->tpl->setVariable("CMD_SUBMIT", "updateClassroom");
                $this->tpl->setVariable("TXT_REQUIRED_FLD", $this->lng->txt("required_field"));

        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilObjiLincClassroomGUI::editClassroomObject (  ) 

Definition at line 203 of file class.ilObjiLincClassroomGUI.php.

References $_SESSION, $fields, displayEditForm(), ilUtil::prepareFormOutput(), and ilUtil::stripSlashes().

        {
                $fields = array();

                if ($_SESSION["error_post_vars"])
                {
                        // fill in saved values in case of error
                        $fields["title"] = ilUtil::prepareFormOutput($_SESSION["error_post_vars"]["Fobject"]["title"],true);
                        $fields["desc"] = ilUtil::stripSlashes($_SESSION["error_post_vars"]["Fobject"]["desc"]);
                }
                else
                {
                        $fields["title"] = ilUtil::prepareFormOutput($this->object->getTitle());
                        $fields["desc"] = ilUtil::stripSlashes($this->object->getDescription());
                }

                $this->displayEditForm($fields);
        }

Here is the call graph for this function:

ilObjiLincClassroomGUI::getTabs ( &$  tabs_gui  ) 

get tabs public

Parameters:
object tabs gui object

Reimplemented from ilObjectGUI.

Definition at line 291 of file class.ilObjiLincClassroomGUI.php.

        {
                // tabs are defined manually here. The autogeneration via objects.xml will be deprecated in future
                // for usage examples see ilObjGroupGUI or ilObjSystemFolderGUI
        }

ilObjiLincClassroomGUI::ilObjiLincClassroomGUI ( a_icla_id,
a_icrs_id 
)

Constructor public.

Definition at line 45 of file class.ilObjiLincClassroomGUI.php.

References $ilCtrl, $ilErr, ilObjectGUI::$ilias, ilObjectGUI::$lng, ilObjectGUI::$objDefinition, ilObjectGUI::$tpl, ilObjectGUI::$tree, assignObject(), and ilObjectGUI::prepareOutput().

        {
                global $ilCtrl,$lng,$ilias,$objDefinition,$tpl,$tree,$ilErr;
                $this->type = "icla";
                $this->id = $a_icla_id;
                $this->parent = $a_icrs_id;
                $this->ilias =& $ilias;
                $this->objDefinition =& $objDefinition;
                $this->tpl =& $tpl;
                $this->html = "";
                $this->ctrl =& $ilCtrl;
                $this->lng =& $lng;
                $this->tree =& $tree;
                $this->ilErr =& $ilErr;
                
                $this->ctrl->saveParameter($this,'parent');
                
                $this->formaction = array();
                $this->return_location = array();
                $this->target_frame = array();
                $this->tab_target_script = "adm_object.php";
                $this->actions = "";
                $this->sub_objects = "";


                /*if ($this->id != 0)
                {
                        $this->link_params = "ref_id=".$this->ref_id;
                }*/

                //prepare output
                if (false)
                {
                        $this->prepareOutput();
                }
                
                $this->assignObject();
        }

Here is the call graph for this function:

ilObjiLincClassroomGUI::joinObject (  ) 

Definition at line 182 of file class.ilObjiLincClassroomGUI.php.

References ilUtil::redirect().

        {
                // check if user is registered at iLinc server
                if (!$this->object->userExists($this->ilias->account))
                {
                                $ilinc_user_id = $this->object->addUser($this->ilias->account);
                }

                // check if user is already member of icourse
                if (!$this->object->isMember($this->ilias->account->getiLincID(),$this->ilinc_course_id))
                {
                        // then assign membership to icourse
                                $this->object->registerUser($this->ilias->account,$this->object->ilinc_course_id,"True");
                }


                // join class
                $url = $this->object->joinClass($this->ilias->account,$this->object->ilinc_id);
                ilUtil::redirect(trim($url));
        }

Here is the call graph for this function:

ilObjiLincClassroomGUI::removeClassroomObject ( a_error = false  ) 

display deletion confirmation screen only for referenced objects.

For user,role & rolt overwrite this function in the appropriate Object folders classes (ilObjUserFolderGUI,ilObjRoleFolderGUI)

public

Definition at line 304 of file class.ilObjiLincClassroomGUI.php.

References $_GET, $counter, ilObjectGUI::getFormAction(), ilUtil::getImagePath(), ilUtil::getImageTagByType(), ilObjectGUI::getTemplateFile(), sendInfo(), and ilUtil::switchColor().

        {
                unset($this->data);
                $this->data["cols"] = array("type", "title", "last_change");

                $this->data["data"][$_GET['class_id']] = array(
                                                                                        "type"        => $this->object->getType(),
                                                                                        "title"       => $this->object->getTitle()."#separator#".$this->object->getDescription()." ",   // workaround for empty desc
                                                                                        "last_update" => "n/a"
                                                                                );

                $this->data["buttons"] = array( "confirmedDeleteClassroom"  => $this->lng->txt("confirm"),
                                                                  "cancelDeleteClassroom"  => $this->lng->txt("cancel"));

                $this->getTemplateFile("confirm");

                if(!$a_error)
                {
                        sendInfo($this->lng->txt("info_delete_sure"));
                }

                $this->tpl->setVariable("FORMACTION", $this->getFormAction("delete",
                        "adm_object.php?ref_id=".$_GET["ref_id"]."&class_id=".$_GET["class_id"]."&cmd=gateway"));
        
                // BEGIN TABLE HEADER
                foreach ($this->data["cols"] as $key)
                {
                        $this->tpl->setCurrentBlock("table_header");
                        $this->tpl->setVariable("TEXT",$this->lng->txt($key));
                        $this->tpl->parseCurrentBlock();
                }
                // END TABLE HEADER

                // BEGIN TABLE DATA
                $counter = 0;

                foreach ($this->data["data"] as $key => $value)
                {
                        // BEGIN TABLE CELL
                        foreach ($value as $key => $cell_data)
                        {
                                $this->tpl->setCurrentBlock("table_cell");

                                // CREATE TEXT STRING
                                if ($key == "type")
                                {
                                        $this->tpl->setVariable("TEXT_CONTENT",ilUtil::getImageTagByType($cell_data,$this->tpl->tplPath));
                                }
                                elseif ($key == "title")
                                {
                                        $name_field = explode("#separator#",$cell_data);

                                        $this->tpl->setVariable("TEXT_CONTENT", "<b>".$name_field[0]."</b>");
                                                
                                        $this->tpl->setCurrentBlock("subtitle");
                                        $this->tpl->setVariable("DESC", $name_field[1]);
                                        $this->tpl->parseCurrentBlock();
                                        $this->tpl->setCurrentBlock("table_cell");
                                }
                                else
                                {
                                        $this->tpl->setVariable("TEXT_CONTENT",$cell_data);
                                }

                                $this->tpl->parseCurrentBlock();
                        }

                        $this->tpl->setCurrentBlock("table_row");
                        $this->tpl->setVariable("CSS_ROW",ilUtil::switchColor(++$counter,"tblrow1","tblrow2"));
                        $this->tpl->parseCurrentBlock();
                        // END TABLE CELL
                }
                // END TABLE DATA

                // BEGIN OPERATION_BTN
                foreach ($this->data["buttons"] as $name => $value)
                {
                        $this->tpl->setCurrentBlock("operation_btn");
                        $this->tpl->setVariable("IMG_ARROW",ilUtil::getImagePath("arrow_downright.gif"));
                        $this->tpl->setVariable("BTN_NAME",$name);
                        $this->tpl->setVariable("BTN_VALUE",$value);
                        $this->tpl->parseCurrentBlock();
                }
        }

Here is the call graph for this function:

ilObjiLincClassroomGUI::saveObject (  ) 

save object public

Reimplemented from ilObjectGUI.

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

References $_POST, $rbacadmin, ilObjiLincClassroom::_lookupiCourseId(), ilObjectGUI::getReturnLocation(), ilUtil::redirect(), and sendInfo().

        {
                global $rbacadmin;
                
                $ilinc_course_id = ilObjiLincClassroom::_lookupiCourseId($this->parent);

//var_dump($_POST["Fobject"]);exit;

                $this->object->ilincAPI->addClass($ilinc_course_id,$_POST['Fobject']);
                $response = $this->object->ilincAPI->sendRequest('addClass');
                
                if ($response->isError())
                {
                        $this->ilErr->raiseError($response->getErrorMsg(),$this->ilErr->MESSAGE);
                }

                //$iClaObj->saveID($response->getFirstID(),$icrs_id);

                // always send a message
                sendInfo($response->getResultMsg(),true);
                
                ilUtil::redirect($this->getReturnLocation("save",$this->ctrl->getLinkTarget($this,"")));
        }

Here is the call graph for this function:

ilObjiLincClassroomGUI::updateClassroomObject (  ) 

updates class room on ilinc server

public

Definition at line 394 of file class.ilObjiLincClassroomGUI.php.

References $_POST, ilObjectGUI::getReturnLocation(), ilUtil::redirect(), sendInfo(), and ilUtil::stripSlashes().

        {
                $this->object->setTitle(ilUtil::stripSlashes($_POST["Fobject"]["title"]));
                $this->object->setDescription(ilUtil::stripSlashes($_POST["Fobject"]["desc"]));
                $this->object->setDocentId($_POST["Fobject"]["instructoruserid"]);
                $this->object->setStatus($_POST["Fobject"]["alwaysopen"]);


                if (!$this->object->update())
                {
                        $this->ilErr->raiseError($this->object->getErrorMsg(),$this->ilErr->MESSAGE);
                }

                sendInfo($this->lng->txt("msg_obj_modified"),true);

                ilUtil::redirect($this->getReturnLocation("update",$this->ctrl->getLinkTarget($this)));
        }

Here is the call graph for this function:


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