5 include_once(
"./Services/Component/classes/class.ilComponent.php");
6 include_once(
"./Services/Component/exceptions/class.ilPluginException.php");
82 private final function setId($a_id)
104 $this->lastupdateversion = $a_lastupdateversion;
114 return $this->lastupdateversion;
124 $this->version = $a_version;
134 return $this->version;
144 $this->iliasminversion = $a_iliasminversion;
154 return $this->iliasminversion;
164 $this->iliasmaxversion = $a_iliasmaxversion;
174 return $this->iliasmaxversion;
184 $this->active = $a_active;
194 return $this->active;
204 $this->slot = $a_slot;
224 $this->dbversion = $a_dbversion;
234 return $this->dbversion;
248 $q =
"UPDATE il_plugin SET db_version = ".$ilDB->quote((
int) $this->
getDBVersion(),
"integer").
251 " AND slot_id = ".$ilDB->quote($this->
getSlotId(),
"text").
254 $ilDB->manipulate($q);
271 static public final function _getDirectory($a_ctype, $a_cname, $a_slot_id, $a_pname)
313 if (!@is_dir($a_lang_directory))
318 $dir = opendir($a_lang_directory);
325 if (@is_file($a_lang_directory.
"/".
$file))
327 if (substr(
$file, 0, 6) ==
"ilias_" &&
330 $langs[] = array(
"key" => substr(
$file, 6, 2),
"file" =>
$file,
331 "path" => $a_lang_directory.
"/".
$file);
349 if (is_file($a_slot_dir.
"/".
350 $a_name.
"/classes/class.il".$a_name.
"ConfigGUI.php"))
365 return "il".$a_name.
"ConfigGUI";
383 return "Customizing/global/plugins/".$a_ctype.
"/".$a_cname.
"/".
384 $a_slot_name.
"/".$a_pname.
"/sql/dbupdate.php";
402 include_once(
"./Services/Language/classes/class.ilObjLanguage.php");
408 foreach($langs as
$lang)
411 $lang_array = array();
416 foreach ($txt as
$row)
418 if ($row[0] !=
"#" && strpos($row,
"#:#") > 0)
420 $a = explode(
"#:#",trim($row));
421 $lang_array[$prefix.
"_".trim($a[0])] = trim($a[1]);
423 $lang[
"key"], trim($a[1]));
441 include_once(
"./Services/Component/classes/class.ilPluginDBUpdate.php");
449 $result = $dbupdate->applyUpdate();
451 if ($dbupdate->updateMsg ==
"no_changes")
453 $message = $lng->txt(
"no_changes").
". ".$lng->txt(
"database_is_uptodate");
457 foreach ($dbupdate->updateMsg as
$row)
459 $message .= $lng->txt($row[
"msg"]).
": ".$row[
"nr"].
"<br/>";
463 $this->message.= $message;
475 $lng->loadLanguageModule($this->
getPrefix());
481 public final function txt($a_var)
490 static function lookupTxt($a_mod_prefix, $a_pl_id, $a_lang_var)
493 return $lng->_lookupEntry($lng->lang_key, $a_mod_prefix.
"_".$a_pl_id,
494 $a_mod_prefix.
"_".$a_pl_id.
"_".$a_lang_var);
500 public final function getTemplate($a_template, $a_par1 =
true, $a_par2 =
true)
514 return $d.
"/templates/images/".$a_img;
522 return $this->
getDirectory().
"/templates/images/".$a_img;
536 public final function addBlockFile($a_tpl, $a_var, $a_block, $a_tplname)
538 $a_tpl->addBlockFile($a_var, $a_block,
545 static final public function getPluginRecord($a_ctype, $a_cname, $a_slot_id, $a_pname)
550 $q =
"SELECT * FROM il_plugin".
551 " WHERE component_type = ".$ilDB->quote($a_ctype,
"text").
552 " AND component_name = ".$ilDB->quote($a_cname,
"text").
553 " AND slot_id = ".$ilDB->quote($a_slot_id,
"text").
554 " AND name = ".$ilDB->quote($a_pname,
"text");
555 $set = $ilDB->query($q);
556 if ($rec = $ilDB->fetchAssoc($set))
562 $q =
"INSERT INTO il_plugin (component_type, component_name, slot_id, name)".
563 " VALUES (".$ilDB->quote($a_ctype,
"text").
",".
564 $ilDB->quote($a_cname,
"text").
",".
565 $ilDB->quote($a_slot_id,
"text").
",".
566 $ilDB->quote($a_pname,
"text").
")";
567 $ilDB->manipulate($q);
568 $q =
"SELECT * FROM il_plugin".
569 " WHERE component_type = ".$ilDB->quote($a_ctype,
"text").
570 " AND component_name = ".$ilDB->quote($a_cname,
"text").
571 " AND slot_id = ".$ilDB->quote($a_slot_id,
"text").
572 " AND name = ".$ilDB->quote($a_pname,
"text");
573 $set = $ilDB->query($q);
574 return $ilDB->fetchAssoc($set);
593 $this->
setId($ilPluginAdmin->getId($this->getComponentType(),
599 $this->
setVersion($ilPluginAdmin->getVersion($this->getComponentType(),
605 $this->
setIliasMinVersion($ilPluginAdmin->getIliasMinVersion($this->getComponentType(),
611 $this->
setIliasMaxVersion($ilPluginAdmin->getIliasMaxVersion($this->getComponentType(),
625 $lng->loadLanguageModule($this->
getPrefix());
639 abstract protected function slotInit();
654 global $ilPluginAdmin;
665 global $ilPluginAdmin;
686 if ($result ===
true)
688 $result = $this->
update();
691 if ($result ===
true)
695 if ($result ===
true)
697 $q =
"UPDATE il_plugin SET active = ".$ilDB->quote(1,
"integer").
",".
698 " plugin_id = ".$ilDB->quote($this->
getId(),
"text").
701 " AND slot_id = ".$ilDB->quote($this->
getSlotId(),
"text").
704 $ilDB->manipulate($q);
738 $q =
"UPDATE il_plugin SET active = ".$ilDB->quote(0,
"integer").
741 " AND slot_id = ".$ilDB->quote($this->
getSlotId(),
"text").
744 $ilDB->manipulate($q);
759 if ($result ===
true)
768 include_once(
"./setup/classes/class.ilCtrlStructureReader.php");
779 if ($result ===
true)
781 $q =
"UPDATE il_plugin SET last_update_version = ".$ilDB->quote($this->
getVersion(),
"text").
784 " AND slot_id = ".$ilDB->quote($this->
getSlotId(),
"text").
787 $ilDB->manipulate($q);
805 include_once(
"./Services/Component/classes/class.ilPluginSlot.php");
809 $set = $ilDB->queryF(
"SELECT * FROM il_component WHERE type = %s ".
810 " AND name = %s", array(
"text",
"text"),
811 array($a_ctype, $a_cname));
812 if (!$ilDB->fetchAssoc($set))
817 $file =
"./Customizing/global/plugins/".$a_ctype.
"/".
818 $a_cname.
"/".$slot_name.
"/".
819 $a_pname.
"/classes/class.il".$a_pname.
"Plugin.php";
824 $class =
"il".$a_pname.
"Plugin";
825 $plugin =
new $class();
840 $q =
"SELECT * FROM il_plugin WHERE ".
841 " component_type = ".$ilDB->quote($a_ctype,
"text").
" AND ".
842 " component_name = ".$ilDB->quote($a_cname,
"text").
" AND ".
843 " slot_id = ".$ilDB->quote($a_slot_id,
"text").
" AND ".
844 " name = ".$ilDB->quote($a_pname,
"text");
846 $set = $ilDB->query($q);
848 $rec = $ilDB->fetchAssoc($set);
858 global
$ilDB, $ilPluginAdmin;
860 $q =
"SELECT * FROM il_plugin WHERE component_type = ".$ilDB->quote($a_ctype,
"text").
861 " AND component_name = ".$ilDB->quote($a_cname,
"text").
862 " AND slot_id = ".$ilDB->quote($a_slot_id,
"text").
863 " AND active = ".$ilDB->quote(1,
"integer");
865 $set = $ilDB->query($q);
867 while($rec = $ilDB->fetchAssoc($set))
869 if ($ilPluginAdmin->isActive($a_ctype, $a_cname, $a_slot_id, $rec[
"name"]))
871 $plugins[] = $rec[
"name"];
885 $q =
"SELECT name FROM il_plugin ".
886 " WHERE component_type = ".$ilDB->quote($a_ctype,
"text").
887 " AND component_name = ".$ilDB->quote($a_cname,
"text").
888 " AND slot_id = ".$ilDB->quote($a_slot_id,
"text").
889 " AND plugin_id = ".$ilDB->quote($a_plugin_id,
"text");
891 $set = $ilDB->query($q);
892 if ($rec = $ilDB->fetchAssoc($set))
905 $q =
"SELECT plugin_id FROM il_plugin ".
906 " WHERE component_type = ".$ilDB->quote($a_ctype,
"text").
907 " AND component_name = ".$ilDB->quote($a_cname,
"text").
908 " AND slot_id = ".$ilDB->quote($a_slot_id,
"text").
909 " AND name = ".$ilDB->quote($a_plugin_name,
"text");
911 $set = $ilDB->query($q);
912 if ($rec = $ilDB->fetchAssoc($set))
914 return $rec[
"plugin_id"];