Public Member Functions | |
| ilCourseArchives (&$course_obj) | |
| getArchives () | |
| getArchive ($a_id) | |
| getPublicArchives () | |
| setType ($a_type) | |
| getType () | |
| setDate ($a_date) | |
| getDate () | |
| setSize ($a_size) | |
| getSize () | |
| setName ($a_name) | |
| getName () | |
| setLanguage ($a_lang_code) | |
| getLanguage () | |
| getArchiveFile ($a_id) | |
| addXML () | |
| addHTML () | |
| add () | |
| delete ($a_id) | |
| deleteAll () | |
| initCourseFilesObject () | |
| initCourseXMLWriter () | |
| __addZipFiles ($a_parent_id) | |
| __addHTMLFiles ($a_parent_id) | |
| __addCourseHTML () | |
| __buildStructure (&$tmp_tpl, $a_parent_id) | |
| __read () | |
Data Fields | |
| $course_obj | |
| $ilias | |
| $ilErr | |
| $ilDB | |
| $tree | |
| $lng | |
| $archive_type | |
| $archive_date | |
| $archive_size | |
| $archive_name | |
| $archive_lang | |
| $course_files_obj | |
| $course_xml_writer | |
Definition at line 35 of file class.ilCourseArchives.php.
| ilCourseArchives::__addCourseHTML | ( | ) |
Definition at line 330 of file class.ilCourseArchives.php.
References $lng, $tpl, __buildStructure(), getLanguage(), and getName().
Referenced by addHTML().
{
global $tpl;
// Get Language
if($this->getLanguage())
{
$lng =& new ilLanguage($this->getLanguage());
$lng->loadLanguageModule('crs');
}
else
{
$lng =& $this->lng;
}
$tmp_tpl =& new ilTemplate("tpl.crs_export.html",true,true,"course");
$this->course_files_obj->copy($tpl->tplPath.'/default.css',$this->getName().'/default.css');
$tmp_tpl->setVariable('TITLE',$lng->txt('crs_export'));
$tmp_tpl->setVariable("CRS_STRUCTURE",$lng->txt('crs_structure'));
$tmp_tpl->setVariable("DETAILS_TITLE",$lng->txt("crs_details"));
#$tmp_tpl->setVariable("TYPE_IMG",ilUtil::getImagePath('icon_crs_b.gif'));
#$tmp_tpl->setVariable("ALT_IMG",$lng->txt("crs_details"));
// SET TXT VARIABLES
$tmp_tpl->setVariable("TXT_SYLLABUS",$lng->txt("crs_syllabus"));
$tmp_tpl->setVariable("TXT_CONTACT",$lng->txt("crs_contact"));
$tmp_tpl->setVariable("TXT_CONTACT_NAME",$lng->txt("crs_contact_name"));
$tmp_tpl->setVariable("TXT_CONTACT_RESPONSIBILITY",$lng->txt("crs_contact_responsibility"));
$tmp_tpl->setVariable("TXT_CONTACT_EMAIL",$lng->txt("crs_contact_email"));
$tmp_tpl->setVariable("TXT_CONTACT_PHONE",$lng->txt("crs_contact_phone"));
$tmp_tpl->setVariable("TXT_CONTACT_CONSULTATION",$lng->txt("crs_contact_consultation"));
$tmp_tpl->setVariable("TXT_DATES",$lng->txt("crs_dates"));
$tmp_tpl->setVariable("TXT_ACTIVATION",$lng->txt("crs_activation"));
$tmp_tpl->setVariable("TXT_SUBSCRIPTION",$lng->txt("crs_subscription"));
$tmp_tpl->setVariable("TXT_ARCHIVE",$lng->txt("crs_archive"));
// FILL
$tmp_tpl->setVariable("SYLLABUS",nl2br($this->course_obj->getSyllabus() ?
$this->course_obj->getSyllabus() :
$lng->txt("crs_not_available")));
$tmp_tpl->setVariable("CONTACT_NAME",$this->course_obj->getContactName() ?
$this->course_obj->getContactName() :
$lng->txt("crs_not_available"));
$tmp_tpl->setVariable("CONTACT_RESPONSIBILITY",$this->course_obj->getContactResponsibility() ?
$this->course_obj->getContactResponsibility() :
$lng->txt("crs_not_available"));
$tmp_tpl->setVariable("CONTACT_PHONE",$this->course_obj->getContactPhone() ?
$this->course_obj->getContactPhone() :
$lng->txt("crs_not_available"));
$tmp_tpl->setVariable("CONTACT_CONSULTATION",nl2br($this->course_obj->getContactConsultation() ?
$this->course_obj->getContactConsultation() :
$lng->txt("crs_not_available")));
if($this->course_obj->getContactEmail())
{
$tmp_tpl->setCurrentBlock("email_link");
#$tmp_tpl->setVariable("EMAIL_LINK","mail_new.php?type=new&rcp_to=".$this->course_obj->getContactEmail());
$tmp_tpl->setVariable("CONTACT_EMAIL",$this->course_obj->getContactEmail());
$tmp_tpl->parseCurrentBlock();
}
else
{
$tmp_tpl->setCurrentBlock("no_mail");
$tmp_tpl->setVariable("NO_CONTACT_EMAIL",$this->course_obj->getContactEmail());
$tmp_tpl->parseCurrentBlock();
}
if($this->course_obj->getActivationUnlimitedStatus())
{
$tmp_tpl->setVariable("ACTIVATION",$lng->txt('crs_unlimited'));
}
else
{
$str = $lng->txt("crs_from")." ".strftime("%Y-%m-%d %R",$this->course_obj->getActivationStart())." ".
$lng->txt("crs_to")." ".strftime("%Y-%m-%d %R",$this->course_obj->getActivationEnd());
$tmp_tpl->setVariable("ACTIVATION",$str);
}
if($this->course_obj->getSubscriptionUnlimitedStatus())
{
$tmp_tpl->setVariable("SUBSCRIPTION",$lng->txt('crs_unlimited'));
}
else
{
$str = $lng->txt("crs_from")." ".strftime("%Y-%m-%d %R",$this->course_obj->getSubscriptionStart())." ".
$lng->txt("crs_to")." ".strftime("%Y-%m-%d %R",$this->course_obj->getSubscriptionEnd());
$tmp_tpl->setVariable("SUBSCRIPTION",$str);
}
if($this->course_obj->getArchiveType() == $this->course_obj->ARCHIVE_DISABLED)
{
$tmp_tpl->setVariable("ARCHIVE",$lng->txt('crs_archive_disabled'));
}
else
{
$str = $lng->txt("crs_from")." ".strftime("%Y-%m-%d %R",$this->course_obj->getArchiveStart())." ".
$lng->txt("crs_to")." ".strftime("%Y-%m-%d %R",$this->course_obj->getArchiveEnd());
$tmp_tpl->setVariable("ARCHIVE",$str);
}
$this->structure = '';
$this->__buildStructure($tmp_tpl,$this->course_obj->getRefId());
$tmp_tpl->setVariable("STRUCTURE",$this->structure);
$this->course_files_obj->writeToFile($tmp_tpl->get(),$this->getName().'/index.html');
return true;
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilCourseArchives::__addHTMLFiles | ( | $ | a_parent_id | ) |
Definition at line 303 of file class.ilCourseArchives.php.
References ilObjectFactory::getInstanceByRefId(), and getName().
Referenced by addHTML().
{
$this->course_obj->initCourseItemObject();
$this->course_obj->items_obj->setParentId($a_parent_id);
foreach($this->course_obj->items_obj->getAllItems() as $item)
{
if(!$tmp_obj =& ilObjectFactory::getInstanceByRefId($item['child'],false))
{
continue;
}
if($abs_dir_name = $tmp_obj->getHTMLDirectory())
{
$new_name = 'il_'.$this->ilias->getSetting('inst_id').'_'.$tmp_obj->getType().'_'.$item['obj_id'];
$this->course_files_obj->addDirectory($this->getName().'/objects/'.$new_name);
$this->course_files_obj->rCopy($abs_dir_name,$this->getName().'/objects/'.$new_name);
// Store filename in hashtable (used for create course html tree)
$this->html_files["$item[obj_id]"] = "objects/".$new_name."/index.html";
}
$this->__addHTMLFiles($item['child']);
unset($tmp_obj);
}
return true;
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilCourseArchives::__addZipFiles | ( | $ | a_parent_id | ) |
Definition at line 279 of file class.ilCourseArchives.php.
References ilObjectFactory::getInstanceByRefId(), and getName().
Referenced by addXML().
{
$this->course_obj->initCourseItemObject();
$this->course_obj->items_obj->setParentId($a_parent_id);
foreach($this->course_obj->items_obj->getAllItems() as $item)
{
if(!$tmp_obj =& ilObjectFactory::getInstanceByRefId($item['child'],false))
{
continue;
}
// must return absolute path to zip file
if($abs_file_name = $tmp_obj->getXMLZip())
{
$new_name = 'il_'.$this->ilias->getSetting('inst_id').'_'.$tmp_obj->getType().'_'.$item['obj_id'].'.zip';
$this->course_files_obj->copy($abs_file_name,$this->getName().'/objects/'.$new_name);
}
$this->__addZipFiles($item['child']);
unset($tmp_obj);
}
return true;
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilCourseArchives::__buildStructure | ( | &$ | tmp_tpl, | |
| $ | a_parent_id | |||
| ) |
Definition at line 440 of file class.ilCourseArchives.php.
References ilObjectFactory::getInstanceByRefId().
Referenced by __addCourseHTML().
{
$this->course_obj->initCourseItemObject();
$this->course_obj->items_obj->setParentId($a_parent_id);
$items = $this->course_obj->items_obj->getAllItems();
foreach($items as $key => $item)
{
if(!$tmp_obj =& ilObjectFactory::getInstanceByRefId($item['child'],false))
{
continue;
}
if($key == 0)
{
$this->structure .= "<ul>";
}
$this->structure .= "<li>";
if(isset($this->html_files["$item[obj_id]"]))
{
$link = "<a href=\"./".$this->html_files["$item[obj_id]"]."\">".$item["title"]."</a>";
}
else
{
$link = $item['title'];
}
$this->structure .= $link;
$this->structure .= "</li>";
$this->__buildStructure($tmp_tpl,$item['child']);
if($key == (count($items) - 1))
{
$this->structure .= "</ul>";
}
unset($tmp_obj);
}
return true;
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilCourseArchives::__read | ( | ) |
Definition at line 487 of file class.ilCourseArchives.php.
References $query, $res, and $row.
Referenced by add(), delete(), and ilCourseArchives().
{
$this->archives = array();
$query = "SELECT * FROM crs_archives ".
"WHERE course_id = '".$this->course_obj->getId()."' ".
"ORDER BY archive_date";
$res = $this->ilDB->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$this->archives[$row->archive_id]["archive_type"] = $row->archive_type;
$this->archives[$row->archive_id]["archive_date"] = $row->archive_date;
$this->archives[$row->archive_id]["archive_size"] = $row->archive_size;
$this->archives[$row->archive_id]["archive_name"] = $row->archive_name;
$this->archives[$row->archive_id]["archive_lang"] = $row->archive_lang;
}
return true;
}
Here is the caller graph for this function:| ilCourseArchives::add | ( | ) |
Definition at line 219 of file class.ilCourseArchives.php.
References $query, __read(), getDate(), getLanguage(), getName(), getSize(), and getType().
Referenced by addHTML(), and addXML().
{
$query = "INSERT INTO crs_archives ".
"VALUES ('','".$this->course_obj->getId()."','".$this->getName()."','".$this->getType()."','".
$this->getDate()."','".$this->getSize()."','".$this->getLanguage()."')";
$this->ilDB->query($query);
$this->__read();
return true;
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilCourseArchives::addHTML | ( | ) |
Definition at line 189 of file class.ilCourseArchives.php.
References __addCourseHTML(), __addHTMLFiles(), add(), getDate(), getName(), initCourseFilesObject(), setDate(), setName(), setSize(), and setType().
{
$this->setType($this->ARCHIVE_HTML);
$this->setDate(time());
$this->setName($this->getDate().'__'.$this->ilias->getSetting('inst_id').'__crs_'.$this->course_obj->getId());
// Step one create folder
$this->initCourseFilesObject();
$this->course_files_obj->addDirectory($this->getName());
// Step two, create child html
$this->course_files_obj->addDirectory($this->getName().'/objects');
$this->__addHTMLFiles($this->course_obj->getRefId());
// Step three create course html
$this->__addCourseHTML();
// Step three ² create copy in web dir
$this->course_files_obj->createOnlineVersion($this->getName());
// Step four zip
$this->setSize($this->course_files_obj->zipFile($this->getName(),$this->getName().'.zip'));
// Finally add entry in crs_archives table
$this->add();
return true;
}
Here is the call graph for this function:| ilCourseArchives::addXML | ( | ) |
Definition at line 155 of file class.ilCourseArchives.php.
References __addZipFiles(), add(), getName(), initCourseFilesObject(), initCourseXMLWriter(), setDate(), setName(), setSize(), and setType().
{
$this->setType($this->ARCHIVE_XML);
$this->setName(time().'__'.$this->ilias->getSetting('inst_id').'__crs_'.$this->course_obj->getId());
$this->setDate(time());
// Step one create folder
$this->initCourseFilesObject();
$this->course_files_obj->addDirectory($this->getName());
// Step two create course xml
$this->initCourseXMLWriter();
$this->course_xml_writer->start();
$this->course_files_obj->writeToFile($this->course_xml_writer->getXML(),$this->getName().'/'.$this->getName().'.xml');
// Step three create child object xml
// add objects directory
$this->course_files_obj->addDirectory($this->getName().'/objects');
$this->__addZipFiles($this->course_obj->getRefId());
// Step four zip
$this->setSize($this->course_files_obj->zipFile($this->getName(),$this->getName().'.zip'));
// Finally add entry in crs_archives table
$this->add();
return true;
}
Here is the call graph for this function:| ilCourseArchives::delete | ( | $ | a_id | ) |
Definition at line 231 of file class.ilCourseArchives.php.
References $query, __read(), and initCourseFilesObject().
{
// Delete in file system
$this->initCourseFilesObject();
$this->course_files_obj->deleteArchive($this->archives[$a_id]["archive_name"]);
$query = "DELETE FROM crs_archives ".
"WHERE course_id = '".$this->course_obj->getId()."' ".
"AND archive_id = '".$a_id."'";
$this->ilDB->query($query);
$this->__read();
return true;
}
Here is the call graph for this function:| ilCourseArchives::deleteAll | ( | ) |
Definition at line 248 of file class.ilCourseArchives.php.
References $id, and getArchives().
{
foreach($this->getArchives() as $id => $archive)
{
$this->delete($id);
}
}
Here is the call graph for this function:| ilCourseArchives::getArchive | ( | $ | a_id | ) |
Definition at line 79 of file class.ilCourseArchives.php.
Referenced by getArchiveFile().
{
return $this->archives[$a_id];
}
Here is the caller graph for this function:| ilCourseArchives::getArchiveFile | ( | $ | a_id | ) |
Definition at line 147 of file class.ilCourseArchives.php.
References getArchive(), and initCourseFilesObject().
{
$archive = $this->getArchive($a_id);
$this->initCourseFilesObject();
return $this->course_files_obj->getArchiveFile($archive['archive_name']);
}
Here is the call graph for this function:| ilCourseArchives::getArchives | ( | ) |
Definition at line 74 of file class.ilCourseArchives.php.
Referenced by deleteAll().
{
return $this->archives;
}
Here is the caller graph for this function:| ilCourseArchives::getDate | ( | ) |
Definition at line 116 of file class.ilCourseArchives.php.
Referenced by add(), and addHTML().
{
return $this->archive_date ? $this->archive_date : time();
}
Here is the caller graph for this function:| ilCourseArchives::getLanguage | ( | ) |
Definition at line 141 of file class.ilCourseArchives.php.
Referenced by __addCourseHTML(), and add().
{
return $this->archive_lang;
}
Here is the caller graph for this function:| ilCourseArchives::getName | ( | ) |
Definition at line 133 of file class.ilCourseArchives.php.
Referenced by __addCourseHTML(), __addHTMLFiles(), __addZipFiles(), add(), addHTML(), and addXML().
{
return $this->archive_name;
}
Here is the caller graph for this function:| ilCourseArchives::getPublicArchives | ( | ) |
Definition at line 84 of file class.ilCourseArchives.php.
References $id.
{
foreach($this->archives as $id => $archive)
{
if($archive['archive_type'] == $this->ARCHIVE_XML)
{
continue;
}
if($this->course_obj->getArchiveType() != $this->course_obj->ARCHIVE_DOWNLOAD and
$archive['archive_type'] == $this->ARCHIVE_PDF)
{
continue;
}
$public_archives[$id] = $archive;
}
return $public_archives ? $public_archives : array();
}
| ilCourseArchives::getSize | ( | ) |
Definition at line 125 of file class.ilCourseArchives.php.
Referenced by add().
{
return $this->archive_size;
}
Here is the caller graph for this function:| ilCourseArchives::getType | ( | ) |
Definition at line 107 of file class.ilCourseArchives.php.
Referenced by add().
{
return $this->archive_type ? $this->archive_type : $this->ARCHIVE_XML;
}
Here is the caller graph for this function:| ilCourseArchives::ilCourseArchives | ( | &$ | course_obj | ) |
Definition at line 54 of file class.ilCourseArchives.php.
References $course_obj, $ilDB, $ilErr, $ilias, $lng, $tree, and __read().
{
global $ilErr,$ilDB,$lng,$tree,$ilias;
$this->ilias =& $ilias;
$this->ilErr =& $ilErr;
$this->ilDB =& $ilDB;
$this->lng =& $lng;
$this->tree =& $tree;
$this->ARCHIVE_XML = 1;
$this->ARCHIVE_HTML = 2;
$this->ARCHIVE_PDF = 3;
$this->course_obj =& $course_obj;
$this->__read();
}
Here is the call graph for this function:| ilCourseArchives::initCourseFilesObject | ( | ) |
Definition at line 256 of file class.ilCourseArchives.php.
Referenced by addHTML(), addXML(), delete(), and getArchiveFile().
{
if(!is_object($this->course_files_obj))
{
include_once "./course/classes/class.ilFileDataCourse.php";
$this->course_files_obj =& new ilFileDataCourse($this->course_obj);
}
return true;
}
Here is the caller graph for this function:| ilCourseArchives::initCourseXMLWriter | ( | ) |
Definition at line 267 of file class.ilCourseArchives.php.
Referenced by addXML().
{
if(!is_object($this->course_xml_writer))
{
include_once "./course/classes/class.ilCourseXMLWriter.php";
$this->course_xml_writer =& new ilCourseXMLWriter($this->course_obj);
}
return true;
}
Here is the caller graph for this function:| ilCourseArchives::setDate | ( | $ | a_date | ) |
Definition at line 112 of file class.ilCourseArchives.php.
Referenced by addHTML(), and addXML().
{
$this->archive_date = $a_date;
}
Here is the caller graph for this function:| ilCourseArchives::setLanguage | ( | $ | a_lang_code | ) |
Definition at line 137 of file class.ilCourseArchives.php.
{
$this->archive_lang = $a_lang_code;
}
| ilCourseArchives::setName | ( | $ | a_name | ) |
Definition at line 129 of file class.ilCourseArchives.php.
Referenced by addHTML(), and addXML().
{
$this->archive_name = $a_name;
}
Here is the caller graph for this function:| ilCourseArchives::setSize | ( | $ | a_size | ) |
Definition at line 121 of file class.ilCourseArchives.php.
Referenced by addHTML(), and addXML().
{
$this->archive_size = $a_size;
}
Here is the caller graph for this function:| ilCourseArchives::setType | ( | $ | a_type | ) |
Definition at line 103 of file class.ilCourseArchives.php.
Referenced by addHTML(), and addXML().
{
$this->archive_type = $a_type;
}
Here is the caller graph for this function:| ilCourseArchives::$archive_date |
Definition at line 45 of file class.ilCourseArchives.php.
| ilCourseArchives::$archive_lang |
Definition at line 48 of file class.ilCourseArchives.php.
| ilCourseArchives::$archive_name |
Definition at line 47 of file class.ilCourseArchives.php.
| ilCourseArchives::$archive_size |
Definition at line 46 of file class.ilCourseArchives.php.
| ilCourseArchives::$archive_type |
Definition at line 44 of file class.ilCourseArchives.php.
| ilCourseArchives::$course_files_obj |
Definition at line 50 of file class.ilCourseArchives.php.
| ilCourseArchives::$course_obj |
Definition at line 37 of file class.ilCourseArchives.php.
Referenced by ilCourseArchives().
| ilCourseArchives::$course_xml_writer |
Definition at line 51 of file class.ilCourseArchives.php.
| ilCourseArchives::$ilDB |
Definition at line 40 of file class.ilCourseArchives.php.
Referenced by ilCourseArchives().
| ilCourseArchives::$ilErr |
Definition at line 39 of file class.ilCourseArchives.php.
Referenced by ilCourseArchives().
| ilCourseArchives::$ilias |
Definition at line 38 of file class.ilCourseArchives.php.
Referenced by ilCourseArchives().
| ilCourseArchives::$lng |
Definition at line 42 of file class.ilCourseArchives.php.
Referenced by __addCourseHTML(), and ilCourseArchives().
| ilCourseArchives::$tree |
Definition at line 41 of file class.ilCourseArchives.php.
Referenced by ilCourseArchives().
1.7.1