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)
502 $prefix = $a_mod_prefix.
"_".$a_pl_id;
503 return $lng->txt($prefix.
"_".$a_lang_var, $prefix);
514 public final function getTemplate($a_template, $a_par1 =
true, $a_par2 =
true)
528 return $d.
"/templates/images/".$a_img;
536 return $this->
getDirectory().
"/templates/images/".$a_img;
550 public final function addBlockFile($a_tpl, $a_var, $a_block, $a_tplname)
552 $a_tpl->addBlockFile($a_var, $a_block,
564 $q =
"SELECT * FROM il_plugin".
565 " WHERE component_type = ".$ilDB->quote($a_ctype,
"text").
566 " AND component_name = ".$ilDB->quote($a_cname,
"text").
567 " AND slot_id = ".$ilDB->quote($a_slot_id,
"text").
568 " AND name = ".$ilDB->quote($a_pname,
"text");
569 $set = $ilDB->query($q);
570 if (!$rec = $ilDB->fetchAssoc($set))
572 $q =
"INSERT INTO il_plugin (component_type, component_name, slot_id, name)".
573 " VALUES (".$ilDB->quote($a_ctype,
"text").
",".
574 $ilDB->quote($a_cname,
"text").
",".
575 $ilDB->quote($a_slot_id,
"text").
",".
576 $ilDB->quote($a_pname,
"text").
")";
577 $ilDB->manipulate($q);
585 static final public function getPluginRecord($a_ctype, $a_cname, $a_slot_id, $a_pname)
590 $q =
"SELECT * FROM il_plugin".
591 " WHERE component_type = ".$ilDB->quote($a_ctype,
"text").
592 " AND component_name = ".$ilDB->quote($a_cname,
"text").
593 " AND slot_id = ".$ilDB->quote($a_slot_id,
"text").
594 " AND name = ".$ilDB->quote($a_pname,
"text");
595 $set = $ilDB->query($q);
596 if ($rec = $ilDB->fetchAssoc($set))
605 include_once(
"./Services/Component/exceptions/class.ilPluginException.php");
606 throw (
new ilPluginException(
"No plugin record found for '".$a_ctype.
"', '".$a_cname.
"', '".$a_slot_id.
"', '".$a_pname.
"'."));
608 $q =
"INSERT INTO il_plugin (component_type, component_name, slot_id, name)".
609 " VALUES (".$ilDB->quote($a_ctype,
"text").
",".
610 $ilDB->quote($a_cname,
"text").
",".
611 $ilDB->quote($a_slot_id,
"text").
",".
612 $ilDB->quote($a_pname,
"text").
")";
613 $ilDB->manipulate($q);
614 $q =
"SELECT * FROM il_plugin".
615 " WHERE component_type = ".$ilDB->quote($a_ctype,
"text").
616 " AND component_name = ".$ilDB->quote($a_cname,
"text").
617 " AND slot_id = ".$ilDB->quote($a_slot_id,
"text").
618 " AND name = ".$ilDB->quote($a_pname,
"text");
619 $set = $ilDB->query($q);
620 return $ilDB->fetchAssoc($set);
629 global $ilDB,
$lng, $ilPluginAdmin;
639 $this->
setId($ilPluginAdmin->getId($this->getComponentType(),
645 $this->
setVersion($ilPluginAdmin->getVersion($this->getComponentType(),
651 $this->
setIliasMinVersion($ilPluginAdmin->getIliasMinVersion($this->getComponentType(),
657 $this->
setIliasMaxVersion($ilPluginAdmin->getIliasMaxVersion($this->getComponentType(),
682 abstract protected function slotInit();
697 global $ilPluginAdmin;
708 global $ilPluginAdmin;
740 $q =
"UPDATE il_plugin SET active = ".$ilDB->quote(1,
"integer").
",".
741 " plugin_id = ".$ilDB->quote($this->
getId(),
"text").
744 " AND slot_id = ".$ilDB->quote($this->
getSlotId(),
"text").
747 $ilDB->manipulate($q);
781 $q =
"UPDATE il_plugin SET active = ".$ilDB->quote(0,
"integer").
784 " AND slot_id = ".$ilDB->quote($this->
getSlotId(),
"text").
787 $ilDB->manipulate($q);
811 include_once(
"./setup/classes/class.ilCtrlStructureReader.php");
824 $q =
"UPDATE il_plugin SET last_update_version = ".$ilDB->quote($this->
getVersion(),
"text").
827 " AND slot_id = ".$ilDB->quote($this->
getSlotId(),
"text").
830 $ilDB->manipulate($q);
848 include_once(
"./Services/Component/classes/class.ilPluginSlot.php");
852 $set = $ilDB->queryF(
"SELECT * FROM il_component WHERE type = %s ".
853 " AND name = %s", array(
"text",
"text"),
854 array($a_ctype, $a_cname));
855 if (!$ilDB->fetchAssoc($set))
860 $file =
"./Customizing/global/plugins/".$a_ctype.
"/".
861 $a_cname.
"/".$slot_name.
"/".
862 $a_pname.
"/classes/class.il".$a_pname.
"Plugin.php";
867 $class =
"il".$a_pname.
"Plugin";
868 $plugin =
new $class();
883 $q =
"SELECT * FROM il_plugin WHERE ".
884 " component_type = ".$ilDB->quote($a_ctype,
"text").
" AND ".
885 " component_name = ".$ilDB->quote($a_cname,
"text").
" AND ".
886 " slot_id = ".$ilDB->quote($a_slot_id,
"text").
" AND ".
887 " name = ".$ilDB->quote($a_pname,
"text");
889 $set = $ilDB->query($q);
891 $rec = $ilDB->fetchAssoc($set);
901 global $ilDB, $ilPluginAdmin;
903 $q =
"SELECT * FROM il_plugin WHERE component_type = ".$ilDB->quote($a_ctype,
"text").
904 " AND component_name = ".$ilDB->quote($a_cname,
"text").
905 " AND slot_id = ".$ilDB->quote($a_slot_id,
"text").
906 " AND active = ".$ilDB->quote(1,
"integer");
908 $set = $ilDB->query($q);
910 while($rec = $ilDB->fetchAssoc($set))
912 if ($ilPluginAdmin->isActive($a_ctype, $a_cname, $a_slot_id, $rec[
"name"]))
914 $plugins[] = $rec[
"name"];
928 $q =
"SELECT name FROM il_plugin ".
929 " WHERE component_type = ".$ilDB->quote($a_ctype,
"text").
930 " AND component_name = ".$ilDB->quote($a_cname,
"text").
931 " AND slot_id = ".$ilDB->quote($a_slot_id,
"text").
932 " AND plugin_id = ".$ilDB->quote($a_plugin_id,
"text");
934 $set = $ilDB->query($q);
935 if ($rec = $ilDB->fetchAssoc($set))
948 $q =
"SELECT plugin_id FROM il_plugin ".
949 " WHERE component_type = ".$ilDB->quote($a_ctype,
"text").
950 " AND component_name = ".$ilDB->quote($a_cname,
"text").
951 " AND slot_id = ".$ilDB->quote($a_slot_id,
"text").
952 " AND name = ".$ilDB->quote($a_plugin_name,
"text");
954 $set = $ilDB->query($q);
955 if ($rec = $ilDB->fetchAssoc($set))
957 return $rec[
"plugin_id"];