Beispiel #1
0
 /**
  * Creates a new preview GUI.
  * @param int $a_node_id The node id.
  * @param int $a_context The context of the preview.
  * @param int $a_obj_id The object id.
  * @param object $a_access_handler The access handler to use.
  */
 public function __construct($a_node_id = null, $a_context = self::CONTEXT_REPOSITORY, $a_obj_id = null, $a_access_handler = null)
 {
     global $ilCtrl, $lng, $ilAccess;
     // if we are the base class, get the id's from the query string
     if (strtolower($_GET["baseClass"]) == "ilpreviewgui") {
         $this->node_id = (int) $_GET["node_id"];
         $this->context = (int) $_GET["context"];
         $a_obj_id = (int) $_GET['obj_id'];
     } else {
         $this->node_id = $a_node_id;
         $this->context = $a_context;
     }
     // assign values
     $this->ctrl =& $ilCtrl;
     $this->lng =& $lng;
     // access handler NOT provided?
     if ($a_access_handler == null) {
         if ($this->context == self::CONTEXT_WORKSPACE) {
             include_once "./Services/PersonalWorkspace/classes/class.ilWorkspaceAccessHandler.php";
             $a_access_handler = new ilWorkspaceAccessHandler();
         } else {
             $a_access_handler = $ilAccess;
         }
     }
     $this->access_handler = $a_access_handler;
     // object id NOT provided?
     if ($a_obj_id == null) {
         if ($this->context == self::CONTEXT_WORKSPACE) {
             $a_obj_id = $this->access_handler->getTree()->lookupObjectId($this->node_id);
         } else {
             $a_obj_id = ilObject::_lookupObjId($this->node_id);
         }
     }
     $this->obj_id = $a_obj_id;
     // create preview object
     $this->preview = new ilPreview($this->obj_id);
     // if the call is NOT async initialize our stuff
     if (!$ilCtrl->isAsynch()) {
         ilPreviewGUI::initPreview();
     }
 }