5 include_once(
"./Services/Component/classes/class.ilComponent.php");
6 include_once(
"./Services/Component/exceptions/class.ilPluginException.php");
83 private final function setId($a_id)
105 $this->lastupdateversion = $a_lastupdateversion;
115 return $this->lastupdateversion;
125 $this->version = $a_version;
135 return $this->version;
145 $this->iliasminversion = $a_iliasminversion;
155 return $this->iliasminversion;
165 $this->iliasmaxversion = $a_iliasmaxversion;
175 return $this->iliasmaxversion;
185 $this->active = $a_active;
195 return $this->active;
205 $this->slot = $a_slot;
225 $this->dbversion = $a_dbversion;
235 return $this->dbversion;
249 $q =
"UPDATE il_plugin SET db_version = ".$ilDB->quote((
int) $this->
getDBVersion(),
"integer").
252 " AND slot_id = ".$ilDB->quote($this->
getSlotId(),
"text").
255 $ilDB->manipulate($q);
272 static public final function _getDirectory($a_ctype, $a_cname, $a_slot_id, $a_pname)
314 if (!@is_dir($a_lang_directory))
319 $dir = opendir($a_lang_directory);
326 if (@is_file($a_lang_directory.
"/".
$file))
328 if (substr(
$file, 0, 6) ==
"ilias_" &&
331 $langs[] = array(
"key" => substr(
$file, 6, 2),
"file" =>
$file,
332 "path" => $a_lang_directory.
"/".
$file);
350 if (is_file($a_slot_dir.
"/".
351 $a_name.
"/classes/class.il".$a_name.
"ConfigGUI.php"))
366 return "il".$a_name.
"ConfigGUI";
384 return "Customizing/global/plugins/".$a_ctype.
"/".$a_cname.
"/".
385 $a_slot_name.
"/".$a_pname.
"/sql/dbupdate.php";
403 include_once(
"./Services/Language/classes/class.ilObjLanguage.php");
409 foreach($langs as
$lang)
412 $lang_array = array();
417 foreach ($txt as
$row)
419 if ($row[0] !=
"#" && strpos($row,
"#:#") > 0)
421 $a = explode(
"#:#",trim($row));
422 $lang_array[$prefix.
"_".trim($a[0])] = trim($a[1]);
424 $lang[
"key"], trim($a[1]));
442 include_once(
"./Services/Component/classes/class.ilPluginDBUpdate.php");
450 $result = $dbupdate->applyUpdate();
452 if ($dbupdate->updateMsg ==
"no_changes")
454 $message = $lng->txt(
"no_changes").
". ".$lng->txt(
"database_is_uptodate");
458 foreach ($dbupdate->updateMsg as
$row)
460 $message .= $lng->txt($row[
"msg"]).
": ".$row[
"nr"].
"<br/>";
464 $this->message.= $message;
476 $lng->loadLanguageModule($this->
getPrefix());
482 public final function txt($a_var)
491 static function lookupTxt($a_mod_prefix, $a_pl_id, $a_lang_var)
494 return $lng->_lookupEntry($lng->lang_key, $a_mod_prefix.
"_".$a_pl_id,
495 $a_mod_prefix.
"_".$a_pl_id.
"_".$a_lang_var);
501 public final function getTemplate($a_template, $a_par1 =
true, $a_par2 =
true)
515 return $d.
"/templates/images/".$a_img;
523 return $this->
getDirectory().
"/templates/images/".$a_img;
537 public final function addBlockFile($a_tpl, $a_var, $a_block, $a_tplname)
539 $a_tpl->addBlockFile($a_var, $a_block,
546 static final public function getPluginRecord($a_ctype, $a_cname, $a_slot_id, $a_pname)
551 $q =
"SELECT * FROM il_plugin".
552 " WHERE component_type = ".$ilDB->quote($a_ctype,
"text").
553 " AND component_name = ".$ilDB->quote($a_cname,
"text").
554 " AND slot_id = ".$ilDB->quote($a_slot_id,
"text").
555 " AND name = ".$ilDB->quote($a_pname,
"text");
556 $set = $ilDB->query($q);
557 if ($rec = $ilDB->fetchAssoc($set))
563 $q =
"INSERT INTO il_plugin (component_type, component_name, slot_id, name)".
564 " VALUES (".$ilDB->quote($a_ctype,
"text").
",".
565 $ilDB->quote($a_cname,
"text").
",".
566 $ilDB->quote($a_slot_id,
"text").
",".
567 $ilDB->quote($a_pname,
"text").
")";
568 $ilDB->manipulate($q);
569 $q =
"SELECT * FROM il_plugin".
570 " WHERE component_type = ".$ilDB->quote($a_ctype,
"text").
571 " AND component_name = ".$ilDB->quote($a_cname,
"text").
572 " AND slot_id = ".$ilDB->quote($a_slot_id,
"text").
573 " AND name = ".$ilDB->quote($a_pname,
"text");
574 $set = $ilDB->query($q);
575 return $ilDB->fetchAssoc($set);
594 $this->
setId($ilPluginAdmin->getId($this->getComponentType(),
600 $this->
setVersion($ilPluginAdmin->getVersion($this->getComponentType(),
606 $this->
setIliasMinVersion($ilPluginAdmin->getIliasMinVersion($this->getComponentType(),
612 $this->
setIliasMaxVersion($ilPluginAdmin->getIliasMaxVersion($this->getComponentType(),
626 $lng->loadLanguageModule($this->
getPrefix());
640 abstract protected function slotInit();
655 global $ilPluginAdmin;
666 global $ilPluginAdmin;
698 $q =
"UPDATE il_plugin SET active = ".$ilDB->quote(1,
"integer").
",".
699 " plugin_id = ".$ilDB->quote($this->
getId(),
"text").
702 " AND slot_id = ".$ilDB->quote($this->
getSlotId(),
"text").
705 $ilDB->manipulate($q);
739 $q =
"UPDATE il_plugin SET active = ".$ilDB->quote(0,
"integer").
742 " AND slot_id = ".$ilDB->quote($this->
getSlotId(),
"text").
745 $ilDB->manipulate($q);
769 include_once(
"./setup/classes/class.ilCtrlStructureReader.php");
782 $q =
"UPDATE il_plugin SET last_update_version = ".$ilDB->quote($this->
getVersion(),
"text").
785 " AND slot_id = ".$ilDB->quote($this->
getSlotId(),
"text").
788 $ilDB->manipulate($q);
806 include_once(
"./Services/Component/classes/class.ilPluginSlot.php");
810 $set = $ilDB->queryF(
"SELECT * FROM il_component WHERE type = %s ".
811 " AND name = %s", array(
"text",
"text"),
812 array($a_ctype, $a_cname));
813 if (!$ilDB->fetchAssoc($set))
818 $file =
"./Customizing/global/plugins/".$a_ctype.
"/".
819 $a_cname.
"/".$slot_name.
"/".
820 $a_pname.
"/classes/class.il".$a_pname.
"Plugin.php";
825 $class =
"il".$a_pname.
"Plugin";
826 $plugin =
new $class();
841 $q =
"SELECT * FROM il_plugin WHERE ".
842 " component_type = ".$ilDB->quote($a_ctype,
"text").
" AND ".
843 " component_name = ".$ilDB->quote($a_cname,
"text").
" AND ".
844 " slot_id = ".$ilDB->quote($a_slot_id,
"text").
" AND ".
845 " name = ".$ilDB->quote($a_pname,
"text");
847 $set = $ilDB->query($q);
849 $rec = $ilDB->fetchAssoc($set);
859 global
$ilDB, $ilPluginAdmin;
861 $q =
"SELECT * FROM il_plugin WHERE component_type = ".$ilDB->quote($a_ctype,
"text").
862 " AND component_name = ".$ilDB->quote($a_cname,
"text").
863 " AND slot_id = ".$ilDB->quote($a_slot_id,
"text").
864 " AND active = ".$ilDB->quote(1,
"integer");
866 $set = $ilDB->query($q);
868 while($rec = $ilDB->fetchAssoc($set))
870 if ($ilPluginAdmin->isActive($a_ctype, $a_cname, $a_slot_id, $rec[
"name"]))
872 $plugins[] = $rec[
"name"];
886 $q =
"SELECT name FROM il_plugin ".
887 " WHERE component_type = ".$ilDB->quote($a_ctype,
"text").
888 " AND component_name = ".$ilDB->quote($a_cname,
"text").
889 " AND slot_id = ".$ilDB->quote($a_slot_id,
"text").
890 " AND plugin_id = ".$ilDB->quote($a_plugin_id,
"text");
892 $set = $ilDB->query($q);
893 if ($rec = $ilDB->fetchAssoc($set))
906 $q =
"SELECT plugin_id FROM il_plugin ".
907 " WHERE component_type = ".$ilDB->quote($a_ctype,
"text").
908 " AND component_name = ".$ilDB->quote($a_cname,
"text").
909 " AND slot_id = ".$ilDB->quote($a_slot_id,
"text").
910 " AND name = ".$ilDB->quote($a_plugin_name,
"text");
912 $set = $ilDB->query($q);
913 if ($rec = $ilDB->fetchAssoc($set))
915 return $rec[
"plugin_id"];
925 spl_autoload_register(
926 array($this,
'autoLoad')
938 @include_once($class_file);