Esempio n. 1
0
 /**
  * Update database
  */
 function showUpdateSteps($a_hotfix = false)
 {
     global $ilCtrlStructureReader;
     $this->checkDisplayMode("setup_database");
     //$this->tpl->addBlockFile("SETUP_CONTENT","setup_content","tpl.clientsetup_db.html", "setup");
     // database is intalled
     if ($this->setup->getClient()->db_installed) {
         $ilDB = $this->setup->getClient()->db;
         $this->lng->setDbHandler($ilDB);
         $dbupdate = new ilDBUpdate($ilDB);
         $db_status = $dbupdate->getDBVersionStatus();
         $hotfix_available = $dbupdate->hotfixAvailable();
         $custom_updates_available = $dbupdate->customUpdatesAvailable();
         //			$this->initClientDbForm(false, $dbupdate, $db_status, $hotfix_available, $custom_updates_available);
         //			$this->getClientDbFormValues($dbupdate);
         $ntpl = new ilTemplate("tpl.setup_steps.html", true, true, "setup");
         if ($a_hotfix) {
             $ntpl->setVariable("CONTENT", $dbupdate->getHotfixSteps());
         } else {
             $ntpl->setVariable("CONTENT", $dbupdate->getUpdateSteps($_POST["update_break"]));
         }
         $ntpl->setVariable("BACK", $this->lng->txt("back"));
         $ntpl->setVariable("HREF_BACK", "./setup.php?client_id=&cmd=db");
         $this->tpl->setVariable("SETUP_CONTENT", $ntpl->get());
     }
 }
