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";
403 ilGlobalCache::flushAll();
404 include_once(
"./Services/Language/classes/class.ilObjLanguage.php");
410 foreach($langs as
$lang)
413 $lang_array = array();
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]));
445 include_once(
"./Services/Component/classes/class.ilPluginDBUpdate.php");
453 $result = $dbupdate->applyUpdate();
455 if ($dbupdate->updateMsg ==
"no_changes")
457 $message = $lng->txt(
"no_changes").
". ".$lng->txt(
"database_is_uptodate");
461 foreach ($dbupdate->updateMsg as
$row)
463 $message .= $lng->txt($row[
"msg"]).
": ".$row[
"nr"].
"<br/>";
467 $this->message.= $message;
479 if (!$this->lang_initialised && is_object($lng))
481 $lng->loadLanguageModule($this->
getPrefix());
482 $this->lang_initialised =
true;
489 public final function txt($a_var)
499 static function lookupTxt($a_mod_prefix, $a_pl_id, $a_lang_var)
504 $prefix = $a_mod_prefix.
"_".$a_pl_id;
505 return $lng->txt($prefix.
"_".$a_lang_var, $prefix);
516 public final function getTemplate($a_template, $a_par1 =
true, $a_par2 =
true)
533 if (is_int(strpos(
$img,
"Customizing")))
539 return $d.
"/templates/images/".$a_img;
560 if (is_int(strpos($css,
"Customizing")))
571 public final function addBlockFile($a_tpl, $a_var, $a_block, $a_tplname)
573 $a_tpl->addBlockFile($a_var, $a_block,
587 $q =
"SELECT * FROM il_plugin".
588 " WHERE component_type = ".$ilDB->quote($a_ctype,
"text").
589 " AND component_name = ".$ilDB->quote($a_cname,
"text").
590 " AND slot_id = ".$ilDB->quote($a_slot_id,
"text").
591 " AND name = ".$ilDB->quote($a_pname,
"text");
592 $set = $ilDB->query($q);
593 if (!$rec = $ilDB->fetchAssoc($set))
595 $q =
"INSERT INTO il_plugin (component_type, component_name, slot_id, name)".
596 " VALUES (".$ilDB->quote($a_ctype,
"text").
",".
597 $ilDB->quote($a_cname,
"text").
",".
598 $ilDB->quote($a_slot_id,
"text").
",".
599 $ilDB->quote($a_pname,
"text").
")";
600 $ilDB->manipulate($q);
608 static final public function getPluginRecord($a_ctype, $a_cname, $a_slot_id, $a_pname)
611 $rec = $cached_component->lookupPluginByName($a_pname);
613 if ($rec[
'component_type'] == $a_ctype AND $rec[
'component_name'] == $a_cname AND $rec[
'slot_id'] == $a_slot_id) {
616 include_once(
"./Services/Component/exceptions/class.ilPluginException.php");
617 throw (
new ilPluginException(
"No plugin record found for '" . $a_ctype .
"', '" . $a_cname .
"', '" . $a_slot_id .
"', '" . $a_pname
674 $this->
setId($ilPluginAdmin->getId($this->getComponentType(),
680 $this->
setVersion($ilPluginAdmin->getVersion($this->getComponentType(),
686 $this->
setIliasMinVersion($ilPluginAdmin->getIliasMinVersion($this->getComponentType(),
692 $this->
setIliasMaxVersion($ilPluginAdmin->getIliasMaxVersion($this->getComponentType(),
717 abstract protected function slotInit();
732 global $ilPluginAdmin;
743 global $ilPluginAdmin;
777 $q =
"UPDATE il_plugin SET active = ".$ilDB->quote(1,
"integer").
",".
778 " plugin_id = ".$ilDB->quote($this->
getId(),
"text").
781 " AND slot_id = ".$ilDB->quote($this->
getSlotId(),
"text").
784 $ilDB->manipulate($q);
821 $q =
"UPDATE il_plugin SET active = ".$ilDB->quote(0,
"integer").
824 " AND slot_id = ".$ilDB->quote($this->
getSlotId(),
"text").
827 $ilDB->manipulate($q);
865 include_once(
"./setup/classes/class.ilCtrlStructureReader.php");
878 $q =
"UPDATE il_plugin SET last_update_version = ".$ilDB->quote($this->
getVersion(),
"text").
881 " AND slot_id = ".$ilDB->quote($this->
getSlotId(),
"text").
884 $ilDB->manipulate($q);
921 include_once(
"./Services/Component/classes/class.ilPluginSlot.php");
925 $rec = $cached_component->lookCompId($a_ctype, $a_cname);
939 $file =
"./Customizing/global/plugins/".$a_ctype.
"/".
940 $a_cname.
"/".$slot_name.
"/".
941 $a_pname.
"/classes/class.il".$a_pname.
"Plugin.php";
946 $class =
"il".$a_pname.
"Plugin";
947 $plugin =
new $class();
962 $q =
"SELECT * FROM il_plugin WHERE ".
963 " component_type = ".$ilDB->quote($a_ctype,
"text").
" AND ".
964 " component_name = ".$ilDB->quote($a_cname,
"text").
" AND ".
965 " slot_id = ".$ilDB->quote($a_slot_id,
"text").
" AND ".
966 " name = ".$ilDB->quote($a_pname,
"text");
968 $set = $ilDB->query($q);
970 $rec = $ilDB->fetchAssoc($set);
980 global
$ilDB, $ilPluginAdmin;
992 $lookupActivePluginsBySlotId = $cached_component->lookupActivePluginsBySlotId($a_slot_id);
993 foreach($lookupActivePluginsBySlotId as $rec)
995 if ($ilPluginAdmin->isActive($a_ctype, $a_cname, $a_slot_id, $rec[
"name"]))
997 $plugins[] = $rec[
"name"];
1011 $q =
"SELECT name FROM il_plugin ".
1012 " WHERE component_type = ".$ilDB->quote($a_ctype,
"text").
1013 " AND component_name = ".$ilDB->quote($a_cname,
"text").
1014 " AND slot_id = ".$ilDB->quote($a_slot_id,
"text").
1015 " AND plugin_id = ".$ilDB->quote($a_plugin_id,
"text");
1017 $set = $ilDB->query($q);
1018 if ($rec = $ilDB->fetchAssoc($set))
1020 return $rec[
"name"];
1031 $q =
"SELECT plugin_id FROM il_plugin ".
1032 " WHERE component_type = ".$ilDB->quote($a_ctype,
"text").
1033 " AND component_name = ".$ilDB->quote($a_cname,
"text").
1034 " AND slot_id = ".$ilDB->quote($a_slot_id,
"text").
1035 " AND name = ".$ilDB->quote($a_plugin_name,
"text");
1037 $set = $ilDB->query($q);
1038 if ($rec = $ilDB->fetchAssoc($set))
1040 return $rec[
"plugin_id"];