ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 
22  protected $lang_initialised = false;
26  protected $id = '';
27 
28  public function __construct()
29  {
30  $this->__init();
31  }
32 
40  abstract function getComponentType();
41 
49  abstract function getComponentName();
57  abstract function getSlot();
58 
66  abstract function getSlotId();
67 
76  abstract function getPluginName();
77 
83  private function setId($a_id)
84  {
85  $this->id = $a_id;
86  }
87 
93  function getId()
94  {
95  return $this->id;
96  }
97 
103  private function setLastUpdateVersion($a_lastupdateversion)
104  {
105  $this->lastupdateversion = $a_lastupdateversion;
106  }
107 
114  {
115  return $this->lastupdateversion;
116  }
117 
123  private function setVersion($a_version)
124  {
125  $this->version = $a_version;
126  }
127 
133  function getVersion()
134  {
135  return $this->version;
136  }
137 
143  private function setIliasMinVersion($a_iliasminversion)
144  {
145  $this->iliasminversion = $a_iliasminversion;
146  }
147 
154  {
155  return $this->iliasminversion;
156  }
157 
163  private function setIliasMaxVersion($a_iliasmaxversion)
164  {
165  $this->iliasmaxversion = $a_iliasmaxversion;
166  }
167 
174  {
175  return $this->iliasmaxversion;
176  }
177 
183  private function setActive($a_active)
184  {
185  $this->active = $a_active;
186  }
187 
193  function getActive()
194  {
195  return $this->active;
196  }
197 
203  protected function setSlotObject($a_slot)
204  {
205  $this->slot = $a_slot;
206  }
207 
213  protected function getSlotObject()
214  {
215  return $this->slot;
216  }
217 
223  function setDBVersion($a_dbversion)
224  {
225  $this->dbversion = $a_dbversion;
226  }
227 
233  function getDBVersion()
234  {
235  return $this->dbversion;
236  }
237 
243  function writeDBVersion($a_dbversion)
244  {
245  global $ilDB;
246 
247  $this->setDBVersion($a_dbversion);
248 
249  $q = "UPDATE il_plugin SET db_version = ".$ilDB->quote((int) $this->getDBVersion(), "integer").
250  " WHERE component_type = ".$ilDB->quote($this->getComponentType(), "text").
251  " AND component_name = ".$ilDB->quote($this->getComponentName(), "text").
252  " AND slot_id = ".$ilDB->quote($this->getSlotId(), "text").
253  " AND name = ".$ilDB->quote($this->getPluginName(), "text");
254 
255  $ilDB->manipulate($q);
256  }
257 
258 
264  public function getDirectory()
265  {
266  return $this->getSlotObject()->getPluginsDirectory()."/".$this->getPluginName();
267  }
268 
272  static public function _getDirectory($a_ctype, $a_cname, $a_slot_id, $a_pname)
273  {
274  include_once "Services/Component/classes/class.ilPluginSlot.php";
275  return ilPluginSlot::_getPluginsDirectory($a_ctype, $a_cname, $a_slot_id)."/".$a_pname;
276  }
277 
278 
284  protected function getClassesDirectory()
285  {
286  return $this->getDirectory()."/classes";
287  }
288 
292  public function includeClass($a_class_file_name)
293  {
294  include_once($this->getClassesDirectory()."/".$a_class_file_name);
295  }
296 
302  protected function getLanguageDirectory()
303  {
304  return $this->getDirectory()."/lang";
305  }
306 
310  static function getAvailableLangFiles($a_lang_directory)
311  {
312  $langs = array();
313 
314  if (!@is_dir($a_lang_directory))
315  {
316  return array();
317  }
318 
319  $dir = opendir($a_lang_directory);
320  while($file = readdir($dir))
321  {
322  if ($file != "." and
323  $file != "..")
324  {
325  // directories
326  if (@is_file($a_lang_directory."/".$file))
327  {
328  if (substr($file, 0, 6) == "ilias_" &&
329  substr($file, strlen($file) - 5) == ".lang")
330  {
331  $langs[] = array("key" => substr($file, 6, 2), "file" => $file,
332  "path" => $a_lang_directory."/".$file);
333  }
334  }
335  }
336  }
337 
338  return $langs;
339  }
340 
348  static function hasConfigureClass($a_slot_dir, $a_name)
349  {
350  if (is_file($a_slot_dir."/".
351  $a_name."/classes/class.il".$a_name."ConfigGUI.php"))
352  {
353  return true;
354  }
355  return false;
356  }
357 
364  static function getConfigureClassName($a_name)
365  {
366  return "il".$a_name."ConfigGUI";
367  }
368 
372  function getPrefix()
373  {
374  return $this->getSlotObject()->getPrefix()."_".$this->getId();
375  }
376 
382  static public function getDBUpdateScriptName($a_ctype, $a_cname, $a_slot_name, $a_pname)
383  {
384  return "Customizing/global/plugins/".$a_ctype."/".$a_cname."/".
385  $a_slot_name."/".$a_pname."/sql/dbupdate.php";
386  }
387 
391  function getTablePrefix()
392  {
393  return $this->getPrefix();
394  }
395 
400  public function updateLanguages($a_lang_keys = null)
401  {
402  ilGlobalCache::flushAll();
403  include_once("./Services/Language/classes/class.ilObjLanguage.php");
404 
405  // get the keys of all installed languages if keys are not provided
406  if(!isset($a_lang_keys))
407  {
408  $a_lang_keys = array();
409  foreach (ilObjLanguage::getInstalledLanguages() as $langObj)
410  {
411  if ($langObj->isInstalled())
412  {
413  $a_lang_keys[] = $langObj->getKey();
414  }
415  }
416  }
417 
418  $langs = $this->getAvailableLangFiles($this->getLanguageDirectory());
419 
420  $prefix = $this->getPrefix();
421 
422  foreach($langs as $lang)
423  {
424  // check if the language should be updated, otherwise skip it
425  if (!in_array($lang['key'], $a_lang_keys) )
426  {
427  continue;
428  }
429 
430  $txt = file($this->getLanguageDirectory()."/".$lang["file"]);
431  $lang_array = array();
432 
433  // get locally changed variables of the module (these should be kept)
434  $local_changes = ilObjLanguage::_getLocalChangesByModule($lang['key'], $prefix);
435 
436  // get language data
437  if (is_array($txt))
438  {
439  foreach ($txt as $row)
440  {
441  if ($row[0] != "#" && strpos($row, "#:#") > 0)
442  {
443  $a = explode("#:#",trim($row));
444  $identifier = $prefix."_".trim($a[0]);
445  $value = trim($a[1]);
446 
447  if (isset($local_changes[$identifier]))
448  {
449  $lang_array[$identifier] = $local_changes[$identifier];
450  }
451  else
452  {
453  $lang_array[$identifier] = $value;
454  ilObjLanguage::replaceLangEntry($prefix, $identifier, $lang["key"], $value);
455  }
456  //echo "<br>-$prefix-".$prefix."_".trim($a[0])."-".$lang["key"]."-";
457  }
458  }
459  }
460 
461  ilObjLanguage::replaceLangModule($lang["key"], $prefix, $lang_array);
462  }
463  }
464 
468  function updateDatabase()
469  {
470  global $ilDB, $lng;
471 
473 
474  include_once("./Services/Component/classes/class.ilPluginDBUpdate.php");
475  $dbupdate = new ilPluginDBUpdate($this->getComponentType(),
476  $this->getComponentName(), $this->getSlotId(),
477  $this->getPluginName(), $ilDB, true, $this->getTablePrefix());
478 
479  //$dbupdate->getDBVersionStatus();
480  //$dbupdate->getCurrentVersion();
481 
482  $result = $dbupdate->applyUpdate();
483  $message = '';
484  if ($dbupdate->updateMsg == "no_changes")
485  {
486  $message = $lng->txt("no_changes").". ".$lng->txt("database_is_uptodate");
487  }
488  else
489  {
490  foreach ($dbupdate->updateMsg as $row)
491  {
492  $message .= $lng->txt($row["msg"]).": ".$row["nr"]."<br/>";
493  }
494  }
495 
496  $this->message.= $message;
497 
498  return $result;
499  }
500 
504  public function loadLanguageModule()
505  {
506  global $lng;
507 
508  if (!$this->lang_initialised && is_object($lng))
509  {
510  $lng->loadLanguageModule($this->getPrefix());
511  $this->lang_initialised = true;
512  }
513  }
514 
518  public function txt($a_var)
519  {
520  global $lng;
521  $this->loadLanguageModule();
522  return $lng->txt($this->getPrefix()."_".$a_var, $this->getPrefix());
523  }
524 
528  static function lookupTxt($a_mod_prefix, $a_pl_id, $a_lang_var)
529  {
530  global $lng;
531 
532  // this enables default language fallback
533  $prefix = $a_mod_prefix."_".$a_pl_id;
534  return $lng->txt($prefix."_".$a_lang_var, $prefix);
535  }
536 
537 
541  public function getTemplate($a_template, $a_par1 = true, $a_par2 = true)
542  {
543  $tpl = new ilTemplate($this->getDirectory()."/templates/".$a_template, $a_par1, $a_par2);
544 
545  return $tpl;
546  }
547 
551  public static function _getImagePath($a_ctype, $a_cname, $a_slot_id,
552  $a_pname, $a_img)
553  {
554  $d2 = ilComponent::lookupId($a_ctype, $a_cname)."_".$a_slot_id."_".
555  ilPlugin::lookupIdForName($a_ctype, $a_cname, $a_slot_id, $a_pname);
556 
557  $img = ilUtil::getImagePath($d2."/".$a_img);
558  if (is_int(strpos($img, "Customizing")))
559  {
560  return $img;
561  }
562 
563  $d = ilPlugin::_getDirectory($a_ctype, $a_cname, $a_slot_id, $a_pname);
564  return $d."/templates/images/".$a_img;
565  }
566 
570  public function getImagePath($a_img)
571  {
572  return self::_getImagePath($this->getComponentType(), $this->getComponentName(), $this->getSlotId(),
573  $this->getPluginName(), $a_img);
574  }
575 
579  public function getStyleSheetLocation($a_css_file)
580  {
581  $d2 = ilComponent::lookupId($this->getComponentType(), $this->getComponentName())."_".$this->getSlotId()."_".
583 
584  $css = ilUtil::getStyleSheetLocation("output", $a_css_file, $d2);
585  if (is_int(strpos($css, "Customizing")))
586  {
587  return $css;
588  }
589 
590  return $this->getDirectory()."/templates/".$a_css_file;
591  }
592 
596  public function addBlockFile($a_tpl, $a_var, $a_block, $a_tplname)
597  {
598  $a_tpl->addBlockFile($a_var, $a_block,
599  $this->getDirectory()."/templates/".$a_tplname);
600  }
601 
602 
611  static public function createPluginRecord($a_ctype, $a_cname, $a_slot_id, $a_pname)
612  {
613  global $ilDB;
614 
616 
617  // check record existence record
618  $q = "SELECT * FROM il_plugin".
619  " WHERE component_type = ".$ilDB->quote($a_ctype, "text").
620  " AND component_name = ".$ilDB->quote($a_cname, "text").
621  " AND slot_id = ".$ilDB->quote($a_slot_id, "text").
622  " AND name = ".$ilDB->quote($a_pname, "text");
623  $set = $ilDB->query($q);
624  if (!$rec = $ilDB->fetchAssoc($set))
625  {
626  $q = "INSERT INTO il_plugin (component_type, component_name, slot_id, name)".
627  " VALUES (".$ilDB->quote($a_ctype, "text").",".
628  $ilDB->quote($a_cname, "text").",".
629  $ilDB->quote($a_slot_id, "text").",".
630  $ilDB->quote($a_pname, "text").")";
631  $ilDB->manipulate($q);
632  }
633  }
634 
635 
639  static public function getPluginRecord($a_ctype, $a_cname, $a_slot_id, $a_pname)
640  {
641  $cached_component = ilCachedComponentData::getInstance();
642  $rec = $cached_component->lookupPluginByName($a_pname);
643 
644  if ($rec['component_type'] == $a_ctype AND $rec['component_name'] == $a_cname AND $rec['slot_id'] == $a_slot_id) {
645  return $rec;
646  } else {
647  include_once("./Services/Component/exceptions/class.ilPluginException.php");
648  throw (new ilPluginException("No plugin record found for '" . $a_ctype . "', '" . $a_cname . "', '" . $a_slot_id . "', '" . $a_pname
649  . "'."));
650 
651  }
652  }
653 
657  private function __init()
658  {
659  global $ilDB, $lng, $ilPluginAdmin;
660 
661  // read/set basic data
663  $this->getComponentName(), $this->getSlotId(), $this->getPluginName());
664  $this->setLastUpdateVersion($rec["last_update_version"]);
665  $this->setDBVersion($rec["db_version"]);
666  $this->setActive($rec["active"]);
667 
668  // get id
669  $this->setId($ilPluginAdmin->getId($this->getComponentType(),
670  $this->getComponentName(),
671  $this->getSlotId(),
672  $this->getPluginName()));
673 
674  // get version
675  $this->setVersion($ilPluginAdmin->getVersion($this->getComponentType(),
676  $this->getComponentName(),
677  $this->getSlotId(),
678  $this->getPluginName()));
679 
680  // get ilias min version
681  $this->setIliasMinVersion($ilPluginAdmin->getIliasMinVersion($this->getComponentType(),
682  $this->getComponentName(),
683  $this->getSlotId(),
684  $this->getPluginName()));
685 
686  // get ilias max version
687  $this->setIliasMaxVersion($ilPluginAdmin->getIliasMaxVersion($this->getComponentType(),
688  $this->getComponentName(),
689  $this->getSlotId(),
690  $this->getPluginName()));
691 
692  // get slot object
693  $this->setSlotObject(new ilPluginSlot($this->getComponentType(),
694  $this->getComponentName(), $this->getSlotId()));
695 
696  // load language module
697 
698  // Fix for authentication plugins
699  $this->loadLanguageModule();
700 
701  // call slot and plugin init methods
702  $this->slotInit();
703  $this->init();
704  }
705 
712  abstract protected function slotInit();
713 
718  protected function init()
719  {
720  }
721 
725  public function isActive()
726  {
727  global $ilPluginAdmin;
728 
729  return $ilPluginAdmin->isActive($this->getComponentType(),
730  $this->getComponentName(), $this->getSlotId(), $this->getPluginName());
731  }
732 
736  public function needsUpdate()
737  {
738  global $ilPluginAdmin;
739 
740  return $ilPluginAdmin->needsUpdate($this->getComponentType(),
741  $this->getComponentName(), $this->getSlotId(), $this->getPluginName());
742  }
743 
747  function activate()
748  {
749  global $lng, $ilDB;
750 
752 
753  $result = true;
754 
755  // check whether update is necessary
756  if ($this->needsUpdate())
757  {
758  //$result = $this->isUpdatePossible();
759 
760  // do update
761  if ($result === true)
762  {
763  $result = $this->update();
764  }
765  }
766  if ($result === true)
767  {
768  $result = $this->beforeActivation();
769  // activate plugin
770  if ($result === true)
771  {
772  $q = "UPDATE il_plugin SET active = ".$ilDB->quote(1, "integer").",".
773  " plugin_id = ".$ilDB->quote($this->getId(), "text").
774  " WHERE component_type = ".$ilDB->quote($this->getComponentType(), "text").
775  " AND component_name = ".$ilDB->quote($this->getComponentName(), "text").
776  " AND slot_id = ".$ilDB->quote($this->getSlotId(), "text").
777  " AND name = ".$ilDB->quote($this->getPluginName(), "text");
778 
779  $ilDB->manipulate($q);
780  $this->afterActivation();
781  }
782  }
784  return $result;
785  }
786 
790  protected function beforeActivation()
791  {
792  return true; // false would indicate that anything went wrong
793  // activation would not proceed
794  // throw an exception in this case
795  //throw new ilPluginException($lng->txt(""));
796  }
797 
801  protected function afterActivation()
802  {
803  }
804 
808  function deactivate()
809  {
810  global $ilDB;
811 
813 
814  $result = true;
815 
816  $q = "UPDATE il_plugin SET active = ".$ilDB->quote(0, "integer").
817  " WHERE component_type = ".$ilDB->quote($this->getComponentType(), "text").
818  " AND component_name = ".$ilDB->quote($this->getComponentName(), "text").
819  " AND slot_id = ".$ilDB->quote($this->getSlotId(), "text").
820  " AND name = ".$ilDB->quote($this->getPluginName(), "text");
821 
822  $ilDB->manipulate($q);
823  $this->afterDeactivation();
824 
825  return $result;
826  }
827 
828 
832  protected function afterDeactivation()
833  {
834  }
835 
836 
837  protected function beforeUninstall()
838  {
839  // plugin-specific
840  // false would indicate that anything went wrong
841  return true;
842  }
843 
844  final function uninstall()
845  {
846  global $ilDB;
847 
848  if($this->beforeUninstall())
849  {
850  // remove all language entries (see ilObjLanguage)
851  // see updateLanguages
852  $prefix = $this->getPrefix();
853  if($prefix)
854  {
855  $ilDB->manipulate("DELETE FROM lng_data".
856  " WHERE module = ".$ilDB->quote($prefix, "text"));
857  $ilDB->manipulate("DELETE FROM lng_modules".
858  " WHERE module = ".$ilDB->quote($prefix, "text"));
859  }
860 
861  // db version is kept in il_plugin - will be deleted, too
862 
863  $q = "DELETE FROM il_plugin".
864  " WHERE component_type = ".$ilDB->quote($this->getComponentType(), "text").
865  " AND component_name = ".$ilDB->quote($this->getComponentName(), "text").
866  " AND slot_id = ".$ilDB->quote($this->getSlotId(), "text").
867  " AND name = ".$ilDB->quote($this->getPluginName(), "text");
868  $ilDB->manipulate($q);
869 
870  $this->afterUninstall();
871 
873  return true;
874  }
875 
876  return false;
877  }
878 
879  protected function afterUninstall()
880  {
881  // plugin-specific
882  }
883 
887  function update()
888  {
889  global $ilDB, $ilCtrl;
890 
892 
893  $result = $this->beforeUpdate();
894  if ($result === false) {
895  return false;
896  }
897 
898  // DB update
899  if ($result === true)
900  {
901  $result = $this->updateDatabase();
902  }
903 
904  // Load language files
905  $this->updateLanguages();
906 
907  // load control structure
908  include_once("./setup/classes/class.ilCtrlStructureReader.php");
909  $structure_reader = new ilCtrlStructureReader();
910  $structure_reader->readStructure(true, "./".$this->getDirectory(), $this->getPrefix(),
911  $this->getDirectory());
912  // $ilCtrl->storeCommonStructures();
913 
914  // add config gui to the ctrl calls
915  $ilCtrl->insertCtrlCalls("ilobjcomponentsettingsgui", ilPlugin::getConfigureClassName($this->getPluginName()),
916  $this->getPrefix());
917 
918  // set last update version to current version
919  if ($result === true)
920  {
921  $q = "UPDATE il_plugin SET last_update_version = ".$ilDB->quote($this->getVersion(), "text").
922  " WHERE component_type = ".$ilDB->quote($this->getComponentType(), "text").
923  " AND component_name = ".$ilDB->quote($this->getComponentName(), "text").
924  " AND slot_id = ".$ilDB->quote($this->getSlotId(), "text").
925  " AND name = ".$ilDB->quote($this->getPluginName(), "text");
926 
927  $ilDB->manipulate($q);
928  $this->afterUpdate();
929  }
930 
931  return $result;
932  }
933 
937  protected function beforeUpdate()
938  {
939  return true; // false would indicate that anything went wrong
940  // update would not proceed
941  // throw an exception in this case
942  //throw new ilPluginException($lng->txt(""));
943  }
944 
948  protected function afterUpdate()
949  {
950  }
951 
960  static function getPluginObject($a_ctype, $a_cname, $a_slot_id, $a_pname)
961  {
962  include_once("./Services/Component/classes/class.ilPluginSlot.php");
963  $slot_name = ilPluginSlot::lookupSlotName($a_ctype, $a_cname, $a_slot_id);
964 
965  $cached_component = ilCachedComponentData::getInstance();
966  $rec = $cached_component->lookCompId($a_ctype, $a_cname);
967  if (! $rec) {
968  return NULL;
969  }
970 
971  $file = "./Customizing/global/plugins/".$a_ctype."/".
972  $a_cname."/".$slot_name."/".
973  $a_pname."/classes/class.il".$a_pname."Plugin.php";
974 
975  if (is_file($file))
976  {
977  include_once($file);
978  $class = "il".$a_pname."Plugin";
979  $plugin = new $class();
980  return $plugin;
981  }
982 
983  return null;
984  }
985 
986 
990  static function lookupStoredData($a_ctype, $a_cname, $a_slot_id, $a_pname)
991  {
992  global $ilDB;
993 
994  $q = "SELECT * FROM il_plugin WHERE ".
995  " component_type = ".$ilDB->quote($a_ctype, "text")." AND ".
996  " component_name = ".$ilDB->quote($a_cname, "text")." AND ".
997  " slot_id = ".$ilDB->quote($a_slot_id, "text")." AND ".
998  " name = ".$ilDB->quote($a_pname, "text");
999 
1000  $set = $ilDB->query($q);
1001 
1002  $rec = $ilDB->fetchAssoc($set);
1003 
1004  return $rec;
1005  }
1006 
1010  static function getActivePluginsForSlot($a_ctype, $a_cname, $a_slot_id)
1011  {
1012  global $ilPluginAdmin;
1013 
1014  $plugins = array();
1015 
1016  $cached_component = ilCachedComponentData::getInstance();
1017 
1018  $lookupActivePluginsBySlotId = $cached_component->lookupActivePluginsBySlotId($a_slot_id);
1019  foreach($lookupActivePluginsBySlotId as $rec)
1020  {
1021  if ($ilPluginAdmin->isActive($a_ctype, $a_cname, $a_slot_id, $rec["name"]))
1022  {
1023  $plugins[] = $rec["name"];
1024  }
1025  }
1026 
1027  return $plugins;
1028  }
1029 
1037  public static function getActivePluginIdsForSlot($a_ctype, $a_cname, $a_slot_id) {
1038  global $ilPluginAdmin;
1039 
1040  $plugins = array();
1041  $cached_component = ilCachedComponentData::getInstance();
1042  $lookupActivePluginsBySlotId = $cached_component->lookupActivePluginsBySlotId($a_slot_id);
1043  foreach($lookupActivePluginsBySlotId as $rec)
1044  {
1045  if ($ilPluginAdmin->isActive($a_ctype, $a_cname, $a_slot_id, $rec["name"]))
1046  {
1047  $plugins[] = $rec["plugin_id"];
1048  }
1049  }
1050 
1051  return $plugins;
1052  }
1053 
1057  static function lookupNameForId($a_ctype, $a_cname, $a_slot_id, $a_plugin_id)
1058  {
1059  global $ilDB;
1060 
1061  $q = "SELECT name 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 plugin_id = ".$ilDB->quote($a_plugin_id, "text");
1066 
1067  $set = $ilDB->query($q);
1068  if ($rec = $ilDB->fetchAssoc($set))
1069  {
1070  return $rec["name"];
1071  }
1072  }
1073 
1077  static function lookupIdForName($a_ctype, $a_cname, $a_slot_id, $a_plugin_name)
1078  {
1079  global $ilDB;
1080 
1081  $q = "SELECT plugin_id FROM il_plugin ".
1082  " WHERE component_type = ".$ilDB->quote($a_ctype, "text").
1083  " AND component_name = ".$ilDB->quote($a_cname, "text").
1084  " AND slot_id = ".$ilDB->quote($a_slot_id, "text").
1085  " AND name = ".$ilDB->quote($a_plugin_name, "text");
1086 
1087  $set = $ilDB->query($q);
1088  if ($rec = $ilDB->fetchAssoc($set))
1089  {
1090  return $rec["plugin_id"];
1091  }
1092  }
1093 }
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.
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.
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 plugin names 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.
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.
for($col=0; $col< 50; $col++) $d
static lookupIdForName($a_ctype, $a_cname, $a_slot_id, $a_plugin_name)
Lookup id for name.
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.
static getActivePluginIdsForSlot($a_ctype, $a_cname, $a_slot_id)
Get All active plugin ids for a slot.
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)
static lookupNameForId($a_ctype, $a_cname, $a_slot_id, $a_plugin_id)
Lookup name for id.
Plugin Slot.
getDirectory()
Get Plugin Directory.
special template class to simplify handling of ITX/PEAR
deactivate()
Deactivate.
Reload workbook from saved file
getActive()
Get Active.
$txt
Definition: error.php:12
txt($a_var)
Get Language Variable (prefix will be prepended automatically)
getPrefix()
Get plugin prefix, used for lang vars.
Create styles array
The data for the language used.
static _getPluginsDirectory($a_ctype, $a_cname, $a_slot_id)
Get plugins directory.
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)
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:17
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.
for($i=1; $i<=count($kw_cases_sel); $i+=1) $lang
Definition: langwiz.php:349
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.
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
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.