Esempio n. 2
0
 /**
  * check client db status
  * @param	object	client
  * @return	boolean
  */
 function checkClientDatabase(&$client)
 {
     if (!($arr["status"] = $client->db_exists)) {
         $arr["comment"] = $this->lng->txt("no_database");
         return $arr;
     }
     if (!($arr["status"] = $client->db_installed)) {
         $arr["comment"] = $this->lng->txt("db_not_installed");
         return $arr;
     }
     // TODO: move this to client class!!
     $client->setup_ok = (bool) $client->getSetting("setup_ok");
     //$this->lng->setDbHandler($client->db);
     include_once "./Services/Database/classes/class.ilDBUpdate.php";
     $ilDB = $client->db;
     $this->lng->setDbHandler($client->db);
     $dbupdate = new ilDBUpdate($client->db);
     if (!($arr["status"] = $dbupdate->getDBVersionStatus())) {
         $arr["comment"] = $this->lng->txt("db_needs_update");
         $arr["update"] = true;
         return $arr;
     } else {
         if ($dbupdate->hotfixAvailable()) {
             $arr["status"] = false;
             $arr["comment"] = $this->lng->txt("hotfix_available");
             $arr["update"] = true;
             return $arr;
         } else {
             if ($dbupdate->customUpdatesAvailable()) {
                 $arr["status"] = false;
                 $arr["comment"] = $this->lng->txt("custom_updates_available");
                 $arr["update"] = true;
                 return $arr;
             }
         }
     }
     // check control information
     $cset = $ilDB->query("SELECT count(*) as cnt FROM ctrl_calls");
     $crec = $ilDB->fetchAssoc($cset);
     if ($crec["cnt"] == 0) {
         $arr["status"] = false;
         $arr["comment"] = $this->lng->txt("db_control_structure_missing");
         $arr["update"] = true;
         return $arr;
     }
     //$arr["comment"] = "version ".$dbupdate->getCurrentVersion();
     return $arr;
 }
 /**
  * execute command
  */
 function &executeCommand()
 {
     global $tree, $rbacsystem, $ilias, $lng, $objDefinition, $ilHelp;
     // permission checks
     include_once './Services/MainMenu/classes/class.ilMainMenuGUI.php';
     if (!ilMainMenuGUI::_checkAdministrationPermission()) {
         $ilias->raiseError($this->lng->txt('permission_denied'), $ilias->error_obj->WARNING);
     }
     // check creation mode
     // determined by "new_type" parameter
     $new_type = $_POST["new_type"] ? $_POST["new_type"] : $_GET["new_type"];
     if ($new_type != "" && $this->ctrl->getCmd() == "create") {
         $this->creation_mode = true;
     }
     // determine next class
     if ($this->creation_mode) {
         $obj_type = $new_type;
         $class_name = $this->objDefinition->getClassName($obj_type);
         $next_class = strtolower("ilObj" . $class_name . "GUI");
         $this->ctrl->setCmdClass($next_class);
     } elseif ($this->ctrl->getCmdClass() == "ilobjlanguageextgui") {
         $next_class = "ilobjlanguageextgui";
     } else {
         $next_class = $this->ctrl->getNextClass($this);
     }
     if (($next_class == "iladministrationgui" || $next_class == "") && $this->ctrl->getCmd() == "return") {
         // get GUI of current object
         $obj_type = ilObject::_lookupType($this->cur_ref_id, true);
         $class_name = $this->objDefinition->getClassName($obj_type);
         $next_class = strtolower("ilObj" . $class_name . "GUI");
         $this->ctrl->setCmdClass($next_class);
         $this->ctrl->setCmd("view");
     }
     $cmd = $this->ctrl->getCmd("forward");
     //echo "<br>cmd:$cmd:nextclass:$next_class:-".$_GET["cmdClass"]."-".$_GET["cmd"]."-";
     switch ($next_class) {
         default:
             // forward all other classes to gui commands
             if ($next_class != "" && $next_class != "iladministrationgui") {
                 // check db update
                 include_once "./Services/Database/classes/class.ilDBUpdate.php";
                 $dbupdate = new ilDBUpdate($this->ilias->db, true);
                 if (!$dbupdate->getDBVersionStatus()) {
                     ilUtil::sendFailure($this->lng->txt("db_need_update"));
                 } else {
                     if ($dbupdate->hotfixAvailable()) {
                         ilUtil::sendFailure($this->lng->txt("db_need_hotfix"));
                     }
                 }
                 $class_path = $this->ctrl->lookupClassPath($next_class);
                 // get gui class instance
                 include_once $class_path;
                 $class_name = $this->ctrl->getClassForClasspath($class_path);
                 if ($next_class == "ilobjrolegui" || $next_class == "ilobjusergui" || $next_class == "ilobjroletemplategui" || $next_class == "ilobjstylesheetgui") {
                     if ($_GET["obj_id"] != "") {
                         $this->gui_obj = new $class_name("", $_GET["obj_id"], false, false);
                         $this->gui_obj->setCreationMode(false);
                     } else {
                         $this->gui_obj = new $class_name("", $this->cur_ref_id, true, false);
                         $this->gui_obj->setCreationMode(true);
                     }
                 } else {
                     if ($objDefinition->isPlugin(ilObject::_lookupType($this->cur_ref_id, true))) {
                         $this->gui_obj = new $class_name($this->cur_ref_id);
                     } else {
                         if (is_subclass_of($class_name, "ilObject2GUI")) {
                             $this->gui_obj = new $class_name($this->cur_ref_id, ilObject2GUI::REPOSITORY_NODE_ID);
                         } else {
                             $this->gui_obj = new $class_name("", $this->cur_ref_id, true, false);
                         }
                     }
                     $this->gui_obj->setCreationMode($this->creation_mode);
                 }
                 $tabs_out = $new_type == "" ? true : false;
                 // set standard screen id
                 //					if (strtolower($next_class) == strtolower($this->ctrl->getCmdClass()) ||
                 //						"ilpermissiongui" == strtolower($this->ctrl->getCmdClass()))
                 //					{
                 $ilHelp->setScreenIdComponent(ilObject::_lookupType($this->cur_ref_id, true));
                 //					}
                 $this->showTree();
                 $this->ctrl->setReturn($this, "return");
                 $ret = $this->ctrl->forwardCommand($this->gui_obj);
                 $html = $this->gui_obj->getHTML();
                 if ($html != "") {
                     $this->tpl->setVariable("OBJECTS", $html);
                 }
                 $this->tpl->show();
             } else {
                 $cmd = $this->ctrl->getCmd("forward");
                 $this->{$cmd}();
             }
             break;
     }
 }