/**
  * check wether learning module is online
  */
 function _lookupOnline($a_id)
 {
     global $ilDB;
     $set = $ilDB->queryF('SELECT * FROM sahs_lm WHERE id = %s', array('integer'), array($a_id));
     $rec = $ilDB->fetchAssoc($set);
     return ilUtil::yn2tf($rec["c_online"]);
 }
 /**
  * Fill table row
  */
 protected function fillRow($entry)
 {
     global $lng, $ilCtrl;
     $ilCtrl->setParameter($this->parent_obj, "menu_entry", $entry["id"]);
     $this->tpl->setCurrentBlock("cmd");
     $this->tpl->setVariable("HREF_CMD", $ilCtrl->getLinkTarget($this->parent_obj, "editMenuEntry"));
     $this->tpl->setVariable("CMD", $this->lng->txt("edit"));
     $this->tpl->parseCurrentBlock();
     $this->tpl->setCurrentBlock("cmd");
     $this->tpl->setVariable("HREF_CMD", $ilCtrl->getLinkTarget($this->parent_obj, "deleteMenuEntry"));
     $this->tpl->setVariable("CMD", $this->lng->txt("delete"));
     $this->tpl->parseCurrentBlock();
     $ilCtrl->setParameter($this, "menu_entry", "");
     $this->tpl->setVariable("LINK_ID", $entry["id"]);
     if ($entry["type"] == "intern") {
         $entry["link"] = ILIAS_HTTP_PATH . "/goto.php?target=" . $entry["link"];
     }
     // add http:// prefix if not exist
     if (!strstr($entry["link"], '://') && !strstr($entry["link"], 'mailto:')) {
         $entry["link"] = "http://" . $entry["link"];
     }
     $this->tpl->setVariable("HREF_LINK", $entry["link"]);
     $this->tpl->setVariable("LINK", $entry["title"]);
     if (ilUtil::yn2tf($entry["active"])) {
         $this->tpl->setVariable("ACTIVE_CHECK", "checked=\"checked\"");
     }
 }
 /**
  * check wether learning module is online
  */
 function _lookupOnline($a_id)
 {
     global $ilDB;
     $q = "SELECT * FROM glossary WHERE id = " . $ilDB->quote($a_id, "integer");
     $lm_set = $ilDB->query($q);
     $lm_rec = $ilDB->fetchAssoc($lm_set);
     return ilUtil::yn2tf($lm_rec["is_online"]);
 }
 /**
  * check wether learning module is online
  */
 function _lookupOfflineModeAvailable($a_id)
 {
     global $ilDB;
     $set = $ilDB->queryF('SELECT offline_mode FROM sahs_lm WHERE id = %s', array('integer'), array($a_id));
     $rec = $ilDB->fetchAssoc($set);
     return ilUtil::yn2tf($rec["offline_mode"]);
 }
 /**
  * save properties
  */
 function saveProperties()
 {
     $this->object->setOnline(ilUtil::yn2tf($_POST["cobj_online"]));
     $this->object->setOpenMode($_POST["open_mode"]);
     $this->object->setWidth($_POST["width"]);
     $this->object->setHeight($_POST["height"]);
     $this->object->setAutoReview(ilUtil::yn2tf($_POST["auto_review"]));
     $this->object->setAPIAdapterName($_POST["api_adapter"]);
     $this->object->setAPIFunctionsPrefix($_POST["api_func_prefix"]);
     $this->object->setCreditMode($_POST["credit_mode"]);
     $this->object->setDefaultLessonMode($_POST["lesson_mode"]);
     $this->object->setMaxAttempt($_POST["max_attempt"]);
     $this->object->setSession(ilUtil::yn2tf($_POST["cobj_session"]));
     $this->object->setDebug(ilUtil::yn2tf($_POST["cobj_debug"]));
     $this->object->setAutoContinue(ilUtil::yn2tf($_POST["auto_continue"]));
     $this->object->setAuto_last_visited(ilUtil::yn2tf($_POST["cobj_auto_last_visited"]));
     $this->object->setCheck_values(ilUtil::yn2tf($_POST["cobj_check_values"]));
     $this->object->update();
     ilUtil::sendInfo($this->lng->txt("msg_obj_modified"), true);
     $this->ctrl->redirect($this, "properties");
 }
 /**
  * Save properties form
  */
 public function saveProperties()
 {
     global $tpl, $ilAccess, $ilTabs;
     $this->initSettingsForm("");
     if ($this->form->checkInput()) {
         $this->object->setTitle($this->form->getInput("title"));
         $this->object->setDescription($this->form->getInput("desc"));
         $this->object->setOnline(ilUtil::yn2tf($_POST["cobj_online"]));
         $this->object->setShowBibliographicalData($this->form->getInput("bib"));
         $lic = $this->form->getItemByPostVar("lic");
         if ($lic && !$lic->getDisabled()) {
             $this->object->setShowLicense($this->form->getInput("lic"));
         }
         $this->object->update();
         ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
         $this->ctrl->redirect($this, "properties");
     }
     $ilTabs->activateTab("id_settings");
     $this->form->setValuesByPost();
     $tpl->setContent($this->form->getHtml());
 }
 function updateSequencingSettings()
 {
     include_once "./Modules/Scorm2004/classes/seq_editor/class.ilSCORM2004Sequencing.php";
     $control_settings = new ilSCORM2004Sequencing($this->getId(), true);
     $control_settings->setChoice(ilUtil::yn2tf($_POST["choice"]));
     $control_settings->setFlow(ilUtil::yn2tf($_POST["flow"]));
     $control_settings->setForwardOnly(ilUtil::yn2tf($_POST["forwardonly"]));
     $control_settings->insert();
     return true;
 }
 function sop2il()
 {
     //		sleep(5);
     global $ilDB, $ilUser;
     $in = file_get_contents("php://input");
     $GLOBALS['ilLog']->write($in);
     $ret = array('msg' => array(), 'err' => array());
     if (!$in || $in == "") {
         $ret['err'][] = "no post data recieved";
         print json_encode($ret);
         exit;
     }
     $userId = $ilUser->getID();
     $result = true;
     if ($this->type == 'scorm2004') {
         $lm_set = $ilDB->queryF('SELECT default_lesson_mode, interactions, objectives, comments FROM sahs_lm WHERE id = %s', array('integer'), array($this->obj_id));
         while ($lm_rec = $ilDB->fetchAssoc($lm_set)) {
             $defaultLessonMode = $lm_rec["default_lesson_mode"];
             $interactions = ilUtil::yn2tf($lm_rec["interactions"]);
             $objectives = ilUtil::yn2tf($lm_rec["objectives"]);
             $comments = ilUtil::yn2tf($lm_rec["comments"]);
         }
         include_once './Modules/Scorm2004/classes/class.ilSCORM2004StoreData.php';
         $data = json_decode($in);
         $GLOBALS['ilLog']->write('cmi_count=' . count($data->cmi));
         for ($i = 0; $i < count($data->cmi); $i++) {
             if ($result == true) {
                 //$a_r=array();
                 $cdata = $data->cmi[$i];
                 $a_r = ilSCORM2004StoreData::setCMIData($userId, $this->obj_id, $data->cmi[$i], $comments, $interactions, $objectives);
                 if (!is_array($a_r)) {
                     $result = false;
                 }
             }
         }
         if ($result == true) {
             $result = ilSCORM2004StoreData::syncGlobalStatus($userId, $this->obj_id, $data, $data->now_global_status);
         }
     } else {
         include_once "./Modules/ScormAicc/classes/SCORM/class.ilObjSCORMTracking.php";
         $data = json_decode($in);
         $result = ilObjSCORMTracking::storeJsApiCmi($userId, $this->obj_id, $data);
         if ($result == true) {
             $result = ilObjSCORMTracking::syncGlobalStatus($userId, $this->obj_id, $data, $data->now_global_status);
         }
     }
     if ($result == true) {
         $result = self::scormPlayerUnloadForSOP2il($data);
     }
     if ($result == false) {
         $ret['err'][] = "invalid post data recieved";
     } else {
         $ret['msg'][] = "post data recieved";
     }
     header('Content-Type: text/plain; charset=UTF-8');
     print json_encode($ret);
 }
