• Main Page
  • Related Pages
  • Namespaces
  • Data Structures
  • Files
  • File List
  • Globals

link/classes/class.ilObjLinkResourceGUI.php

Go to the documentation of this file.
00001 <?php
00002 /*
00003         +-----------------------------------------------------------------------------+
00004         | ILIAS open source                                                           |
00005         +-----------------------------------------------------------------------------+
00006         | Copyright (c) 1998-2005 ILIAS open source, University of Cologne            |
00007         |                                                                             |
00008         | This program is free software; you can redistribute it and/or               |
00009         | modify it under the terms of the GNU General Public License                 |
00010         | as published by the Free Software Foundation; either version 2              |
00011         | of the License, or (at your option) any later version.                      |
00012         |                                                                             |
00013         | This program is distributed in the hope that it will be useful,             |
00014         | but WITHOUT ANY WARRANTY; without even the implied warranty of              |
00015         | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               |
00016         | GNU General Public License for more details.                                |
00017         |                                                                             |
00018         | You should have received a copy of the GNU General Public License           |
00019         | along with this program; if not, write to the Free Software                 |
00020         | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. |
00021         +-----------------------------------------------------------------------------+
00022 */
00023 
00037 include_once "./classes/class.ilObjectGUI.php";
00038 
00039 class ilObjLinkResourceGUI extends ilObjectGUI
00040 {
00045         function ilObjLinkResourceGUI($a_data,$a_id,$a_call_by_reference,$a_prepare_output = true)
00046         {
00047                 global $ilCtrl;
00048 
00049                 $this->type = "webr";
00050                 $this->ilObjectGUI($a_data,$a_id,$a_call_by_reference,false);
00051 
00052                 // CONTROL OPTIONS
00053                 $this->ctrl =& $ilCtrl;
00054                 $this->ctrl->saveParameter($this,array("ref_id","cmdClass"));
00055 
00056                 $this->lng->loadLanguageModule('webr');
00057         }
00058 
00059         function &executeCommand()
00060         {
00061                 global $rbacsystem;
00062 
00063                 if($this->ctrl->getTargetScript() == 'link_resources.php')
00064                 {
00065                         $this->__prepareOutput();
00066                 }
00067                 
00068                 if (strtolower($_GET["baseClass"]) == "iladministrationgui" ||
00069                         $this->getCreationMode() == true)
00070                 {
00071                         $this->prepareOutput();
00072                 }
00073 
00074 
00075                 $next_class = $this->ctrl->getNextClass($this);
00076                 $cmd = $this->ctrl->getCmd();
00077 
00078                 switch($next_class)
00079                 {
00080                         case "ilinfoscreengui":
00081                                 $this->infoScreen();    // forwards command
00082                                 break;
00083 
00084                         case 'ilmdeditorgui':
00085 
00086                                 include_once 'Services/MetaData/classes/class.ilMDEditorGUI.php';
00087 
00088                                 $md_gui =& new ilMDEditorGUI($this->object->getId(), 0, $this->object->getType());
00089                                 $md_gui->addObserver($this->object,'MDUpdateListener','General');
00090 
00091                                 $this->ctrl->forwardCommand($md_gui);
00092                                 break;
00093                                 
00094                         case 'ilpermissiongui':
00095                                 include_once("./classes/class.ilPermissionGUI.php");
00096                                 $perm_gui =& new ilPermissionGUI($this);
00097                                 $ret =& $this->ctrl->forwardCommand($perm_gui);
00098                                 break;
00099 
00100                         default:
00101                                 if(!$cmd)
00102                                 {
00103                                         $cmd = "view";
00104                                 }
00105                                 $cmd .= "Object";
00106                                 $this->$cmd();
00107                                         
00108                                 break;
00109                 }
00110                 return true;
00111         }
00112 
00113         function viewObject()
00114         {
00115                 if (strtolower($_GET["baseClass"]) == "iladministrationgui")
00116                 {
00117                         parent::viewObject();
00118                         return true;
00119                 }
00120                 else
00121                 {
00122                         $this->listItemsObject();
00123 
00124                         return true;
00125                 }
00126         }
00127 
00128         function listItemsObject()
00129         {
00130                 global $rbacsystem;
00131 
00132                 include_once './classes/class.ilTableGUI.php';
00133                 include_once './link/classes/class.ilParameterAppender.php';
00134 
00135                 // MINIMUM ACCESS LEVEL = 'read'
00136                 if(!$rbacsystem->checkAccess("read", $this->object->getRefId()))
00137                 {
00138                         $this->ilias->raiseError($this->lng->txt("msg_no_perm_read"),$this->ilias->error_obj->MESSAGE);
00139                 }
00140 
00141                 $this->object->initLinkResourceItemsObject();
00142                 if(!count($items = $this->object->items_obj->getActivatedItems()))
00143                 {
00144                         sendInfo($this->lng->txt('webr_no_items_created'));
00145 
00146                         return true;
00147                 }
00148 
00149                 $this->tpl->addBlockFile("ADM_CONTENT","adm_content","tpl.lnkr_view_items.html","link");
00150                 
00151                 $tpl =& new ilTemplate("tpl.table.html", true, true);
00152                 #$items_sliced = array_slice($items, $_GET["offset"], $_GET["limit"]);
00153 
00154                 $tpl->addBlockfile("TBL_CONTENT", "tbl_content", "tpl.lnkr_view_items_row.html",'link');
00155 
00156                 $items = ilUtil::sortArray($items,
00157                                                                    'title',
00158                                                                    $_GET['sort_order'] ? $_GET['sort_order'] : 'asc');
00159                 $counter = 0;
00160                 foreach($items as $item_id => $item)
00161                 {
00162                         if(ilParameterAppender::_isEnabled())
00163                         {
00164                                 $item = ilParameterAppender::_append($item);
00165                         }
00166                         if(strlen($item['description']))
00167                         {
00168                                 $tpl->setCurrentBlock("description");
00169                                 $tpl->setVariable("DESCRIPTION",$item['description']);
00170                                 $tpl->parseCurrentBlock();
00171                         }
00172                         $tpl->setCurrentBlock("row");
00173                         $tpl->setVariable("ROW_CSS",ilUtil::switchColor(++$counter,'tblrow1','tblrow2'));
00174                         $tpl->setVariable("TITLE",$item['title']);
00175                         $tpl->setVariable("TARGET",$item['target']);
00176                         $tpl->parseCurrentBlock();
00177                 }
00178 
00179                 // create table
00180                 $tbl = new ilTableGUI();
00181 
00182                 // title & header columns
00183                 $tbl->setTitle($this->lng->txt("web_resources"),"icon_webr.gif",$this->lng->txt("web_resources"));
00184                 $tbl->setHeaderNames(array($this->lng->txt("title")));
00185                 $tbl->setHeaderVars(array("title"),array("ref_id" => $this->object->getRefId(),
00186                                                                                                            "cmd" => 'listItems'));
00187                 $tbl->setColumnWidth(array("100%"));
00188                 $tbl->disable('linkbar');
00189                 $tbl->disable('numinfo');
00190 
00191                 $tbl->setOrderColumn('title');
00192                 $tbl->setOrderDirection($_GET['sort_order']);
00193                 $tbl->setLimit($_GET["limit"]);
00194                 $tbl->setOffset($_GET["offset"]);
00195                 $tbl->setMaxCount(count($items));
00196 
00197                 // render table
00198                 $tbl->setTemplate($tpl);
00199                 $tbl->render();
00200 
00201                 $this->tpl->setVariable("ITEM_TABLE", $tpl->get());
00202 
00203                 return true;
00204         }
00205 
00206         function editItemsObject()
00207         {
00208                 global $rbacsystem;
00209 
00210                 include_once './classes/class.ilTableGUI.php';
00211                 include_once 'link/classes/class.ilParameterAppender.php';
00212                 
00213 
00214                 // MINIMUM ACCESS LEVEL = 'read'
00215                 if(!$rbacsystem->checkAccess("write", $this->object->getRefId()))
00216                 {
00217                         $this->ilias->raiseError($this->lng->txt("msg_no_perm_read"),$this->ilias->error_obj->MESSAGE);
00218                 }
00219 
00220                 $this->tpl->addBlockFile("ADM_CONTENT","adm_content","tpl.lnkr_edit_items.html","link");
00221                 $this->__showButton('showAddItem',$this->lng->txt('webr_add_item'));
00222 
00223                 $this->object->initLinkResourceItemsObject();
00224                 if(!count($items = $this->object->items_obj->getAllItems()))
00225                 {
00226                         sendInfo($this->lng->txt('webr_no_items_created'));
00227 
00228                         return true;
00229                 }
00230                 
00231                 $tpl =& new ilTemplate("tpl.table.html", true, true);
00232                 #$items_sliced = array_slice($items, $_GET["offset"], $_GET["limit"]);
00233 
00234                 $tpl->setCurrentBlock("tbl_form_header");
00235                 $tpl->setVariable("FORMACTION",$this->ctrl->getFormAction($this));
00236                 $tpl->parseCurrentBlock();
00237 
00238                 $tpl->setCurrentBlock("tbl_action_btn");
00239                 $tpl->setVariable("BTN_NAME",'askDeleteItems');
00240                 $tpl->setVariable("BTN_VALUE",$this->lng->txt('delete'));
00241                 $tpl->parseCurrentBlock();
00242                 
00243                 $tpl->setCurrentBlock("plain_buttons");
00244                 $tpl->setVariable("PBTN_NAME",'updateItems');
00245                 $tpl->setVariable("PBTN_VALUE",$this->lng->txt('save'));
00246                 $tpl->parseCurrentBlock();
00247                 
00248                 $tpl->setCurrentBlock("tbl_action_row");
00249                 $tpl->setVariable("IMG_ARROW",ilUtil::getImagePath('arrow_downright.gif'));
00250                 $tpl->setVariable("COLUMN_COUNTS",ilParameterAppender::_isEnabled() ? 8 : 7);
00251                 $tpl->parseCurrentBlock();
00252                 
00253 
00254 
00255                 $tpl->addBlockfile("TBL_CONTENT", "tbl_content", "tpl.lnkr_edit_items_row.html",'link');
00256 
00257                 $items = ilUtil::sortArray($items,
00258                                                                    $_GET['sort_by'] ? $_GET['sort_by'] : 'title',
00259                                                                    $_GET['sort_order'] ? $_GET['sort_order'] : 'asc');
00260                 
00261                 $counter = 0;
00262                 foreach($items as $item_id => $item)
00263                 {
00264                         if(ilParameterAppender::_isEnabled())
00265                         {
00266                                 $params_list = array();
00267                                 foreach($params = ilParameterAppender::_getParams($item['link_id']) as $id => $param)
00268                                 {
00269                                         $txt_param = $param['name'];
00270                                         switch($param['value'])
00271                                         {
00272                                                 case LINKS_USER_ID:
00273                                                         $txt_param .= '=IL_USER_ID';
00274                                                         break;
00275 
00276                                                 case LINKS_SESSION_ID:
00277                                                         $txt_param .= '=IL_SESSION_ID';
00278                                                         break;
00279                                                 
00280                                                 case LINKS_LOGIN:
00281                                                         $txt_param .= '=IL_LOGIN';
00282                                                         break;
00283                                         }
00284                                         $params_list[] = $txt_param;
00285                                 }
00286                                 $tpl->setCurrentBlock("params");
00287                                 $tpl->setVariable("DYN_PARAM",count($params_list) ? 
00288                                                                   implode('<br />',$params_list) :
00289                                                                   $this->lng->txt('links_not_available'));
00290                                 $tpl->parseCurrentBlock();
00291                         }                       
00292 
00293 
00294                         if(strlen($item['description']))
00295                         {
00296                                 $tpl->setCurrentBlock("description");
00297                                 $tpl->setVariable("DESCRIPTION",$item['description']);
00298                                 $tpl->parseCurrentBlock();
00299                         }
00300 
00301                         $tpl->setCurrentBlock("row");
00302                         $tpl->setVariable("ROW_CSS",ilUtil::switchColor(++$counter,'tblrow1','tblrow2'));
00303                         
00304                         $tpl->setVariable("CHECK_ITEM",ilUtil::formCheckbox(0,'item_id[]',$item['link_id']));
00305                         $tpl->setVariable("TITLE",$item['title']);
00306 
00307                         if($item['last_check'])
00308                         {
00309                                 $last_check = date('Y-m-d H:i:s',$item['last_check']);
00310                         }
00311                         else
00312                         {
00313                                 $last_check = $this->lng->txt('webr_never_checked');
00314                         }
00315                         $tpl->setVariable("TXT_LAST_CHECK",$this->lng->txt('webr_last_check_table'));
00316                         $tpl->setVariable("LAST_CHECK",$last_check);
00317 
00318                         $target = substr($item['target'],0,70);
00319                         if(strlen($item['target']) > 70)
00320                         {
00321                                 $target = substr($item['target'],0,70).'...';
00322                         }
00323                         else
00324                         {
00325                                 $target = $item['target'];
00326                         }
00327 
00328                                 
00329 
00330                         $tpl->setVariable("TARGET",$target);
00331                         $tpl->setVariable("VALID",ilUtil::formCheckbox($item['valid'] ? 1 : 0,'valid['.$item['link_id'].']',1));
00332                         $tpl->setVariable("ACTIVE",ilUtil::formCheckbox($item['active'] ? 1 : 0,'active['.$item['link_id'].']',1));
00333                         $tpl->setVariable("DISABLE_CHECK",ilUtil::formCheckbox($item['disable_check'] ? 1 : 0,'disable['.$item['link_id'].']',1));
00334                         $tpl->setVariable("EDIT_IMG",ilUtil::getImagePath('icon_pencil.gif'));
00335                         $tpl->setVariable("EDIT_ALT",$this->lng->txt('edit'));
00336 
00337                         $this->ctrl->setParameter($this,'item_id',$item['link_id']);
00338                         $tpl->setVariable("EDIT_LINK",$this->ctrl->getLinkTarget($this,'editItem'));
00339 
00340                         $tpl->parseCurrentBlock();
00341                 }
00342 
00343                 // create table
00344                 $tbl = new ilTableGUI();
00345 
00346 
00347 
00348 
00349                 // title & header columns
00350                 $tbl->setTitle($this->lng->txt("web_resources"),"icon_webr.gif",$this->lng->txt("web_resources"));
00351 
00352                 if(!ilParameterAppender::_isEnabled())
00353                 {
00354                         $tbl->setHeaderNames(array('',
00355                                                                            $this->lng->txt("title"),
00356                                                                            $this->lng->txt("target"),
00357                                                                            $this->lng->txt('valid'),
00358                                                                            $this->lng->txt('active'),
00359                                                                            $this->lng->txt('disable_check'),
00360                                                                            $this->lng->txt('details')));
00361                         $tbl->setHeaderVars(array("",
00362                                                                           "title",
00363                                                                           "target",
00364                                                                           "valid",
00365                                                                           "active",
00366                                                                           "disable_check",
00367                                                                           ""),array("ref_id" => $this->object->getRefId(),
00368                                                                                                 "cmd" => 'editItems'));
00369                         $tbl->setColumnWidth(array("",
00370                                                                            "50%",
00371                                                                            "30%",
00372                                                                            "5%",
00373                                                                            "5%",
00374                                                                            "5%",
00375                                                                            "5%"));
00376                 }
00377                 else
00378                 {
00379                         $tbl->setHeaderNames(array('',
00380                                                                            $this->lng->txt("title"),
00381                                                                            $this->lng->txt("target"),
00382                                                                            $this->lng->txt("links_dyn_parameter"),
00383                                                                            $this->lng->txt('valid'),
00384                                                                            $this->lng->txt('active'),
00385                                                                            $this->lng->txt('disable_check'),
00386                                                                            $this->lng->txt('details')));
00387                         
00388                         $tbl->setHeaderVars(array("",
00389                                                                           "title",
00390                                                                           "target",
00391                                                                           "parameter",
00392                                                                           "valid",
00393                                                                           "active",
00394                                                                           "disable_check",
00395                                                                           ""),array("ref_id" => $this->object->getRefId(),
00396                                                                                                 "cmd" => 'editItems'));
00397                         $tbl->setColumnWidth(array("",
00398                                                                            "40%",
00399                                                                            "20%",
00400                                                                            "20%",
00401                                                                            "5%",
00402                                                                            "5%",
00403                                                                            "5%",
00404                                                                            "5%"));
00405                 }
00406                 $tbl->disable('linkbar');
00407                 $tbl->disable('numinfo');
00408                 $tbl->enable('sort');
00409 
00410                 $tbl->setOrderColumn($_GET['sort_by']);
00411                 $tbl->setOrderDirection($_GET['sort_order']);
00412                 $tbl->setLimit($_GET["limit"]);
00413                 $tbl->setOffset($_GET["offset"]);
00414                 $tbl->setMaxCount(count($items));
00415 
00416                 // render table
00417                 $tbl->setTemplate($tpl);
00418                 $tbl->render();
00419 
00420                 $this->tpl->setVariable("ITEM_TABLE", $tpl->get());
00421 
00422                 return true;
00423         }
00424 
00425         function askDeleteItemsObject()
00426         {
00427                 global $rbacsystem;
00428 
00429                 // MINIMUM ACCESS LEVEL = 'write'
00430                 if(!$rbacsystem->checkAccess("write", $this->object->getRefId()))
00431                 {
00432                         $this->ilias->raiseError($this->lng->txt("msg_no_perm_read"),$this->ilias->error_obj->MESSAGE);
00433                 }
00434                 if(!count($_POST['item_id']))
00435                 {
00436                         sendInfo($this->lng->txt('webr_select_one'));
00437                         $this->editItemsObject();
00438 
00439                         return true;
00440                 }
00441 
00442                 sendInfo($this->lng->txt('webr_sure_delete_items'));
00443                 $this->tpl->addBlockfile('ADM_CONTENT','adm_content','tpl.lnkr_ask_delete.html','link');
00444 
00445                 $this->tpl->setVariable("FORMACTION",$this->ctrl->getFormAction($this));
00446                 $this->tpl->setVariable("TBL_TITLE_IMG",ilUtil::getImagePath('icon_webr.gif'));
00447                 $this->tpl->setVariable("TBL_TITLE_IMG_ALT",$this->lng->txt('obj_webr'));
00448                 $this->tpl->setVariable("TBL_TITLE",$this->lng->txt('webr_delete_items'));
00449                 $this->tpl->setVariable("HEADER_DESC",$this->lng->txt('title'));
00450                 $this->tpl->setVariable("BTN_CANCEL",$this->lng->txt('cancel'));
00451                 $this->tpl->setVariable("BTN_DELETE",$this->lng->txt('delete'));
00452 
00453                 $this->object->initLinkResourceItemsObject();
00454                 
00455                 $counter = 0;
00456                 foreach($_POST['item_id'] as $id)
00457                 {
00458                         $this->object->items_obj->readItem($id);
00459                         $this->tpl->setCurrentBlock("item_row");
00460                         $this->tpl->setVariable("ITEM_TITLE",$this->object->items_obj->getTitle());
00461                         $this->tpl->setVariable("TXT_TARGET",$this->lng->txt('target'));
00462                         $this->tpl->setVariable("TARGET",$this->object->items_obj->getTarget());
00463                         $this->tpl->setVariable("ROW_CLASS",ilUtil::switchColor(++$counter,'tblrow1','tblrow2'));
00464                         $this->tpl->parseCurrentBlock();
00465                 }
00466                 $_SESSION['webr_item_ids'] = $_POST['item_id'];
00467 
00468                 return true;
00469         }
00470 
00471         function deleteItemsObject()
00472         {
00473                 global $rbacsystem;
00474 
00475                 // MINIMUM ACCESS LEVEL = 'write'
00476                 if(!$rbacsystem->checkAccess("write", $this->object->getRefId()))
00477                 {
00478                         $this->ilias->raiseError($this->lng->txt("msg_no_perm_read"),$this->ilias->error_obj->MESSAGE);
00479                 }
00480                 if(!count($_SESSION['webr_item_ids']))
00481                 {
00482                         sendInfo($this->lng->txt('webr_select_one'));
00483                         $this->editItemsObject();
00484 
00485                         return true;
00486                 }
00487 
00488                 $this->object->initLinkResourceItemsObject();
00489                 foreach($_SESSION['webr_item_ids'] as $id)
00490                 {
00491                         $this->object->items_obj->delete($id);
00492                 }
00493                 sendInfo($this->lng->txt('webr_deleted_items'));
00494 
00495                 $this->editItemsObject();
00496                 return true;
00497         }
00498                 
00499 
00500         function updateItemsObject()
00501         {
00502                 global $rbacsystem;
00503 
00504                 // MINIMUM ACCESS LEVEL = 'write'
00505                 if(!$rbacsystem->checkAccess("write", $this->object->getRefId()))
00506                 {
00507                         $this->ilias->raiseError($this->lng->txt("msg_no_perm_read"),$this->ilias->error_obj->MESSAGE);
00508                 }
00509                 $this->object->initLinkResourceItemsObject();
00510                 foreach($this->object->items_obj->getAllItems() as $item)
00511                 {
00512                         $update = false;
00513 
00514                         $valid = (int) $_POST['valid'][$item['link_id']];
00515                         $active = (int) $_POST['active'][$item['link_id']];
00516                         $disable = (int) $_POST['disable'][$item['link_id']];
00517 
00518                         if($valid != $item['valid'] or
00519                            $active != $item['active'] or 
00520                            $disable != $item['disable_check'])
00521                         {
00522                                 $this->object->items_obj->readItem($item['link_id']);
00523                                 $this->object->items_obj->setValidStatus($valid);
00524                                 $this->object->items_obj->setActiveStatus($active);
00525                                 $this->object->items_obj->setDisableCheckStatus($disable);
00526                                 $this->object->items_obj->update();
00527                         }
00528                 }
00529 
00530                 sendInfo($this->lng->txt('webr_modified_items'));
00531                 $this->editItemsObject();
00532 
00533                 return true;
00534         }
00535 
00536         function editItemObject()
00537         {
00538                 global $rbacsystem;
00539 
00540                 // MINIMUM ACCESS LEVEL = 'write'
00541                 if(!$rbacsystem->checkAccess("write", $this->object->getRefId()))
00542                 {
00543                         $this->ilias->raiseError($this->lng->txt("msg_no_perm_read"),$this->ilias->error_obj->MESSAGE);
00544                 }
00545 
00546                 $this->object->initLinkResourceItemsObject();
00547                 $item = $this->object->items_obj->getItem($_GET['item_id'] ? $_GET['item_id'] : $_SESSION['webr_item_id']);
00548 
00549 
00550                 $this->tpl->addBlockfile('ADM_CONTENT','adm_content','tpl.lnkr_edit_item.html','link');
00551 
00552                 $this->tpl->setVariable("FORMACTION",$this->ctrl->getFormAction($this));
00553                 $this->tpl->setVariable("TBL_TITLE_IMG",ilUtil::getImagePath('icon_webr.gif'));
00554                 $this->tpl->setVariable("TBL_TITLE_IMG_ALT",$this->lng->txt('obj_webr'));
00555                 $this->tpl->setVariable("TBL_TITLE",$this->lng->txt('webr_edit_item'));
00556                 $this->tpl->setVariable("TXT_TITLE",$this->lng->txt('title'));
00557                 $this->tpl->setVariable("TXT_DESCRIPTION",$this->lng->txt('description'));
00558                 $this->tpl->setVariable("TITLE",ilUtil::prepareFormOutput($item['title']));
00559                 $this->tpl->setVariable("DESCRIPTION",ilUtil::prepareFormOutput($item['description']));
00560                 $this->tpl->setVariable("TXT_TARGET",$this->lng->txt('target'));
00561                 $this->tpl->setVariable("TARGET",ilUtil::prepareFormOutput($item['target']));
00562                 $this->tpl->setVariable("TXT_ACTIVE",$this->lng->txt('webr_active'));
00563                 $this->tpl->setVariable("ACTIVE_CHECK",ilUtil::formCheckbox($item['active'] ? 1 : 0,'active',1));
00564                 $this->tpl->setVariable("TXT_VALID",$this->lng->txt('valid'));
00565                 $this->tpl->setVariable("VALID_CHECK",ilUtil::formCheckbox($item['valid'] ? 1 : 0,'valid',1));
00566                 $this->tpl->setVariable("TXT_DISABLE",$this->lng->txt('disable_check'));
00567                 $this->tpl->setVariable("DISABLE_CHECK",ilUtil::formCheckbox($item['disable_check'] ? 1 : 0,'disable',1));
00568                 $this->tpl->setVariable("TXT_CREATED",$this->lng->txt('created'));
00569                 $this->tpl->setVariable("CREATED",date('Y-m-d H:i:s',$item['create_date']));
00570                 $this->tpl->setVariable("TXT_MODIFIED",$this->lng->txt('last_change'));
00571                 $this->tpl->setVariable("MODIFIED",date('Y-m-d H:i:s',$item['last_update']));
00572                 $this->tpl->setVariable("TXT_LAST_CHECK",$this->lng->txt('webr_last_check'));
00573 
00574                 // add dynamic params
00575                 include_once('link/classes/class.ilParameterAppender.php');
00576 
00577                 if(ilParameterAppender::_isEnabled())
00578                 {
00579                         $counter = 0;
00580                         foreach($params = ilParameterAppender::_getParams($item['link_id']) as $id => $param)
00581                         {
00582                                 if(!$counter++)
00583                                 {
00584                                         $this->tpl->setCurrentBlock("header_info");
00585                                         $this->tpl->setVariable("TXT_PARAM_EXIST",$this->lng->txt('links_existing_params'));
00586                                         $this->tpl->parseCurrentBlock();
00587                                 }
00588                                 $this->tpl->setCurrentBlock("show_params");
00589                                 
00590                                 $txt_param = $param['name'];
00591                                 switch($param['value'])
00592                                 {
00593                                         case LINKS_USER_ID:
00594                                                 $txt_param .= '=IL_USER_ID';
00595                                                 break;
00596 
00597                                         case LINKS_SESSION_ID:
00598                                                 $txt_param .= '=IL_SESSION_ID';
00599                                                 break;
00600                                                 
00601                                         case LINKS_LOGIN:
00602                                                 $txt_param .= '=IL_LOGIN';
00603                                                 break;
00604                                 }
00605                                 $this->tpl->setVariable("PARAMETER",$txt_param);
00606                                 
00607                                 // Delete link
00608                                 $this->ctrl->setParameter($this,'param_id',$id);
00609                                 $this->tpl->setVariable("DEL_TARGET",$this->ctrl->getLinkTarget($this,'deleteParameter'));
00610                                 $this->tpl->setVariable("TXT_DELETE",$this->lng->txt('delete'));
00611                                 $this->tpl->parseCurrentBlock();
00612                         }
00613 
00614                         $this->tpl->setCurrentBlock("params");
00615                         $this->tpl->setVariable("TXT_ADD_PARAM",$this->lng->txt('links_add_param'));
00616                         $this->tpl->setVariable("TXT_DYNAMIC",$this->lng->txt('links_dynamic'));
00617                         $this->tpl->setVariable("TXT_NAME",$this->lng->txt('links_name'));
00618                         $this->tpl->setVariable("TXT_VALUE",$this->lng->txt('links_value'));
00619                         $this->tpl->setVariable("DYNAMIC_INFO",$this->lng->txt('link_dynamic_info'));
00620 
00621                         $this->tpl->setVariable("NAME",$_POST['name'] ? ilUtil::prepareFormOutput($_POST['name'],true) : '');
00622                         $this->tpl->setVariable("VAL_SEL",ilUtil::formSelect((int) $_POST['value'],
00623                                                                                                                                  'value',
00624                                                                                                                                  ilParameterAppender::_getOptionSelect(),
00625                                                                                                                                  false,
00626                                                                                                                                  true));
00627                         $this->tpl->parseCurrentBlock();
00628                 }
00629 
00630                 
00631 
00632                 if($item['last_check'])
00633                 {
00634                         $last_check = date('Y-m-d H:i:s',$item['last_check']);
00635                 }
00636                 else
00637                 {
00638                         $last_check = $this->lng->txt('webr_never_checked');
00639                 }
00640 
00641                 $this->tpl->setVariable("LAST_CHECK",$last_check);
00642                 $this->tpl->setVariable("BTN_CANCEL",$this->lng->txt('cancel'));
00643                 $this->tpl->setVariable("BTN_UPDATE",$this->lng->txt('save'));
00644 
00645                 $_SESSION['webr_item_id'] = $_GET['item_id'] ? $_GET['item_id'] : $_SESSION['webr_item_id'];
00646 
00647                 return true;
00648         }
00649 
00650         function deleteParameterObject()
00651         {
00652                 if(!((int) $_GET['param_id']))
00653                 {
00654                         sendInfo('No parameter id given');
00655                         $this->editItemObject();
00656 
00657                         return false;
00658                 }
00659 
00660                 include_once 'link/classes/class.ilParameterAppender.php';
00661 
00662                 $appender = new ilParameterAppender($this->object->getId());
00663                 $appender->delete((int) $_GET['param_id']);
00664 
00665                 sendInfo($this->lng->txt('links_parameter_deleted'));
00666 
00667                 $this->editItemObject();
00668                 return true;
00669         }
00670 
00671 
00672         function updateItemObject()
00673         {
00674                 include_once 'link/classes/class.ilParameterAppender.php';
00675 
00676                 global $rbacsystem;
00677 
00678                 // MINIMUM ACCESS LEVEL = 'write'
00679                 if(!$rbacsystem->checkAccess("write", $this->object->getRefId()))
00680                 {
00681                         $this->ilias->raiseError($this->lng->txt("msg_no_perm_read"),$this->ilias->error_obj->MESSAGE);
00682                 }
00683                 if(!$_POST['title'] or $_POST['target'] == 'http://')
00684                 {
00685                         sendInfo($this->lng->txt('webr_fillout_all'));
00686 
00687                         $this->editItemObject();
00688                         return false;
00689                 }
00690                 if(ilParameterAppender::_isEnabled())
00691                 {
00692                         $appender =& new ilParameterAppender($this->object->getId());
00693                         $appender->setName(ilUtil::stripSlashes($_POST['name']));
00694                         $appender->setValue(ilUtil::stripSlashes($_POST['value']));
00695                         
00696                         if(!$appender->validate())
00697                         {
00698                                 switch($appender->getErrorCode())
00699                                 {
00700                                         case LINKS_ERR_NO_NAME:
00701                                                 sendInfo($this->lng->txt('links_no_name_given'));
00702                                                 $this->editItemObject();
00703                                                 return false;
00704 
00705                                         case LINKS_ERR_NO_VALUE:
00706                                                 sendInfo($this->lng->txt('links_no_value_given'));
00707                                                 $this->editItemObject();
00708                                                 return false;
00709 
00710                                         default:
00711                                                 break;
00712                                 }
00713                         }
00714                 }
00715 
00716                 $this->object->initLinkResourceItemsObject();
00717 
00718                 $this->object->items_obj->readItem($_SESSION['webr_item_id']);
00719                 $this->object->items_obj->setLinkId($_SESSION['webr_item_id']);
00720                 $this->object->items_obj->setTitle(ilUtil::stripSlashes($_POST['title']));
00721                 $this->object->items_obj->setDescription(ilUtil::stripSlashes($_POST['description']));
00722                 $this->object->items_obj->setTarget(ilUtil::stripSlashes($_POST['target']));
00723                 $this->object->items_obj->setActiveStatus($_POST['active']);
00724                 $this->object->items_obj->setValidStatus($_POST['valid']);
00725                 $this->object->items_obj->setDisableCheckStatus($_POST['disable']);
00726                 $this->object->items_obj->update();
00727 
00728                 if(is_object($appender))
00729                 {
00730                         $appender->add($_SESSION['webr_item_id']);
00731                 }
00732 
00733                 unset($_SESSION['webr_item_id']);
00734                 sendInfo($this->lng->txt('webr_item_updated'));
00735                 $this->editItemsObject();
00736                 
00737                 return true;
00738         }
00739 
00740                 
00741 
00742         function showAddItemObject()
00743         {
00744                 global $rbacsystem;
00745 
00746                 $this->tabs_gui->setTabActive('edit_content');
00747 
00748                 // MINIMUM ACCESS LEVEL = 'read'
00749                 if(!$rbacsystem->checkAccess("write", $this->object->getRefId()))
00750                 {
00751                         $this->ilias->raiseError($this->lng->txt("msg_no_perm_read"),$this->ilias->error_obj->MESSAGE);
00752                 }
00753 
00754                 $title = $_POST['title'] ? ilUtil::prepareFormOutput($_POST['title'],true) : '';
00755                 $target = $_POST['target'] ? ilUtil::prepareFormOutput($_POST['target'],true) : 'http://';
00756 
00757 
00758                 $this->tpl->addBlockFile("ADM_CONTENT","adm_content","tpl.lnkr_add_item.html","link");
00759 
00760                 $this->tpl->setVariable("FORMACTION",$this->ctrl->getFormAction($this));
00761                 $this->tpl->setVariable("TXT_HEADER",$this->lng->txt('webr_add_item'));
00762                 $this->tpl->setVariable("TXT_TITLE",$this->lng->txt('title'));
00763                 $this->tpl->setVariable("TXT_DESC",$this->lng->txt('description'));
00764                 $this->tpl->setVariable("TXT_TARGET",$this->lng->txt('target'));
00765                 $this->tpl->setVariable("TARGET",$target);
00766                 $this->tpl->setVariable("TXT_ACTIVE",$this->lng->txt('active'));
00767                 $this->tpl->setVariable("TXT_CHECK",$this->lng->txt('webr_disable_check'));
00768                 $this->tpl->setVariable("TXT_REQUIRED_FLD",$this->lng->txt('required'));
00769                 $this->tpl->setVariable("TXT_CANCEL",$this->lng->txt('cancel'));
00770                 $this->tpl->setVariable("TXT_SUBMIT",$this->lng->txt('add'));
00771                 $this->tpl->setVariable("CMD_SUBMIT",'addItem');
00772                 $this->tpl->setVariable("CMD_CANCEL",'editItems');
00773 
00774                 // Params
00775                 include_once('link/classes/class.ilParameterAppender.php');
00776 
00777                 if(ilParameterAppender::_isEnabled())
00778                 {
00779                         $this->tpl->setCurrentBlock("params");
00780                         $this->tpl->setVariable("TXT_DYNAMIC",$this->lng->txt('links_dynamic'));
00781                         $this->tpl->setVariable("TXT_NAME",$this->lng->txt('links_name'));
00782                         $this->tpl->setVariable("TXT_VALUE",$this->lng->txt('links_value'));
00783                         $this->tpl->setVariable("DYNAMIC_INFO",$this->lng->txt('links_dynamic_info'));
00784 
00785                         $this->tpl->setVariable("NAME",$_POST['name'] ? ilUtil::prepareFormOutput($_POST['name'],true) : '');
00786                         $this->tpl->setVariable("VAL_SEL",ilUtil::formSelect((int) $_POST['value'],
00787                                                                                                                                  'value',
00788                                                                                                                                  ilParameterAppender::_getOptionSelect(),
00789                                                                                                                                  false,
00790                                                                                                                                  true));
00791                         $this->tpl->parseCurrentBlock();
00792                 }
00793 
00794                 $this->tpl->setVariable("ACTIVE_CHECK",ilUtil::formCheckBox(1,'active',1));
00795                 $this->tpl->setVariable("CHECK_CHECK",ilUtil::formCheckBox(0,'disable_check',1));
00796         
00797         }
00798 
00799         function addItemObject()
00800         {
00801                 include_once('link/classes/class.ilParameterAppender.php');
00802 
00803                 global $rbacsystem;
00804 
00805                 // MINIMUM ACCESS LEVEL = 'read'
00806                 if(!$rbacsystem->checkAccess("write", $this->object->getRefId()))
00807                 {
00808                         $this->ilias->raiseError($this->lng->txt("msg_no_perm_read"),$this->ilias->error_obj->MESSAGE);
00809                 }
00810 
00811                 $this->object->initLinkResourceItemsObject();
00812 
00813                 if(!$_POST['title'] or $_POST['target'] == 'http://')
00814                 {
00815                         sendInfo($this->lng->txt('webr_fillout_all'));
00816 
00817                         $this->showAddItemObject();
00818                         return false;
00819                 }
00820                 if(ilParameterAppender::_isEnabled())
00821                 {
00822                         $appender =& new ilParameterAppender($this->object->getId());
00823                         $appender->setName(ilUtil::stripSlashes($_POST['name']));
00824                         $appender->setValue(ilUtil::stripSlashes($_POST['value']));
00825                         
00826                         if(!$appender->validate())
00827                         {
00828                                 switch($appender->getErrorCode())
00829                                 {
00830                                         case LINKS_ERR_NO_NAME:
00831                                                 sendInfo($this->lng->txt('links_no_name_given'));
00832                                                 $this->showAddItemObject();
00833                                                 return false;
00834 
00835                                         case LINKS_ERR_NO_VALUE:
00836                                                 sendInfo($this->lng->txt('links_no_name_given'));
00837                                                 $this->showAddItemObject();
00838                                                 return false;
00839 
00840                                         default:
00841                                                 break;
00842                                 }
00843                         }
00844                 }
00845                 $this->object->items_obj->setTitle(ilUtil::stripSlashes($_POST['title']));
00846                 $this->object->items_obj->setDescription(ilUtil::stripSlashes($_POST['description']));
00847                 $this->object->items_obj->setTarget(ilUtil::stripSlashes($_POST['target']));
00848                 $this->object->items_obj->setActiveStatus($_POST['active']);
00849                 $this->object->items_obj->setDisableCheckStatus($_POST['disable_check']);
00850                 $link_id = $this->object->items_obj->add();
00851 
00852                 if(is_object($appender))
00853                 {
00854                         $appender->add($link_id);
00855                 }
00856                 $this->editItemsObject();
00857         }
00858         
00864         function infoScreenObject()
00865         {
00866                 $this->ctrl->setCmd("showSummary");
00867                 $this->ctrl->setCmdClass("ilinfoscreengui");
00868                 $this->infoScreen();
00869         }
00870 
00874         function infoScreen()
00875         {
00876                 global $ilAccess;
00877 
00878                 if (!$ilAccess->checkAccess("visible", "", $this->ref_id))
00879                 {
00880                         $this->ilias->raiseError($this->lng->txt("msg_no_perm_read"),$this->ilias->error_obj->MESSAGE);
00881                 }
00882 
00883                 include_once("classes/class.ilInfoScreenGUI.php");
00884                 $info = new ilInfoScreenGUI($this);
00885                 
00886                 $info->enablePrivateNotes();
00887                 
00888                 // standard meta data
00889                 $info->addMetaDataSections($this->object->getId(),0, $this->object->getType());
00890                 
00891                 // forward the command
00892                 $this->ctrl->forwardCommand($info);
00893         }
00894 
00895 
00896         function historyObject()
00897         {
00898                 global $rbacsystem;
00899 
00900                 if (!$rbacsystem->checkAccess("write", $_GET["ref_id"]))
00901                 {
00902                         $this->ilErr->raiseError($this->lng->txt("permission_denied"),$this->ilErr->MESSAGE);
00903                 }
00904 
00905                 include_once("classes/class.ilHistoryGUI.php");
00906                 
00907                 $hist_gui =& new ilHistoryGUI($this->object->getId());
00908                 
00909                 $hist_html = $hist_gui->getHistoryTable(array("ref_id" => $_GET["ref_id"], 
00910                                                                                                           "cmd" => "history",
00911                                                                                                           "cmdClass" =>$_GET["cmdClass"],
00912                                                                                                           "cmdNode" =>$_GET["cmdNode"]));
00913                 
00914                 $this->tpl->setVariable("ADM_CONTENT", $hist_html);
00915         }
00916 
00921         function saveObject()
00922         {
00923                 global $rbacadmin;
00924 
00925                 // create and insert forum in objecttree
00926                 $newObj = parent::saveObject();
00927 
00928                 // setup rolefolder & default local roles
00929                 //$roles = $newObj->initDefaultRoles();
00930 
00931                 // ...finally assign role to creator of object
00932                 //$rbacadmin->assignUser($roles[0], $newObj->getOwner(), "y");
00933 
00934                 // put here object specific stuff
00935 
00936                 // always send a message
00937                 //sendInfo($this->lng->txt("object_added"),true);
00938                 ilUtil::redirect("link/link_resources.php?ref_id=".$newObj->getRefId().
00939                         "&cmd=showAddItem");
00940                 
00941                 //ilUtil::redirect($this->getReturnLocation("save",'adm_object.php?ref_id='.$newObj->getRefId()));
00942         }
00943 
00944         
00945         function linkCheckerObject()
00946         {
00947                 global $ilias,$ilUser;
00948 
00949                 $this->__initLinkChecker();
00950                 $this->object->initLinkResourceItemsObject();
00951 
00952                 $invalid_links = $this->link_checker_obj->getInvalidLinksFromDB();
00953 
00954 
00955                 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.link_check.html",'link');
00956 
00957                 if($last_access = $this->link_checker_obj->getLastCheckTimestamp())
00958                 {
00959                         $this->tpl->setCurrentBlock("LAST_MODIFIED");
00960                         $this->tpl->setVariable("AS_OF",$this->lng->txt('last_change').": ");
00961                         $this->tpl->setVariable("LAST_CHECK",date('Y-m-d H:i:s',$last_access));
00962                         $this->tpl->parseCurrentBlock();
00963                 }
00964 
00965 
00966                 $this->tpl->setVariable("F_ACTION",$this->ctrl->getFormAction($this));
00967 
00968                 $this->tpl->setVariable("TYPE_IMG",ilUtil::getImagePath('icon_webr.gif'));
00969                 $this->tpl->setVariable("ALT_IMG",$this->lng->txt('obj_webr'));
00970                 $this->tpl->setVariable("TITLE",$this->object->getTitle().' ('.$this->lng->txt('link_check').')');
00971                 $this->tpl->setVariable("PAGE_TITLE",$this->lng->txt('title'));
00972                 $this->tpl->setVariable("URL",$this->lng->txt('url'));
00973                 $this->tpl->setVariable("OPTIONS",$this->lng->txt('edit'));
00974 
00975                 if(!count($invalid_links))
00976                 {
00977                         $this->tpl->setCurrentBlock("no_invalid");
00978                         $this->tpl->setVariable("TXT_NO_INVALID",$this->lng->txt('no_invalid_links'));
00979                         $this->tpl->parseCurrentBlock();
00980                 }
00981                 else
00982                 {
00983                         $counter = 0;
00984                         foreach($invalid_links as $invalid)
00985                         {
00986                                 $this->object->items_obj->readItem($invalid['page_id']);
00987 
00988                                 $this->tpl->setCurrentBlock("invalid_row");
00989                                 $this->tpl->setVariable("ROW_COLOR",ilUtil::switchColor(++$counter,'tblrow1','tblrow2'));
00990                                 $this->tpl->setVariable("ROW_PAGE_TITLE",$this->object->items_obj->getTitle());
00991                                 $this->tpl->setVariable("ROW_URL",$invalid['url']);
00992 
00993 
00994                                 // EDIT IMAGE
00995                                 $this->ctrl->setParameter($this,'item_id',$invalid['page_id']);
00996                                 $this->tpl->setVariable("ROW_EDIT_LINK",$this->ctrl->getLinkTarget($this,'editItem'));
00997                                 $this->tpl->setVariable("ROW_IMG",ilUtil::getImagePath('icon_pencil.gif'));
00998                                 $this->tpl->setVariable("ROW_ALT_IMG",$this->lng->txt('edit'));
00999                                 $this->tpl->parseCurrentBlock();
01000                         }
01001                 }
01002                 if((bool) $ilias->getSetting('cron_web_resource_check'))
01003                 {
01004                         include_once './classes/class.ilLinkCheckNotify.php';
01005 
01006                         // Show message block
01007                         $this->tpl->setCurrentBlock("MESSAGE_BLOCK");
01008                         $this->tpl->setVariable("INFO_MESSAGE",$this->lng->txt('link_check_message_a'));
01009                         $this->tpl->setVariable("CHECK_MESSAGE",ilUtil::formCheckbox(
01010                                                                                 ilLinkCheckNotify::_getNotifyStatus($ilUser->getId(),$this->object->getId()),
01011                                                                                 'link_check_message',
01012                                                                                 1));
01013                         $this->tpl->setVariable("INFO_MESSAGE_LONG",$this->lng->txt('link_check_message_b'));
01014                         $this->tpl->parseCurrentBlock();
01015 
01016                         // Show save button
01017                         $this->tpl->setCurrentBlock("CRON_ENABLED");
01018                         $this->tpl->setVariable("DOWNRIGHT_IMG",ilUtil::getImagePath('arrow_downright.gif'));
01019                         $this->tpl->setVariable("BTN_SUBMIT_LINK_CHECK",$this->lng->txt('save'));
01020                         $this->tpl->parseCurrentBlock();
01021                 }
01022                 $this->tpl->setVariable("BTN_REFRESH",$this->lng->txt('refresh'));
01023 
01024                 return true;
01025 
01026         }
01027         function saveLinkCheckObject()
01028         {
01029                 global $ilDB,$ilUser;
01030 
01031                 include_once './classes/class.ilLinkCheckNotify.php';
01032 
01033                 $link_check_notify =& new ilLinkCheckNotify($ilDB);
01034                 $link_check_notify->setUserId($ilUser->getId());
01035                 $link_check_notify->setObjId($this->object->getId());
01036 
01037                 if($_POST['link_check_message'])
01038                 {
01039                         sendInfo($this->lng->txt('link_check_message_enabled'));
01040                         $link_check_notify->addNotifier();
01041                 }
01042                 else
01043                 {
01044                         sendInfo($this->lng->txt('link_check_message_disabled'));
01045                         $link_check_notify->deleteNotifier();
01046                 }
01047                 $this->linkCheckerObject();
01048 
01049                 return true;
01050         }
01051                 
01052 
01053 
01054         function refreshLinkCheckObject()
01055         {
01056                 $this->__initLinkChecker();
01057 
01058                 if(!$this->link_checker_obj->checkPear())
01059                 {
01060                         sendInfo($this->lng->txt('missing_pear_library'));
01061                         $this->linkCheckerObject();
01062 
01063                         return false;
01064                 }
01065 
01066 
01067                 $this->object->initLinkResourceItemsObject();
01068 
01069                 // Set all link to valid. After check invalid links will be set to invalid
01070                 $this->object->items_obj->updateValidByCheck();
01071                 
01072                 foreach($this->link_checker_obj->checkWebResourceLinks() as $invalid)
01073                 {
01074                         $this->object->items_obj->readItem($invalid['page_id']);
01075                         $this->object->items_obj->setActiveStatus(false);
01076                         $this->object->items_obj->setValidStatus(false);
01077                         $this->object->items_obj->update(false);
01078                 }
01079                 
01080                 $this->object->items_obj->updateLastCheck();
01081                 sendInfo($this->lng->txt('link_checker_refreshed'));
01082 
01083                 $this->linkCheckerObject();
01084 
01085                 return true;
01086         }
01087 
01088         function __initLinkChecker()
01089         {
01090                 global $ilDB;
01091 
01092                 include_once './classes/class.ilLinkChecker.php';
01093 
01094                 $this->link_checker_obj =& new ilLinkChecker($ilDB,false);
01095                 $this->link_checker_obj->setObjId($this->object->getId());
01096 
01097                 return true;
01098         }
01104         function getTabs(&$tabs_gui)
01105         {
01106                 global $rbacsystem,$rbacreview;
01107                 
01108                 if ($rbacsystem->checkAccess('read',$this->object->getRefId()))
01109                 {
01110                         $tabs_gui->addTarget("view_content",
01111                                 $this->ctrl->getLinkTarget($this, "view"), "view", get_class($this));
01112                 }
01113 
01114                 if ($rbacsystem->checkAccess('write',$this->object->getRefId()))
01115                 {
01116                         $tabs_gui->addTarget("edit_content",
01117                                 $this->ctrl->getLinkTarget($this, "editItems"),
01118                                 array("editItems", "addItem", "deleteItems", "editItem", "updateItem"),
01119                                 "");
01120                 }
01121                 
01122                 if ($rbacsystem->checkAccess('visible',$this->ref_id))
01123                 {
01124                         // this is not nice. tabs should be displayed in ilcoursegui
01125                         // not via ilrepositorygui, then next_class == ilinfoscreengui
01126                         // could be checked
01127                         $force_active = (strtolower($_GET["cmdClass"]) == "ilinfoscreengui"
01128                                 || strtolower($_GET["cmdClass"]) == "ilnotegui")
01129                                 ? true
01130                                 : false;
01131                         $tabs_gui->addTarget("info_short",
01132                                                                  $this->ctrl->getLinkTargetByClass(
01133                                                                  array("ilobjlinkresourcegui", "ilinfoscreengui"), "showSummary"),
01134                                                                  "infoScreen",
01135                                                                  "", "", $force_active);
01136                 }
01137 
01138                 if ($rbacsystem->checkAccess('write',$this->object->getRefId()))
01139                 {
01140                         $tabs_gui->addTarget("meta_data",
01141                                  $this->ctrl->getLinkTargetByClass('ilmdeditorgui','listSection'),
01142                                  "", 'ilmdeditorgui');
01143                 }
01144 
01145                 if ($rbacsystem->checkAccess('write',$this->object->getRefId()))
01146                 {
01147                         $tabs_gui->addTarget("history",
01148                                 $this->ctrl->getLinkTarget($this, "history"), "history", get_class($this));
01149                 }
01150 
01151                 if ($rbacsystem->checkAccess('write',$this->object->getRefId()))
01152                 {
01153                         // Check if pear library is available
01154                         if(@include_once('HTTP/Request.php'))
01155                         {
01156                                 $tabs_gui->addTarget("link_check",
01157                                                                          $this->ctrl->getLinkTarget($this, "linkChecker"),
01158                                                                          array("linkChecker", "refreshLinkCheck"), get_class($this));
01159                         }
01160                 }
01161 
01162                 if ($rbacsystem->checkAccess('edit_permission',$this->object->getRefId()))
01163                 {
01164                         $tabs_gui->addTarget("perm_settings",
01165                                 $this->ctrl->getLinkTargetByClass(array(get_class($this),'ilpermissiongui'), "perm"), array("perm","info","owner"), 'ilpermissiongui');
01166                 }
01167         }
01168 
01169         // PRIVATE
01170         function __prepareOutput()
01171         {
01172                 // output objects
01173                 //$this->tpl->addBlockFile("CONTENT", "content", "tpl.link_resource.html",'link');
01174                 $this->tpl->addBlockFile("CONTENT", "content", "tpl.adm_content.html");
01175                 $this->tpl->addBlockFile("STATUSLINE", "statusline", "tpl.statusline.html");
01176 
01177                 // output locator
01178                 $this->__setLocator();
01179 
01180                 // output message
01181                 if ($this->message)
01182                 {
01183                         sendInfo($this->message);
01184                 }
01185 
01186                 // display infopanel if something happened
01187                 infoPanel();
01188 
01189                 // set header
01190                 $this->__setHeader();
01191         }
01192 
01193         function __setHeader()
01194         {
01195                 include_once './classes/class.ilTabsGUI.php';
01196 
01197                 $this->tpl->setCurrentBlock("header_image");
01198                 $this->tpl->setVariable("IMG_HEADER", ilUtil::getImagePath("icon_webr_b.gif"));
01199                 $this->tpl->parseCurrentBlock();
01200                 $this->tpl->setVariable("HEADER",$this->object->getTitle());
01201                 $this->tpl->setVariable("H_DESCRIPTION",$this->object->getDescription());
01202 
01203                 #$tabs_gui =& new ilTabsGUI();
01204                 $this->getTabs($this->tabs_gui);
01205 
01206                 // output tabs
01207                 #$this->tpl->setVariable("TABS", $tabs_gui->getHTML());
01208         }
01209 
01210         function __setLocator()
01211         {
01212                 global $tree;
01213                 global $ilias_locator;
01214 
01215                 $this->tpl->addBlockFile("LOCATOR", "locator", "tpl.locator.html");
01216 
01217                 $counter = 0;
01218                 foreach ($tree->getPathFull($this->object->getRefId()) as $key => $row)
01219                 {
01220                         if($counter++)
01221                         {
01222                                 $this->tpl->touchBlock('locator_separator_prefix');
01223                         }
01224 
01225                         $this->tpl->setCurrentBlock("locator_item");
01226 
01227                         if($row["type"] == 'webr')
01228                         {
01229                                 $this->tpl->setVariable("ITEM",$this->object->getTitle());
01230                                 $this->tpl->setVariable("LINK_ITEM",$this->ctrl->getLinkTarget($this));
01231                         }
01232                         elseif ($row["child"] != $tree->getRootId())
01233                         {
01234                                 $this->tpl->setVariable("ITEM", $row["title"]);
01235                                 $this->tpl->setVariable("LINK_ITEM","../repository.php?ref_id=".$row["child"]);
01236                         }
01237                         else
01238                         {
01239                                 $this->tpl->setVariable("ITEM", $this->lng->txt("repository"));
01240                                 $this->tpl->setVariable("LINK_ITEM","../repository.php?ref_id=".$row["child"]);
01241                         }
01242 
01243                         $this->tpl->parseCurrentBlock();
01244                 }
01245 
01246                 $this->tpl->setVariable("TXT_LOCATOR",$this->lng->txt("locator"));
01247                 $this->tpl->parseCurrentBlock();
01248         }
01249 
01250 
01251 } // END class.ilObjLinkResource
01252 ?>

Generated on Fri Dec 13 2013 11:57:58 for ILIAS Release_3_6_x_branch .rev 46809 by  doxygen 1.7.1