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);
355 return "Customizing/global/plugins/".$a_ctype.
"/".$a_cname.
"/".
356 $a_slot_name.
"/".$a_pname.
"/sql/dbupdate.php";
374 include_once(
"./Services/Language/classes/class.ilObjLanguage.php");
380 foreach($langs as
$lang)
383 $lang_array = array();
388 foreach ($txt as
$row)
390 if ($row[0] !=
"#" && strpos($row,
"#:#") > 0)
392 $a = explode(
"#:#",trim($row));
393 $lang_array[$prefix.
"_".trim($a[0])] = trim($a[1]);
395 $lang[
"key"], trim($a[1]));
412 include_once(
"./Services/Component/classes/class.ilPluginDBUpdate.php");
420 $result = $dbupdate->applyUpdate();
422 if ($dbupdate->updateMsg ==
"no_changes")
424 $message = $lng->txt(
"no_changes").
". ".$lng->txt(
"database_is_uptodate");
428 foreach ($dbupdate->updateMsg as
$row)
430 $message .= $lng->txt($row[
"msg"]).
": ".$row[
"nr"].
"<br/>";
434 $this->message.= $message;
446 $lng->loadLanguageModule($this->
getPrefix());
452 public final function txt($a_var)
455 return $lng->txt($this->
getPrefix().
"_".$a_var);
461 static function lookupTxt($a_mod_prefix, $a_pl_id, $a_lang_var)
464 return $lng->_lookupEntry($lng->lang_key, $a_mod_prefix.
"_".$a_pl_id,
465 $a_mod_prefix.
"_".$a_pl_id.
"_".$a_lang_var);
471 public final function getTemplate($a_template, $a_par1 =
true, $a_par2 =
true)
485 return $d.
"/templates/images/".$a_img;
493 return $this->
getDirectory().
"/templates/images/".$a_img;
507 public final function addBlockFile($a_tpl, $a_var, $a_block, $a_tplname)
509 $a_tpl->addBlockFile($a_var, $a_block,
516 static final public function getPluginRecord($a_ctype, $a_cname, $a_slot_id, $a_pname)
521 $q =
"SELECT * FROM il_plugin".
522 " WHERE component_type = ".$ilDB->quote($a_ctype,
"text").
523 " AND component_name = ".$ilDB->quote($a_cname,
"text").
524 " AND slot_id = ".$ilDB->quote($a_slot_id,
"text").
525 " AND name = ".$ilDB->quote($a_pname,
"text");
526 $set = $ilDB->query(
$q);
527 if ($rec = $ilDB->fetchAssoc($set))
533 $q =
"INSERT INTO il_plugin (component_type, component_name, slot_id, name)".
534 " VALUES (".$ilDB->quote($a_ctype,
"text").
",".
535 $ilDB->quote($a_cname,
"text").
",".
536 $ilDB->quote($a_slot_id,
"text").
",".
537 $ilDB->quote($a_pname,
"text").
")";
538 $ilDB->manipulate(
$q);
539 $q =
"SELECT * FROM il_plugin".
540 " WHERE component_type = ".$ilDB->quote($a_ctype,
"text").
541 " AND component_name = ".$ilDB->quote($a_cname,
"text").
542 " AND slot_id = ".$ilDB->quote($a_slot_id,
"text").
543 " AND name = ".$ilDB->quote($a_pname,
"text");
544 $set = $ilDB->query(
$q);
545 return $ilDB->fetchAssoc($set);
564 $this->
setId($ilPluginAdmin->getId($this->getComponentType(),
570 $this->
setVersion($ilPluginAdmin->getVersion($this->getComponentType(),
576 $this->
setIliasMinVersion($ilPluginAdmin->getIliasMinVersion($this->getComponentType(),
582 $this->
setIliasMaxVersion($ilPluginAdmin->getIliasMaxVersion($this->getComponentType(),
596 $lng->loadLanguageModule($this->
getPrefix());
610 abstract protected function slotInit();
625 global $ilPluginAdmin;
636 global $ilPluginAdmin;
668 $q =
"UPDATE il_plugin SET active = ".$ilDB->quote(1,
"integer").
",".
669 " plugin_id = ".$ilDB->quote($this->
getId(),
"text").
672 " AND slot_id = ".$ilDB->quote($this->
getSlotId(),
"text").
675 $ilDB->manipulate(
$q);
709 $q =
"UPDATE il_plugin SET active = ".$ilDB->quote(0,
"integer").
712 " AND slot_id = ".$ilDB->quote($this->
getSlotId(),
"text").
715 $ilDB->manipulate(
$q);
739 include_once(
"./setup/classes/class.ilCtrlStructureReader.php");
743 $ilCtrl->storeCommonStructures();
748 $q =
"UPDATE il_plugin SET last_update_version = ".$ilDB->quote($this->
getVersion(),
"text").
751 " AND slot_id = ".$ilDB->quote($this->
getSlotId(),
"text").
754 $ilDB->manipulate(
$q);
772 include_once(
"./Services/Component/classes/class.ilPluginSlot.php");
776 $set = $ilDB->queryF(
"SELECT * FROM il_component WHERE type = %s ".
777 " AND name = %s", array(
"text",
"text"),
778 array($a_ctype, $a_cname));
779 if (!$ilDB->fetchAssoc($set))
784 $file =
"./Customizing/global/plugins/".$a_ctype.
"/".
785 $a_cname.
"/".$slot_name.
"/".
786 $a_pname.
"/classes/class.il".$a_pname.
"Plugin.php";
791 $class =
"il".$a_pname.
"Plugin";
792 $plugin =
new $class();
807 $q =
"SELECT * FROM il_plugin WHERE ".
808 " component_type = ".$ilDB->quote($a_ctype,
"text").
" AND ".
809 " component_name = ".$ilDB->quote($a_cname,
"text").
" AND ".
810 " slot_id = ".$ilDB->quote($a_slot_id,
"text").
" AND ".
811 " name = ".$ilDB->quote($a_pname,
"text");
813 $set = $ilDB->query(
$q);
815 $rec = $ilDB->fetchAssoc($set);
825 global
$ilDB, $ilPluginAdmin;
827 $q =
"SELECT * FROM il_plugin WHERE component_type = ".$ilDB->quote($a_ctype,
"text").
828 " AND component_name = ".$ilDB->quote($a_cname,
"text").
829 " AND slot_id = ".$ilDB->quote($a_slot_id,
"text").
830 " AND active = ".$ilDB->quote(1,
"integer");
832 $set = $ilDB->query(
$q);
834 while($rec = $ilDB->fetchAssoc($set))
836 if ($ilPluginAdmin->isActive($a_ctype, $a_cname, $a_slot_id, $rec[
"name"]))
838 $plugins[] = $rec[
"name"];
852 $q =
"SELECT name FROM il_plugin ".
853 " WHERE component_type = ".$ilDB->quote($a_ctype,
"text").
854 " AND component_name = ".$ilDB->quote($a_cname,
"text").
855 " AND slot_id = ".$ilDB->quote($a_slot_id,
"text").
856 " AND plugin_id = ".$ilDB->quote($a_plugin_id,
"text");
858 $set = $ilDB->query(
$q);
859 if ($rec = $ilDB->fetchAssoc($set))
872 $q =
"SELECT plugin_id FROM il_plugin ".
873 " WHERE component_type = ".$ilDB->quote($a_ctype,
"text").
874 " AND component_name = ".$ilDB->quote($a_cname,
"text").
875 " AND slot_id = ".$ilDB->quote($a_slot_id,
"text").
876 " AND name = ".$ilDB->quote($a_plugin_name,
"text");
878 $set = $ilDB->query(
$q);
879 if ($rec = $ilDB->fetchAssoc($set))
881 return $rec[
"plugin_id"];