Example #9
0
 /**
  * @todo refactor rolf => search calls
  * @global ilDB $ilDB
  * @param type $a_ref_id
  * @param type $a_role_id
  * @return type
  * @todo refactor rolf => DONE
  */
 public function isProtected($a_ref_id, $a_role_id)
 {
     global $ilDB;
     $query = "SELECT protected FROM rbac_fa " . "WHERE rol_id = " . $ilDB->quote($a_role_id, 'integer') . " " . "AND parent = " . $ilDB->quote($a_ref_id, 'integer') . " ";
     $res = $ilDB->query($query);
     $row = $ilDB->fetchAssoc($res);
     return ilUtil::yn2tf($row['protected']);
 }
 /**
  * save properties
  */
 function saveProperties()
 {
     global $tpl;
     $this->initSettingsForm();
     if ($this->form->checkInput()) {
         $this->object->setOnline(ilUtil::yn2tf($_POST["cobj_online"]));
         $this->object->setVirtualMode($_POST["glo_mode"]);
         //			$this->object->setActiveGlossaryMenu(ilUtil::yn2tf($_POST["glo_act_menu"]));
         $this->object->setActiveDownloads(ilUtil::yn2tf($_POST["glo_act_downloads"]));
         $this->object->setPresentationMode($_POST["pres_mode"]);
         $this->object->setSnippetLength($_POST["snippet_length"]);
         $this->object->setShowTaxonomy($_POST["show_tax"]);
         $this->object->update();
         // set definition short texts dirty
         include_once "./Modules/Glossary/classes/class.ilGlossaryDefinition.php";
         ilGlossaryDefinition::setShortTextsDirty($this->object->getId());
         // Update ecs export settings
         include_once 'Modules/Glossary/classes/class.ilECSGlossarySettings.php';
         $ecs = new ilECSGlossarySettings($this->object);
         if ($ecs->handleSettingsUpdate()) {
             ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
             $this->ctrl->redirect($this, "properties");
         }
     }
     $this->form->setValuesByPost();
     $tpl->setContent($this->form->getHTML());
 }
 /**
  * save scorm 2004 module properties
  */
 function saveProperties()
 {
     global $ilSetting;
     if ($this->object->editable != 1) {
         //check if OfflineMode-Zip has to be created
         $tmpOfflineMode = ilUtil::yn2tf($_POST["cobj_offline_mode"]);
         $tmpSequencing = ilUtil::yn2tf($_POST["cobj_sequencing"]);
         if ($tmpOfflineMode == true) {
             $tmpSequencing = false;
             //actually no sequencing for offline_mode
             if ($this->object->getOfflineMode() == false) {
                 $this->object->zipLmForOfflineMode();
             }
         }
         $this->object->setOnline(ilUtil::yn2tf($_POST["cobj_online"]));
         $this->object->setOpenMode($_POST["open_mode"]);
         $this->object->setWidth($_POST["width"]);
         $this->object->setHeight($_POST["height"]);
         $this->object->setCreditMode($_POST["credit_mode"]);
         $this->object->setMaxAttempt($_POST["max_attempt"]);
         $this->object->setAutoReviewChar($_POST["auto_review"]);
         $this->object->setDefaultLessonMode($_POST["lesson_mode"]);
         $this->object->setSession(ilUtil::yn2tf($_POST["cobj_session"]));
         $this->object->setNoMenu(ilUtil::yn2tf($_POST["cobj_nomenu"]));
         $this->object->setHideNavig(ilUtil::yn2tf($_POST["cobj_hidenavig"]));
         $this->object->setAuto_last_visited(ilUtil::yn2tf($_POST["cobj_auto_last_visited"]));
         $this->object->setSequencing($tmpSequencing);
         $this->object->setInteractions(ilUtil::yn2tf($_POST["cobj_interactions"]));
         $this->object->setObjectives(ilUtil::yn2tf($_POST["cobj_objectives"]));
         $this->object->setComments(ilUtil::yn2tf($_POST["cobj_comments"]));
         $this->object->setTime_from_lms(ilUtil::yn2tf($_POST["cobj_time_from_lms"]));
         $this->object->setCheck_values(ilUtil::yn2tf($_POST["cobj_check_values"]));
         $this->object->setAutoSuspend(ilUtil::yn2tf($_POST["cobj_auto_suspend"]));
         $this->object->setOfflineMode($tmpOfflineMode);
         $this->object->setDebug(ilUtil::yn2tf($_POST["cobj_debug"]));
         //$this->object->setDebugPw($_POST["debug_pw"]);
     } else {
         $this->initPropertiesEditableForm();
         if ($this->form->checkInput()) {
             $this->object->setTries($_POST["q_tries"]);
             $this->object->setLocalization($_POST["localization"]);
             if ($ilSetting->get("fixed_content_style_id") <= 0 && (ilObjStyleSheet::_lookupStandard($this->object->getStyleSheetId()) || $this->object->getStyleSheetId() == 0)) {
                 $this->object->setStyleSheetId(ilUtil::stripSlashes($_POST["style_id"]));
             }
         }
     }
     $this->object->update();
     ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
     $this->ctrl->redirect($this, "properties");
 }
 public function persistCMIData()
 {
     global $ilLog, $ilDB, $ilUser;
     $packageId = (int) $_GET['package_id'];
     $lm_set = $ilDB->queryF('SELECT default_lesson_mode, interactions, objectives, comments FROM sahs_lm WHERE id = %s', array('integer'), array($packageId));
     while ($lm_rec = $ilDB->fetchAssoc($lm_set)) {
         $defaultLessonMode = $lm_rec["default_lesson_mode"];
         $interactions = ilUtil::yn2tf($lm_rec["interactions"]);
         $objectives = ilUtil::yn2tf($lm_rec["objectives"]);
         $comments = ilUtil::yn2tf($lm_rec["comments"]);
     }
     $data = file_get_contents('php://input');
     $ilUser->setId($data->p);
     include_once './Modules/Scorm2004/classes/class.ilSCORM2004StoreData.php';
     ilSCORM2004StoreData::persistCMIData(null, $packageId, $defaultLessonMode, $comments, $interactions, $objectives, $data);
 }
    function _isActivated($a_course_obj_id)
    {
        global $ilDB, $ilias;
        if (!$ilias->getSetting("ilinc_active")) {
            return false;
        }
        $r = $ilDB->queryf('
			SELECT activation_offline FROM ilinc_data WHERE obj_id = %s', array('integer'), array($a_course_obj_id));
        $row = $r->fetchRow(DB_FETCHMODE_OBJECT);
        return ilUtil::yn2tf($row->activation_offline);
    }
 /**
  * Preload data
  *
  * @param array $a_obj_ids array of object ids
  */
 function _preloadData($a_obj_ids, $a_ref_ids)
 {
     global $ilDB, $ilUser;
     $q = "SELECT id, is_online, startfile FROM file_based_lm WHERE " . $ilDB->in("id", $a_obj_ids, false, "integer");
     $lm_set = $ilDB->query($q);
     while ($rec = $ilDB->fetchAssoc($lm_set)) {
         self::$online[$rec["id"]] = ilUtil::yn2tf($rec["is_online"]);
         self::$startfile[$rec["id"]] = $rec["startfile"] . "";
     }
 }
Example #15
0
 /**
  * @todo refactor rolf => search calls
  * @global ilDB $ilDB
  * @param type $a_ref_id
  * @param type $a_role_id
  * @return type
  * @todo refactor rolf => DONE
  */
 public function isProtected($a_ref_id, $a_role_id)
 {
     global $ilDB;
     // ref_id not used yet. protected permission acts 'global' for each role,
     $query = "SELECT protected FROM rbac_fa " . "WHERE rol_id = " . $ilDB->quote($a_role_id, 'integer') . " ";
     $res = $ilDB->query($query);
     $row = $ilDB->fetchAssoc($res);
     return ilUtil::yn2tf($row['protected']);
 }
 /**
  * check wether content object is online
  */
 function _lookupOnline($a_id)
 {
     global $ilDB;
     //echo "class ilObjContentObject::_lookupOnline($a_id) called. Use Access class instead.";
     $q = "SELECT is_online FROM content_object WHERE id = " . $ilDB->quote($a_id, "integer");
     $lm_set = $ilDB->query($q);
     $lm_rec = $ilDB->fetchAssoc($lm_set);
     return ilUtil::yn2tf($lm_rec["is_online"]);
 }
 /**
  * Preload data
  *
  * @param array $a_obj_ids array of object ids
  */
 function _preloadData($a_obj_ids, $a_ref_ids)
 {
     global $ilDB, $ilUser;
     $q = "SELECT id, is_online FROM content_object WHERE " . $ilDB->in("id", $a_obj_ids, false, "integer");
     $lm_set = $ilDB->query($q);
     while ($rec = $ilDB->fetchAssoc($lm_set)) {
         self::$online[$rec["id"]] = ilUtil::yn2tf($rec["is_online"]);
     }
     $q = "SELECT obj_id, lm_id FROM lo_access WHERE " . "usr_id = " . $ilDB->quote($ilUser->getId(), "integer") . " AND " . $ilDB->in("lm_id", $a_ref_ids, false, "integer");
     $set = $ilDB->query($q);
     foreach ($a_ref_ids as $r) {
         self::$lo_access[$r] = 0;
     }
     while ($rec = $ilDB->fetchAssoc($set)) {
         self::$lo_access[$rec["lm_id"]] = $rec["obj_id"];
     }
 }
 /**
  * get auto review as true/false for SCORM 1.2, HACP, SAHS, AICC
  */
 function getAutoReview()
 {
     return ilUtil::yn2tf($this->auto_review);
 }
    /**
     * Synch read event table
     *
     * @param
     * @return
     */
    function _syncReadEvent($a_obj_id, $a_user_id, $a_type, $a_ref_id, $time_from_lms = null)
    {
        global $ilDB;
        //get condition to select time
        $val_set = $ilDB->queryF('SELECT time_from_lms FROM sahs_lm WHERE id = %s', array('integer'), array($a_obj_id));
        $val_rec = $ilDB->fetchAssoc($val_set);
        $time_from_lms = ilUtil::yn2tf($val_rec["time_from_lms"]);
        // get attempts and time
        $val_set = $ilDB->queryF('
			SELECT package_attempts, sco_total_time_sec, total_time_sec 
			FROM sahs_user WHERE obj_id = %s AND user_id = %s', array('integer', 'integer'), array($a_obj_id, $a_user_id));
        $val_rec = $ilDB->fetchAssoc($val_set);
        if ($time_from_lms == false) {
            $time = $val_rec["sco_total_time_sec"];
        } else {
            $time = $val_rec["total_time_sec"];
        }
        $attempts = $val_rec["package_attempts"];
        if ($attempts == null) {
            $attempts = "";
        }
        //??
        if ($attempts != "" && $time == null) {
            //use old way
            $time = self::getSumTotalTimeSecondsFromScos($a_obj_id, $a_user_id, true);
        }
        include_once "./Services/Tracking/classes/class.ilChangeEvent.php";
        ilChangeEvent::_recordReadEvent($a_type, $a_ref_id, $a_obj_id, $a_user_id, false, $attempts, $time);
    }
 /**
  * Save properties form
  */
 public function saveProperties()
 {
     global $tpl, $lng, $ilCtrl, $ilTabs;
     $this->initSettingsForm("");
     if ($this->form->checkInput()) {
         $this->object->setTitle($this->form->getInput("title"));
         $this->object->setDescription($this->form->getInput("desc"));
         $this->object->setOnline(ilUtil::yn2tf($_POST["cobj_online"]));
         $this->object->update();
         ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
         $this->ctrl->redirect($this, "properties");
     }
     $ilTabs->activateTab("id_settings");
     $this->form->setValuesByPost();
     $tpl->setContent($this->form->getHtml());
 }
Example #21
0
 /**
  * save properties
  */
 function saveProperties()
 {
     global $tpl;
     $this->initSettingsForm();
     if ($this->form->checkInput()) {
         $this->object->setTitle($_POST['title']);
         $this->object->setDescription($_POST['description']);
         $this->object->setOnline(ilUtil::yn2tf($_POST["cobj_online"]));
         $this->object->setVirtualMode($_POST["glo_mode"]);
         //			$this->object->setActiveGlossaryMenu(ilUtil::yn2tf($_POST["glo_act_menu"]));
         $this->object->setActiveDownloads(ilUtil::yn2tf($_POST["glo_act_downloads"]));
         $this->object->setPresentationMode($_POST["pres_mode"]);
         $this->object->setSnippetLength($_POST["snippet_length"]);
         $this->object->setShowTaxonomy($_POST["show_tax"]);
         $this->object->update();
         // field order of advanced metadata
         include_once "./Modules/Glossary/classes/class.ilGlossaryAdvMetaDataAdapter.php";
         $adv_ap = new ilGlossaryAdvMetaDataAdapter($this->object->getId());
         $cols = $adv_ap->getColumnOrder();
         if (count($cols) > 1) {
             $adv_ap->saveColumnOrder($_POST["field_order"]);
         }
         // set definition short texts dirty
         include_once "./Modules/Glossary/classes/class.ilGlossaryDefinition.php";
         ilGlossaryDefinition::setShortTextsDirty($this->object->getId());
         // update metadata record selection
         include_once 'Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordGUI.php';
         $record_gui = new ilAdvancedMDRecordGUI(ilAdvancedMDRecordGUI::MODE_REC_SELECTION, 'glo', $this->object->getId(), "term");
         $record_gui->saveSelection();
         // Update ecs export settings
         include_once 'Modules/Glossary/classes/class.ilECSGlossarySettings.php';
         $ecs = new ilECSGlossarySettings($this->object);
         if ($ecs->handleSettingsUpdate()) {
             ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
             $this->ctrl->redirect($this, "properties");
         }
     }
     $this->form->setValuesByPost();
     $tpl->setContent($this->form->getHTML());
 }
Example #22
0
/* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
/**
 * for storing Data also without session
 * @author Uwe Kohnle <*****@*****.**>
 * @version $Id$
 */
include_once "Services/Context/classes/class.ilContext.php";
ilContext::init(ilContext::CONTEXT_SCORM);
require_once "Services/Init/classes/class.ilInitialisation.php";
ilInitialisation::initILIAS();
include_once 'Modules/Scorm2004/classes/class.ilSCORM2004StoreData.php';
if ((string) $_GET['do'] == "unload") {
    include_once 'Modules/Scorm2004/classes/class.ilSCORM2004StoreData.php';
    ilSCORM2004StoreData::scormPlayerUnload(null, (int) $_GET['package_id']);
} else {
    global $ilLog, $ilDB, $ilUser;
    $packageId = (int) $_GET['package_id'];
    $lm_set = $ilDB->queryF('SELECT default_lesson_mode, interactions, objectives, comments FROM sahs_lm WHERE id = %s', array('integer'), array($packageId));
    while ($lm_rec = $ilDB->fetchAssoc($lm_set)) {
        $defaultLessonMode = $lm_rec["default_lesson_mode"];
        $interactions = ilUtil::yn2tf($lm_rec["interactions"]);
        $objectives = ilUtil::yn2tf($lm_rec["objectives"]);
        $comments = ilUtil::yn2tf($lm_rec["comments"]);
    }
    $data = file_get_contents('php://input');
    $ilUser->setId($data->p);
    //until now only 2004
    include_once 'Modules/Scorm2004/classes/class.ilSCORM2004StoreData.php';
    ilSCORM2004StoreData::persistCMIData(null, $packageId, $defaultLessonMode, $comments, $interactions, $objectives, $data);
}
 /**
  * handler for begin of element
  *
  * @param	resource	$a_xml_parser		xml parser
  * @param	string		$a_name				element name
  * @param	array		$a_attribs			element attributes array
  */
 function handlerBeginTag($a_xml_parser, $a_name, $a_attribs)
 {
     //echo "<b>BEGIN TAG: $a_name <br></b>"; flush();
     switch ($a_name) {
         case "ContentObject":
             $this->current_object =& $this->content_object;
             //echo "<br>Parser:CObjType:".$a_attribs["Type"];
             if ($a_attribs["Type"] == "Glossary") {
                 $this->glossary_object =& $this->content_object;
             }
             break;
         case "StructureObject":
             //echo "<br><br>StructureOB-SET-".count($this->structure_objects)."<br>";
             $this->structure_objects[count($this->structure_objects)] =& new ilStructureObject($this->content_object);
             $this->current_object =& $this->structure_objects[count($this->structure_objects) - 1];
             $this->current_object->setLMId($this->content_object->getId());
             // new meta data handling: we create the structure
             // object already here, this should also create a
             // md entry
             $this->current_object->create(true);
             break;
         case "PageObject":
             $this->in_page_object = true;
             $this->cur_qid = "";
             if ($this->coType != "tst" and $this->coType != "qpl") {
                 $this->lm_page_object =& new ilLMPageObject($this->content_object);
                 $this->page_object =& new ilPageObject($this->content_object->getType());
                 $this->lm_page_object->setLMId($this->content_object->getId());
                 $this->lm_page_object->assignPageObject($this->page_object);
                 $this->current_object =& $this->lm_page_object;
             } else {
                 $this->page_object =& new ilPageObject("qpl");
             }
             break;
         case "PageAlias":
             if ($this->coType != "tst" and $this->coType != "qpl") {
                 $this->lm_page_object->setAlias(true);
                 $this->lm_page_object->setOriginID($a_attribs["OriginId"]);
             }
             break;
         case "MediaObject":
             $this->in_media_object = true;
             $this->media_meta_start = true;
             $this->media_meta_cache = array();
             $this->media_object =& new ilObjMediaObject();
             break;
         case "MediaAlias":
             //echo "<br>---NEW MEDIAALIAS---<br>";
             $this->media_object->setAlias(true);
             $this->media_object->setImportId($a_attribs["OriginId"]);
             if (is_object($this->page_object)) {
                 $this->page_object->needsImportParsing(true);
             }
             break;
         case "MediaItem":
         case "MediaAliasItem":
             $this->in_media_item = true;
             $this->media_item =& new ilMediaItem();
             $this->media_item->setPurpose($a_attribs["Purpose"]);
             /*if ($a_name == "MediaItem")
             		{
             			$this->media_item->setHighlightMode($a_attribs["MapHighlightMode"]);
             			$this->media_item->setHighlightClass($a_attribs["MapHighlightClass"]);
             		}*/
             break;
         case "Layout":
             if (is_object($this->media_object) && $this->in_media_object) {
                 $this->media_item->setWidth($a_attribs["Width"]);
                 $this->media_item->setHeight($a_attribs["Height"]);
                 $this->media_item->setHAlign($a_attribs["HorizontalAlign"]);
             }
             break;
         case "Parameter":
             if (is_object($this->media_object) && $this->in_media_object) {
                 $this->media_item->setParameter($a_attribs["Name"], $a_attribs["Value"]);
             }
             break;
         case "MapArea":
             $this->in_map_area = true;
             $this->map_area =& new ilMapArea();
             $this->map_area->setShape($a_attribs["Shape"]);
             $this->map_area->setCoords($a_attribs["Coords"]);
             $this->map_area->setHighlightMode($a_attribs["HighlightMode"]);
             $this->map_area->setHighlightClass($a_attribs["HighlightClass"]);
             break;
         case "Glossary":
             $this->in_glossary = true;
             if ($this->content_object->getType() != "glo") {
                 $this->glossary_object =& new ilObjGlossary();
                 $this->glossary_object->setTitle("");
                 $this->glossary_object->setDescription("");
                 $this->glossary_object->create(true);
                 $this->glossary_object->createReference();
                 $parent =& $this->tree->getParentNodeData($this->content_object->getRefId());
                 $this->glossary_object->putInTree($parent["child"]);
                 $this->glossary_object->setPermissions($parent["child"]);
                 $this->glossary_object->notify("new", $_GET["ref_id"], $_GET["parent_non_rbac_id"], $_GET["ref_id"], $this->glossary_object->getRefId());
             }
             $this->current_object =& $this->glossary_object;
             break;
         case "GlossaryItem":
             $this->glossary_term =& new ilGlossaryTerm();
             $this->glossary_term->setGlossaryId($this->glossary_object->getId());
             $this->glossary_term->setLanguage($a_attribs["Language"]);
             $this->glossary_term->setImportId($a_attribs["Id"]);
             $this->link_targets[$a_attribs["Id"]] = $a_attribs["Id"];
             break;
         case "Definition":
             $this->in_glossary_definition = true;
             $this->glossary_definition =& new ilGlossaryDefinition();
             $this->page_object =& new ilPageObject("gdf");
             $this->page_object->setParentId($this->glossary_term->getGlossaryId());
             $this->glossary_definition->setTermId($this->glossary_term->getId());
             $this->glossary_definition->assignPageObject($this->page_object);
             $this->current_object =& $this->glossary_definition;
             $this->glossary_definition->create(true);
             break;
         case "FileItem":
             $this->in_file_item = true;
             $this->file_item =& new ilObjFile();
             $this->file_item->setTitle("dummy");
             $this->file_item->setMode("filelist");
             if (is_object($this->page_object)) {
                 $this->page_object->needsImportParsing(true);
             }
             break;
         case "Paragraph":
             if ($a_attribs["Characteristic"] == "Code") {
                 $this->inside_code = true;
             }
             break;
         case "Properties":
             $this->in_properties = true;
             break;
         case "Property":
             if ($this->content_object->getType() == "lm" || $this->content_object->getType() == "dbk") {
                 switch ($a_attribs["Name"]) {
                     case "Layout":
                         $this->content_object->setLayout($a_attribs["Value"]);
                         break;
                     case "PageHeader":
                         $this->content_object->setPageHeader($a_attribs["Value"]);
                         break;
                     case "TOCMode":
                         $this->content_object->setTOCMode($a_attribs["Value"]);
                         break;
                     case "ActiveLMMenu":
                         $this->content_object->setActiveLMMenu(ilUtil::yn2tf($a_attribs["Value"]));
                         break;
                     case "ActiveNumbering":
                         $this->content_object->setActiveNumbering(ilUtil::yn2tf($a_attribs["Value"]));
                         break;
                     case "ActiveTOC":
                         $this->content_object->setActiveTOC(ilUtil::yn2tf($a_attribs["Value"]));
                         break;
                     case "ActivePrintView":
                         $this->content_object->setActivePrintView(ilUtil::yn2tf($a_attribs["Value"]));
                         break;
                     case "CleanFrames":
                         $this->content_object->setCleanFrames(ilUtil::yn2tf($a_attribs["Value"]));
                         break;
                     case "PublicNotes":
                         $this->content_object->setPublicNotes(ilUtil::yn2tf($a_attribs["Value"]));
                         break;
                     case "HistoryUserComments":
                         $this->content_object->setHistoryUserComments(ilUtil::yn2tf($a_attribs["Value"]));
                         break;
                     case "HeaderPage":
                         if ($a_attribs["Value"] != "") {
                             if ($this->pg_mapping[$a_attribs["Value"]] > 0) {
                                 $this->content_object->setHeaderPage($this->pg_mapping[$a_attribs["Value"]]);
                             }
                         }
                         break;
                     case "FooterPage":
                         if ($a_attribs["Value"] != "") {
                             if ($this->pg_mapping[$a_attribs["Value"]] > 0) {
                                 $this->content_object->setFooterPage($this->pg_mapping[$a_attribs["Value"]]);
                             }
                         }
                         break;
                 }
                 //echo "<br>+".$a_attribs["Name"]."+";
             }
             break;
             ////////////////////////////////////////////////
             /// Meta Data Section
             ////////////////////////////////////////////////
         ////////////////////////////////////////////////
         /// Meta Data Section
         ////////////////////////////////////////////////
         case "MetaData":
             $this->in_meta_data = true;
             //echo "<br>begin meta data section -".$this->current_object->getType()."-";
             // media obejct meta data handling
             // is done in the "Identifier" begin tag processing
             // the rest is done here
             if (!$this->in_media_object) {
                 if ($this->coType != "tst" and $this->coType != "qpl") {
                     // type pg/st
                     if ($this->current_object->getType() == "st" || $this->current_object->getType() == "pg") {
                         // late creation of page object
                         if ($this->current_object->getType() == "pg") {
                             $this->lm_page_object->create(true);
                         }
                         $this->md =& new ilMD($this->content_object->getId(), $this->current_object->getId(), $this->current_object->getType());
                     } else {
                         if ($this->current_object->getType() == "gdf") {
                             $this->md =& new ilMD($this->glossary_object->getId(), $this->current_object->getId(), $this->current_object->getType());
                         } else {
                             if ($this->processMeta()) {
                                 $this->md =& new ilMD($this->current_object->getId(), 0, $this->current_object->getType());
                             }
                         }
                     }
                 } else {
                     // type qpl or tst
                     $this->md =& new ilMD($this->content_object->getId(), 0, $this->current_object->getType());
                     if ($this->md->getGeneral() != false) {
                         $this->metadata_parsing_disabled = true;
                         $this->enableMDParsing(false);
                     }
                 }
             }
             break;
             // Identifier
         // Identifier
         case "Identifier":
             // please note: Meta-Metadata and MetaData are different tags!
             if (!$this->in_meta_meta_data) {
                 if ($this->in_meta_data && !$this->in_glossary_definition) {
                     if (!$this->in_media_object) {
                         $this->current_object->setImportId($a_attribs["Entry"]);
                     }
                     $this->link_targets[$a_attribs["Entry"]] = $a_attribs["Entry"];
                 }
                 if ($this->in_file_item) {
                     if ($this->file_item_mapping[$a_attribs["Entry"]] == "") {
                         $this->file_item->create();
                         $this->file_item->setImportId($a_attribs["Entry"]);
                         $this->file_item_mapping[$a_attribs["Entry"]] = $this->file_item->getId();
                     }
                 }
                 if ($this->in_meta_data && $this->in_media_object) {
                     //echo "looking for -".$a_attribs["Entry"]."-<br>";
                     $mob_id = $this->mob_mapping[$a_attribs["Entry"]];
                     // within learning module import, usually a media object
                     // has already been created with a media alias tag
                     if ($mob_id > 0) {
                         $this->media_object = new ilObjMediaObject($mob_id);
                     } else {
                         $this->media_object = new ilObjMediaObject();
                         $this->media_object->create(true, false);
                         $this->mob_mapping[$a_attribs["Entry"]] = $this->media_object->getId();
                     }
                     $this->media_object->setImportId($a_attribs["Entry"]);
                     $this->md =& new ilMD(0, $this->media_object->getId(), "mob");
                     $this->emptyMediaMetaCache($a_xml_parser);
                 }
             }
             break;
         case "Meta-Metadata":
             $this->in_meta_meta_data = true;
             break;
             // Internal Link
         // Internal Link
         case "IntLink":
             if (is_object($this->page_object)) {
                 $this->page_object->setContainsIntLink(true);
             }
             if ($this->in_map_area) {
                 //echo "intlink:maparea:<br>";
                 $this->map_area->setLinkType(IL_INT_LINK);
                 $this->map_area->setTarget($a_attribs["Target"]);
                 $this->map_area->setType($a_attribs["Type"]);
                 $this->map_area->setTargetFrame($a_attribs["TargetFrame"]);
                 if (is_object($this->media_object)) {
                     //echo ":setContainsLink:<br>";
                     $this->media_object->setContainsIntLink(true);
                 }
             }
             break;
             // External Link
         // External Link
         case "ExtLink":
             if ($this->in_map_area) {
                 $this->map_area->setLinkType(IL_EXT_LINK);
                 $this->map_area->setHref($a_attribs["Href"]);
                 $this->map_area->setExtTitle($a_attribs["Title"]);
             }
             break;
             // Question
         // Question
         case "Question":
             $this->cur_qid = $a_attribs["QRef"];
             $this->page_object->setContainsQuestion(true);
             break;
         case "Location":
             $this->loc_type = $a_attribs["Type"];
             break;
         case "Bibliography":
             $this->in_bib_item = true;
             //echo "<br>---NEW BIBLIOGRAPHY---<br>";
             $this->bib_item =& new ilBibItem();
             break;
     }
     $this->beginElement($a_name);
     // append content to page xml content
     if (($this->in_page_object || $this->in_glossary_definition) && !$this->in_meta_data && !$this->in_media_object) {
         if ($a_name == "Definition") {
             $app_name = "PageObject";
             $app_attribs = array();
         } else {
             $app_name = $a_name;
             $app_attribs = $a_attribs;
         }
         // change identifier entry of file items to new local file id
         if ($this->in_file_item && $app_name == "Identifier") {
             $app_attribs["Entry"] = "il__file_" . $this->file_item_mapping[$a_attribs["Entry"]];
             //$app_attribs["Entry"] = "il__file_".$this->file_item->getId();
         }
         $this->page_object->appendXMLContent($this->buildTag("start", $app_name, $app_attribs));
         //echo "&nbsp;&nbsp;after append, xml:".$this->page_object->getXMLContent().":<br>";
     }
     // append content to bibitem xml content
     if ($this->in_bib_item) {
         $this->bib_item->appendXMLContent("\n" . $this->buildTag("start", $a_name, $a_attribs));
     }
     // call meta data handler
     if ($this->in_meta_data && $this->processMeta()) {
         // cache beginning of meta data within media object tags
         // (we need to know the id at the begin of meta elements within
         // media objects, after the "Identifier" tag has been processed
         // we send the cached data to the meta xml handler)
         if ($this->in_media_object && $this->media_meta_start) {
             $this->media_meta_cache[] = array("type" => "handlerBeginTag", "par1" => $a_name, "par2" => $a_attribs);
         } else {
             if ($a_name == "Identifier") {
                 if (!$this->in_media_object) {
                     $a_attribs["Entry"] = "il__" . $this->current_object->getType() . "_" . $this->current_object->getId();
                 } else {
                     $a_attribs["Entry"] = "il__mob" . "_" . $this->media_object->getId();
                 }
                 $a_attribs["Catalog"] = "ILIAS";
             }
             parent::handlerBeginTag($a_xml_parser, $a_name, $a_attribs);
         }
     }
 }
Example #24
0
 static function _isPagePublic($a_node_id, $a_check_public_mode = false)
 {
     global $ilDB, $ilLog;
     if (empty($a_node_id)) {
         $message = sprintf('ilLMObject::_isPagePublic(): Invalid parameter! $a_node_id is empty');
         $ilLog->write($message, $ilLog->WARNING);
         return false;
     }
     if ($a_check_public_mode === true) {
         $lm_id = ilLMObject::_lookupContObjId($a_node_id);
         $q = "SELECT public_access_mode FROM content_object WHERE id = " . $ilDB->quote($lm_id, "integer");
         $r = $ilDB->query($q);
         $row = $ilDB->fetchAssoc($r);
         if ($row["public_access_mode"] == "complete") {
             return true;
         }
     }
     $q = "SELECT public_access FROM lm_data WHERE obj_id=" . $ilDB->quote($a_node_id, "integer");
     $r = $ilDB->query($q);
     $row = $ilDB->fetchAssoc($r);
     return ilUtil::yn2tf($row["public_access"]);
 }
 /**
  * save properties
  */
 function saveProperties()
 {
     //check if OfflineMode-Zip has to be created
     $tmpOfflineMode = ilUtil::yn2tf($_POST["cobj_offline_mode"]);
     if ($tmpOfflineMode == true) {
         if ($this->object->getOfflineMode() == false) {
             $this->object->zipLmForOfflineMode();
         }
     }
     $this->object->setOnline(ilUtil::yn2tf($_POST["cobj_online"]));
     $this->object->setOfflineMode($tmpOfflineMode);
     $this->object->setOpenMode($_POST["open_mode"]);
     $this->object->setWidth($_POST["width"]);
     $this->object->setHeight($_POST["height"]);
     $this->object->setAuto_last_visited(ilUtil::yn2tf($_POST["cobj_auto_last_visited"]));
     $this->object->setAutoContinue(ilUtil::yn2tf($_POST["auto_continue"]));
     $this->object->setMaxAttempt($_POST["max_attempt"]);
     $this->object->setDefaultLessonMode($_POST["lesson_mode"]);
     $this->object->setCreditMode($_POST["credit_mode"]);
     $this->object->setAutoReview(ilUtil::yn2tf($_POST["auto_review"]));
     //		$this->object->setAPIAdapterName($_POST["api_adapter"]);
     //		$this->object->setAPIFunctionsPrefix($_POST["api_func_prefix"]);
     $this->object->setSession(ilUtil::yn2tf($_POST["cobj_session"]));
     $this->object->setInteractions(ilUtil::yn2tf($_POST["cobj_interactions"]));
     $this->object->setObjectives(ilUtil::yn2tf($_POST["cobj_objectives"]));
     $this->object->setTime_from_lms(ilUtil::yn2tf($_POST["cobj_time_from_lms"]));
     $this->object->setCheck_values(ilUtil::yn2tf($_POST["cobj_check_values"]));
     $this->object->setDebug(ilUtil::yn2tf($_POST["cobj_debug"]));
     $this->object->update();
     ilUtil::sendInfo($this->lng->txt("msg_obj_modified"), true);
     $this->ctrl->redirect($this, "properties");
 }