<?php
# ObrEns     -  Fichero de instalación de compoente Mambo
# Version    :  1.0 
# By         :  2005 Rodax Software
# Web        :  www.rodax-software.com
# License    :  GNU GPL Public License

function com_install() {
  global $database;

  $database->setQuery( "UPDATE #__components"
  ." SET admin_menu_link='option=categories&section=com_obrens'"
  ." WHERE admin_menu_link = 'option=com_obrens&act=categories'");
  if (!$database->query()) {
    echo "<script> alert('".$database->getErrorMsg()."'); window.history.go(-1); </script>\n";
    exit();
  }
  echo "Categoria insertada ... <b>OK</b><br />";

          # Set up new icons for admin menu
          $database->setQuery("UPDATE #__components SET admin_menu_img='js/ThemeOffice/edit.png' WHERE admin_menu_link='option=com_obrens&act=ref'");
          $iconresult[0] = $database->query();
          $database->setQuery("UPDATE #__components SET admin_menu_img='js/ThemeOffice/config.png' WHERE admin_menu_link='option=com_obrens&act=settings'");
          $iconresult[1] = $database->query();
          $database->setQuery("UPDATE #__components SET admin_menu_img='js/ThemeOffice/user.png' WHERE admin_menu_link='option=com_obrens&act=language'");
          $iconresult[2] = $database->query();
          $database->setQuery("UPDATE #__components SET admin_menu_img='js/ThemeOffice/credits.png' WHERE admin_menu_link='option=com_obrens&act=about'");
          $iconresult[3] = $database->query();
          foreach ($iconresult as $i=>$icresult) {
            if ($icresult) {
              echo "<font color='green'>FINALIZADO:</font> Imagen de menu correpondiente a entrada $i correcto.<br />";
            } else {
              echo "<font color='red'>ERROR:</font> Imagen de menu correpondiente a entrada $i no se ha podido insertar.<br />";
            }
          }

  echo "<p><b>Area de ensayo ha sido instalado correctamente!</b></p>";
}
?>