Exemplo n.º 1
0
 public function getPluginTablePrefix()
 {
     $id = $this->getId();
     if (!$id) {
         $rec = ilPlugin::getPluginRecord($this->getComponentType(), $this->getComponentName(), $this->getSlotId(), $this->getPluginName());
         $id = $rec['plugin_id'];
     }
     return $this->getSlotObject()->getPrefix() . "_" . $id;
 }
Exemplo n.º 2
0
 /**
  * Default initialization
  */
 private final function __init()
 {
     global $ilDB, $lng, $ilPluginAdmin;
     // read/set basic data
     $rec = ilPlugin::getPluginRecord($this->getComponentType(), $this->getComponentName(), $this->getSlotId(), $this->getPluginName());
     $this->setLastUpdateVersion($rec["last_update_version"]);
     $this->setDBVersion($rec["db_version"]);
     $this->setActive($rec["active"]);
     // get id
     $this->setId($ilPluginAdmin->getId($this->getComponentType(), $this->getComponentName(), $this->getSlotId(), $this->getPluginName()));
     // get version
     $this->setVersion($ilPluginAdmin->getVersion($this->getComponentType(), $this->getComponentName(), $this->getSlotId(), $this->getPluginName()));
     // get ilias min version
     $this->setIliasMinVersion($ilPluginAdmin->getIliasMinVersion($this->getComponentType(), $this->getComponentName(), $this->getSlotId(), $this->getPluginName()));
     // get ilias max version
     $this->setIliasMaxVersion($ilPluginAdmin->getIliasMaxVersion($this->getComponentType(), $this->getComponentName(), $this->getSlotId(), $this->getPluginName()));
     // get slot object
     $this->setSlotObject(new ilPluginSlot($this->getComponentType(), $this->getComponentName(), $this->getSlotId()));
     // load language module
     // Fix for authentication plugins
     $this->loadLanguageModule();
     // call slot and plugin init methods
     $this->slotInit();
     $this->init();
 }
Exemplo n.º 3
0
 /**
  * Get basic data of plugin from plugin.php
  *
  * @param	string	$a_ctype	Component Type
  * @param	string	$a_cname	Component Name
  * @param	string	$a_slot_id	Slot ID
  * @param	string	$a_pname	Plugin Name
  */
 private final function getPluginData($a_ctype, $a_cname, $a_slot_id, $a_pname)
 {
     global $ilDB, $lng;
     if (!isset($this->got_data[$a_ctype][$a_cname][$a_slot_id][$a_pname])) {
         include_once "./Services/Component/classes/class.ilPluginSlot.php";
         $slot_name = ilPluginSlot::lookupSlotName($a_ctype, $a_cname, $a_slot_id);
         $plugin_php_file = "./Customizing/global/plugins/" . $a_ctype . "/" . $a_cname . "/" . $slot_name . "/" . $a_pname . "/plugin.php";
         $rec = ilPlugin::getPluginRecord($a_ctype, $a_cname, $a_slot_id, $a_pname);
         if (is_file($plugin_php_file)) {
             include_once $plugin_php_file;
             $this->data[$a_ctype][$a_cname][$a_slot_id][$a_pname] = array("version" => $version, "id" => $id, "ilias_min_version" => $ilias_min_version, "ilias_max_version" => $ilias_max_version, "responsible" => $responsible, "responsible_mail" => $responsible_mail, "learning_progress" => (bool) $learning_progress);
         }
         $active = $rec["active"];
         $needs_update = false;
         $activation_possible = !$active;
         $inactive_reason = "";
         // version checks
         if (ilComponent::isVersionGreaterString($ilias_min_version, ILIAS_VERSION_NUMERIC)) {
             $active = false;
             if (is_object($lng)) {
                 $inactive_reason = $lng->txt("cmps_needs_newer_ilias_version");
             } else {
                 $inactive_reason = "Plugin needs a newer version of ILIAS.";
             }
             $activation_possible = false;
         } else {
             if (ilComponent::isVersionGreaterString(ILIAS_VERSION_NUMERIC, $ilias_max_version)) {
                 $active = false;
                 if (is_object($lng)) {
                     $inactive_reason = $lng->txt("cmps_needs_newer_plugin_version");
                 } else {
                     $inactive_reason = "Plugin does not support current version of ILIAS. Newer version of plugin needed.";
                 }
                 $activation_possible = false;
             } else {
                 if ($rec["last_update_version"] == "") {
                     $active = false;
                     if (is_object($lng)) {
                         $inactive_reason = $lng->txt("cmps_needs_update");
                     } else {
                         $inactive_reason = "Update needed.";
                     }
                     $needs_update = true;
                     $activation_possible = false;
                 } else {
                     if (ilComponent::isVersionGreaterString($rec["last_update_version"], $version)) {
                         $active = false;
                         if (is_object($lng)) {
                             $inactive_reason = $lng->txt("cmps_needs_upgrade");
                         } else {
                             $inactive_reason = "Upgrade needed.";
                         }
                         $activation_possible = false;
                     } else {
                         if ($rec["last_update_version"] != $version) {
                             $active = false;
                             if (is_object($lng)) {
                                 $inactive_reason = $lng->txt("cmps_needs_update");
                             } else {
                                 $inactive_reason = "Update needed.";
                             }
                             $needs_update = true;
                             $activation_possible = false;
                         }
                     }
                 }
             }
         }
         $this->data[$a_ctype][$a_cname][$a_slot_id][$a_pname]["is_active"] = $active;
         $this->data[$a_ctype][$a_cname][$a_slot_id][$a_pname]["inactive_reason"] = $inactive_reason;
         $this->data[$a_ctype][$a_cname][$a_slot_id][$a_pname]["needs_update"] = $needs_update;
         $this->data[$a_ctype][$a_cname][$a_slot_id][$a_pname]["activation_possible"] = $activation_possible;
         $this->got_data[$a_ctype][$a_cname][$a_slot_id][$a_pname] = true;
     }
 }