5 include_once(
"./Services/Component/classes/class.ilComponent.php");
6 include_once(
"./Services/Component/exceptions/class.ilPluginException.php");
84 private final function setId($a_id)
106 $this->lastupdateversion = $a_lastupdateversion;
116 return $this->lastupdateversion;
126 $this->version = $a_version;
136 return $this->version;
146 $this->iliasminversion = $a_iliasminversion;
156 return $this->iliasminversion;
166 $this->iliasmaxversion = $a_iliasmaxversion;
176 return $this->iliasmaxversion;
186 $this->active = $a_active;
196 return $this->active;
206 $this->slot = $a_slot;
226 $this->dbversion = $a_dbversion;
236 return $this->dbversion;
250 $q =
"UPDATE il_plugin SET db_version = ".$ilDB->quote((
int) $this->
getDBVersion(),
"integer").
253 " AND slot_id = ".$ilDB->quote($this->
getSlotId(),
"text").
256 $ilDB->manipulate($q);
273 static public final function _getDirectory($a_ctype, $a_cname, $a_slot_id, $a_pname)
275 include_once
"Services/Component/classes/class.ilPluginSlot.php";
315 if (!@is_dir($a_lang_directory))
320 $dir = opendir($a_lang_directory);
321 while(
$file = readdir($dir))
327 if (@is_file($a_lang_directory.
"/".
$file))
329 if (substr(
$file, 0, 6) ==
"ilias_" &&
332 $langs[] = array(
"key" => substr(
$file, 6, 2),
"file" =>
$file,
333 "path" => $a_lang_directory.
"/".
$file);
351 if (is_file($a_slot_dir.
"/".
352 $a_name.
"/classes/class.il".$a_name.
"ConfigGUI.php"))
367 return "il".$a_name.
"ConfigGUI";
385 return "Customizing/global/plugins/".$a_ctype.
"/".$a_cname.
"/".
386 $a_slot_name.
"/".$a_pname.
"/sql/dbupdate.php";
404 include_once(
"./Services/Language/classes/class.ilObjLanguage.php");
410 foreach($langs as
$lang)
413 $lang_array = array();
418 foreach ($txt as
$row)
420 if ($row[0] !=
"#" && strpos($row,
"#:#") > 0)
422 $a = explode(
"#:#",trim($row));
423 $lang_array[$prefix.
"_".trim($a[0])] = trim($a[1]);
425 $lang[
"key"], trim($a[1]));
443 include_once(
"./Services/Component/classes/class.ilPluginDBUpdate.php");
451 $result = $dbupdate->applyUpdate();
453 if ($dbupdate->updateMsg ==
"no_changes")
455 $message = $lng->txt(
"no_changes").
". ".$lng->txt(
"database_is_uptodate");
459 foreach ($dbupdate->updateMsg as
$row)
461 $message .= $lng->txt($row[
"msg"]).
": ".$row[
"nr"].
"<br/>";
465 $this->message.= $message;
477 if (!$this->lang_initialised && is_object($lng))
479 $lng->loadLanguageModule($this->
getPrefix());
480 $this->lang_initialised =
true;
487 public final function txt($a_var)
497 static function lookupTxt($a_mod_prefix, $a_pl_id, $a_lang_var)
500 return $lng->_lookupEntry($lng->lang_key, $a_mod_prefix.
"_".$a_pl_id,
501 $a_mod_prefix.
"_".$a_pl_id.
"_".$a_lang_var);
507 public final function getTemplate($a_template, $a_par1 =
true, $a_par2 =
true)
521 return $d.
"/templates/images/".$a_img;
529 return $this->
getDirectory().
"/templates/images/".$a_img;
543 public final function addBlockFile($a_tpl, $a_var, $a_block, $a_tplname)
545 $a_tpl->addBlockFile($a_var, $a_block,
552 static final public function getPluginRecord($a_ctype, $a_cname, $a_slot_id, $a_pname)
557 $q =
"SELECT * FROM il_plugin".
558 " WHERE component_type = ".$ilDB->quote($a_ctype,
"text").
559 " AND component_name = ".$ilDB->quote($a_cname,
"text").
560 " AND slot_id = ".$ilDB->quote($a_slot_id,
"text").
561 " AND name = ".$ilDB->quote($a_pname,
"text");
562 $set = $ilDB->query($q);
563 if ($rec = $ilDB->fetchAssoc($set))
569 $q =
"INSERT INTO il_plugin (component_type, component_name, slot_id, name)".
570 " VALUES (".$ilDB->quote($a_ctype,
"text").
",".
571 $ilDB->quote($a_cname,
"text").
",".
572 $ilDB->quote($a_slot_id,
"text").
",".
573 $ilDB->quote($a_pname,
"text").
")";
574 $ilDB->manipulate($q);
575 $q =
"SELECT * FROM il_plugin".
576 " WHERE component_type = ".$ilDB->quote($a_ctype,
"text").
577 " AND component_name = ".$ilDB->quote($a_cname,
"text").
578 " AND slot_id = ".$ilDB->quote($a_slot_id,
"text").
579 " AND name = ".$ilDB->quote($a_pname,
"text");
580 $set = $ilDB->query($q);
581 return $ilDB->fetchAssoc($set);
590 global $ilDB,
$lng, $ilPluginAdmin;
600 $this->
setId($ilPluginAdmin->getId($this->getComponentType(),
606 $this->
setVersion($ilPluginAdmin->getVersion($this->getComponentType(),
612 $this->
setIliasMinVersion($ilPluginAdmin->getIliasMinVersion($this->getComponentType(),
618 $this->
setIliasMaxVersion($ilPluginAdmin->getIliasMaxVersion($this->getComponentType(),
643 abstract protected function slotInit();
658 global $ilPluginAdmin;
669 global $ilPluginAdmin;
701 $q =
"UPDATE il_plugin SET active = ".$ilDB->quote(1,
"integer").
",".
702 " plugin_id = ".$ilDB->quote($this->
getId(),
"text").
705 " AND slot_id = ".$ilDB->quote($this->
getSlotId(),
"text").
708 $ilDB->manipulate($q);
742 $q =
"UPDATE il_plugin SET active = ".$ilDB->quote(0,
"integer").
745 " AND slot_id = ".$ilDB->quote($this->
getSlotId(),
"text").
748 $ilDB->manipulate($q);
772 include_once(
"./setup/classes/class.ilCtrlStructureReader.php");
785 $q =
"UPDATE il_plugin SET last_update_version = ".$ilDB->quote($this->
getVersion(),
"text").
788 " AND slot_id = ".$ilDB->quote($this->
getSlotId(),
"text").
791 $ilDB->manipulate($q);
809 include_once(
"./Services/Component/classes/class.ilPluginSlot.php");
813 $set = $ilDB->queryF(
"SELECT * FROM il_component WHERE type = %s ".
814 " AND name = %s", array(
"text",
"text"),
815 array($a_ctype, $a_cname));
816 if (!$ilDB->fetchAssoc($set))
821 $file =
"./Customizing/global/plugins/".$a_ctype.
"/".
822 $a_cname.
"/".$slot_name.
"/".
823 $a_pname.
"/classes/class.il".$a_pname.
"Plugin.php";
828 $class =
"il".$a_pname.
"Plugin";
829 $plugin =
new $class();
844 $q =
"SELECT * FROM il_plugin WHERE ".
845 " component_type = ".$ilDB->quote($a_ctype,
"text").
" AND ".
846 " component_name = ".$ilDB->quote($a_cname,
"text").
" AND ".
847 " slot_id = ".$ilDB->quote($a_slot_id,
"text").
" AND ".
848 " name = ".$ilDB->quote($a_pname,
"text");
850 $set = $ilDB->query($q);
852 $rec = $ilDB->fetchAssoc($set);
862 global $ilDB, $ilPluginAdmin;
864 $q =
"SELECT * FROM il_plugin WHERE component_type = ".$ilDB->quote($a_ctype,
"text").
865 " AND component_name = ".$ilDB->quote($a_cname,
"text").
866 " AND slot_id = ".$ilDB->quote($a_slot_id,
"text").
867 " AND active = ".$ilDB->quote(1,
"integer");
869 $set = $ilDB->query($q);
871 while($rec = $ilDB->fetchAssoc($set))
873 if ($ilPluginAdmin->isActive($a_ctype, $a_cname, $a_slot_id, $rec[
"name"]))
875 $plugins[] = $rec[
"name"];
889 $q =
"SELECT name FROM il_plugin ".
890 " WHERE component_type = ".$ilDB->quote($a_ctype,
"text").
891 " AND component_name = ".$ilDB->quote($a_cname,
"text").
892 " AND slot_id = ".$ilDB->quote($a_slot_id,
"text").
893 " AND plugin_id = ".$ilDB->quote($a_plugin_id,
"text");
895 $set = $ilDB->query($q);
896 if ($rec = $ilDB->fetchAssoc($set))
909 $q =
"SELECT plugin_id FROM il_plugin ".
910 " WHERE component_type = ".$ilDB->quote($a_ctype,
"text").
911 " AND component_name = ".$ilDB->quote($a_cname,
"text").
912 " AND slot_id = ".$ilDB->quote($a_slot_id,
"text").
913 " AND name = ".$ilDB->quote($a_plugin_name,
"text");
915 $set = $ilDB->query($q);
916 if ($rec = $ilDB->fetchAssoc($set))
918 return $rec[
"plugin_id"];