Example #1
0
 /**
  * The basic properties of a file object are stored in table object_data.
  * This is not sufficient for a file object. Therefore we create additional
  * properties in table file_data.
  * This method has been put into a separate operation, to allow a WebDAV Null resource
  * (class.ilObjNull.php) to become a file object.
  */
 function createProperties($a_upload = false, $a_prevent_meta_data_creation = false)
 {
     global $ilDB, $tree;
     // Create file directory
     $this->initFileStorage();
     $this->file_storage->create();
     if ($a_upload) {
         return true;
     }
     // not upload mode
     require_once "./Services/History/classes/class.ilHistory.php";
     ilHistory::_createEntry($this->getId(), "create", $this->getFileName() . ",1");
     $this->addNewsNotification("file_created");
     require_once "./Services/News/classes/class.ilNewsItem.php";
     $default_visibility = ilNewsItem::_getDefaultVisibilityForRefId($_GET['ref_id']);
     if ($default_visibility == "public") {
         ilBlockSetting::_write("news", "public_notifications", 1, 0, $this->getId());
     }
     $q = "INSERT INTO file_data (file_id,file_name,file_type,file_size,version,f_mode) " . "VALUES (" . $ilDB->quote($this->getId(), 'integer') . "," . $ilDB->quote($this->getFileName(), 'text') . "," . $ilDB->quote($this->getFileType(), 'text') . "," . $ilDB->quote((int) $this->getFileSize(), 'integer') . "," . $ilDB->quote(1, 'integer') . "," . $ilDB->quote($this->getMode(), 'text') . ")";
     $res = $ilDB->manipulate($q);
     // no meta data handling for file list files
     if ($this->getMode() != "filelist" && !$a_prevent_meta_data_creation) {
         $this->createMetaData();
     }
 }
 /**
  * Save settings.
  */
 function saveSettings()
 {
     global $ilCtrl, $ilUser;
     $this->initSettingsForm();
     if ($this->settings_form->checkInput()) {
         $news_set = new ilSetting("news");
         $enable_internal_rss = $news_set->get("enable_rss_for_internal");
         if ($enable_internal_rss) {
             ilBlockSetting::_write($this->getBlockType(), "public_notifications", $_POST["notifications_public"], 0, $this->block_id);
             ilBlockSetting::_write($this->getBlockType(), "public_feed", $_POST["notifications_public_feed"], 0, $this->block_id);
             ilBlockSetting::_write($this->getBlockType(), "default_visibility", $_POST["default_visibility"], 0, $this->block_id);
         }
         if ($this->getProperty("hide_news_block_option")) {
             ilBlockSetting::_write($this->getBlockType(), "hide_news_block", $_POST["hide_news_block"], 0, $this->block_id);
             ilBlockSetting::_write($this->getBlockType(), "hide_news_per_date", $_POST["hide_news_per_date"], 0, $this->block_id);
             // hide date
             $hd = $this->settings_form->getInput("hide_news_date");
             $hide_date = new ilDateTime($hd["date"] . " " . $hd["time"], IL_CAL_DATETIME, $ilUser->getTimeZone());
             ilBlockSetting::_write($this->getBlockType(), "hide_news_date", $hide_date->get(IL_CAL_DATETIME), 0, $this->block_id);
         }
         include_once "./Services/News/classes/class.ilNewsCache.php";
         $cache = new ilNewsCache();
         $cache->deleteEntry($ilUser->getId() . ":" . $_GET["ref_id"]);
         $ilCtrl->returnToParent($this);
     } else {
         $this->settings_form->setValuesByPost();
         return $this->settings_form->getHtml();
     }
 }
 /**
  * Save Settings
  */
 function saveSettingsObject()
 {
     global $ilCtrl, $ilTabs;
     $this->checkPermission("write");
     $ilTabs->activateTab("id_settings");
     $this->initSettingsForm();
     if ($this->form_gui->checkInput()) {
         $news_set = new ilSetting("news");
         $enable_internal_rss = $news_set->get("enable_rss_for_internal");
         $this->object->setTitle($this->form_gui->getInput("title"));
         $this->object->setDescription($this->form_gui->getInput("description"));
         $this->object->setOnline($this->form_gui->getInput("online"));
         $this->object->setDownloadable($this->form_gui->getInput("downloadable"));
         $this->object->setOrder($this->form_gui->getInput("order"));
         $this->object->setViewMode($this->form_gui->getInput("viewmode"));
         if ($enable_internal_rss) {
             $this->object->setPublicFiles($this->form_gui->getInput("public_files"));
             $this->object->setDefaultAccess($this->form_gui->getInput("defaultaccess"));
         }
         $this->object->update();
         if ($enable_internal_rss) {
             include_once "./Services/Block/classes/class.ilBlockSetting.php";
             ilBlockSetting::_write("news", "public_feed", $this->form_gui->getInput("extra_feed"), 0, $this->object->getId());
             ilBlockSetting::_write("news", "keep_rss_min", $this->form_gui->getInput("keep_rss_min"), 0, $this->object->getId());
         }
         ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
         $ilCtrl->redirect($this, "editSettings");
     } else {
         $this->form_gui->setValuesByPost();
         $this->tpl->setContent($this->form_gui->getHTML());
     }
 }
 public function createSettings()
 {
     // news settings (public notifications yes/no)
     include_once "./Services/News/classes/class.ilNewsItem.php";
     $default_visibility = ilNewsItem::_getDefaultVisibilityForRefId($_GET["ref_id"]);
     if ($default_visibility == "public") {
         ilBlockSetting::_write("news", "public_notifications", 1, 0, $this->getId());
     }
     return true;
 }
 /**
  * Save settings.
  */
 function saveSettings()
 {
     global $ilCtrl, $ilUser;
     $news_set = new ilSetting("news");
     $enable_internal_rss = $news_set->get("enable_rss_for_internal");
     ilBlockSetting::_write($this->getBlockType(), "news_pd_period", $_POST["news_pd_period"], $ilUser->getId(), $this->block_id);
     include_once "./Services/News/classes/class.ilNewsCache.php";
     $cache = new ilNewsCache();
     $cache->deleteEntry($ilUser->getId() . ":0");
     $ilCtrl->returnToParent($this);
 }
 /**
  * Import record
  *
  * @param
  * @return
  */
 function importRecord($a_entity, $a_types, $a_rec, $a_mapping, $a_schema_version)
 {
     //echo $a_entity;
     //var_dump($a_rec);
     switch ($a_entity) {
         case "mcst":
             include_once "./Modules/MediaCast/classes/class.ilObjMediaCast.php";
             if ($new_id = $a_mapping->getMapping('Services/Container', 'objs', $a_rec['Id'])) {
                 $newObj = ilObjectFactory::getInstanceByObjId($new_id, false);
             } else {
                 $newObj = new ilObjMediaCast();
                 $newObj->setType("mcst");
                 $newObj->create(true);
             }
             $newObj->setTitle($a_rec["Title"]);
             $newObj->setDescription($a_rec["Description"]);
             $newObj->setDefaultAccess($a_rec["DefaultAccess"]);
             $newObj->setDownloadable($a_rec["Downloadable"]);
             $newObj->setPublicFiles($a_rec["PublicFiles"]);
             if ($a_schema_version == "5.0.0") {
                 $newObj->setOrder($a_rec["Sortmode"]);
                 $newObj->setViewMode($a_rec["Viewmode"]);
                 if ($a_rec["Order"]) {
                     $this->order[$newObj->getId()] = explode(";", $a_rec["Order"]);
                 }
                 include_once "./Services/Block/classes/class.ilBlockSetting.php";
                 ilBlockSetting::_write("news", "public_feed", $a_rec["PublicFeed"], 0, $newObj->getId());
                 ilBlockSetting::_write("news", "keep_rss_min", $a_rec["KeepRssMin"], 0, $newObj->getId());
             }
             $newObj->update(true);
             $this->current_obj = $newObj;
             $a_mapping->addMapping("Modules/MediaCast", "mcst", $a_rec["Id"], $newObj->getId());
             $a_mapping->addMapping("Services/News", "news_context", $a_rec["Id"] . ":mcst:0:", $newObj->getId() . ":mcst:0:");
             //var_dump($a_mapping->mappings["Services/News"]["news_context"]);
             break;
     }
 }
 /**
  * Write side to database.
  *
  */
 public static function _writeSide($a_type, $a_value, $a_user = 0, $a_block_id = 0)
 {
     ilBlockSetting::_write($a_type, "side", $a_value, $a_user, $a_block_id);
 }
 /**
  * Clone media cast
  *
  * @param int target ref_id
  * @param int copy id
  */
 public function cloneObject($a_target_id, $a_copy_id = 0)
 {
     global $ilDB, $ilUser, $ilias;
     $new_obj = parent::cloneObject($a_target_id, $a_copy_id);
     //copy online status if object is not the root copy object
     $cp_options = ilCopyWizardOptions::_getInstance($a_copy_id);
     if (!$cp_options->isRootNode($this->getRefId())) {
         $new_obj->setOnline($this->getOnline());
     }
     //$new_obj->setTitle($this->getTitle());
     $new_obj->setPublicFiles($this->getPublicFiles());
     $new_obj->setDownloadable($this->getDownloadable());
     $new_obj->setDefaultAccess($this->getDefaultAccess());
     $new_obj->setOrder($this->getOrder());
     $new_obj->setViewMode($this->getViewMode());
     $new_obj->update();
     include_once "./Services/Block/classes/class.ilBlockSetting.php";
     $pf = ilBlockSetting::_lookup("news", "public_feed", 0, $this->getId());
     $keeprss = (int) ilBlockSetting::_lookup("news", "keep_rss_min", 0, $this->getId());
     ilBlockSetting::_write("news", "public_feed", $pf, 0, $new_obj->getId());
     ilBlockSetting::_write("news", "keep_rss_min", $keeprss, 0, $new_obj->getId());
     // copy items
     $this->copyItems($new_obj);
     // copy order!?
     return $new_obj;
 }