ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
class.ilPlugin.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 
5 include_once("./Services/Component/classes/class.ilComponent.php");
6 include_once("./Services/Component/exceptions/class.ilPluginException.php");
7 
16 abstract class ilPlugin
17 {
18  protected $lang_initialised = false;
19 
23  final function __construct()
24  {
25  $this->__init();
26  }
27 
36  abstract function getComponentType();
37 
46  abstract function getComponentName();
47 
56  abstract function getSlot();
57 
66  abstract function getSlotId();
67 
77  abstract function getPluginName();
78 
84  private final function setId($a_id)
85  {
86  $this->id = $a_id;
87  }
88 
94  final function getId()
95  {
96  return $this->id;
97  }
98 
104  private final function setLastUpdateVersion($a_lastupdateversion)
105  {
106  $this->lastupdateversion = $a_lastupdateversion;
107  }
108 
114  final function getLastUpdateVersion()
115  {
116  return $this->lastupdateversion;
117  }
118 
124  private final function setVersion($a_version)
125  {
126  $this->version = $a_version;
127  }
128 
134  final function getVersion()
135  {
136  return $this->version;
137  }
138 
144  private final function setIliasMinVersion($a_iliasminversion)
145  {
146  $this->iliasminversion = $a_iliasminversion;
147  }
148 
154  final function getIliasMinVersion()
155  {
156  return $this->iliasminversion;
157  }
158 
164  private final function setIliasMaxVersion($a_iliasmaxversion)
165  {
166  $this->iliasmaxversion = $a_iliasmaxversion;
167  }
168 
174  final function getIliasMaxVersion()
175  {
176  return $this->iliasmaxversion;
177  }
178 
184  private final function setActive($a_active)
185  {
186  $this->active = $a_active;
187  }
188 
194  final function getActive()
195  {
196  return $this->active;
197  }
198 
204  protected final function setSlotObject($a_slot)
205  {
206  $this->slot = $a_slot;
207  }
208 
214  protected final function getSlotObject()
215  {
216  return $this->slot;
217  }
218 
224  final function setDBVersion($a_dbversion)
225  {
226  $this->dbversion = $a_dbversion;
227  }
228 
234  final function getDBVersion()
235  {
236  return $this->dbversion;
237  }
238 
244  final function writeDBVersion($a_dbversion)
245  {
246  global $ilDB;
247 
248  $this->setDBVersion($a_dbversion);
249 
250  $q = "UPDATE il_plugin SET db_version = ".$ilDB->quote((int) $this->getDBVersion(), "integer").
251  " WHERE component_type = ".$ilDB->quote($this->getComponentType(), "text").
252  " AND component_name = ".$ilDB->quote($this->getComponentName(), "text").
253  " AND slot_id = ".$ilDB->quote($this->getSlotId(), "text").
254  " AND name = ".$ilDB->quote($this->getPluginName(), "text");
255 
256  $ilDB->manipulate($q);
257  }
258 
259 
265  public final function getDirectory()
266  {
267  return $this->getSlotObject()->getPluginsDirectory()."/".$this->getPluginName();
268  }
269 
273  static public final function _getDirectory($a_ctype, $a_cname, $a_slot_id, $a_pname)
274  {
275  include_once "Services/Component/classes/class.ilPluginSlot.php";
276  return ilPluginSlot::_getPluginsDirectory($a_ctype, $a_cname, $a_slot_id)."/".$a_pname;
277  }
278 
279 
285  protected final function getClassesDirectory()
286  {
287  return $this->getDirectory()."/classes";
288  }
289 
293  public final function includeClass($a_class_file_name)
294  {
295  include_once($this->getClassesDirectory()."/".$a_class_file_name);
296  }
297 
303  protected final function getLanguageDirectory()
304  {
305  return $this->getDirectory()."/lang";
306  }
307 
311  static final function getAvailableLangFiles($a_lang_directory)
312  {
313  $langs = array();
314 
315  if (!@is_dir($a_lang_directory))
316  {
317  return array();
318  }
319 
320  $dir = opendir($a_lang_directory);
321  while($file = readdir($dir))
322  {
323  if ($file != "." and
324  $file != "..")
325  {
326  // directories
327  if (@is_file($a_lang_directory."/".$file))
328  {
329  if (substr($file, 0, 6) == "ilias_" &&
330  substr($file, strlen($file) - 5) == ".lang")
331  {
332  $langs[] = array("key" => substr($file, 6, 2), "file" => $file,
333  "path" => $a_lang_directory."/".$file);
334  }
335  }
336  }
337  }
338 
339  return $langs;
340  }
341 
349  static final function hasConfigureClass($a_slot_dir, $a_name)
350  {
351  if (is_file($a_slot_dir."/".
352  $a_name."/classes/class.il".$a_name."ConfigGUI.php"))
353  {
354  return true;
355  }
356  return false;
357  }
358 
365  static final function getConfigureClassName($a_name)
366  {
367  return "il".$a_name."ConfigGUI";
368  }
369 
373  final function getPrefix()
374  {
375  return $this->getSlotObject()->getPrefix()."_".$this->getId();
376  }
377 
383  static public final function getDBUpdateScriptName($a_ctype, $a_cname, $a_slot_name, $a_pname)
384  {
385  return "Customizing/global/plugins/".$a_ctype."/".$a_cname."/".
386  $a_slot_name."/".$a_pname."/sql/dbupdate.php";
387  }
388 
392  final function getTablePrefix()
393  {
394  return $this->getPrefix();
395  }
396 
401  public function updateLanguages($a_lang_keys = null)
402  {
403  ilGlobalCache::flushAll();
404  include_once("./Services/Language/classes/class.ilObjLanguage.php");
405 
406  // get the keys of all installed languages if keys are not provided
407  if(!isset($a_lang_keys))
408  {
409  $a_lang_keys = array();
410  foreach (ilObjLanguage::getInstalledLanguages() as $langObj)
411  {
412  if ($langObj->isInstalled())
413  {
414  $a_lang_keys[] = $langObj->getKey();
415  }
416  }
417  }
418 
419  $langs = $this->getAvailableLangFiles($this->getLanguageDirectory());
420 
421  $prefix = $this->getPrefix();
422 
423  foreach($langs as $lang)
424  {
425  // check if the language should be updated, otherwise skip it
426  if (!in_array($lang['key'], $a_lang_keys) )
427  {
428  continue;
429  }
430 
431  $txt = file($this->getLanguageDirectory()."/".$lang["file"]);
432  $lang_array = array();
433 
434  // get locally changed variables of the module (these should be kept)
435  $local_changes = ilObjLanguage::_getLocalChangesByModule($lang['key'], $prefix);
436 
437  // get language data
438  if (is_array($txt))
439  {
440  foreach ($txt as $row)
441  {
442  if ($row[0] != "#" && strpos($row, "#:#") > 0)
443  {
444  $a = explode("#:#",trim($row));
445  $identifier = $prefix."_".trim($a[0]);
446  $value = trim($a[1]);
447 
448  if (isset($local_changes[$identifier]))
449  {
450  $lang_array[$identifier] = $local_changes[$identifier];
451  }
452  else
453  {
454  $lang_array[$identifier] = $value;
455  ilObjLanguage::replaceLangEntry($prefix, $identifier, $lang["key"], $value);
456  }
457  //echo "<br>-$prefix-".$prefix."_".trim($a[0])."-".$lang["key"]."-";
458  }
459  }
460  }
461 
462  ilObjLanguage::replaceLangModule($lang["key"], $prefix, $lang_array);
463  }
464  }
465 
469  function updateDatabase()
470  {
471  global $ilDB, $lng;
472 
474 
475  include_once("./Services/Component/classes/class.ilPluginDBUpdate.php");
476  $dbupdate = new ilPluginDBUpdate($this->getComponentType(),
477  $this->getComponentName(), $this->getSlotId(),
478  $this->getPluginName(), $ilDB, true, $this->getTablePrefix());
479 
480  //$dbupdate->getDBVersionStatus();
481  //$dbupdate->getCurrentVersion();
482 
483  $result = $dbupdate->applyUpdate();
484  $message = '';
485  if ($dbupdate->updateMsg == "no_changes")
486  {
487  $message = $lng->txt("no_changes").". ".$lng->txt("database_is_uptodate");
488  }
489  else
490  {
491  foreach ($dbupdate->updateMsg as $row)
492  {
493  $message .= $lng->txt($row["msg"]).": ".$row["nr"]."<br/>";
494  }
495  }
496 
497  $this->message.= $message;
498 
499  return $result;
500  }
501 
505  public final function loadLanguageModule()
506  {
507  global $lng;
508 
509  if (!$this->lang_initialised && is_object($lng))
510  {
511  $lng->loadLanguageModule($this->getPrefix());
512  $this->lang_initialised = true;
513  }
514  }
515 
519  public final function txt($a_var)
520  {
521  global $lng;
522  $this->loadLanguageModule();
523  return $lng->txt($this->getPrefix()."_".$a_var, $this->getPrefix());
524  }
525 
529  static function lookupTxt($a_mod_prefix, $a_pl_id, $a_lang_var)
530  {
531  global $lng;
532 
533  // this enables default language fallback
534  $prefix = $a_mod_prefix."_".$a_pl_id;
535  return $lng->txt($prefix."_".$a_lang_var, $prefix);
536 
537  /*
538  return ilLanguage::_lookupEntry($lng->lang_key, $a_mod_prefix."_".$a_pl_id,
539  $a_mod_prefix."_".$a_pl_id."_".$a_lang_var);
540  */
541  }
542 
546  public final function getTemplate($a_template, $a_par1 = true, $a_par2 = true)
547  {
548  $tpl = new ilTemplate($this->getDirectory()."/templates/".$a_template, $a_par1, $a_par2);
549 
550  return $tpl;
551  }
552 
556  public static final function _getImagePath($a_ctype, $a_cname, $a_slot_id,
557  $a_pname, $a_img)
558  {
559  $d2 = ilComponent::lookupId($a_ctype, $a_cname)."_".$a_slot_id."_".
560  ilPlugin::lookupIdForName($a_ctype, $a_cname, $a_slot_id, $a_pname);
561 
562  $img = ilUtil::getImagePath($d2."/".$a_img);
563  if (is_int(strpos($img, "Customizing")))
564  {
565  return $img;
566  }
567 
568  $d = ilPlugin::_getDirectory($a_ctype, $a_cname, $a_slot_id, $a_pname);
569  return $d."/templates/images/".$a_img;
570  }
571 
575  public final function getImagePath($a_img)
576  {
577  return self::_getImagePath($this->getComponentType(), $this->getComponentName(), $this->getSlotId(),
578  $this->getPluginName(), $a_img);
579  }
580 
584  public final function getStyleSheetLocation($a_css_file)
585  {
586  $d2 = ilComponent::lookupId($this->getComponentType(), $this->getComponentName())."_".$this->getSlotId()."_".
588 
589  $css = ilUtil::getStyleSheetLocation("output", $a_css_file, $d2);
590  if (is_int(strpos($css, "Customizing")))
591  {
592  return $css;
593  }
594 
595  return $this->getDirectory()."/templates/".$a_css_file;
596  }
597 
601  public final function addBlockFile($a_tpl, $a_var, $a_block, $a_tplname)
602  {
603  $a_tpl->addBlockFile($a_var, $a_block,
604  $this->getDirectory()."/templates/".$a_tplname);
605  }
606 
610  static final public function createPluginRecord($a_ctype, $a_cname, $a_slot_id, $a_pname)
611  {
612  global $ilDB;
613 
615 
616  // check record existence record
617  $q = "SELECT * FROM il_plugin".
618  " WHERE component_type = ".$ilDB->quote($a_ctype, "text").
619  " AND component_name = ".$ilDB->quote($a_cname, "text").
620  " AND slot_id = ".$ilDB->quote($a_slot_id, "text").
621  " AND name = ".$ilDB->quote($a_pname, "text");
622  $set = $ilDB->query($q);
623  if (!$rec = $ilDB->fetchAssoc($set))
624  {
625  $q = "INSERT INTO il_plugin (component_type, component_name, slot_id, name)".
626  " VALUES (".$ilDB->quote($a_ctype, "text").",".
627  $ilDB->quote($a_cname, "text").",".
628  $ilDB->quote($a_slot_id, "text").",".
629  $ilDB->quote($a_pname, "text").")";
630  $ilDB->manipulate($q);
631  }
632  }
633 
634 
638  static final public function getPluginRecord($a_ctype, $a_cname, $a_slot_id, $a_pname)
639  {
640  $cached_component = ilCachedComponentData::getInstance();
641  $rec = $cached_component->lookupPluginByName($a_pname);
642 
643  if ($rec['component_type'] == $a_ctype AND $rec['component_name'] == $a_cname AND $rec['slot_id'] == $a_slot_id) {
644  return $rec;
645  } else {
646  include_once("./Services/Component/exceptions/class.ilPluginException.php");
647  throw (new ilPluginException("No plugin record found for '" . $a_ctype . "', '" . $a_cname . "', '" . $a_slot_id . "', '" . $a_pname
648  . "'."));
649 
650  }
651  //
652  // global $ilDB;
653  //
654  // // read/set basic data
655  // $q = "SELECT * FROM il_plugin".
656  // " WHERE component_type = ".$ilDB->quote($a_ctype, "text").
657  // " AND component_name = ".$ilDB->quote($a_cname, "text").
658  // " AND slot_id = ".$ilDB->quote($a_slot_id, "text").
659  // " AND name = ".$ilDB->quote($a_pname, "text");
660  // $set = $ilDB->query($q);
661  // if ($rec = $ilDB->fetchAssoc($set))
662  // {
663  // return $rec;
664  // }
665  // else // no record? create one
666  // {
667  // // silently create these records is not a good idea, since
668  // // the function can be called with "wrong parameters"
669  // // raise exceptions instead
670  // include_once("./Services/Component/exceptions/class.ilPluginException.php");
671  // throw (new ilPluginException("No plugin record found for '".$a_ctype."', '".$a_cname."', '".$a_slot_id."', '".$a_pname."'."));
672  //
673  // $q = "INSERT INTO il_plugin (component_type, component_name, slot_id, name)".
674  // " VALUES (".$ilDB->quote($a_ctype, "text").",".
675  // $ilDB->quote($a_cname, "text").",".
676  // $ilDB->quote($a_slot_id, "text").",".
677  // $ilDB->quote($a_pname, "text").")";
678  // $ilDB->manipulate($q);
679  // $q = "SELECT * FROM il_plugin".
680  // " WHERE component_type = ".$ilDB->quote($a_ctype, "text").
681  // " AND component_name = ".$ilDB->quote($a_cname, "text").
682  // " AND slot_id = ".$ilDB->quote($a_slot_id, "text").
683  // " AND name = ".$ilDB->quote($a_pname, "text");
684  // $set = $ilDB->query($q);
685  // return $ilDB->fetchAssoc($set);
686  // }
687  }
688 
692  final private function __init()
693  {
694  global $ilDB, $lng, $ilPluginAdmin;
695 
696  // read/set basic data
698  $this->getComponentName(), $this->getSlotId(), $this->getPluginName());
699  $this->setLastUpdateVersion($rec["last_update_version"]);
700  $this->setDBVersion($rec["db_version"]);
701  $this->setActive($rec["active"]);
702 
703  // get id
704  $this->setId($ilPluginAdmin->getId($this->getComponentType(),
705  $this->getComponentName(),
706  $this->getSlotId(),
707  $this->getPluginName()));
708 
709  // get version
710  $this->setVersion($ilPluginAdmin->getVersion($this->getComponentType(),
711  $this->getComponentName(),
712  $this->getSlotId(),
713  $this->getPluginName()));
714 
715  // get ilias min version
716  $this->setIliasMinVersion($ilPluginAdmin->getIliasMinVersion($this->getComponentType(),
717  $this->getComponentName(),
718  $this->getSlotId(),
719  $this->getPluginName()));
720 
721  // get ilias max version
722  $this->setIliasMaxVersion($ilPluginAdmin->getIliasMaxVersion($this->getComponentType(),
723  $this->getComponentName(),
724  $this->getSlotId(),
725  $this->getPluginName()));
726 
727  // get slot object
728  $this->setSlotObject(new ilPluginSlot($this->getComponentType(),
729  $this->getComponentName(), $this->getSlotId()));
730 
731  // load language module
732 
733  // Fix for authentication plugins
734  $this->loadLanguageModule();
735 
736  // call slot and plugin init methods
737  $this->slotInit();
738  $this->init();
739  }
740 
747  abstract protected function slotInit();
748 
753  protected function init()
754  {
755  }
756 
760  public final function isActive()
761  {
762  global $ilPluginAdmin;
763 
764  return $ilPluginAdmin->isActive($this->getComponentType(),
765  $this->getComponentName(), $this->getSlotId(), $this->getPluginName());
766  }
767 
771  public final function needsUpdate()
772  {
773  global $ilPluginAdmin;
774 
775  return $ilPluginAdmin->isActive($this->getComponentType(),
776  $this->getComponentName(), $this->getSlotId(), $this->getPluginName());
777  }
778 
782  final function activate()
783  {
784  global $lng, $ilDB;
785 
787 
788  $result = true;
789 
790  // check whether update is necessary
791  if ($this->needsUpdate())
792  {
793  //$result = $this->isUpdatePossible();
794 
795  // do update
796  if ($result === true)
797  {
798  $result = $this->update();
799  }
800  }
801  if ($result === true)
802  {
803  $result = $this->beforeActivation();
804  // activate plugin
805  if ($result === true)
806  {
807  $q = "UPDATE il_plugin SET active = ".$ilDB->quote(1, "integer").",".
808  " plugin_id = ".$ilDB->quote($this->getId(), "text").
809  " WHERE component_type = ".$ilDB->quote($this->getComponentType(), "text").
810  " AND component_name = ".$ilDB->quote($this->getComponentName(), "text").
811  " AND slot_id = ".$ilDB->quote($this->getSlotId(), "text").
812  " AND name = ".$ilDB->quote($this->getPluginName(), "text");
813 
814  $ilDB->manipulate($q);
815  $this->afterActivation();
816  }
817  }
819  return $result;
820  }
821 
825  protected function beforeActivation()
826  {
827  return true; // false would indicate that anything went wrong
828  // activation would not proceed
829  // throw an exception in this case
830  //throw new ilPluginException($lng->txt(""));
831  }
832 
836  protected function afterActivation()
837  {
838  }
839 
843  final function deactivate()
844  {
845  global $ilDB;
846 
848 
849  $result = true;
850 
851  $q = "UPDATE il_plugin SET active = ".$ilDB->quote(0, "integer").
852  " WHERE component_type = ".$ilDB->quote($this->getComponentType(), "text").
853  " AND component_name = ".$ilDB->quote($this->getComponentName(), "text").
854  " AND slot_id = ".$ilDB->quote($this->getSlotId(), "text").
855  " AND name = ".$ilDB->quote($this->getPluginName(), "text");
856 
857  $ilDB->manipulate($q);
858  $this->afterDeactivation();
859 
860  return $result;
861  }
862 
863 
867  protected function afterDeactivation()
868  {
869  }
870 
874  final function update()
875  {
876  global $ilDB, $ilCtrl;
877 
879 
880  $result = $this->beforeUpdate();
881  if ($result === false) {
882  return false;
883  }
884 
885  // DB update
886  if ($result === true)
887  {
888  $result = $this->updateDatabase();
889  }
890 
891  // Load language files
892  $this->updateLanguages();
893 
894  // load control structure
895  include_once("./setup/classes/class.ilCtrlStructureReader.php");
896  $structure_reader = new ilCtrlStructureReader();
897  $structure_reader->readStructure(true, "./".$this->getDirectory(), $this->getPrefix(),
898  $this->getDirectory());
899  // $ilCtrl->storeCommonStructures();
900 
901  // add config gui to the ctrl calls
902  $ilCtrl->insertCtrlCalls("ilobjcomponentsettingsgui", ilPlugin::getConfigureClassName($this->getPluginName()),
903  $this->getPrefix());
904 
905  // set last update version to current version
906  if ($result === true)
907  {
908  $q = "UPDATE il_plugin SET last_update_version = ".$ilDB->quote($this->getVersion(), "text").
909  " WHERE component_type = ".$ilDB->quote($this->getComponentType(), "text").
910  " AND component_name = ".$ilDB->quote($this->getComponentName(), "text").
911  " AND slot_id = ".$ilDB->quote($this->getSlotId(), "text").
912  " AND name = ".$ilDB->quote($this->getPluginName(), "text");
913 
914  $ilDB->manipulate($q);
915  $this->afterUpdate();
916  }
917 
918  return $result;
919  }
920 
924  protected function beforeUpdate()
925  {
926  return true; // false would indicate that anything went wrong
927  // update would not proceed
928  // throw an exception in this case
929  //throw new ilPluginException($lng->txt(""));
930  }
931 
935  protected function afterUpdate()
936  {
937  }
938 
947  final static function getPluginObject($a_ctype, $a_cname, $a_slot_id, $a_pname)
948  {
949  global $ilDB;
950 
951  include_once("./Services/Component/classes/class.ilPluginSlot.php");
952  $slot_name = ilPluginSlot::lookupSlotName($a_ctype, $a_cname, $a_slot_id);
953 
954  $cached_component = ilCachedComponentData::getInstance();
955  $rec = $cached_component->lookCompId($a_ctype, $a_cname);
956  if (! $rec) {
957  return NULL;
958  }
959 
960  // this check is done due to security reasons
961  // $set = $ilDB->queryF("SELECT * FROM il_component WHERE type = %s ".
962  // " AND name = %s", array("text", "text"),
963  // array($a_ctype, $a_cname));
964  // if (!$ilDB->fetchAssoc($set))
965  // {
966  // return null;
967  // }
968 
969  $file = "./Customizing/global/plugins/".$a_ctype."/".
970  $a_cname."/".$slot_name."/".
971  $a_pname."/classes/class.il".$a_pname."Plugin.php";
972 
973  if (is_file($file))
974  {
975  include_once($file);
976  $class = "il".$a_pname."Plugin";
977  $plugin = new $class();
978  return $plugin;
979  }
980 
981  return null;
982  }
983 
984 
988  final static function lookupStoredData($a_ctype, $a_cname, $a_slot_id, $a_pname)
989  {
990  global $ilDB;
991 
992  $q = "SELECT * FROM il_plugin WHERE ".
993  " component_type = ".$ilDB->quote($a_ctype, "text")." AND ".
994  " component_name = ".$ilDB->quote($a_cname, "text")." AND ".
995  " slot_id = ".$ilDB->quote($a_slot_id, "text")." AND ".
996  " name = ".$ilDB->quote($a_pname, "text");
997 
998  $set = $ilDB->query($q);
999 
1000  $rec = $ilDB->fetchAssoc($set);
1001 
1002  return $rec;
1003  }
1004 
1008  static final function getActivePluginsForSlot($a_ctype, $a_cname, $a_slot_id)
1009  {
1010  global $ilDB, $ilPluginAdmin;
1011 
1012  $plugins = array();
1013 
1014  // $q = "SELECT * FROM il_plugin WHERE component_type = ".$ilDB->quote($a_ctype, "text").
1015  // " AND component_name = ".$ilDB->quote($a_cname, "text").
1016  // " AND slot_id = ".$ilDB->quote($a_slot_id, "text").
1017  // " AND active = ".$ilDB->quote(1, "integer");
1018  //
1019  // $set = $ilDB->query($q);
1020  $cached_component = ilCachedComponentData::getInstance();
1021  // while($rec = $ilDB->fetchAssoc($set))
1022  $lookupActivePluginsBySlotId = $cached_component->lookupActivePluginsBySlotId($a_slot_id);
1023  foreach($lookupActivePluginsBySlotId as $rec)
1024  {
1025  if ($ilPluginAdmin->isActive($a_ctype, $a_cname, $a_slot_id, $rec["name"]))
1026  {
1027  $plugins[] = $rec["name"];
1028  }
1029  }
1030 
1031  return $plugins;
1032  }
1033 
1037  function lookupNameForId($a_ctype, $a_cname, $a_slot_id, $a_plugin_id)
1038  {
1039  global $ilDB;
1040 
1041  $q = "SELECT name FROM il_plugin ".
1042  " WHERE component_type = ".$ilDB->quote($a_ctype, "text").
1043  " AND component_name = ".$ilDB->quote($a_cname, "text").
1044  " AND slot_id = ".$ilDB->quote($a_slot_id, "text").
1045  " AND plugin_id = ".$ilDB->quote($a_plugin_id, "text");
1046 
1047  $set = $ilDB->query($q);
1048  if ($rec = $ilDB->fetchAssoc($set))
1049  {
1050  return $rec["name"];
1051  }
1052  }
1053 
1057  function lookupIdForName($a_ctype, $a_cname, $a_slot_id, $a_plugin_name)
1058  {
1059  global $ilDB;
1060 
1061  $q = "SELECT plugin_id FROM il_plugin ".
1062  " WHERE component_type = ".$ilDB->quote($a_ctype, "text").
1063  " AND component_name = ".$ilDB->quote($a_cname, "text").
1064  " AND slot_id = ".$ilDB->quote($a_slot_id, "text").
1065  " AND name = ".$ilDB->quote($a_plugin_name, "text");
1066 
1067  $set = $ilDB->query($q);
1068  if ($rec = $ilDB->fetchAssoc($set))
1069  {
1070  return $rec["plugin_id"];
1071  }
1072  }
1073 }
1074 ?>
getTablePrefix()
Get db table plugin prefix.
static getPluginObject($a_ctype, $a_cname, $a_slot_id, $a_pname)
Get plugin object.
loadLanguageModule()
Load language module for plugin.
print $file
static replaceLangEntry($a_module, $a_identifier, $a_lang_key, $a_value, $a_local_change=null, $a_remarks=null)
Replace lang entry.
getVersion()
Get Current Version (from plugin.php file).
getIliasMinVersion()
Get Required ILIAS min.
static lookupId($a_type, $a_name)
Lookup ID of a component.
setId($a_id)
Set Id.
$result
includeClass($a_class_file_name)
Include (once) a class file.
static getStyleSheetLocation($mode="output", $a_css_name="", $a_css_location="")
get full style sheet file name (path inclusive) of current user
getImagePath($a_img)
Get image path.
update()
Update plugin.
static lookupStoredData($a_ctype, $a_cname, $a_slot_id, $a_pname)
Lookup information data in il_plugin.
_getPluginsDirectory($a_ctype, $a_cname, $a_slot_id)
Get plugins directory.
needsUpdate()
Check whether update is needed.
static getInstalledLanguages()
Get the language objects of the installed languages.
Database Update class.
static getActivePluginsForSlot($a_ctype, $a_cname, $a_slot_id)
Get all active plugins for a slot.
static lookupSlotName($a_ctype, $a_cname, $a_slot_id)
Lookup slot name for component and slot id.
static _getImagePath($a_ctype, $a_cname, $a_slot_id, $a_pname, $a_img)
Get image path.
setSlotObject($a_slot)
Set Plugin Slot.
lookupNameForId($a_ctype, $a_cname, $a_slot_id, $a_plugin_id)
Lookup name for id.
updateLanguages($a_lang_keys=null)
static getConfigureClassName($a_name)
Get plugin configure class name.
activate()
Activate.
setVersion($a_version)
Set Current Version (from plugin.php file).
getComponentName()
Get Component Name.
beforeActivation()
Before activation processing.
getTemplate($a_template, $a_par1=true, $a_par2=true)
Get template from plugin.
setIliasMaxVersion($a_iliasmaxversion)
Set Required ILIAS max.
Class ilCtrlStructureReader.
static getPluginRecord($a_ctype, $a_cname, $a_slot_id, $a_pname)
Get record from il_plugin table.
isActive()
Check whether plugin is active.
global $tpl
Definition: ilias.php:8
global $ilCtrl
Definition: ilias.php:18
getId()
Get Id.
getComponentType()
Get Component Type.
init()
Object initialization.
static lookupTxt($a_mod_prefix, $a_pl_id, $a_lang_var)
Lookup language text.
writeDBVersion($a_dbversion)
Write DB version to database.
afterActivation()
After activation processing.
lookupIdForName($a_ctype, $a_cname, $a_slot_id, $a_plugin_name)
Lookup id for name.
setDBVersion($a_dbversion)
Set DB Version.
updateDatabase()
Update database.
getDBVersion()
Get DB Version.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
Plugin Slot.
getDirectory()
Get Plugin Directory.
special template class to simplify handling of ITX/PEAR
deactivate()
Deactivate.
getActive()
Get Active.
$txt
Definition: error.php:10
txt($a_var)
Get Language Variable (prefix will be prepended automatically)
getPrefix()
Get plugin prefix, used for lang vars.
__construct()
Constructor.
afterUpdate()
After update processing.
getLastUpdateVersion()
Get Version of last update.
setLastUpdateVersion($a_lastupdateversion)
Set Version of last update.
getClassesDirectory()
Get Plugin&#39;s classes Directory.
static getDBUpdateScriptName($a_ctype, $a_cname, $a_slot_name, $a_pname)
Get DB update script filename (full path)
static createPluginRecord($a_ctype, $a_cname, $a_slot_id, $a_pname)
Create plugin record, if not existing.
getStyleSheetLocation($a_css_file)
Get css file location.
getSlotId()
Get Slot ID.
static hasConfigureClass($a_slot_dir, $a_name)
Has the plugin a configure class?
global $lng
Definition: privfeed.php:40
slotInit()
Object initialization done by slot.
static getAvailableLangFiles($a_lang_directory)
Get array of all language files in the plugin.
global $ilDB
__init()
Default initialization.
getPluginName()
Get Plugin Name.
getSlotObject()
Get Plugin Slot.
addBlockFile($a_tpl, $a_var, $a_block, $a_tplname)
Add template content to placeholder variable.
getLanguageDirectory()
Get Plugin&#39;s language Directory.
getSlot()
Get Slot Name.
setIliasMinVersion($a_iliasminversion)
Set Required ILIAS min.
getIliasMaxVersion()
Get Required ILIAS max.
setActive($a_active)
Set Active.
beforeUpdate()
Before update processing.
afterDeactivation()
After deactivation processing.
static _getDirectory($a_ctype, $a_cname, $a_slot_id, $a_pname)
Get plugin directory.